MCPcopy Index your code
hub / github.com/ember-cli/ember-cli / init

Function init

lib/models/command.js:82–162  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

80 _printableProperties: ['name', 'description', 'aliases', 'works', 'availableOptions', 'anonymousOptions'],
81
82 init() {
83 this._super.apply(this, arguments);
84
85 /**
86 * @final
87 * @property isWithinProject
88 * @type Boolean
89 */
90 this.isWithinProject = this.project.isEmberCLIProject();
91
92 /**
93 * @final
94 * @property isViteProject
95 * @type Boolean
96 */
97 this.isViteProject = this.isWithinProject && this.project.isViteProject?.();
98
99 /**
100 * The name of the command.
101 *
102 * @final
103 * @property name
104 * @type String
105 * @example `new` or `generate`
106 */
107 this.name = this.name || path.basename(getCallerFile(), '.js');
108
109 logger.info('initialize: name: %s, name: %s', this.name);
110
111 /**
112 * An array of aliases for the command
113 *
114 * @final
115 * @property aliases
116 * @type Array
117 * @example `['g']` for the `generate` command
118 */
119 this.aliases = this.aliases || [];
120
121 // Works Property
122 if (!allowedWorkOptions[this.works]) {
123 throw new Error(
124 `The "${this.name}" command's works field has to be either "everywhere", "insideProject" or "outsideProject".`
125 );
126 }
127
128 /**
129 * An array of available options for the command
130 *
131 * @final
132 * @property availableOptions
133 * @type Array
134 * @example
135 * ```js
136 * availableOptions: [
137 * { name: 'dry-run', type: Boolean, default: false, aliases: ['d'] },
138 * { name: 'verbose', type: Boolean, default: false, aliases: ['v'] },
139 * { name: 'blueprint', type: String, default: 'app', aliases: ['b'] },

Callers

nothing calls this directly

Calls 2

isEmberCLIProjectMethod · 0.80
isViteProjectMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…