ember-cli 7.2.0-alpha.1 → 7.2.0-alpha.2

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # ember-cli Changelog
2
2
 
3
+ ## Release (2026-08-14)
4
+
5
+ * ember-cli 7.2.0-alpha.2 (patch)
6
+ * @ember-tooling/classic-build-addon-blueprint 7.2.0-alpha.2 (patch)
7
+ * @ember-tooling/classic-build-app-blueprint 7.2.0-alpha.2 (patch)
8
+ * @ember-tooling/blueprint-model 0.7.1 (patch)
9
+
10
+ #### :bug: Bug Fix
11
+ * `ember-cli`, `@ember-tooling/blueprint-model`
12
+ * [#11050](https://github.com/ember-cli/ember-cli/pull/11050) fix default blueprint lookup ([@mansona](https://github.com/mansona))
13
+
14
+ #### :house: Internal
15
+ * `ember-cli`
16
+ * [#11051](https://github.com/ember-cli/ember-cli/pull/11051) fix release-plan ([@mansona](https://github.com/mansona))
17
+ * [#11052](https://github.com/ember-cli/ember-cli/pull/11052) speed up windows CI ([@mansona](https://github.com/mansona))
18
+ * [#11049](https://github.com/ember-cli/ember-cli/pull/11049) fix help tests to stop relying on private APIs ([@mansona](https://github.com/mansona))
19
+ * [#11048](https://github.com/ember-cli/ember-cli/pull/11048) update fixturify-project from v2 to v7 ([@mansona](https://github.com/mansona))
20
+ * [#11044](https://github.com/ember-cli/ember-cli/pull/11044) add a notify discord webhook action for CI ([@mansona](https://github.com/mansona))
21
+ * [#11023](https://github.com/ember-cli/ember-cli/pull/11023) Update RELEASE.md ([@mansona](https://github.com/mansona))
22
+
23
+ #### Committers: 1
24
+ - Chris Manson ([@mansona](https://github.com/mansona))
25
+
3
26
  ## Release (2026-06-30)
4
27
 
5
28
  * ember-cli 7.2.0-alpha.1 (minor)
package/RELEASE.md CHANGED
@@ -41,11 +41,11 @@ You can use [this saved search](https://github.com/ember-cli/ember-cli/pulls?q=i
41
41
  - **make sure to not update the .github/workflows/plan-stable-release.yml file** this should still plan a stable release
42
42
  - **make sure to not update the .github/workflows/publish-stable.yml file** this should still publish a stable release
43
43
  - **make sure to not update the CHANGELOG.md file** so as not to include the beta or alpha changelogs in the next release
44
- - make sure to not update the version in the package.json during this step, this will be release-plan's job
45
- - make sure to not update the version in the `packages/app-blueprint/package.json`, or `packages/addon-blueprint/package.json` files during this step, this will be release-plan's job
46
- - make sure to not add the `release-plan` config section to the package.json during this step. We are releasing a real release so we don't want to configure release-plan to do a pre-release.
44
+ - make sure to not update the version in the `package.json`, `packages/app-blueprint/package.json`, or `packages/addon-blueprint/package.json` files during this step, this will be release-plan's job
45
+ - make sure to not update update the `ember-cli` reference in `packages/app-blueprint/files/package.json`, this has been automated in the release-plan process
46
+ - make sure to not add the `release-plan` config section to the `package.json`, `packages/app-blueprint/package.json`, or `packages/addon-blueprint/package.json` files during this step. We are releasing a real release so we don't want to configure release-plan to do a pre-release.
47
47
  - commit the merge `git commit -am "promote beta to release"`
48
- - Update blueprint dependencies to latest. Note: ember-data needs to be updated only in the alpha version from now on, make sure to only update to the release version of what was in the beta.
48
+ - Update blueprint dependencies to latest.
49
49
 
50
50
  ```
51
51
  pnpm dlx update-blueprint-deps --filter 'ember-source$' --tag latest ./packages/*-blueprint/**/*ackage.json ./tests/fixtures/**/package.json
@@ -53,13 +53,14 @@ You can use [this saved search](https://github.com/ember-cli/ember-cli/pulls?q=i
53
53
  pnpm dlx update-blueprint-deps --filter '.*' ./package.json ./packages/*-blueprint/**/*ackage.json ./tests/fixtures/*/package.json ./tests/fixtures/*/*/package.json
54
54
  ```
55
55
 
56
+ - run `pnpm install` to update your pacakge.lock and download any new dependencies
56
57
  - run `pnpm lint:fix`
57
58
  - update the @ember/app-blueprint dependency `pnpm i -w @ember/app-blueprint@latest`
58
59
  - manually add a `~` back into the `@ember/app-blueprint` dependency in the root package.json
59
60
  - run `pnpm install` to make sure the lock file is up to date
60
61
  - commit this update `git commit -am "update blueprint dependencies to latest"`
61
62
  - push and open a PR targeting `release` with a PR title like `Promote Beta and update all dependencies for 6.4 release`
62
- - mark this PR as an `enhancement` if it is a minor release
63
+ - mark this PR as an `enhancement` if it is a minor release, or `breaking` if it is a major
63
64
  - check that everything is ok (i.e. that CI has run correctly and that you have the changes you expect)
64
65
  - merge branch
65
66
  - check that the `Prepare Release` PR has been correctly opened by `release-plan`
@@ -3,7 +3,7 @@
3
3
  "logo": "https://ember-cli.com/assets/images/ember-cli-logo-small-dark.png",
4
4
  "name": "ember-cli",
5
5
  "description": "Command line tool for developing ambitious ember.js apps",
6
- "version": "7.2.0-alpha.1-master-52ee6a0bd8"
6
+ "version": "7.2.0-alpha.2-master-8f5fb9970c"
7
7
  },
8
8
  "files": {
9
9
  "lib/broccoli/default-packager.js": {
@@ -4675,7 +4675,22 @@
4675
4675
  },
4676
4676
  {
4677
4677
  "file": "lib/models/project.js",
4678
- "line": 535,
4678
+ "line": 532,
4679
+ "description": "Returns the built-in ember-cli path for looking up blueprints",
4680
+ "access": "private",
4681
+ "tagname": "",
4682
+ "itemtype": "method",
4683
+ "name": "builtInLookupPath",
4684
+ "return": {
4685
+ "description": "path to the ember-cli built-in blueprints",
4686
+ "type": "String"
4687
+ },
4688
+ "class": "Project",
4689
+ "module": "ember-cli"
4690
+ },
4691
+ {
4692
+ "file": "lib/models/project.js",
4693
+ "line": 543,
4679
4694
  "description": "Returns a list of addon paths where blueprints will be looked up.",
4680
4695
  "access": "private",
4681
4696
  "tagname": "",
@@ -4690,7 +4705,7 @@
4690
4705
  },
4691
4706
  {
4692
4707
  "file": "lib/models/project.js",
4693
- "line": 558,
4708
+ "line": 566,
4694
4709
  "description": "Reloads package.json of the project. Clears and reloads the packageInfo and\nper-bundle addon cache, too.",
4695
4710
  "access": "private",
4696
4711
  "tagname": "",
@@ -4705,7 +4720,7 @@
4705
4720
  },
4706
4721
  {
4707
4722
  "file": "lib/models/project.js",
4708
- "line": 586,
4723
+ "line": 594,
4709
4724
  "description": "Re-initializes addons.",
4710
4725
  "access": "private",
4711
4726
  "tagname": "",
@@ -4716,7 +4731,7 @@
4716
4731
  },
4717
4732
  {
4718
4733
  "file": "lib/models/project.js",
4719
- "line": 599,
4734
+ "line": 607,
4720
4735
  "description": "Find an addon by its name",
4721
4736
  "access": "public",
4722
4737
  "tagname": "",
@@ -4738,7 +4753,7 @@
4738
4753
  },
4739
4754
  {
4740
4755
  "file": "lib/models/project.js",
4741
- "line": 613,
4756
+ "line": 621,
4742
4757
  "description": "Generate test file contents.\n\nThis method is supposed to be overwritten by test framework addons\nlike `ember-qunit`.",
4743
4758
  "access": "public",
4744
4759
  "tagname": "",
@@ -4765,7 +4780,7 @@
4765
4780
  },
4766
4781
  {
4767
4782
  "file": "lib/models/project.js",
4768
- "line": 637,
4783
+ "line": 645,
4769
4784
  "description": "Returns a new project based on the first `package.json` that is found\nin `pathName`.\n\nIf the above `package.json` specifies `ember-addon.projectRoot`, we load\nthe project based on the relative path between this directory and the\nspecified `projectRoot`.",
4770
4785
  "access": "private",
4771
4786
  "tagname": "",
@@ -4793,7 +4808,7 @@
4793
4808
  },
4794
4809
  {
4795
4810
  "file": "lib/models/project.js",
4796
- "line": 688,
4811
+ "line": 696,
4797
4812
  "description": "Returns a new project based on the first package.json that is found\nin `pathName`, or the nullProject.\n\nThe nullProject signifies no-project, but abides by the null object pattern",
4798
4813
  "access": "private",
4799
4814
  "tagname": "",
@@ -4816,7 +4831,7 @@
4816
4831
  },
4817
4832
  {
4818
4833
  "file": "lib/models/project.js",
4819
- "line": 712,
4834
+ "line": 720,
4820
4835
  "description": "Returns the project root based on the first package.json that is found",
4821
4836
  "static": 1,
4822
4837
  "itemtype": "method",
@@ -523,15 +523,23 @@ class Project {
523
523
  */
524
524
  blueprintLookupPaths() {
525
525
  if (this.isEmberCLIProject()) {
526
- let lookupPaths = [this.localBlueprintLookupPath()];
527
- let addonLookupPaths = this.addonBlueprintLookupPaths();
528
-
529
- return lookupPaths.concat(addonLookupPaths);
526
+ return [this.localBlueprintLookupPath(), ...this.addonBlueprintLookupPaths(), this.builtInLookupPath()];
530
527
  } else {
531
- return this.addonBlueprintLookupPaths();
528
+ return [...this.addonBlueprintLookupPaths(), this.builtInLookupPath()];
532
529
  }
533
530
  }
534
531
 
532
+ /**
533
+ * Returns the built-in ember-cli path for looking up blueprints
534
+ *
535
+ * @private
536
+ * @method builtInLookupPath
537
+ * @return {string} path to the ember-cli built-in blueprints
538
+ */
539
+ builtInLookupPath() {
540
+ return path.resolve(__dirname, '..', '..', 'blueprints');
541
+ }
542
+
535
543
  /**
536
544
  Returns a list of addon paths where blueprints will be looked up.
537
545
 
@@ -3,11 +3,12 @@
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
5
  const getRepoInfo = require('git-repo-info');
6
+ const version = require('../../package.json').version;
6
7
 
7
8
  module.exports = {
8
9
  emberCLIVersion() {
9
10
  let gitPath = path.join(__dirname, '..', '..', '.git');
10
- let output = [require('../../package.json').version];
11
+ let output = [version];
11
12
 
12
13
  if (fs.existsSync(gitPath)) {
13
14
  let { branch, abbreviatedSha } = getRepoInfo(gitPath);
@@ -21,6 +22,10 @@ module.exports = {
21
22
  return output.join('-');
22
23
  },
23
24
 
25
+ emberCLIBareVersion() {
26
+ return version;
27
+ },
28
+
24
29
  isDevelopment(version) {
25
30
  // match postfix SHA in dev version
26
31
  return /\b[0-9a-f]{5,40}\b/.test(version);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-cli",
3
- "version": "7.2.0-alpha.1",
3
+ "version": "7.2.0-alpha.2",
4
4
  "description": "Command line tool for developing ambitious ember.js apps",
5
5
  "keywords": [
6
6
  "app",
@@ -117,9 +117,9 @@
117
117
  "workerpool": "^10.0.2",
118
118
  "yam": "^1.0.0",
119
119
  "@ember-tooling/blueprint-blueprint": "0.3.0",
120
- "@ember-tooling/classic-build-app-blueprint": "7.2.0-alpha.1",
121
- "@ember-tooling/classic-build-addon-blueprint": "7.2.0-alpha.1",
122
- "@ember-tooling/blueprint-model": "0.7.0"
120
+ "@ember-tooling/blueprint-model": "0.7.1",
121
+ "@ember-tooling/classic-build-app-blueprint": "7.2.0-alpha.2",
122
+ "@ember-tooling/classic-build-addon-blueprint": "7.2.0-alpha.2"
123
123
  },
124
124
  "devDependencies": {
125
125
  "broccoli-plugin": "^4.0.7",
@@ -129,6 +129,7 @@
129
129
  "chai-files": "^1.4.0",
130
130
  "chai-jest-snapshot": "^2.0.0",
131
131
  "concurrently": "^9.2.1",
132
+ "ember-cli": "link:.",
132
133
  "ember-cli-blueprint-test-helpers": "^0.19.2",
133
134
  "ember-cli-internal-test-helpers": "^0.9.1",
134
135
  "eslint": "^8.57.1",
@@ -137,7 +138,7 @@
137
138
  "eslint-plugin-mocha": "^10.5.0",
138
139
  "eslint-plugin-n": "^17.24.0",
139
140
  "fixturify": "^3.0.0",
140
- "fixturify-project": "^2.1.1",
141
+ "fixturify-project": "^7.1.3",
141
142
  "jsdom": "^21.1.2",
142
143
  "latest-version": "^9.0.0",
143
144
  "mocha": "^11.7.6",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ember-tooling/classic-build-addon-blueprint",
3
- "version": "7.2.0-alpha.1",
3
+ "version": "7.2.0-alpha.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/ember-cli/ember-cli.git",
@@ -63,7 +63,7 @@
63
63
  "broccoli-asset-rev": "^3.0.0",
64
64
  "concurrently": "^9.2.1",
65
65
  "ember-auto-import": "^2.13.1",
66
- "ember-cli": "~7.2.0-alpha.1",
66
+ "ember-cli": "~7.2.0-alpha.2",
67
67
  "ember-cli-app-version": "^7.0.0",
68
68
  "ember-cli-babel": "^8.3.1",
69
69
  "ember-cli-clean-css": "^3.0.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ember-tooling/classic-build-app-blueprint",
3
- "version": "7.2.0-alpha.1",
3
+ "version": "7.2.0-alpha.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/ember-cli/ember-cli.git",
@@ -20,7 +20,6 @@ const zipObject = require('lodash/zipObject');
20
20
  const intersection = require('lodash/intersection');
21
21
  const cloneDeep = require('lodash/cloneDeep');
22
22
  const compact = require('lodash/compact');
23
- const uniq = require('lodash/uniq');
24
23
  const sortBy = require('lodash/sortBy');
25
24
  const walkSync = require('walk-sync');
26
25
  const SilentError = require('silent-error');
@@ -1425,10 +1424,13 @@ const builtInBlueprints = new Map([
1425
1424
  Blueprint.lookup = function (name, options) {
1426
1425
  options = options || {};
1427
1426
 
1428
- let lookupPaths = generateLookupPaths(options.paths);
1427
+ let lookupPaths = new Set(options.paths);
1429
1428
 
1430
- let lookupPath;
1431
- for (let i = 0; (lookupPath = lookupPaths[i]); i++) {
1429
+ for (let path of options?.project?.blueprintLookupPaths() ?? []) {
1430
+ lookupPaths.add(path);
1431
+ }
1432
+
1433
+ for (let lookupPath of lookupPaths) {
1432
1434
  let blueprintPath = path.resolve(lookupPath, name);
1433
1435
 
1434
1436
  if (Blueprint._existsSync(blueprintPath)) {
@@ -1502,10 +1504,15 @@ Blueprint.load = function (blueprintPath, blueprintOptions) {
1502
1504
  Blueprint.list = function (options) {
1503
1505
  options = options || {};
1504
1506
 
1505
- let lookupPaths = generateLookupPaths(options.paths);
1507
+ let lookupPaths = new Set(options.paths);
1508
+
1509
+ for (let path of options?.project?.blueprintLookupPaths() ?? []) {
1510
+ lookupPaths.add(path);
1511
+ }
1512
+
1506
1513
  let seen = [];
1507
1514
 
1508
- return lookupPaths.map((lookupPath) => {
1515
+ return Array.from(lookupPaths).map((lookupPath) => {
1509
1516
  let source;
1510
1517
  let packagePath = path.join(lookupPath, '../package.json');
1511
1518
  if (Blueprint._existsSync(packagePath)) {
@@ -1582,14 +1589,6 @@ Blueprint.ignoredFiles = initialIgnoredFiles;
1582
1589
  */
1583
1590
  Blueprint.ignoredUpdateFiles = ['.gitkeep', 'app.css', 'LICENSE.md'];
1584
1591
 
1585
- /**
1586
- @static
1587
- @property defaultLookupPaths
1588
- */
1589
- Blueprint.defaultLookupPaths = function () {
1590
- return [path.resolve(__dirname, '..', '..', 'blueprints')];
1591
- };
1592
-
1593
1592
  /**
1594
1593
  @private
1595
1594
  @method prepareConfirm
@@ -1649,21 +1648,6 @@ function isIgnored(info) {
1649
1648
  return Blueprint.ignoredFiles.some((ignoredFile) => minimatch(fn, ignoredFile, { matchBase: true }));
1650
1649
  }
1651
1650
 
1652
- /**
1653
- Combines provided lookup paths with defaults and removes
1654
- duplicates.
1655
-
1656
- @private
1657
- @method generateLookupPaths
1658
- @param {Array} lookupPaths
1659
- @return {Array}
1660
- */
1661
- function generateLookupPaths(lookupPaths) {
1662
- lookupPaths = lookupPaths || [];
1663
- lookupPaths = lookupPaths.concat(Blueprint.defaultLookupPaths());
1664
- return uniq(lookupPaths);
1665
- }
1666
-
1667
1651
  /**
1668
1652
  Looks for a __path__ token in the files folder. Must be present for
1669
1653
  the blueprint to support pod tokens.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ember-tooling/blueprint-model",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/ember-cli/ember-cli.git",
@@ -4,9 +4,10 @@ const path = require('path');
4
4
  const merge = require('lodash/merge');
5
5
  // this is a test-only dependency
6
6
  // eslint-disable-next-line n/no-unpublished-require
7
- const FixturifyProject = require('fixturify-project');
7
+ const { Project: FixturifyProject } = require('fixturify-project');
8
8
  const Project = require('../../lib/models/project');
9
9
  const MockCLI = require('./mock-cli');
10
+ const { readFile } = require('fs/promises');
10
11
 
11
12
  // used in these tests to ensure we are only
12
13
  // operating on the addons added here
@@ -45,22 +46,9 @@ function getOptionsObjectWithCallbackFunction(defaultOptions, optionsOrCallback)
45
46
  );
46
47
  }
47
48
 
48
- // Essentially a copy of the function in node-fixturify-project, converted from TS to JS.
49
- // We need this for use during toJSON().
50
- function parseScoped(name) {
51
- let matched = name.match(/(@[^@/]+)\/(.*)/);
52
- if (matched) {
53
- return {
54
- scope: matched[1],
55
- name: matched[2],
56
- };
57
- }
58
- return null;
59
- }
60
-
61
49
  module.exports = class EmberCLIFixturifyProject extends FixturifyProject {
62
- writeSync() {
63
- super.writeSync(...arguments);
50
+ async write() {
51
+ await super.write(...arguments);
64
52
  this._hasWritten = true;
65
53
  }
66
54
 
@@ -68,26 +56,24 @@ module.exports = class EmberCLIFixturifyProject extends FixturifyProject {
68
56
  merge(this.files, filesObj);
69
57
  }
70
58
 
71
- buildProjectModel(ProjectClass = ProjectWithoutInternalAddons) {
59
+ async buildProjectModel(ProjectClass = ProjectWithoutInternalAddons) {
72
60
  if (!this._hasWritten) {
73
- this.writeSync();
61
+ await this.write();
74
62
  }
75
63
 
76
- let pkg = JSON.parse(this.toJSON('package.json'));
77
64
  let cli = new MockCLI();
78
- let root = path.join(this.root, this.name);
79
65
 
80
- return new ProjectClass(root, pkg, cli.ui, cli);
66
+ return new ProjectClass(this.baseDir, this.pkg, cli.ui, cli);
81
67
  }
82
68
 
83
- buildProjectModelForInRepoAddon(addonName, ProjectClass = ProjectWithoutInternalAddons) {
69
+ async buildProjectModelForInRepoAddon(addonName, ProjectClass = ProjectWithoutInternalAddons) {
84
70
  if (!this._hasWritten) {
85
- this.writeSync();
71
+ await this.write();
86
72
  }
87
73
 
88
- let pkg = JSON.parse(this.files.lib[addonName]['package.json']);
74
+ let root = path.join(this.baseDir, 'lib', addonName);
75
+ let pkg = JSON.parse(await readFile(path.join(root, 'package.json'), 'utf8'));
89
76
  let cli = new MockCLI();
90
- let root = path.join(this.root, this.name, 'lib', addonName);
91
77
 
92
78
  return new ProjectClass(root, pkg, cli.ui, cli);
93
79
  }
@@ -105,31 +91,7 @@ module.exports = class EmberCLIFixturifyProject extends FixturifyProject {
105
91
  */
106
92
  addDependency(name, version, optionsOrCallback) {
107
93
  const options = getOptionsObjectWithCallbackFunction(optionsOrCallback);
108
- return super.addDependency(name, version, options.callback);
109
- }
110
-
111
- /**
112
- * Add a 'reference' entry to this object's `dependencies` list. A 'reference' dependency is
113
- * an entry in `dependencies` where the caller knows the dependency's source files are being
114
- * created elsewhere in the project tree, so no source files should be created locally in
115
- * `node_modules`, which is the standard FixturifyProject (and node-fixturify-project) behavior.
116
- * We do this by adding the necessary reference to `dependencies` during `toJSON`.
117
- *
118
- * This is used when two addons wish to share a single definition on disk for a dependency (various parts of
119
- * ember-cli optimize processing based on paths on disk.)
120
- *
121
- * Because there is no FixturifyProject being created, no callback is given as in other methods.
122
- *
123
- * @param {String} name name of the dependency
124
- * @param {String} version version of the dependency, defaults to '*'. For our purposes, '*' means
125
- * "whatever version was specified elsewhere."
126
- */
127
- addReferenceDependency(name, version = '*') {
128
- if (!this._referenceDependencies) {
129
- this._referenceDependencies = {};
130
- }
131
-
132
- this._referenceDependencies[name] = version;
94
+ return super.addDependency(new this.constructor(name, version), options.callback);
133
95
  }
134
96
 
135
97
  /**
@@ -148,30 +110,6 @@ module.exports = class EmberCLIFixturifyProject extends FixturifyProject {
148
110
  return super.addDevDependency(name, version, options.callback);
149
111
  }
150
112
 
151
- /**
152
- * Add a 'reference' entry to this object's `devDependencies` list. A 'reference' devDependency is
153
- * an entry in `devDependencies` where the caller knows the dependency's source files are being
154
- * created elsewhere in the project tree, so no source files should be created locally in
155
- * `node_modules`, which is the standard FixturifyProject (and node-fixturify-project) behavior.
156
- * We do this by adding the necessary reference to `devDependencies` during `toJSON`.
157
- *
158
- * This is used when two addons wish to share a single definition on disk for a devDependency
159
- * (various parts of ember-cli optimize processing based on paths on disk.)
160
- *
161
- * Because there is no FixturifyProject being created, no callback is given as in other methods.
162
- *
163
- * @param {String} name name of the devDependency
164
- * @param {String} version version of the devDependency, defaults to '*'. For our purposes, '*' means
165
- * "whatever version was specified elsewhere."
166
- */
167
- addReferenceDevDependency(name, version = '*') {
168
- if (!this._referenceDevDependencies) {
169
- this._referenceDevDependencies = {};
170
- }
171
-
172
- this._referenceDevDependencies[name] = version;
173
- }
174
-
175
113
  /**
176
114
  * Add an addon to this object's `dependencies` list. The addon files will be written in
177
115
  * this object's `node_modules/<addon_name>` directory when this object is written out.
@@ -274,15 +212,22 @@ module.exports = class EmberCLIFixturifyProject extends FixturifyProject {
274
212
  * a callback function while also specifying other properties.)
275
213
  * @returns {FixturifyProject} the newly-created addon
276
214
  */
277
- addInRepoAddon(name, version = '0.0.0', optionsOrCallback) {
215
+ async addInRepoAddon(name, version = '0.0.0', optionsOrCallback) {
278
216
  const options = getOptionsObjectWithCallbackFunction({ allowCachingPerBundle: false }, optionsOrCallback);
279
217
 
280
- const inRepoAddon = new EmberCLIFixturifyProject(name, version, (addon) => {
281
- prepareAddon(addon, options);
218
+ let inRepoAddon;
282
219
 
283
- if (typeof options.callback === 'function') {
284
- options.callback(addon);
285
- }
220
+ await new Promise((resolve) => {
221
+ inRepoAddon = new EmberCLIFixturifyProject(name, version, async (addon) => {
222
+ prepareAddon(addon, options);
223
+
224
+ if (typeof options.callback === 'function') {
225
+ await options.callback(addon);
226
+ resolve();
227
+ } else {
228
+ resolve();
229
+ }
230
+ });
286
231
  });
287
232
 
288
233
  // configure the current project to have an ember-addon configured at the
@@ -301,10 +246,9 @@ module.exports = class EmberCLIFixturifyProject extends FixturifyProject {
301
246
 
302
247
  addon.paths.push(addonPath);
303
248
 
304
- this.files[addonRootDir] = this.files[addonRootDir] || {};
249
+ inRepoAddon.baseDir = path.join(this.baseDir, addonRootDir, inRepoAddon.pkg.name);
305
250
 
306
- let addonJSON = inRepoAddon.toJSON();
307
- Object.assign(this.files[addonRootDir], addonJSON);
251
+ await inRepoAddon.write();
308
252
  return inRepoAddon;
309
253
  }
310
254
 
@@ -322,12 +266,12 @@ module.exports = class EmberCLIFixturifyProject extends FixturifyProject {
322
266
  * @returns {FixturifyProject} the newly-created addon
323
267
  */
324
268
  addInRepoEngine(name, version = '0.0.0', options = { allowCachingPerBundle: false, enableLazyLoading: false }) {
325
- const callback = (engine) => {
269
+ const callback = async (engine) => {
326
270
  engine.pkg.keywords.push('ember-engine');
327
271
 
328
272
  // call original callback if it exists
329
273
  if (typeof options.callback === 'function') {
330
- options.callback(engine);
274
+ await options.callback(engine);
331
275
  }
332
276
  };
333
277
 
@@ -341,56 +285,4 @@ module.exports = class EmberCLIFixturifyProject extends FixturifyProject {
341
285
 
342
286
  return this.addInRepoAddon(name, version, { ...options, callback });
343
287
  }
344
-
345
- /**
346
- * Convert the object into a data structure suitable for passing to `fixturify`.
347
- *
348
- * @param {String} key optional key. If specified, the object will be run through toJSON, then the given
349
- * property extracted and returned.
350
- * @returns {Object} the `toJSON` value of the object (wrapped) or the toJSON value of the specified field
351
- * (not wrapped.)
352
- */
353
- toJSON(key) {
354
- if (key) {
355
- return super.toJSON(key);
356
- }
357
-
358
- let jsonData = super.toJSON();
359
-
360
- let scoped = parseScoped(this.name);
361
-
362
- // Allowing for scoped names, get the object in the JSON structure that corresponds
363
- // to this FixturifyProject.
364
- let container = scoped ? jsonData[scoped.scope][scoped.name] : jsonData[this.name];
365
-
366
- if (this._referenceDependencies || this._referenceDevDependencies) {
367
- let pkg = JSON.parse(container['package.json']);
368
-
369
- if (this._referenceDependencies) {
370
- if (!pkg.dependencies) {
371
- pkg.dependencies = {};
372
- }
373
-
374
- Object.assign(pkg.dependencies, this._referenceDependencies);
375
- }
376
-
377
- if (this._referenceDevDependencies) {
378
- if (!pkg.devDependencies) {
379
- pkg.devDependencies = {};
380
- }
381
-
382
- Object.assign(pkg.devDependencies, this._referenceDevDependencies);
383
- }
384
-
385
- container['package.json'] = JSON.stringify(pkg, undefined, 2);
386
- }
387
-
388
- // an optimization to remove any node_modules declaration that has nothing in it,
389
- // to avoid creating extra directories for no reason.
390
- if (container['node_modules'] && Object.keys(container['node_modules']).length === 0) {
391
- delete container['node_modules'];
392
- }
393
-
394
- return jsonData;
395
- }
396
288
  };
@@ -110,53 +110,47 @@ function countAddons(projectOrAddon, config = { byName: {}, proxyCount: 0, realA
110
110
  *
111
111
  * @name createStandardCacheFixture
112
112
  */
113
- function createStandardCacheFixture() {
113
+ async function createStandardCacheFixture() {
114
114
  let project = new FixturifyProject('test-ember-project', '1.0.0');
115
115
 
116
- project.addInRepoAddon('test-addon-a', '1.0.0', {
116
+ await project.addInRepoAddon('test-addon-a', '1.0.0', {
117
117
  callback: (addonA) => {
118
- addonA.addInRepoAddon('test-addon-dep', '1.0.0');
119
-
120
- // At this point, TAD has been run through toJSON inside of TAA.
121
- // TAD itself has no issues.
122
- // in TAA, we want to store all the inrepo addons, at any level, in
123
- // PROJ/lib, so move TAD from TAA and change its path in TAA.
124
118
  addonA.pkg['ember-addon'].paths = ['../test-addon-dep'];
125
- project.files.lib = project.files.lib || {};
126
- project.files.lib['test-addon-dep'] = addonA.files.lib['test-addon-dep'];
127
- delete addonA.files.lib;
128
119
  },
129
120
  });
130
121
 
131
- project.addInRepoEngine('lazy-engine-a', '1.0.0', {
122
+ await project.addInRepoAddon('test-addon-dep', '1.0.0');
123
+
124
+ await project.addInRepoAddon('test-engine-dep', '1.0.0');
125
+ await project.addInRepoEngine('lazy-engine-a', '1.0.0', {
132
126
  enableLazyLoading: true,
133
127
  callback: (lazyEngineA) => {
134
- lazyEngineA.addInRepoAddon('test-engine-dep', '1.0.0');
135
-
136
- // Similar to above
137
128
  lazyEngineA.pkg['ember-addon'].paths = ['../test-engine-dep'];
138
- project.files.lib['test-engine-dep'] = lazyEngineA.files.lib['test-engine-dep'];
139
- delete lazyEngineA.files.lib;
140
129
  },
141
130
  });
142
131
 
143
- project.addInRepoEngine('lazy-engine-b', '1.0.0', {
132
+ await project.addInRepoEngine('lazy-engine-b', '1.0.0', {
144
133
  enableLazyLoading: true,
145
134
  callback: (lazyEngineB) => {
146
- // These two addon definitions have already been moved to project, so just
147
- // fix the ember-addon.paths and remove the files.lib entry.
148
135
  lazyEngineB.pkg['ember-addon'].paths = ['../test-engine-dep', '../test-addon-dep'];
149
- delete lazyEngineB.files.lib;
150
136
  },
151
137
  });
152
138
 
153
- project.addInRepoEngine('regular-engine-c', '1.0.0', {
139
+ await project.addInRepoEngine('regular-engine-c', '1.0.0', {
154
140
  callback: (regularEngineC) => {
155
141
  regularEngineC.pkg['ember-addon'].paths = ['../test-engine-dep'];
156
- delete regularEngineC.files.lib;
157
142
  },
158
143
  });
159
144
 
145
+ // this test is actively trying to test a very strange setup of dependencies so we need to correct
146
+ // the config vs what the above fixturify-project setup would have added
147
+ project.pkg['ember-addon'].paths = [
148
+ 'lib/test-addon-a',
149
+ 'lib/lazy-engine-a',
150
+ 'lib/lazy-engine-b',
151
+ 'lib/regular-engine-c',
152
+ ];
153
+
160
154
  return project;
161
155
  }
162
156