Comparing version 0.2.4 to 0.2.5
{ | ||
"name": "c12", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "Smart Config Loader", | ||
@@ -21,10 +21,18 @@ "repository": "unjs/c12", | ||
], | ||
"scripts": { | ||
"build": "unbuild", | ||
"dev": "vitest dev", | ||
"lint": "eslint --ext .ts,.js,.mjs,.cjs .", | ||
"prepack": "unbuild", | ||
"release": "pnpm test && standard-version && git push --follow-tags && pnpm publish", | ||
"test": "vitest run --coverage" | ||
}, | ||
"dependencies": { | ||
"defu": "^5.0.1", | ||
"dotenv": "^14.3.2", | ||
"defu": "^6.0.0", | ||
"dotenv": "^16.0.0", | ||
"gittar": "^0.1.1", | ||
"jiti": "^1.12.14", | ||
"mlly": "^0.4.1", | ||
"mlly": "^0.5.1", | ||
"pathe": "^0.2.0", | ||
"rc9": "^1.2.0" | ||
"rc9": "^1.2.1" | ||
}, | ||
@@ -40,11 +48,3 @@ "devDependencies": { | ||
}, | ||
"packageManager": "pnpm@6.32.3", | ||
"scripts": { | ||
"build": "unbuild", | ||
"dev": "vitest dev", | ||
"lint": "eslint --ext .ts,.js,.mjs,.cjs .", | ||
"release": "pnpm test && standard-version && git push --follow-tags && pnpm publish", | ||
"test": "vitest run --coverage" | ||
}, | ||
"readme": "# c12\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![Github Actions][github-actions-src]][github-actions-href]\n[![Codecov][codecov-src]][codecov-href]\n\n> Smart Configuration Loader\n\n## Features\n\n- JSON, CJS, Typescript and ESM config loader with [unjs/jiti](https://github.com/unjs/jiti)\n- RC config support with [unjs/rc9](https://github.com/unjs/rc9)\n- Multiple sources merged with [unjs/defu](https://github.com/unjs/defu)\n- `.env` support with [dotenv](https://www.npmjs.com/package/dotenv)\n- Support extending nested configurations from multiple local or git sources\n\n## Usage\n\nInstall package:\n\n```sh\n# npm\nnpm install c12\n\n# yarn\nyarn install c12\n\n# pnpm\npnpm install c12\n```\n\nImport:\n\n```js\n// ESM\nimport { loadConfig } from 'c12'\n\n// CommonJS\nconst { loadConfig } = require('c12')\n```\n\nLoad configuration:\n\n```js\n// Get loaded config\nconst { config } = await loadConfig({})\n\n// Get resolved config and extended layers\nconst { config, configFile, layers } = await loadConfig({})\n```\n\n## Loading priority\n\nc12 merged config sources with [unjs/defu](https://github.com/unjs/defu) by below order:\n\n1. config overrides passed by options\n2. config file in CWD\n3. RC file in CWD\n4. global RC file in user's home directory\n5. default config passed by options\n6. Extended config layers\n\n## Options\n\n### `cwd`\n\nResolve configuration from this working directory. Default is `process.cwd()`\n\n### `name`\n\nConfiguration base name. Default is `config`.\n\n### `configName`\n\nConfiguration file name without extension . Default is generated from `name` (name=foo => `foo.config`).\n\nSet to `false` to avoid loading config file.\n\n### `rcFile`\n\nRC Config file name. Default is generated from `name` (name=foo => `.foorc`).\n\nSet to `false` to disable loading RC config.\n\n### `globalRC`\n\nLoad RC config from the user's home directory. Only enabled when `rcFile` is provided. Set to `false` to disable this functionality.\n\n### `dotenv`\n\nLoads `.env` file if enabled. It is disabled by default.\n\n### `defaults`\n\nSpecify default configuration. It has the **lowest** priority.\n\n### `overides`\n\nSpecify override configuration. It has the **highest** priority.\n\n## Extending configuration\n\nIf resolved config contains a `extends` key, it will be used to extend configuration.\n\nExtending can be nested and each layer can extend from one base or more.\n\nFinal config is merged result of extended options and user options with [unjs/defu](https://github.com/unjs/defu).\n\nEach item in extends, is a string that can be either an absolute or relative path to current config file pointing to a config file for extending or directory containing config file.\nIf it starts with either of `github:`, `gitlab:`, `bitbucket:` or `https:`, c12 autmatically clones it.\n\nFor custom merging strategies, you can directly access each layer with `layers` property.\n\n**Example:**\n\n```js\n// config.ts\nexport default {\n colors: {\n primary: 'user_primary'\n },\n extends: [\n './theme',\n './config.dev.ts'\n ]\n}\n```\n\n```js\n// config.dev.ts\nexport default {\n dev: true\n}\n```\n\n```js\n// theme/config.ts\nexport default {\n extends: '../base',\n colors: {\n primary: 'theme_primary',\n secondary: 'theme_secondary'\n }\n}\n```\n\n```js\n// base/config.ts\nexport default {\n colors: {\n primary: 'base_primary'\n text: 'base_text'\n }\n}\n```\n\nLoaded configuration would look like this:\n\n```js\n{\n dev: true,\n colors: {\n primary: 'user_primary',\n secondary: 'theme_secondary',\n text: 'base_text'\n }\n}\n```\n\nLayers:\n\n```js\n[\n { config: /* theme config */, configFile: /* path/to/theme/config.ts */, cwd: /* path/to/theme */ },\n { config: /* base config */, configFile: /* path/to/base/config.ts */, cwd: /* path/to/base */ },\n { config: /* dev config */, configFile: /* path/to/config.dev.ts */, cwd: /* path/ */ },\n]\n```\n\n## 💻 Development\n\n- Clone this repository\n- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable` (use `npm i -g corepack` for Node.js < 16.10)\n- Install dependencies using `pnpm install`\n- Run interactive tests using `pnpm dev`\n\n## License\n\nMade with 💛 Published under [MIT License](./LICENSE).\n\n<!-- Badges -->\n[npm-version-src]: https://img.shields.io/npm/v/c12?style=flat-square\n[npm-version-href]: https://npmjs.com/package/c12\n\n[npm-downloads-src]: https://img.shields.io/npm/dm/c12?style=flat-square\n[npm-downloads-href]: https://npmjs.com/package/c12\n\n[github-actions-src]: https://img.shields.io/github/workflow/status/unjs/c12/ci/main?style=flat-square\n[github-actions-href]: https://github.com/unjs/c12/actions?query=workflow%3Aci\n\n[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/c12/main?style=flat-square\n[codecov-href]: https://codecov.io/gh/unjs/c12\n" | ||
} | ||
"packageManager": "pnpm@6.32.3" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22184
+ Addedacorn@8.12.1(transitive)
+ Addedconfbox@0.1.7(transitive)
+ Addeddotenv@16.4.5(transitive)
+ Addedmlly@0.5.171.7.1(transitive)
+ Addedpathe@1.1.2(transitive)
+ Addedpkg-types@1.2.0(transitive)
+ Addedufo@1.5.4(transitive)
- Removeddefu@5.0.1(transitive)
- Removeddotenv@14.3.2(transitive)
- Removedmlly@0.4.3(transitive)
Updateddefu@^6.0.0
Updateddotenv@^16.0.0
Updatedmlly@^0.5.1
Updatedrc9@^1.2.1