Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stbestichhh/stlib-config
Utility for creating configs in node.js applications
https://github.com/stbestichhh/stlib-config
config library nodejs npm npm-package utility
Last synced: about 12 hours ago
JSON representation
Utility for creating configs in node.js applications
- Host: GitHub
- URL: https://github.com/stbestichhh/stlib-config
- Owner: stbestichhh
- License: mit
- Created: 2024-08-04T10:01:34.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2024-08-04T10:22:33.000Z (3 months ago)
- Last Synced: 2024-08-04T11:30:21.243Z (3 months ago)
- Topics: config, library, nodejs, npm, npm-package, utility
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@stlib/config
- Size: 66.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
[![Node.js CI](https://github.com/stbestichhh/stlib-utils/actions/workflows/node.js.yml/badge.svg)](https://github.com/stbestichhh/stlib-utils/actions/workflows/node.js.yml)
[![NPM Version](https://img.shields.io/npm/v/@stlib/config)](https://www.npmjs.com/package/@stlib/config)
[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
[![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/ellerbrock/open-source-badges/)# @stlib/config
## Table of contents
* [Description](#about)
* [Getting started](#getting-started)
* [Instalation](#installation)
* [Usage](#usage)
* [Contributing](#contributing)
* [Changelog](#changelog)
* [Authors](#authors)
* [License](#license)## About
**stlib/config** - is a library for creating configurations in your node.js applications.
## Getting started
### Installation
```shell
$ yarn add @stlib/config
```> [!IMPORTANT]
> **Node.js 18.x+** version must be installed in your OS.### Usage
Object type for config:
```TypeScript
ConfigType {
[key: string]: string | number;
}
```Options type for config:
```TypeScript
export interface ConfigOptionsType {
force?: boolean;
alter?: boolean;
}
``````TypeScript
Config {
constructor(path: PathLike, config: ConfigType, options?: ConfigOptionsType);// reads current config
read(): ConfigType;
static read(path: PathLike): Promise;
static readSync(path: PathLike): ConfigType;// Get specific value from config
get(key: string): string | number;
static get(key: string, path: PathLike): Promise;
static getSync(key: string, path: PathLike): string | number;// If use static methods of Config class, use this function to create config before other operations
static create(path: PathLike): Promise;
static createSync(path: PathLike): void;// Update config
write(config: ConfigType): Promise;
static write(path: PathLike, config: ConfigType): Promise;
static writeSync(path: PathLike, config: ConfigType): void;
}```
## Contributing
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
## Changelog
Project changes are writen in changelog, see the [CHANGELOG.md](CHANGELOG.md).
We use [SemVer](https://semver.org/) for versioning.
For the versions available, see the [tags](https://github.com/stbestichhh/stlib-utils/tags) on this repository.
For the versions supported, see the [SECURITY.md](SECURITY.md).## Authors
- [@stbestichhh](https://www.github.com/stbestichhh)
## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE)