Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emberjs/ember-optional-features
https://github.com/emberjs/ember-optional-features
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/emberjs/ember-optional-features
- Owner: emberjs
- License: mit
- Created: 2018-01-10T22:15:39.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-03-27T18:13:08.000Z (8 months ago)
- Last Synced: 2024-05-01T09:51:59.534Z (7 months ago)
- Language: JavaScript
- Size: 1.25 MB
- Stars: 40
- Watchers: 16
- Forks: 15
- Open Issues: 26
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-ember - @ember/optional-features - This addon allows you to easily enable/disable optional features in ember-source. To clarify what we mean by optional, these are features that will be opt-in/opt-out and optional for the foreseeable future, not features that will be enabled by default. It is intended for use with apps only not addons. (Packages / Command-line apps)
README
# @ember/optional-features
This addon allows you to easily enable/disable optional features in ember-source. To clarify what we mean by optional, these are features that will be opt-in/opt-out and optional for the foreseeable future, not features that will be enabled by default. It is intended for use with apps *only* not addons.
## Installation
```bash
ember install @ember/optional-features
```## Usage
### From command-line
#### List available features
Features will only be available in versions of ember-source that included them. To list all available features run:
```bash
ember feature:list
```#### Enable/disable features
To enable a feature, run:
```bash
ember feature:enable some-feature
```Similarly, if you want to disable a feature, you can run:
```bash
ember feature:disable some-feature
```### At build-time (from an addon)
This addon exposes a build-time method called `isFeatureEnabled`, which can be called from an addon's `index.js`, e.g.:
```javascript
included() {
let optionalFeatues = this.addons.find(a => a.name === '@ember/optional-features');
if (optionalFeatures.isFeatureEnabled('jquery-integration') {
// ...
}
}
```It also exposes a method called `isFeatureExplicitlySet`, which can be used to check whether or not the user has explictly set the value of the option instead of using the default.
### At run-time (from an app or addon)
WIP -- there does not yet exist a public API for accessing the state of optional features at runtime. [This](https://github.com/pzuraq/ember-compatibility-helpers/issues/27) issue is tracking it.