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

Method _initOptions

lib/broccoli/ember-app.js:208–319  ·  view source on GitHub ↗

Initializes the `options` property from the `options` parameter and a set of default values from Ember CLI. @private @method _initOptions @param {Object} options

(options)

Source from the content-addressed store, hash-verified

206 @param {Object} options
207 */
208 _initOptions(options) {
209 let resolvePathFor = (defaultPath, specified) => {
210 let path = defaultPath;
211 if (specified && typeof specified === 'string') {
212 path = specified;
213 }
214 let resolvedPath = this._resolveLocal(path);
215
216 return resolvedPath;
217 };
218
219 let buildTreeFor = (defaultPath, specified, shouldWatch) => {
220 if (specified !== null && specified !== undefined && typeof specified !== 'string') {
221 return specified;
222 }
223
224 let tree = null;
225 let resolvedPath = resolvePathFor(defaultPath, specified);
226 if (fs.existsSync(resolvedPath)) {
227 if (shouldWatch !== false) {
228 tree = new WatchedDir(resolvedPath);
229 } else {
230 tree = new UnwatchedDir(resolvedPath);
231 }
232 }
233
234 return tree;
235 };
236 let trees = (options && options.trees) || {};
237
238 let appTree = buildTreeFor('app', trees.app);
239 let testsTree = buildTreeFor('tests', trees.tests, options.tests);
240
241 // these are contained within app/ no need to watch again
242 // (we should probably have the builder or the watcher dedup though)
243 this._stylesPath = resolvePathFor('app/styles', trees.styles);
244
245 let stylesTree = null;
246 if (fs.existsSync(this._stylesPath)) {
247 stylesTree = new UnwatchedDir(this._stylesPath);
248 }
249
250 let templatesTree = buildTreeFor('app/templates', trees.templates, false);
251 let vendorTree = buildTreeFor('vendor', trees.vendor);
252 let publicTree = buildTreeFor('public', trees.public);
253
254 let detectedDefaultOptions = {
255 babel: {},
256 minifyCSS: {
257 enabled: this.isProduction,
258 options: { processImport: false },
259 },
260 sourcemaps: {
261 enabled: !this.isProduction,
262 extensions: ['js'],
263 },
264 trees: {
265 app: appTree,

Callers 2

constructorMethod · 0.95
ember-app-test.jsFile · 0.80

Calls 1

findAddonByNameMethod · 0.80

Tested by

no test coverage detected