# config-cjson

> Load cjson config files

Latest version **1.0.3** (published 2022-12-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install config-cjson
pnpm add config-cjson
yarn add config-cjson
bun add config-cjson
```

Provides the command `config-cjson`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2022-12-24 |
| First published | 2022-12-22 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 9.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | muqsith |
| Maintainers | muqsithirfan |
| Keywords | config, cjson |

## Links

- npm: https://www.npmjs.com/package/config-cjson
- Repository: https://github.com/muqsith/config-cjson
- Homepage: https://github.com/muqsith/config-cjson#readme
- Issues: https://github.com/muqsith/config-cjson/issues
- npm.io page: https://npm.io/package/config-cjson

## Dependencies (4)

- [json5](https://npm.io/package/json5.md) 2.2.2
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [fs-extra](https://npm.io/package/fs-extra.md) ^11.1.0
- [commander](https://npm.io/package/commander.md) ^9.4.1

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2022-12-24
- 1.0.2 — 2022-12-23
- 1.0.1 — 2022-12-23
- 1.0.0 — 2022-12-22

## README

# config-cjson

A small utility to load config files written in cjson (JSON with comments).

Inspiration: https://www.npmjs.com/package/oconf

## usage

1. Use as a module
   ```
   const  pathModule = require('path');
   const loadConfig = require("config-cjson");
   .
   .
   .
   const config = await loadConfig(
       pathModule.resolve(__dirname, "..", "config", "development.cjson")
   );
   ```
2. Use as CLI - prints config in the terminal
   ```
   ./node_modules/.bin/config-cjson <config file path>
   ```

## supported directives

1.  `#include` - directive to include parent configs, path to included config can be relative(relative to the first config loaded) or absolute.

    ```
    {
        "#include": "common.cjson",
        .
        .
        .
    }
    ```

    or

    ```
    {
        "#include": ["common.cjson", "production.cjson"],
        .
        .
        .
    }
    ```

2.  `#public` - directive to expose a property on a separate `#public` attribute.
    ```
    {
        ...
        "title#public": "My App"
        ...
    }
    ```
    or
    ```
        ...
        "lang#public": {
            "defaultLocale": "en-US",
            "supportedLocales: ["en-US", "es-ES"]
        }
        ...
    ```
    
    <span style="color:red">Below is not supported</span>
    ```
    # Not supported
    "#public": {
        "lang" : {
            "defaultLocale": "en-US"
        }
    }
    ```

---
_Source: https://npm.io/package/config-cjson · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
