{"id":16327058,"url":"https://github.com/mrmlnc/config-profiler","last_synced_at":"2025-05-14T22:33:12.506Z","repository":{"id":57205463,"uuid":"90479634","full_name":"mrmlnc/config-profiler","owner":"mrmlnc","description":"Find configuration for the current file from provided path, settings, package.json, workspace, HOME directory or env variable.","archived":false,"fork":false,"pushed_at":"2017-10-03T06:15:03.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-29T19:40:05.043Z","etag":null,"topics":["config","cwd","finder","profiler","resolver","workspace"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrmlnc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-06T17:28:16.000Z","updated_at":"2017-05-08T17:09:39.000Z","dependencies_parsed_at":"2022-09-18T00:50:38.996Z","dependency_job_id":null,"html_url":"https://github.com/mrmlnc/config-profiler","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrmlnc%2Fconfig-profiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrmlnc%2Fconfig-profiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrmlnc%2Fconfig-profiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrmlnc%2Fconfig-profiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrmlnc","download_url":"https://codeload.github.com/mrmlnc/config-profiler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254239704,"owners_count":22037754,"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":["config","cwd","finder","profiler","resolver","workspace"],"created_at":"2024-10-10T23:10:17.847Z","updated_at":"2025-05-14T22:33:12.435Z","avatar_url":"https://github.com/mrmlnc.png","language":"TypeScript","funding_links":["https://paypal.me/mrmlnc"],"categories":[],"sub_categories":[],"readme":"# config-profiler\n\n\u003e Find configuration for the current file from provided path, settings, `package.json`, workspace, HOME directory or env variable.\n\n## Donate\n\nIf you want to thank me, or promote your Issue.\n\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/mrmlnc)\n\n\u003e Sorry, but I have work and support for plugins and modules requires some time after work. I will be glad of your support or PR's.\n\n## Install\n\n```shell\n$ npm i -S config-profiler\n```\n\n## Why?\n\n  * Originally designed for my VS Code plugins, because many plugins use similar code.\n  * The ability to add your parsers for specific files or for one file.\n  * The ability to setup predefined configs and use they from configs.\n  * Less dependencies and more features.\n\n## How it works?\n\nFor example, if your config name is \"my-cofig\" we will search out configuration in the following places and order:\n\n  1. Settings (if you set `options.settings`):\n    * Return `options.settings` if they are the object.\n    * Return config from `oprions.predefinedConfigs` by name in the `options.settings` if is a string and it is found.\n    * Return config from filepath defined in the `options.settings`.\n  2. Trying to get the path to the config file from environment variable (if you set `options.envVariableName`)\n  3. Trying to find the config file in the current workspace (cwd). Closest config file to the current file. File from the following list:\n    * `options.configFiles`\n    * `package.json` if you set `options.packageProp`\n  4. Trying to find the config file in the HOME directory.\n  5. If no configuration object is found then we return `null`.\n\n## Usage\n\n```js\nconst ConfigProfiler = require('config-profiler');\n\nconst configProfiler = new ConfigProfiler('./path/to/current/workspace', {\n  configFiles: ['my-super-module-config.json', 'my-super-module-config.js']\n});\n\nconfigProfiler.getConfig('./path/to/current/file').then((result) =\u003e {\n  console.log(result);\n  // { from: './bla/bla/my-super-module-config.json', config: { ok: true } }\n});\n```\n\n## API\n\nSee [`/docs/api.md`](docs/api.md).\n\n## Options\n\nSee [`/docs/options.md`](docs/options.md).\n\n## Changelog\n\nSee the [Releases section of our GitHub project](https://github.com/mrmlnc/config-profiler/releases) for changelogs for each release version.\n\n## License\n\nThis software is released under the terms of the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrmlnc%2Fconfig-profiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrmlnc%2Fconfig-profiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrmlnc%2Fconfig-profiler/lists"}