ember-cli 4.12.0 → 5.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/.github/workflows/ci.yml +4 -5
  2. package/CHANGELOG.md +44 -0
  3. package/CONTRIBUTING.md +1 -1
  4. package/blueprints/addon/files/.github/workflows/ci.yml +3 -3
  5. package/blueprints/addon/files/.travis.yml +1 -1
  6. package/blueprints/addon/files/README.md +1 -1
  7. package/blueprints/addon/files/npmignore +0 -6
  8. package/blueprints/app/files/.eslintignore +0 -12
  9. package/blueprints/app/files/.github/workflows/ci.yml +2 -2
  10. package/blueprints/app/files/.prettierignore +1 -13
  11. package/blueprints/app/files/.travis.yml +1 -1
  12. package/blueprints/app/files/.watchmanconfig +1 -1
  13. package/blueprints/app/files/gitignore +0 -8
  14. package/blueprints/app/files/package.json +1 -1
  15. package/blueprints/server/index.js +0 -27
  16. package/docs/build/data.json +217 -401
  17. package/lib/broccoli/default-packager.js +2 -79
  18. package/lib/broccoli/ember-addon.js +0 -4
  19. package/lib/broccoli/ember-app.js +19 -460
  20. package/lib/cli/cli.js +0 -9
  21. package/lib/commands/addon.js +0 -1
  22. package/lib/commands/init.js +0 -8
  23. package/lib/commands/install.js +2 -2
  24. package/lib/commands/new.js +0 -1
  25. package/lib/commands/serve.js +1 -1
  26. package/lib/experiments/index.js +2 -2
  27. package/lib/models/addon.js +38 -113
  28. package/lib/models/blueprint.js +0 -115
  29. package/lib/models/command.js +3 -4
  30. package/lib/models/package-info-cache/package-info.js +1 -5
  31. package/lib/models/project.js +2 -87
  32. package/lib/tasks/interactive-new.js +1 -1
  33. package/lib/tasks/npm-task.js +0 -15
  34. package/lib/tasks/server/express-server.js +0 -1
  35. package/lib/tasks/server/middleware/broccoli-watcher/index.js +5 -5
  36. package/lib/tasks/server/middleware/history-support/index.js +6 -7
  37. package/lib/tasks/server/middleware/testem-url-rewriter/index.js +0 -10
  38. package/lib/tasks/server/middleware/tests-server/index.js +8 -9
  39. package/lib/utilities/ember-app-utils.js +1 -21
  40. package/lib/utilities/get-serve-url.js +2 -2
  41. package/package.json +13 -23
  42. package/tests/helpers/acceptance.js +1 -3
  43. package/tests/helpers/command-generator.js +2 -2
  44. package/tests/helpers/default-packager.js +3 -9
  45. package/tests/helpers/init-app.js +1 -1
  46. package/tests/helpers/mock-project.js +1 -1
  47. package/tests/helpers/package-cache.js +2 -19
  48. package/blueprints/server/files/server/.jshintrc +0 -3
  49. package/blueprints/vendor-shim/files/vendor/shims/__name__.js +0 -12
  50. package/blueprints/vendor-shim/index.js +0 -30
  51. package/lib/broccoli/babel-process-modules-only.js +0 -18
  52. package/lib/models/installation-checker.js +0 -87
  53. package/lib/tasks/bower-install.js +0 -175
  54. package/lib/utilities/ember-cli-babel-config-key.js +0 -12
  55. package/lib/utilities/find-addon-by-name.js +0 -39
