{"id":15602916,"url":"https://github.com/m-basov/ember-cli-config-builder","last_synced_at":"2025-04-24T07:33:00.141Z","repository":{"id":40950257,"uuid":"123429879","full_name":"m-basov/ember-cli-config-builder","owner":"m-basov","description":"⚙️ Edit Ember app configs in your addon blueprints!","archived":false,"fork":false,"pushed_at":"2022-12-07T09:17:09.000Z","size":440,"stargazers_count":10,"open_issues_count":18,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-13T02:09:15.486Z","etag":null,"topics":["config","ember-addon","ember-cli","ember-util"],"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/m-basov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-01T12:07:14.000Z","updated_at":"2018-12-16T23:03:55.000Z","dependencies_parsed_at":"2023-01-24T15:31:01.382Z","dependency_job_id":null,"html_url":"https://github.com/m-basov/ember-cli-config-builder","commit_stats":null,"previous_names":["kolybasov/ember-cli-config-builder"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-basov%2Fember-cli-config-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-basov%2Fember-cli-config-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-basov%2Fember-cli-config-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-basov%2Fember-cli-config-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m-basov","download_url":"https://codeload.github.com/m-basov/ember-cli-config-builder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250583086,"owners_count":21453961,"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","ember-addon","ember-cli","ember-util"],"created_at":"2024-10-03T03:00:53.407Z","updated_at":"2025-04-24T07:33:00.105Z","avatar_url":"https://github.com/m-basov.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ember-cli-config-builder\n\n[![Build Status](https://travis-ci.org/kolybasov/ember-cli-config-builder.svg?branch=master)](https://travis-ci.org/kolybasov/ember-cli-config-builder)\n[![npm version](https://badge.fury.io/js/ember-cli-config-builder.svg)](https://badge.fury.io/js/ember-cli-config-builder)\n\nExtensible library to edit Ember’s config files with familiar API.\n\nWhy? Checkout this [blog post](https://kolybasov.github.io/posts/making-ember-addon-installation-smoother/).\n\n## Installation\n\n* `$ npm install --save ember-cli-config-builder`\n\nOr\n\n* `$ yarn add ember-cli-config-builder`\n\n## Basic Usage\n\n```javascript\n// Import library\nconst ConfigBuilder = require('ember-cli-config-builder');\n\n// Create builder instance. Notice: it is async operation which returns\n// Promise because async fs.readFile method is used to read file contents\nlet config = await ConfigBuilder.create('./my-addon/config/environment.js');\n\n// Read variables with #get(path) method. Notice: it is always returns string\n// with raw value. Example: \"'string value'\", 'true', '{ object: true }' etc\nconfig.get('rootURL'); // \"'/'\"\n\n// Read nested values with dot-separated path\nconfig.get('EmberENV.EXTEND_PROTOTYPES.Date'); // 'false'\n\n// Read multiple values at once\nconfig.get(['modulePrefix', 'locationType']); // { modulePrefix: \"'dummy'\", locationType: \"'auto'\" }\n\n// Change existing properties with #set(path, value) method. It returns true\n// if set was successful or false otherwise\nconfig.set('rootURL', \"'/dev'\"); // true\n\n// Create a new poperty\nconfig.set('myNewProp', '{}'); // true\n\n// Change nested properties\nconfig.set('EmberENV.EXTEND_PROTOTYPES.Date', 'true'); // true\n\n// Change or create multiple properties at once\nconfig.setProperties({ 'myNewProp.child': \"'works'\", 'rootURL.child': \"'rootURL is not an object'\" }); // { 'myNewProp.child': true, 'rootURL.child': false }\n\n// Or remove properties entirely with #remove(path) method. It returns true\n// if key was found and removed and false otherwise\nconfig.remove('rootURL'); // true\n\n// You can remove only child keys.\nconfig.remove('myNewProp.child'); // true\n\n// Multiple remove is available as well\nconfig.removeProperties(['myNewProp', 'modulePrefix']); // { myNewProp: true, modulePrefix: true }\n\n// After editing is done there are a few options to save result.\n// The most straightforward is save to the same file.\n// Notice: this method is async as well because of usage non-blocking\n// fs.writeFile method\nawait config.save(); // will write changes to disk and return string with file content\n\n// Or you can write changes to another file\nawait config.save('./my-addon/config/new-environment.js');\n\n// See Advanced Usage section for more use cases\n```\n\n## Built-in adapters\n\n* environment.js\n* ember-cli-build.js\n\n## Alternatives\n\n* [ember-cli-build-config-editor](https://github.com/srvance/ember-cli-build-config-editor) – uses the same approach with recast AST trees but is have many limits what you can edit and uses it owns non-Ember intuitive API. Also it moves reading and writing files to user responsibilities.\n* [recast](https://github.com/benjamn/recast) – very powerful but yet very low-level tool to parse, edit and print JavaScript files. This addon wraps it to make editing much more easier.\n\n## Advanced Usage\n\nTODO: write this :)\n\n## Contributing\n\n### Installation\n\n`git clone git@github.com:kolybasov/ember-cli-config-builder.git`\n\n`cd ember-cli-config-builder`\n\n`yarn install`\n\n### Running tests\n\n`yarn test` – Runs jest tests\n\n## License\n\nThis project is licensed under the [MIT License](./LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-basov%2Fember-cli-config-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm-basov%2Fember-cli-config-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-basov%2Fember-cli-config-builder/lists"}