Interactive Ember CLI commands for managing optional features from the terminal. All commands work within Ember projects and provide validation, feature listing, and optional automated codemods.
Shows usage information and available commands.
/**
* Base feature command that displays usage information
*/
interface FeatureCommand {
name: 'feature';
description: 'Prints the USAGE.';
works: 'insideProject';
run(): void;
}Usage:
ember featureThis displays the usage message explaining all available feature commands.
Lists all available features for the current Ember version with descriptions and default values.
/**
* Lists all available optional features
*/
interface FeatureListCommand {
name: 'feature:list';
description: 'List all available features.';
works: 'insideProject';
run(): void;
}Usage:
ember feature:listExample Output:
Available features:
application-template-wrapper (Default: true)
Wrap the top-level application template (application.hbs) with a `<div class="ember-view">` element.
More information: https://github.com/emberjs/rfcs/pull/280
template-only-glimmer-components (Default: false)
Use Glimmer Components semantics for template-only components (component templates with no corresponding .js file).
More information: https://github.com/emberjs/rfcs/pull/278Enables a specific optional feature with optional automated codemod execution.
/**
* Enables a specific optional feature
*/
interface FeatureEnableCommand {
name: 'feature:enable';
description: 'Enable feature.';
works: 'insideProject';
availableOptions: [
{
name: 'run-codemod';
type: Boolean;
description: 'run any associated codemods without prompting';
}
];
anonymousOptions: ['<feature-name>'];
run(commandOptions: { runCodemod?: boolean }, args: string[]): Promise<void>;
}Usage:
# Enable feature with interactive prompts
ember feature:enable template-only-glimmer-components
# Enable feature and automatically run codemods
ember feature:enable template-only-glimmer-components --run-codemod
# Enable feature and skip codemods
ember feature:enable template-only-glimmer-components --no-run-codemodBehavior:
config/optional-features.json with the new setting--run-codemod or --no-run-codemod is specifiedDisables a specific optional feature with optional automated codemod execution.
/**
* Disables a specific optional feature
*/
interface FeatureDisableCommand {
name: 'feature:disable';
description: 'Disable feature.';
works: 'insideProject';
availableOptions: [
{
name: 'run-codemod';
type: Boolean;
description: 'run any associated codemods without prompting';
}
];
anonymousOptions: ['<feature-name>'];
run(commandOptions: { runCodemod?: boolean }, args: string[]): Promise<void>;
}Usage:
# Disable feature with interactive prompts
ember feature:disable jquery-integration
# Disable feature and automatically run codemods
ember feature:disable application-template-wrapper --run-codemodAll feature commands inherit shared functionality for validation, configuration management, and feature manipulation.
/**
* Check if a feature is available in the current Ember version
* @param feature - Feature definition object
* @returns Whether feature is available
*/
_isFeatureAvailable(feature: FeatureDefinition): boolean;/**
* Ensure config/optional-features.json exists, create if missing
* @returns Path to the configuration file
*/
_ensureConfigFile(): string;/**
* Set a feature's enabled state and run optional codemods
* @param name - Feature name
* @param value - Whether to enable (true) or disable (false)
* @param shouldRunCodemod - Whether to run associated codemods
*/
_setFeature(name: string, value: boolean, shouldRunCodemod?: boolean): Promise<void>;Commands provide clear error messages for common issues:
Example Error Output:
Error: template-only-glimmer-components is only available in Ember 3.1 or above.Error: unknown-feature is not a valid feature.
Available features:
application-template-wrapper (Default: true)
...