{"id":15290677,"url":"https://github.com/CourseDesign/conev-source-jsonfile","last_synced_at":"2025-10-07T04:30:37.366Z","repository":{"id":36964487,"uuid":"248435024","full_name":"CourseDesign/conev-source-jsonfile","owner":"CourseDesign","description":"conev-source-jsonfile is an implementation of conev's source to get configuration from json file.","archived":false,"fork":false,"pushed_at":"2023-01-16T07:04:50.000Z","size":19,"stargazers_count":0,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-05-28T20:49:04.323Z","etag":null,"topics":["conev","configuration","environment","npm","npm-package"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/conev-source-jsonfile","language":"TypeScript","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/CourseDesign.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-03-19T07:12:00.000Z","updated_at":"2021-05-01T05:28:33.000Z","dependencies_parsed_at":"2023-01-17T09:01:56.027Z","dependency_job_id":null,"html_url":"https://github.com/CourseDesign/conev-source-jsonfile","commit_stats":null,"previous_names":["kdpark0723/conev-source-jsonfile"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CourseDesign%2Fconev-source-jsonfile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CourseDesign%2Fconev-source-jsonfile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CourseDesign%2Fconev-source-jsonfile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CourseDesign%2Fconev-source-jsonfile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CourseDesign","download_url":"https://codeload.github.com/CourseDesign/conev-source-jsonfile/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234901084,"owners_count":18904395,"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":["conev","configuration","environment","npm","npm-package"],"created_at":"2024-09-30T16:08:59.504Z","updated_at":"2025-10-07T04:30:37.027Z","avatar_url":"https://github.com/CourseDesign.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# conev-source-jsonfile\n\nconev-source-jsonfile is an implementation of conev's source to get configuration from json file.\n\n![](https://img.shields.io/npm/dm/conev-source-jsonfile.png?style=flat-square)\n\n​    \n\n## Install\n\n```shell\n# with npm \nnpm install conev-source-jsonfile\n \n# or with Yarn \nyarn add conev-source-jsonfile\n```\n\n​    \n\n## Usage\n\nGet ConfigBuilder from conev and Sources to use.\n\n```typescript\nimport { ConfigBuilder } from 'conev';\nimport ProcessEnvSource from 'conev-source-jsonfile';\n```\n\nAnd create Source and set up.\n\n```typescript\nconst jsonFileSource = new ProcessEnvSource();\n\njsonFileSource    \n\t.setConfig('basic', './basic.json') // basic is JSON\n    .setConfig('dev', './dev.json') // dev is JSON\n    .setConfig('prd', './prd.json'); // prd is JSON\n```\n\nCreate ConfigBuilder and set Environment, add source. (highest priority is added first).\n\n```typescript\nconst builder = new ConfigBuilder();\n\nbuilder\n    .setEnv('dev', 'basic')\n    .addSource(jsonFileSource);\n```\n\nBuild configuration\n\n```typescript\nconst config = await builder.build(); // This is the result of combining dev and basic.\n```\n\nUse configuration\n\n```typescript\nconfig.get() // The whole configuration created comes out\nconfig.get('a.b.c'); // Is same as config.get().a.b.c\n```\n\n​    \n\n## Json File Source\n\n```typescript\nclass JsonFileSource {\n    constructor(fileMap?: Map\u003cstring, string\u003e);\n    setConfig(env: string, ...filenames: string[]): JsonFileSource;\n    addConfig(env: string, ...filename: string[]): JsonFileSource;\n    removeConfig(env: string): JsonFileSource;\n    export(): Promise\u003cMap\u003cstring, object\u003e\u003e;\n}\n```\n\n`ProcessEnvSource` defines the source from JSON file. Use `setConfig` to add a configuration for a new environment or ` removeConfig` to delete a configuration. Map is returned as the result value of `export`. The key of this map is environment and the value is the configuration when environment.\n\n​    \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCourseDesign%2Fconev-source-jsonfile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCourseDesign%2Fconev-source-jsonfile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCourseDesign%2Fconev-source-jsonfile/lists"}