{"id":19768331,"url":"https://github.com/roxiness/configent","last_synced_at":"2025-04-30T16:34:11.252Z","repository":{"id":42999475,"uuid":"299939642","full_name":"roxiness/configent","owner":"roxiness","description":"no fuzz configurator","archived":false,"fork":false,"pushed_at":"2022-12-09T23:10:09.000Z","size":1385,"stargazers_count":12,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-17T19:30:08.679Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roxiness.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-30T14:06:51.000Z","updated_at":"2022-03-16T12:57:29.000Z","dependencies_parsed_at":"2023-01-26T04:31:58.038Z","dependency_job_id":null,"html_url":"https://github.com/roxiness/configent","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxiness%2Fconfigent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxiness%2Fconfigent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxiness%2Fconfigent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxiness%2Fconfigent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roxiness","download_url":"https://codeload.github.com/roxiness/configent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251251999,"owners_count":21559700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T04:37:21.039Z","updated_at":"2025-04-30T16:34:10.752Z","avatar_url":"https://github.com/roxiness.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"https://github.com/roxiness/configent/raw/master/configent.png\" alt=\"configent\"\u003e\n\u003c/div\u003e\n\n# Configent\n\n### Confident configurations\n\nNo fuzz config compilation from (ordered by ascending precedence)\n\n-   defaults\n-   package.json\n-   [name].config.js\n-   .env\n-   environment\n-   input\n\n```javascript\n/** \n * package.json {\"foobar\": {\"city\": \"Portsmouth\"}}\n * foobar.config.js {lastSeen: 'Liverpool'}\n * process.env.foobar_last_seen = London\n * options = { name: 'Sherlock Holmes' }\n*/\n\nconst defaults = { name: 'John Doe', city: 'N/A', lastSeen: 'N/A' }\n\nconst config = configent('foobar', defaults, options)\n\n/**\n * console.log(config)\n * {\n *   name: 'Sherlock Holmes',\n *   city: 'Portsmouth',\n *   lastSeen: 'London'  \n * }\n * /\n```\n\n### Auto detect defaults\n\nConfigent supports multiple default configs. These are added to `./configs`.\n\n```javascript\n/** ./configs/routify2.config.js */\n\nmodule.exports = {\n    supersedes: ['svelte'],\n    condition: ({ pkgjson }) =\u003e pkgjson.dependencies['@roxi/routify'],\n    config: () =\u003e ({ \n        /** the config object used as default */\n        myAppName: 'Routify App' \n    })\n}\n```\n\n```javascript\n/** ./configs/svelte.config.js */\n\nmodule.exports = {\n    condition: ({ pkgjson }) =\u003e pkgjson.dependencies['svelte'],\n    config: () =\u003e ({ \n        /** the config object used as default */\n        myAppName: 'Svelte App' \n    })\n}\n```\n\nThe first config with a true condition is used. To avoid conflicts, configs using the  `supersedes` option, will run before their superseded targets.\n\nTo change the location of default configs, refer to `detectDefaultsConfigPath`.\n\n### API\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n##### Table of Contents\n\n-   [configent](#configent)\n    -   [Parameters](#parameters)\n\n#### configent\n\n##### Parameters\n\n-   `defaults` **options** default options\n-   `input` **Partial\u0026lt;options\u003e?** provided input (optional, default `{}`)\n-   `configentOptions` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** configent options\n    -   `configentOptions.name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name to use for configs. If left empty, name from package.json is used (optional, default `''`)\n    -   `configentOptions.cacheConfig` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** calling configent twice with same parameters will return the same instance (optional, default `true`)\n    -   `configentOptions.cacheDetectedDefaults` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** calling configent twice from the same module will return the same defaults (optional, default `true`)\n    -   `configentOptions.useDotEnv` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** include config from .env files (optional, default `true`)\n    -   `configentOptions.useEnv` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** include config from process.env (optional, default `true`)\n    -   `configentOptions.usePackageConfig` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** include config from package.json (optional, default `true`)\n    -   `configentOptions.useConfig` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** include config from [name].config.js (optional, default `true`)\n    -   `configentOptions.useDetectDefaults` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** detect defaults from context (package.json and file stucture) (optional, default `true`)\n    -   `configentOptions.detectDefaultsConfigPath` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** detect defaults from context (package.json and file stucture) (optional, default `'configs'`)\n    -   `configentOptions.sanitizeEnvValue` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** sanitize environment values. Convert snake_case to camelCase by default. (optional, default `str=\u003estr.replace(/[-_][a-z]/g,str=\u003estr.substr(1).toUpperCase())`)\n    -   `configentOptions.module` **NodeModule?** required if multiple modules are using configent\n\nReturns **options** \n\n#### \n\n\n---\n\n\u003ca href=\"https://www.freepik.com/vectors/vintage\"\u003eVintage vector created by macrovector - www.freepik.com\u003c/a\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froxiness%2Fconfigent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froxiness%2Fconfigent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froxiness%2Fconfigent/lists"}