{"id":15536266,"url":"https://github.com/bertdeblock/ember-cli-should-include","last_synced_at":"2025-07-01T03:34:01.747Z","repository":{"id":110418895,"uuid":"323028907","full_name":"bertdeblock/ember-cli-should-include","owner":"bertdeblock","description":"Allow the users of your addon to configure which parts of your addon they want to include.","archived":false,"fork":false,"pushed_at":"2020-12-21T13:02:40.000Z","size":445,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-05-30T10:13:17.440Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/bertdeblock.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-20T08:43:19.000Z","updated_at":"2023-09-10T18:44:26.000Z","dependencies_parsed_at":"2023-04-08T21:00:57.167Z","dependency_job_id":null,"html_url":"https://github.com/bertdeblock/ember-cli-should-include","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bertdeblock/ember-cli-should-include","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertdeblock%2Fember-cli-should-include","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertdeblock%2Fember-cli-should-include/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertdeblock%2Fember-cli-should-include/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertdeblock%2Fember-cli-should-include/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bertdeblock","download_url":"https://codeload.github.com/bertdeblock/ember-cli-should-include/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertdeblock%2Fember-cli-should-include/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262889029,"owners_count":23380144,"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-10-02T11:50:41.995Z","updated_at":"2025-07-01T03:34:01.723Z","avatar_url":"https://github.com/bertdeblock.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ember CLI Should Include\n\n[![NPM Version](https://badge.fury.io/js/ember-cli-should-include.svg)](https://badge.fury.io/js/ember-cli-should-include)\n[![Build Status](https://travis-ci.com/bertdeblock/ember-cli-should-include.svg?branch=main)](https://travis-ci.com/bertdeblock/ember-cli-should-include)\n[![Ember Observer Score](https://emberobserver.com/badges/ember-cli-should-include.svg)](https://emberobserver.com/addons/ember-cli-should-include)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nAllow the users of your addon to configure which parts of your addon they want to include.\n\n\u003e :warning: For now, this is mainly a personal experiment to become more familiar with the Ember CLI build system. You probably shouldn't use this.\n\n## Table of Contents\n\n- [Support](#support)\n- [Installation](#installation)\n- [Examples](#examples)\n- [Roadmap](#roadmap)\n\n## Support\n\n`ember-cli-should-include` supports **Ember CLI v2.13 and up**.\n\n## Installation\n\n```shell\nyarn add ember-cli-should-include\n```\n\n```shell\nnpm install ember-cli-should-include\n```\n\n\u003e :information_source: Make sure `ember-cli-should-include` ends up in your `dependencies`.\n\n## Examples\n\n### 1\\. Including Components\n\nIf your addon ships a lot of components, you might want to give your users the ability to configure which ones should be included and which ones should not.\n\nConfiguring your addon could look like this:\n\n```javascript\nconst app = new EmberApp(defaults, {\n  'your-addon': {\n    include: [\n      'component-1',\n      'component-2',\n    ],\n  },\n});\n```\n\nThe implementation on your side could look like this:\n\n```javascript\n'use strict';\n\nconst {\n  shouldIncludeForAddonTree,\n  shouldIncludeForAppTree,\n} = require('ember-cli-should-include/lib');\n\nmodule.exports = {\n  name: require('./package').name,\n  shouldIncludeConfig: null,\n\n  included(app) {\n    const yourAddonOptions = app.options[this.name] || {};\n\n    this.shouldIncludeConfig = {\n      components: yourAddonOptions.include\n    };\n\n    return this._super.included.apply(this, arguments);\n  },\n\n  treeForAddon(tree) {\n    const newTree = shouldIncludeForAddonTree(tree, this.shouldIncludeConfig);\n\n    return this._super.treeForAddon.apply(this, [newTree]);\n  },\n\n  treeForApp(tree) {\n    const newTree = shouldIncludeForAppTree(tree, this.shouldIncludeConfig);\n\n    return this._super.treeForApp.apply(this, [newTree]);\n  },\n};\n```\n\nEh voilà! Now only `component-1` and `component-2` will be included in your user's app.\n\n\u003e :information_source: Only colocated components are supported.\n\n\u003e :information_source: This example works as well for any other type of entity (e.g. helpers, models, services and so on).\n\n### 2\\. Including Multiple Types of Entities\n\nIf your addon ships more than a single type of entity, configuring your addon could look like this:\n\n```javascript\nconst app = new EmberApp(defaults, {\n  'your-addon': {\n    include: {\n      components: [\n        'component-1',\n        'component-2',\n      ],\n      helpers: [\n        'helper-1',\n        'helper-2',\n      ],\n    },\n  },\n});\n```\n\nThe implementation on your side could look like this:\n\n```javascript\n'use strict';\n\nconst {\n  shouldIncludeForAddonTree,\n  shouldIncludeForAppTree,\n} = require('ember-cli-should-include/lib');\n\nmodule.exports = {\n  name: require('./package').name,\n  shouldIncludeConfig: null,\n\n  included(app) {\n    const yourAddonOptions = app.options[this.name] || {};\n\n    this.shouldIncludeConfig = yourAddonOptions.include;\n\n    return this._super.included.apply(this, arguments);\n  },\n\n  treeForAddon(tree) {\n    const newTree = shouldIncludeForAddonTree(tree, this.shouldIncludeConfig);\n\n    return this._super.treeForAddon.apply(this, [newTree]);\n  },\n\n  treeForApp(tree) {\n    const newTree = shouldIncludeForAppTree(tree, this.shouldIncludeConfig);\n\n    return this._super.treeForApp.apply(this, [newTree]);\n  },\n};\n```\n\nDone! Now only `component-1`, `component-2`, `helper-1` and `helper-2` will be included in your user's app.\n\n## Roadmap\n\n- [ ] Including/Excluding CSS\n- [ ] Validating entity types\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbertdeblock%2Fember-cli-should-include","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbertdeblock%2Fember-cli-should-include","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbertdeblock%2Fember-cli-should-include/lists"}