ember-cli 4.7.0 → 4.8.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.
@@ -190,6 +190,7 @@ const initialIgnoredFiles = ['.DS_Store'];
190
190
  @constructor
191
191
  @extends CoreObject
192
192
  @param {String} [blueprintPath]
193
+ @param {Object} [blueprintOptions]
193
194
  */
194
195
  let Blueprint = CoreObject.extend({
195
196
  availableOptions: [],
@@ -209,11 +210,29 @@ let Blueprint = CoreObject.extend({
209
210
  */
210
211
  shouldTransformTypeScript: false,
211
212
 
212
- init(blueprintPath) {
213
+ init(blueprintPath, blueprintOptions) {
213
214
  this._super();
214
215
 
215
216
  this.path = blueprintPath;
216
217
  this.name = path.basename(blueprintPath);
218
+
219
+ this._processOptions(blueprintOptions);
220
+ },
221
+
222
+ /**
223
+ Process the options object coming from either
224
+ the `init`, `install` or `uninstall` hook.
225
+
226
+ @private
227
+ @method _processOptions
228
+ @param {Object} options
229
+ */
230
+ _processOptions(options = {}) {
231
+ this.options = options;
232
+ this.dryRun = options.dryRun;
233
+ this.pod = options.pod;
234
+ this.project = options.project;
235
+ this.ui = options.ui;
217
236
  },
218
237
 
219
238
  /**
@@ -238,9 +257,10 @@ let Blueprint = CoreObject.extend({
238
257
 
239
258
  @public
240
259
  @method files
260
+ @param {Object} options
241
261
  @return {Array} Contents of the blueprint's files directory
242
262
  */
243
- files() {
263
+ files(/* options */) {
244
264
  if (this._files) {
245
265
  return this._files;
246
266
  }
@@ -528,17 +548,14 @@ let Blueprint = CoreObject.extend({
528
548
  @return {Promise}
529
549
  */
530
550
  install(options) {
531
- let ui = (this.ui = options.ui);
532
- let dryRun = (this.dryRun = options.dryRun);
533
- this.project = options.project;
534
- this.pod = options.pod;
535
- this.options = options;
551
+ this._processOptions(options);
552
+
536
553
  this.hasPathToken = hasPathToken(this.files(this.options));
537
554
 
538
- ui.writeLine(`installing ${this.name}`);
555
+ this.ui.writeLine(`installing ${this.name}`);
539
556
 
540
- if (dryRun) {
541
- ui.writeLine(chalk.yellow('You specified the dry-run flag, so no' + ' changes will be written.'));
557
+ if (this.dryRun) {
558
+ this.ui.writeLine(chalk.yellow('You specified the `dry-run` flag, so no changes will be written.'));
542
559
  }
543
560
 
544
561
  this._normalizeEntityName(options.entity);
@@ -558,17 +575,14 @@ let Blueprint = CoreObject.extend({
558
575
  @return {Promise}
559
576
  */
560
577
  uninstall(options) {
561
- let ui = (this.ui = options.ui);
562
- let dryRun = (this.dryRun = options.dryRun);
563
- this.project = options.project;
564
- this.pod = options.pod;
565
- this.options = options;
578
+ this._processOptions(options);
579
+
566
580
  this.hasPathToken = hasPathToken(this.files(this.options));
567
581
 
568
- ui.writeLine(`uninstalling ${this.name}`);
582
+ this.ui.writeLine(`uninstalling ${this.name}`);
569
583
 
570
- if (dryRun) {
571
- ui.writeLine(chalk.yellow('You specified the dry-run flag, so no' + ' files will be deleted.'));
584
+ if (this.dryRun) {
585
+ this.ui.writeLine(chalk.yellow('You specified the `dry-run` flag, so no files will be deleted.'));
572
586
  }
573
587
 
574
588
  this._normalizeEntityName(options.entity);
@@ -934,7 +948,7 @@ let Blueprint = CoreObject.extend({
934
948
  @return {Boolean}
935
949
  */
936
950
  supportsAddon() {
937
- return /__root__/.test(this.files().join());
951
+ return /__root__/.test(this.files(this.options).join());
938
952
  },
939
953
 
940
954
  /**
@@ -1131,8 +1145,8 @@ let Blueprint = CoreObject.extend({
1131
1145
 
1132
1146
  /**
1133
1147
  Used to add a Bower package to the projects `bower.json`.
1134
-
1135
- Bower is a package manager that is no longer recommended
1148
+
1149
+ Bower is a package manager that is no longer recommended
1136
1150
  for new projects, but you may find this hook used in older
1137
1151
  addons.
1138
1152
 
@@ -1184,8 +1198,8 @@ let Blueprint = CoreObject.extend({
1184
1198
 
1185
1199
  /**
1186
1200
  Used to add an array of packages to the projects `bower.json`.
1187
-
1188
- Bower is a package manager that is no longer recommended
1201
+
1202
+ Bower is a package manager that is no longer recommended
1189
1203
  for new projects, but you may find this hook used in older
1190
1204
  addons.
1191
1205
 
@@ -1456,6 +1470,8 @@ let Blueprint = CoreObject.extend({
1456
1470
  @param {Array} [options.paths] Extra paths to search for blueprints
1457
1471
  @param {Boolean} [options.ignoreMissing] Throw a `SilentError` if a
1458
1472
  matching Blueprint could not be found
1473
+ @param {Object} [options.blueprintOptions] Options object that will be passed
1474
+ along to the Blueprint instance on creation.
1459
1475
  @return {Blueprint}
1460
1476
  */
1461
1477
  Blueprint.lookup = function (name, options) {
@@ -1467,7 +1483,7 @@ Blueprint.lookup = function (name, options) {
1467
1483
 
1468
1484
  if (isNameAPath) {
1469
1485
  if (Blueprint._existsSync(blueprintPath)) {
1470
- return Blueprint.load(blueprintPath);
1486
+ return Blueprint.load(blueprintPath, options.blueprintOptions);
1471
1487
  }
1472
1488
 
1473
1489
  if (!options.ignoreMissing) {
@@ -1485,7 +1501,7 @@ Blueprint.lookup = function (name, options) {
1485
1501
  let blueprintPath = path.resolve(lookupPath, name);
1486
1502
 
1487
1503
  if (Blueprint._existsSync(blueprintPath)) {
1488
- return Blueprint.load(blueprintPath);
1504
+ return Blueprint.load(blueprintPath, options.blueprintOptions);
1489
1505
  }
1490
1506
  }
1491
1507
 
@@ -1500,9 +1516,10 @@ Blueprint.lookup = function (name, options) {
1500
1516
  @method load
1501
1517
  @namespace Blueprint
1502
1518
  @param {String} blueprintPath
1519
+ @param {Object} [blueprintOptions]
1503
1520
  @return {Blueprint} blueprint instance
1504
1521
  */
1505
- Blueprint.load = function (blueprintPath) {
1522
+ Blueprint.load = function (blueprintPath, blueprintOptions) {
1506
1523
  if (fs.lstatSync(blueprintPath).isDirectory()) {
1507
1524
  let Constructor = Blueprint;
1508
1525
 
@@ -1517,7 +1534,7 @@ Blueprint.load = function (blueprintPath) {
1517
1534
  }
1518
1535
  }
1519
1536
 
1520
- return new Constructor(blueprintPath);
1537
+ return new Constructor(blueprintPath, blueprintOptions);
1521
1538
  }
1522
1539
  };
1523
1540
 
@@ -658,6 +658,7 @@ class Project {
658
658
  reloadAddons() {
659
659
  this.reloadPkg();
660
660
  this._addonsInitialized = false;
661
+ this._didDiscoverAddons = false;
661
662
  return this.initializeAddons();
662
663
  }
663
664
 
@@ -3,7 +3,6 @@
3
3
  const Blueprint = require('../models/blueprint');
4
4
  const Task = require('../models/task');
5
5
  const parseOptions = require('../utilities/parse-options');
6
- const { merge } = require('ember-cli-lodash-subset');
7
6
  const logger = require('heimdalljs-logger')('ember-cli:generate-from-blueprint');
8
7
  const lintFix = require('../utilities/lint-fix');
9
8
 
@@ -29,18 +28,51 @@ class GenerateTask extends Task {
29
28
  let name = options.args[0];
30
29
  let noAddonBlueprint = ['mixin', 'blueprint-test'];
31
30
 
32
- let mainBlueprint = this.lookupBlueprint(name, options.ignoreMissingMain);
33
- let testBlueprint = this.lookupBlueprint(`${name}-test`, true);
31
+ let entity = {
32
+ name: options.args[1],
33
+ options: parseOptions(options.args.slice(2)),
34
+ };
34
35
 
35
- // lookup custom addon blueprint
36
- let addonBlueprint = this.lookupBlueprint(`${name}-addon`, true);
36
+ let baseBlueprintOptions = {
37
+ target: this.project.root,
38
+ entity,
39
+ ui: this.ui,
40
+ analytics: this.analytics,
41
+ project: this.project,
42
+ settings: this.settings,
43
+ testing: this.testing,
44
+ taskOptions: options,
45
+ originBlueprintName: name,
46
+ };
47
+
48
+ let mainBlueprintOptions = { ...baseBlueprintOptions, ...options };
49
+ let testBlueprintOptions = { ...mainBlueprintOptions, installingTest: true };
50
+ let addonBlueprintOptions = { ...mainBlueprintOptions, installingAddon: true };
51
+
52
+ let mainBlueprint = this.lookupBlueprint(name, {
53
+ blueprintOptions: mainBlueprintOptions,
54
+ ignoreMissing: options.ignoreMissingMain,
55
+ });
56
+
57
+ let testBlueprint = this.lookupBlueprint(`${name}-test`, {
58
+ blueprintOptions: testBlueprintOptions,
59
+ ignoreMissing: true,
60
+ });
61
+
62
+ let addonBlueprint = this.lookupBlueprint(`${name}-addon`, {
63
+ blueprintOptions: addonBlueprintOptions,
64
+ ignoreMissing: true,
65
+ });
37
66
 
38
67
  // otherwise, use default addon-import
39
68
  if (noAddonBlueprint.indexOf(name) < 0 && !addonBlueprint && options.args[1]) {
40
69
  let mainBlueprintSupportsAddon = mainBlueprint && mainBlueprint.supportsAddon();
41
70
 
42
71
  if (mainBlueprintSupportsAddon) {
43
- addonBlueprint = this.lookupBlueprint('addon-import', true);
72
+ addonBlueprint = this.lookupBlueprint('addon-import', {
73
+ blueprintOptions: addonBlueprintOptions,
74
+ ignoreMissing: true,
75
+ });
44
76
  }
45
77
  }
46
78
 
@@ -56,26 +88,7 @@ class GenerateTask extends Task {
56
88
  }
57
89
  }
58
90
 
59
- let entity = {
60
- name: options.args[1],
61
- options: parseOptions(options.args.slice(2)),
62
- };
63
-
64
- let blueprintOptions = {
65
- target: this.project.root,
66
- entity,
67
- ui: this.ui,
68
- analytics: this.analytics,
69
- project: this.project,
70
- settings: this.settings,
71
- testing: this.testing,
72
- taskOptions: options,
73
- originBlueprintName: name,
74
- };
75
-
76
- blueprintOptions = merge(blueprintOptions, options || {});
77
-
78
- await mainBlueprint[this.blueprintFunction](blueprintOptions);
91
+ await mainBlueprint[this.blueprintFunction](mainBlueprintOptions);
79
92
  if (testBlueprint) {
80
93
  if (testBlueprint.locals === Blueprint.prototype.locals) {
81
94
  testBlueprint.locals = function (options) {
@@ -83,14 +96,13 @@ class GenerateTask extends Task {
83
96
  };
84
97
  }
85
98
 
86
- let testBlueprintOptions = merge({}, blueprintOptions, { installingTest: true });
87
99
  await testBlueprint[this.blueprintFunction](testBlueprintOptions);
88
100
  }
89
101
 
90
102
  if (!addonBlueprint || name.match(/-addon/)) {
91
103
  return;
92
104
  }
93
- if (!this.project.isEmberCLIAddon() && blueprintOptions.inRepoAddon === null) {
105
+ if (!this.project.isEmberCLIAddon() && mainBlueprintOptions.inRepoAddon === null) {
94
106
  return;
95
107
  }
96
108
 
@@ -100,15 +112,14 @@ class GenerateTask extends Task {
100
112
  };
101
113
  }
102
114
 
103
- let addonBlueprintOptions = merge({}, blueprintOptions, { installingAddon: true });
104
-
105
115
  return addonBlueprint[this.blueprintFunction](addonBlueprintOptions);
106
116
  }
107
117
 
108
- lookupBlueprint(name, ignoreMissing) {
118
+ lookupBlueprint(name, { blueprintOptions, ignoreMissing }) {
109
119
  return Blueprint.lookup(name, {
110
- paths: this.project.blueprintLookupPaths(),
120
+ blueprintOptions,
111
121
  ignoreMissing,
122
+ paths: this.project.blueprintLookupPaths(),
112
123
  });
113
124
  }
114
125
  }
@@ -63,7 +63,11 @@ class NpmTask extends Task {
63
63
 
64
64
  if (semver.gte(version, '2.0.0')) {
65
65
  logger.warn('yarn --version: %s', version);
66
- this.ui.writeWarnLine(`Yarn v2 is not fully supported. Proceeding with yarn: ${version}`);
66
+ let yarnConfig = await this.yarn(['config', 'get', 'nodeLinker']);
67
+ let nodeLinker = yarnConfig.stdout.trim();
68
+ if (nodeLinker !== 'node-modules') {
69
+ this.ui.writeWarnLine(`Yarn v2 is not fully supported. Proceeding with yarn: ${version}`);
70
+ }
67
71
  } else {
68
72
  logger.info('yarn --version: %s', version);
69
73
  }
@@ -6,8 +6,8 @@ const path = require('path');
6
6
  const yaml = require('js-yaml');
7
7
 
8
8
  let parsers = {
9
- '.yml': yaml.safeLoad,
10
- '.yaml': yaml.safeLoad,
9
+ '.yml': yaml.load,
10
+ '.yaml': yaml.load,
11
11
  '.json': JSON.parse,
12
12
  };
13
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-cli",
3
- "version": "4.7.0",
3
+ "version": "4.8.0",
4
4
  "description": "Command line tool for developing ambitious ember.js apps",
5
5
  "keywords": [
6
6
  "app",
@@ -37,7 +37,7 @@
37
37
  "test:slow": "node --unhandled-rejections=strict tests/runner slow"
38
38
  },
39
39
  "dependencies": {
40
- "@babel/core": "^7.18.6",
40
+ "@babel/core": "^7.18.13",
41
41
  "@babel/plugin-transform-modules-amd": "^7.18.6",
42
42
  "amd-name-resolver": "^1.3.1",
43
43
  "babel-plugin-module-resolver": "^4.1.0",
@@ -61,7 +61,7 @@
61
61
  "calculate-cache-key-for-tree": "^2.0.0",
62
62
  "capture-exit": "^2.0.0",
63
63
  "chalk": "^4.1.2",
64
- "ci-info": "^3.3.1",
64
+ "ci-info": "^3.3.2",
65
65
  "clean-base-url": "^1.0.0",
66
66
  "compression": "^1.7.4",
67
67
  "configstore": "^5.0.1",
@@ -97,7 +97,7 @@
97
97
  "is-git-url": "^1.0.0",
98
98
  "is-language-code": "^3.1.0",
99
99
  "isbinaryfile": "^5.0.0",
100
- "js-yaml": "^3.14.0",
100
+ "js-yaml": "^4.1.0",
101
101
  "leek": "0.0.24",
102
102
  "lodash.template": "^4.5.0",
103
103
  "markdown-it": "^13.0.1",
@@ -105,9 +105,9 @@
105
105
  "minimatch": "^5.1.0",
106
106
  "morgan": "^1.10.0",
107
107
  "nopt": "^3.0.6",
108
- "npm-package-arg": "^9.0.2",
108
+ "npm-package-arg": "^9.1.0",
109
109
  "p-defer": "^3.0.0",
110
- "portfinder": "^1.0.28",
110
+ "portfinder": "^1.0.29",
111
111
  "promise-map-series": "^0.3.0",
112
112
  "promise.hash.helper": "^1.0.8",
113
113
  "quick-temp": "^0.1.8",
@@ -121,18 +121,18 @@
121
121
  "sort-package-json": "^1.57.0",
122
122
  "symlink-or-copy": "^1.3.1",
123
123
  "temp": "0.9.4",
124
- "testem": "^3.7.0",
124
+ "testem": "^3.8.0",
125
125
  "tiny-lr": "^2.0.0",
126
126
  "tree-sync": "^2.1.0",
127
127
  "uuid": "^8.3.2",
128
- "walk-sync": "^2.2.0",
129
- "watch-detector": "^1.0.1",
128
+ "walk-sync": "^3.0.0",
129
+ "watch-detector": "^1.0.2",
130
130
  "workerpool": "^6.2.1",
131
131
  "yam": "^1.0.0"
132
132
  },
133
133
  "devDependencies": {
134
134
  "@ember/edition-utils": "^1.2.0",
135
- "@octokit/rest": "^18.12.0",
135
+ "@octokit/rest": "^19.0.4",
136
136
  "broccoli-plugin": "^4.0.3",
137
137
  "broccoli-test-helper": "^2.0.0",
138
138
  "chai": "^4.3.6",
@@ -141,24 +141,24 @@
141
141
  "chai-jest-snapshot": "^2.0.0",
142
142
  "ember-cli-blueprint-test-helpers": "^0.19.2",
143
143
  "ember-cli-internal-test-helpers": "^0.9.1",
144
- "eslint": "^8.10.0",
144
+ "eslint": "^8.23.0",
145
145
  "eslint-config-prettier": "^8.5.0",
146
146
  "eslint-plugin-chai-expect": "^3.0.0",
147
- "eslint-plugin-mocha": "^10.0.5",
147
+ "eslint-plugin-mocha": "^10.1.0",
148
148
  "eslint-plugin-node": "^11.1.0",
149
149
  "eslint-plugin-prettier": "^4.2.1",
150
150
  "fixturify": "^2.1.0",
151
151
  "jsdom": "^20.0.0",
152
152
  "latest-version": "^5.1.0",
153
153
  "mocha": "^10.0.0",
154
- "nock": "^13.2.8",
154
+ "nock": "^13.2.9",
155
155
  "nyc": "^15.1.0",
156
- "prettier": "2.6.2",
157
- "release-it": "^15.1.1",
156
+ "prettier": "2.7.1",
157
+ "release-it": "^15.4.1",
158
158
  "rimraf": "^3.0.2",
159
159
  "strip-ansi": "^6.0.0",
160
- "supertest": "^6.2.3",
161
- "testdouble": "^3.16.5",
160
+ "supertest": "^6.2.4",
161
+ "testdouble": "^3.16.6",
162
162
  "tmp": "^0.2.1",
163
163
  "websocket": "^1.0.32",
164
164
  "which": "2.0.2",