package/lib/cli/cli.js CHANGED
@@ -175,15 +175,6 @@ class CLI {
175
175
 
176
176
  logger.info('command: %s', commandName);
177
177
 
178
- if (!this.testing) {
179
- process.chdir(environment.project.root);
180
- let skipInstallationCheck = commandArgs.indexOf('--skip-installation-check') !== -1;
181
- if (environment.project.isEmberCLIProject() && !skipInstallationCheck) {
182
- const InstallationChecker = require('../models/installation-checker');
183
- new InstallationChecker({ project: environment.project }).checkInstallations();
184
- }
185
- }
186
-
187
178
  let instrumentation = this.instrumentation;
188
179
  let onCommandInterrupt;
189
180
 
@@ -12,7 +12,6 @@ module.exports = NewCommand.extend({
12
12
  { name: 'verbose', type: Boolean, default: false, aliases: ['v'] },
13
13
  { name: 'blueprint', type: String, default: 'addon', aliases: ['b'] },
14
14
  { name: 'skip-npm', type: Boolean, default: false, aliases: ['sn'] },
15
- { name: 'skip-bower', type: Boolean, default: false, aliases: ['sb'] },
16
15
  { name: 'skip-git', type: Boolean, default: false, aliases: ['sg'] },
17
16
  { name: 'yarn', type: Boolean }, // no default means use yarn if the blueprint has a yarn.lock
18
17
  { name: 'directory', type: String, aliases: ['dir'] },
@@ -20,7 +20,6 @@ module.exports = Command.extend({
20
20
  { name: 'verbose', type: Boolean, default: false, aliases: ['v'] },
21
21
  { name: 'blueprint', type: String, aliases: ['b'] },
22
22
  { name: 'skip-npm', type: Boolean, default: false, aliases: ['sn'] },
23
- { name: 'skip-bower', type: Boolean, default: false, aliases: ['sb'] },
24
23
  { name: 'lint-fix', type: Boolean, default: true },
25
24
  {
26
25
  name: 'welcome',
@@ -60,7 +59,6 @@ module.exports = Command.extend({
60
59
  async run(commandOptions, rawArgs) {
61
60
  if (commandOptions.dryRun) {
62
61
  commandOptions.skipNpm = true;
63
- commandOptions.skipBower = true;
64
62
  }
65
63
 
66
64
  let project = this.project;
@@ -115,12 +113,6 @@ module.exports = Command.extend({
115
113
  });
116
114
  }
117
115
 
118
- if (!commandOptions.skipBower) {
119
- await this.runTask('BowerInstall', {
120
- verbose: commandOptions.verbose,
121
- });
122
- }
123
-
124
116
  if (commandOptions.skipGit === false) {
125
117
  await this.runTask('GitInit', commandOptions, rawArgs);
126
118
  }
@@ -29,8 +29,8 @@ module.exports = Command.extend({
29
29
  run(commandOptions, addonNames) {
30
30
  if (!addonNames.length) {
31
31
  let msg = 'The `install` command must take an argument with the name';
32
- msg += ' of an ember-cli addon. For installing all npm and bower ';
33
- msg += 'dependencies you can run `npm install && bower install`.';
32
+ msg += ' of an ember-cli addon. For installing all npm ';
33
+ msg += 'dependencies you can run `npm install`.';
34
34
  return Promise.reject(new SilentError(msg));
35
35
  }
36
36
 
@@ -18,7 +18,6 @@ module.exports = Command.extend({
18
18
  { name: 'verbose', type: Boolean, default: false, aliases: ['v'] },
19
19
  { name: 'blueprint', type: String, default: 'app', aliases: ['b'] },
20
20
  { name: 'skip-npm', type: Boolean, default: false, aliases: ['sn'] },
21
- { name: 'skip-bower', type: Boolean, default: false, aliases: ['sb'] },
22
21
  { name: 'skip-git', type: Boolean, default: false, aliases: ['sg'] },
23
22
  {
24
23
  name: 'welcome',
@@ -58,7 +58,7 @@ module.exports = Command.extend({
58
58
  { name: 'watcher', type: String, default: 'events', aliases: ['w'] },
59
59
  { name: 'live-reload', type: Boolean, default: true, aliases: ['lr'] },
60
60
  { name: 'live-reload-host', type: String, aliases: ['lrh'], description: 'Defaults to host' },
61
- { name: 'live-reload-base-url', type: String, aliases: ['lrbu'], description: 'Defaults to baseURL' },
61
+ { name: 'live-reload-base-url', type: String, aliases: ['lrbu'], description: 'Defaults to rootURL' },
62
62
  { name: 'live-reload-port', type: Number, aliases: ['lrp'], description: 'Defaults to same port as ember app' },
63
63
  { name: 'live-reload-prefix', type: String, default: '_lr', aliases: ['lrprefix'], description: 'Default to _lr' },
64
64
  {
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  const chalk = require('chalk');
4
- const availableExperiments = Object.freeze(['PACKAGER', 'EMBROIDER', 'CLASSIC']);
4
+ const availableExperiments = Object.freeze(['EMBROIDER', 'CLASSIC']);
5
5
 
6
- const deprecatedExperiments = Object.freeze(['PACKAGER']);
6
+ const deprecatedExperiments = Object.freeze([]);
7
7
  const enabledExperiments = Object.freeze([]);
8
8
  const deprecatedExperimentsDeprecationsIssued = [];
9
9
 
@@ -28,17 +28,11 @@ const Funnel = require('broccoli-funnel');
28
28
  const walkSync = require('walk-sync');
29
29
  const ensurePosixPath = require('ensure-posix-path');
30
30
  const { defaultsDeep } = require('ember-cli-lodash-subset');
31
- const findAddonByName = require('../utilities/find-addon-by-name');
32
31
  const heimdall = require('heimdalljs');
33
32
  const calculateCacheKeyForTree = require('calculate-cache-key-for-tree');
34
33
  const addonProcessTree = require('../utilities/addon-process-tree');
35
- const emberCLIBabelConfigKey = require('../utilities/ember-cli-babel-config-key');
36
- const semver = require('semver');
37
- const processModulesOnly = require('../broccoli/babel-process-modules-only');
38
34
  const registryHasPreprocessor = require('../utilities/registry-has-preprocessor');
39
35
 
40
- const BUILD_BABEL_OPTIONS_FOR_PREPROCESSORS = Symbol('BUILD_BABEL_OPTIONS_FOR_PREPROCESSORS');
41
-
42
36
  if (!heimdall.hasMonitor('addon-tree-cache')) {
43
37
  heimdall.registerMonitor('addon-tree-cache', function AddonTreeCacheSchema() {
44
38
  this.hits = 0;
@@ -125,15 +119,6 @@ function _resetTreeCache() {
125
119
  ADDON_TREE_CACHE.clear();
126
120
  }
127
121
 
128
- function warn(message) {
129
- if (this.ui) {
130
- this.ui.writeDeprecateLine(message);
131
- } else {
132
- const chalk = require('chalk');
133
- console.log(chalk.yellow(`DEPRECATION: ${message}`));
134
- }
135
- }
136
-
137
122
  /**
138
123
  Root class for an Addon. If your addon module exports an Object this
139
124
  will be extended from this base class. If you export a constructor (function),
@@ -323,18 +308,13 @@ let addonProto = {
323
308
  },
324
309
 
325
310
  _initDefaultBabelOptions() {
326
- this.__originalOptions = this.options = defaultsDeep(this.options, {
327
- babel: this[BUILD_BABEL_OPTIONS_FOR_PREPROCESSORS](),
311
+ this.options = defaultsDeep(this.options, {
312
+ babel: {},
328
313
  });
329
314
 
330
- let defaultEmberCLIBabelOptions = {
315
+ this.options['ember-cli-babel'] = defaultsDeep(this.options['ember-cli-babel'], {
331
316
  compileModules: true,
332
- };
333
- let emberCLIBabelConfigKey = this._emberCLIBabelConfigKey();
334
- this.__originalOptions[emberCLIBabelConfigKey] = this.options[emberCLIBabelConfigKey] = defaultsDeep(
335
- this.options[emberCLIBabelConfigKey],
336
- defaultEmberCLIBabelOptions
337
- );
317
+ });
338
318
  },
339
319
 
340
320
  /**
@@ -409,16 +389,14 @@ let addonProto = {
409
389
  return true;
410
390
  }
411
391
 
412
- // Addon names in index.js and package.json should be the same at all times whether they have scope or not.
392
+ // Addon names in index.js and package.json must be the same at all times whether they have scope or not.
413
393
  if (this.root === this.parent.root) {
414
- if (parentName !== this.name && !process.env.EMBER_CLI_IGNORE_ADDON_NAME_MISMATCH) {
394
+ if (parentName !== this.name) {
415
395
  let pathToDisplay = process.cwd() === this.root ? process.cwd() : path.relative(process.cwd(), this.root);
416
396
 
417
397
  throw new SilentError(
418
- 'ember-cli: Your names in package.json and index.js should match. ' +
419
- `The addon in ${pathToDisplay} currently have '${parentName}' in package.json and '${this.name}' in index.js. ` +
420
- 'Until ember-cli v3.9, this error can be disabled by setting env variable EMBER_CLI_IGNORE_ADDON_NAME_MISMATCH to "true". ' +
421
- 'For more information about this workaround, see: https://github.com/ember-cli/ember-cli/pull/7950.'
398
+ 'ember-cli: Your names in package.json and index.js must match. ' +
399
+ `The addon in ${pathToDisplay} currently has '${parentName}' in package.json and '${this.name}' in index.js.`
422
400
  );
423
401
  }
424
402
 
@@ -547,8 +525,8 @@ let addonProto = {
547
525
  let tree;
548
526
 
549
527
  if (!this.project) {
550
- this._warn(
551
- `Addon: \`${this.name}\` is missing addon.project, this may be the result of an addon forgetting to invoke \`super\` in its init.`
528
+ throw new SilentError(
529
+ `Addon \`${this.name}\` is missing \`addon.project\`. This may be the result of an addon forgetting to invoke \`super\` in its init hook.`
552
530
  );
553
531
  }
554
532
  // TODO: fix law of demeter `_watchmanInfo.canNestRoots` is obviously a poor idea
@@ -571,18 +549,6 @@ let addonProto = {
571
549
  return ensurePosixPath(normalizedAbsoluteTreePath);
572
550
  },
573
551
 
574
- /**
575
- * @private
576
- * @method _warn
577
- */
578
- _warn: warn,
579
-
580
- _emberCLIBabelConfigKey() {
581
- let emberCLIBabelInstance = findAddonByName(this.addons, 'ember-cli-babel');
582
-
583
- return emberCLIBabelConfigKey(emberCLIBabelInstance);
584
- },
585
-
586
552
  /**
587
553
  Returns a given type of tree (if present), merged with the
588
554
  application tree. For each of the trees available using this
@@ -836,15 +802,12 @@ let addonProto = {
836
802
  @example
837
803
  ```js
838
804
  treeForAddon() {
839
- var tree = this._super.treeForAddon.apply(this, arguments);
840
- var checker = new VersionChecker(this);
841
- var isOldEmber = checker.for('ember', 'bower').lt('1.13.0');
805
+ let emberVersion = new VersionChecker(this.project).for('ember-source');
806
+ let shouldUsePolyfill = emberVersion.lt('4.5.0-alpha.4');
842
807
 
843
- if (isOldEmber) {
844
- tree = new Funnel(tree, { exclude: [ /instance-initializers/ ] });
808
+ if (shouldUsePolyfill) {
809
+ return this._super.treeForAddon.apply(this, arguments);
845
810
  }
846
-
847
- return tree;
848
811
  }
849
812
  ```
850
813
  */
@@ -946,16 +909,14 @@ let addonProto = {
946
909
  registry: this.registry,
947
910
  treeType: 'addon-test-support',
948
911
  });
949
- } else {
950
- this._warn(
951
- `Addon test support files were detected in \`${this._treePathFor('addon-test-support')}\`, but no JavaScript ` +
952
- `preprocessors were found for \`${this.name}\`. Please make sure to add a preprocessor ` +
953
- `(most likely \`ember-cli-babel\`) to \`dependencies\` (NOT \`devDependencies\`) in ` +
954
- `\`${this.name}\`'s \`package.json\`.`
955
- );
956
-
957
- return processModulesOnly(namespacedTree, `Babel Fallback - Addon#treeForAddonTestSupport (${this.name})`);
958
912
  }
913
+
914
+ throw new SilentError(
915
+ `Addon test-support files were detected in \`${this._treePathFor('addon-test-support')}\`, but no JavaScript ` +
916
+ `preprocessor was found for \`${this.name}\`. Please make sure to add a preprocessor ` +
917
+ `(most likely \`ember-cli-babel\`) to \`dependencies\` (NOT \`devDependencies\`) in ` +
918
+ `\`${this.name}\`'s \`package.json\`.`
919
+ );
959
920
  },
960
921
 
961
922
  /**
@@ -1159,37 +1120,27 @@ let addonProto = {
1159
1120
  */
1160
1121
  compileAddon(tree) {
1161
1122
  if (!this.options) {
1162
- this._warn(
1123
+ throw new SilentError(
1163
1124
  `Ember CLI addons manage their own module transpilation during the \`treeForAddon\` processing. ` +
1164
1125
  `\`${this.name}\` (found at \`${this.root}\`) has removed \`this.options\` ` +
1165
- `which conflicts with the addons ability to transpile its \`addon/\` files properly. ` +
1166
- `Falling back to default babel configuration options.`
1126
+ `which conflicts with the addons ability to transpile its \`addon/\` files properly.`
1167
1127
  );
1168
-
1169
- this.options = {};
1170
1128
  }
1171
1129
 
1172
1130
  if (!this.options.babel) {
1173
- this._warn(
1131
+ throw new SilentError(
1174
1132
  `Ember CLI addons manage their own module transpilation during the \`treeForAddon\` processing. ` +
1175
- `\`${this.name}\` (found at \`${this.root}\`) has overridden the \`this.options.babel\` ` +
1176
- `options which conflicts with the addons ability to transpile its \`addon/\` files properly. ` +
1177
- `Falling back to default babel configuration options.`
1133
+ `\`${this.name}\` (found at \`${this.root}\`) has overridden the \`this.options.babel\` options ` +
1134
+ `which conflicts with the addons ability to transpile its \`addon/\` files properly.`
1178
1135
  );
1179
-
1180
- this.options.babel = this.__originalOptions.babel;
1181
1136
  }
1182
1137
 
1183
- let emberCLIBabelConfigKey = this._emberCLIBabelConfigKey();
1184
- if (!this.options[emberCLIBabelConfigKey]) {
1185
- this._warn(
1138
+ if (!this.options['ember-cli-babel']) {
1139
+ throw new SilentError(
1186
1140
  `Ember CLI addons manage their own module transpilation during the \`treeForAddon\` processing. ` +
1187
- `\`${this.name}\` (found at \`${this.root}\`) has overridden the \`this.options.${emberCLIBabelConfigKey}\` ` +
1188
- `options which conflicts with the addons ability to transpile its \`addon/\` files properly. ` +
1189
- `Falling back to default babel configuration options.`
1141
+ `\`${this.name}\` (found at \`${this.root}\`) has overridden the \`this.options['ember-cli-babel']\` options ` +
1142
+ `which conflicts with the addons ability to transpile its \`addon/\` files properly.`
1190
1143
  );
1191
-
1192
- this.options[emberCLIBabelConfigKey] = this.__originalOptions[emberCLIBabelConfigKey];
1193
1144
  }
1194
1145
 
1195
1146
  let scopedInput = new Funnel(tree, {
@@ -1297,23 +1248,16 @@ let addonProto = {
1297
1248
  treeType: 'addon',
1298
1249
  });
1299
1250
 
1300
- let postprocessedAddonJs = this._addonPostprocessTree('js', processedAddonJS);
1301
-
1302
- if (!registryHasPreprocessor(this.registry, 'js')) {
1303
- this._warn(
1304
- `Addon files were detected in \`${this._treePathFor('addon')}\`, but no JavaScript ` +
1305
- `preprocessors were found for \`${this.name}\`. Please make sure to add a preprocessor ` +
1306
- '(most likely `ember-cli-babel`) to in `dependencies` (NOT `devDependencies`) in ' +
1307
- `\`${this.name}\`'s \`package.json\`.`
1308
- );
1309
-
1310
- postprocessedAddonJs = processModulesOnly(
1311
- postprocessedAddonJs,
1312
- `Babel Fallback - Addon#processedAddonJsFiles(${this.name})`
1313
- );
1251
+ if (registryHasPreprocessor(this.registry, 'js')) {
1252
+ return this._addonPostprocessTree('js', processedAddonJS);
1314
1253
  }
1315
1254
 
1316
- return postprocessedAddonJs;
1255
+ throw new SilentError(
1256
+ `Addon files were detected in \`${this._treePathFor('addon')}\`, but no JavaScript ` +
1257
+ `preprocessor was found for \`${this.name}\`. Please make sure to add a preprocessor ` +
1258
+ '(most likely `ember-cli-babel`) to `dependencies` (NOT `devDependencies`) in ' +
1259
+ `\`${this.name}\`'s \`package.json\`.`
1260
+ );
1317
1261
  },
1318
1262
 
1319
1263
  /**
@@ -1360,7 +1304,6 @@ let addonProto = {
1360
1304
 
1361
1305
  - Modifying configuration options (see list of defaults [here](https://github.com/ember-cli/ember-cli/blob/v2.4.3/lib/broccoli/ember-app.js#L163))
1362
1306
  - For example
1363
- - `minifyJS`
1364
1307
  - `storeConfigInMeta`
1365
1308
  - et, al
1366
1309
 
@@ -1732,24 +1675,6 @@ function methodsForTreeType(treeType) {
1732
1675
 
1733
1676
  let Addon = CoreObject.extend(addonProto);
1734
1677
 
1735
- Addon.prototype[BUILD_BABEL_OPTIONS_FOR_PREPROCESSORS] = function () {
1736
- let emberCLIBabelInstance = findAddonByName(this.addons, 'ember-cli-babel');
1737
- let version;
1738
- if (emberCLIBabelInstance) {
1739
- version = require(path.join(emberCLIBabelInstance.root, 'package')).version;
1740
- }
1741
-
1742
- if (version && semver.satisfies(version, '^5')) {
1743
- return {
1744
- modules: 'amdStrict',
1745
- moduleIds: true,
1746
- resolveModuleSource: require('amd-name-resolver').moduleResolve,
1747
- };
1748
- } else {
1749
- return {};
1750
- }
1751
- };
1752
-
1753
1678
  module.exports = Addon;
1754
1679
  module.exports._resetTreeCache = _resetTreeCache;
1755
1680
  module.exports._treeCache = ADDON_TREE_CACHE;
@@ -20,11 +20,9 @@ const walkSync = require('walk-sync');
20
20
  const SilentError = require('silent-error');
21
21
  const CoreObject = require('core-object');
22
22
  const EOL = require('os').EOL;
23
- const bowEpParser = require('bower-endpoint-parser');
24
23
  const logger = require('heimdalljs-logger')('ember-cli:blueprint');
25
24
  const normalizeEntityName = require('ember-cli-normalize-entity-name');
26
25
  const isAddon = require('../utilities/is-addon');
27
- const { deprecate } = require('../debug');
28
26
 
29
27
  const initialIgnoredFiles = ['.DS_Store'];
30
28
 
@@ -1143,119 +1141,6 @@ let Blueprint = CoreObject.extend({
1143
1141
  });
1144
1142
  },
1145
1143
 
1146
- /**
1147
- Used to add a Bower package to the projects `bower.json`.
1148
-
1149
- Bower is a package manager that is no longer recommended
1150
- for new projects, but you may find this hook used in older
1151
- addons.
1152
-
1153
- Generally, this would be done from the `afterInstall` hook, to
1154
- ensure that a package that is required by a given blueprint is
1155
- available.
1156
-
1157
- `localPackageName` and `target` may be thought of as equivalent
1158
- to the key-value pairs in the `dependency` or `devDepencency`
1159
- objects contained within a bower.json file.
1160
- @method addBowerPackageToProject
1161
- @param {String} localPackageName
1162
- @param {String} target
1163
- @param {Object} installOptions
1164
- @return {Promise}
1165
-
1166
- @example
1167
- ```js
1168
- addBowerPackageToProject('jquery', '~1.11.1');
1169
- addBowerPackageToProject('old_jquery', 'jquery#~1.9.1');
1170
- addBowerPackageToProject('bootstrap-3', 'https://twitter.github.io/bootstrap/assets/bootstrap');
1171
- ```
1172
- */
1173
- addBowerPackageToProject(localPackageName, target, installOptions) {
1174
- deprecate(
1175
- [
1176
- `(Blueprint: \`${this.name}\`) \`addBowerPackageToProject\` has been deprecated.`,
1177
- 'If the package is also available on the npm registry, please use `addPackageToProject` instead.',
1178
- 'If not, please install the Bower package manually by running:',
1179
- `\`bower install ${localPackageName} --save\``,
1180
- ].join('\n'),
1181
- false,
1182
- {
1183
- for: 'ember-cli',
1184
- id: 'ember-cli.blueprint.add-bower-package-to-project',
1185
- since: {
1186
- available: '4.3.0',
1187
- enabled: '4.3.0',
1188
- },
1189
- until: '5.0.0',
1190
- }
1191
- );
1192
-
1193
- let lpn = localPackageName;
1194
- let tar = target;
1195
- let packageObject = bowEpParser.json2decomposed(lpn, tar);
1196
- return this.addBowerPackagesToProject([packageObject], installOptions, true);
1197
- },
1198
-
1199
- /**
1200
- Used to add an array of packages to the projects `bower.json`.
1201
-
1202
- Bower is a package manager that is no longer recommended
1203
- for new projects, but you may find this hook used in older
1204
- addons.
1205
-
1206
- Generally, this would be done from the `afterInstall` hook, to
1207
- ensure that a package that is required by a given blueprint is
1208
- available.
1209
-
1210
- Expects each array item to be an object with a `name`. Each object
1211
- may optionally have a `target` to specify a specific version, or a
1212
- `source` to specify a non-local name to be resolved.
1213
-
1214
- @method addBowerPackagesToProject
1215
- @param {Array} packages
1216
- @param {Object} installOptions
1217
- @return {Promise}
1218
- */
1219
- addBowerPackagesToProject(packages, installOptions, _deprecationCondition = false) {
1220
- let task = this.taskFor('bower-install');
1221
- let installText = packages.length > 1 ? 'install bower packages' : 'install bower package';
1222
- let packageNames = [];
1223
- let packageNamesAndVersions = packages
1224
- .map((pkg) => {
1225
- pkg.source = pkg.source || pkg.name;
1226
- packageNames.push(pkg.name);
1227
- return pkg;
1228
- })
1229
- .map(bowEpParser.compose);
1230
-
1231
- deprecate(
1232
- [
1233
- `(Blueprint: \`${this.name}\`) \`addBowerPackagesToProject\` has been deprecated.`,
1234
- 'If the packages are also available on the npm registry, please use `addPackagesToProject` instead.',
1235
- 'If not, please install the Bower packages manually by running:',
1236
- `\`bower install ${packageNames.join(' ')} --save\``,
1237
- ].join('\n'),
1238
- _deprecationCondition,
1239
- {
1240
- for: 'ember-cli',
1241
- id: 'ember-cli.blueprint.add-bower-packages-to-project',
1242
- since: {
1243
- available: '4.3.0',
1244
- enabled: '4.3.0',
1245
- },
1246
- until: '5.0.0',
1247
- }
1248
- );
1249
-
1250
- this._writeStatusToUI(chalk.green, installText, packageNames.join(', '));
1251
-
1252
- return task.run({
1253
- verbose: true,
1254
- packages: packageNamesAndVersions,
1255
- installOptions: installOptions || { save: true },
1256
- });
1257
- },
1258
-
1259
1144
  /**
1260
1145
  Used to add an addon to the project's `package.json` and run it's
1261
1146
  `defaultBlueprint` if it provides one.
@@ -127,7 +127,6 @@ let Command = CoreObject.extend({
127
127
  * { name: 'verbose', type: Boolean, default: false, aliases: ['v'] },
128
128
  * { name: 'blueprint', type: String, default: 'app', aliases: ['b'] },
129
129
  * { name: 'skip-npm', type: Boolean, default: false, aliases: ['sn'] },
130
- * { name: 'skip-bower', type: Boolean, default: false, aliases: ['sb'] },
131
130
  * { name: 'skip-git', type: Boolean, default: false, aliases: ['sg'] },
132
131
  * { name: 'directory', type: String , aliases: ['dir'] }
133
132
  * ],
@@ -288,12 +287,12 @@ let Command = CoreObject.extend({
288
287
  );
289
288
  }
290
289
 
291
- let installInstuction = '`npm install`';
290
+ let installCommand = 'npm install';
292
291
  if (isYarnProject(this.project.root)) {
293
- installInstuction = '`yarn install`';
292
+ installCommand = 'yarn install';
294
293
  }
295
294
  throw new SilentError(
296
- `Required packages are missing, run ${installInstuction} from this directory to install them.`
295
+ `Required packages are missing, run \`${installCommand}\` from this directory to install them.`
297
296
  );
298
297
  }
299
298
  }
@@ -412,11 +412,7 @@ class PackageInfo {
412
412
  });
413
413
  }
414
414
 
415
- if (process.env.EMBER_CLI_ERROR_ON_INVALID_ADDON) {
416
- throw msg;
417
- } else {
418
- this.cache.ui.writeWarnLine(msg);
419
- }
415
+ throw msg;
420
416
  }
421
417
  }
422
418
 
@@ -12,13 +12,11 @@ const { cloneDeep, merge, forOwn } = require('ember-cli-lodash-subset');
12
12
  const logger = require('heimdalljs-logger')('ember-cli:project');
13
13
  const versionUtils = require('../utilities/version-utils');
14
14
  const emberCLIVersion = versionUtils.emberCLIVersion;
15
- const findAddonByName = require('../utilities/find-addon-by-name');
16
15
  const heimdall = require('heimdalljs');
17
16
  const PackageInfoCache = require('./package-info-cache');
18
17
  const PerBundleAddonCache = require('./per-bundle-addon-cache');
19
18
  const instantiateAddons = require('./instantiate-addons');
20
19
  const HostInfoCache = require('./host-info-cache');
21
- const { deprecate } = require('../debug');
22
20
 
23
21
  let processCwd = process.cwd();
24
22
 
@@ -48,7 +46,6 @@ class Project {
48
46
  this.addonPackages = Object.create(null);
49
47
  this.addons = [];
50
48
  this.liveReloadFilterPatterns = [];
51
- this.setupBowerDirectory();
52
49
  this.configCache = new Map();
53
50
  this.hostInfoCache = new HostInfoCache(this);
54
51
 
@@ -57,7 +54,7 @@ class Project {
57
54
  so that other areas of the system can be aware that watchman is being used.
58
55
 
59
56
  For example, this information is used in the broccoli build pipeline to know
60
- if we can watch additional directories (like bower_components) "cheaply".
57
+ if we can watch additional directories "cheaply".
61
58
 
62
59
  Contains `enabled` and `version`.
63
60
 
@@ -105,51 +102,6 @@ class Project {
105
102
  }
106
103
  }
107
104
 
108
- /**
109
- * Sets the name of the bower directory for this project
110
- *
111
- * @private
112
- * @method setupBowerDirectory
113
- */
114
- setupBowerDirectory() {
115
- let bowerrcPath = path.join(this.root, '.bowerrc');
116
-
117
- logger.info('bowerrc path: %s', bowerrcPath);
118
-
119
- if (fs.existsSync(bowerrcPath)) {
120
- try {
121
- this._bowerDirectory = fs.readJsonSync(bowerrcPath).directory;
122
- } catch (exception) {
123
- logger.info('failed to parse bowerc: %s', exception);
124
- this._bowerDirectory = null;
125
- }
126
- }
127
-
128
- this._bowerDirectory = this._bowerDirectory || 'bower_components';
129
- logger.info('bowerDirectory: %s', this._bowerDirectory);
130
- }
131
-
132
- get bowerDirectory() {
133
- deprecate(
134
- [
135
- '`bowerDirectory` has been deprecated.',
136
- "If you still need access to the project's Bower directory, you will have to manually resolve the project's `.bowerrc` file, and read the `directory` property instead.",
137
- ].join('\n'),
138
- false,
139
- {
140
- for: 'ember-cli',
141
- id: 'ember-cli.project.bower-directory',
142
- since: {
143
- available: '4.3.0',
144
- enabled: '4.3.0',
145
- },
146
- until: '5.0.0',
147
- }
148
- );
149
-
150
- return this._bowerDirectory;
151
- }
152
-
153
105
  // Checks whether the project's npm dependencies are
154
106
  // present. Previously this just looked for a node_modules folder in
155
107
  // a fixed place (which is not compatible with node's module
@@ -400,43 +352,6 @@ class Project {
400
352
  return Object.assign({}, devDependencies, pkg['dependencies']);
401
353
  }
402
354
 
403
- /**
404
- Returns the bower dependencies for this project.
405
-
406
- @private
407
- @method bowerDependencies
408
- @param {String} bower Path to bower.json
409
- @return {Object} Bower dependencies
410
- */
411
- bowerDependencies(bower) {
412
- deprecate(
413
- [
414
- '`bowerDependencies` has been deprecated.',
415
- "If you still need access to the project's Bower dependencies, you will have to manually resolve the project's `bower.json` file instead.",
416
- ].join('\n'),
417
- false,
418
- {
419
- for: 'ember-cli',
420
- id: 'ember-cli.project.bower-dependencies',
421
- since: {
422
- available: '4.3.0',
423
- enabled: '4.3.0',
424
- },
425
- until: '5.0.0',
426
- }
427
- );
428
-
429
- return this._bowerDependencies(bower);
430
- }
431
-
432
- _bowerDependencies(bower) {
433
- if (!bower) {
434
- let bowerPath = path.join(this.root, 'bower.json');
435
- bower = fs.existsSync(bowerPath) ? require(bowerPath) : {};
436
- }
437
- return Object.assign({}, bower['devDependencies'], bower['dependencies']);
438
- }
439
-
440
355
  /**
441
356
  Provides the list of paths to consult for addons that may be provided
442
357
  internally to this project. Used for middleware addons with built-in support.
@@ -674,7 +589,7 @@ class Project {
674
589
  findAddonByName(name) {
675
590
  this.initializeAddons();
676
591
 
677
- return findAddonByName(this.addons, name);
592
+ return this.addons.find((addon) => addon.pkg?.name === name);
678
593
  }
679
594
 
680
595
  /**
@@ -7,7 +7,7 @@ const DEFAULT_LOCALE = 'en-US';
7
7
 
8
8
  class InteractiveNewTask extends Task {
9
9
  async run(newCommandOptions, _testAnswers) {
10
- const inquirer = require('inquirer');
10
+ const inquirer = await import('inquirer');
11
11
 
12
12
  let prompt = inquirer.createPromptModule();
13
13
  let questions = await this.getQuestions(newCommandOptions);