ember-cli 7.1.0-beta.1 → 7.2.0-alpha.1
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 +73 -16
- package/blueprints/http-mock/index.js +1 -1
- package/blueprints/http-proxy/index.js +1 -1
- package/docs/build/data.json +105 -1590
- package/lib/commands/generate.js +1 -1
- package/lib/models/command.js +1 -1
- package/lib/models/package-info-cache/package-info.js +1 -1
- package/lib/tasks/generate-from-blueprint.js +1 -1
- package/lib/tasks/install-blueprint.js +4 -2
- package/lib/utilities/merge-blueprint-options.js +1 -1
- package/package.json +11 -11
- package/packages/addon-blueprint/files/README.md +10 -0
- package/packages/addon-blueprint/package.json +4 -4
- package/packages/app-blueprint/files/package.json +4 -4
- package/packages/app-blueprint/package.json +4 -4
- package/packages/blueprint-blueprint/files/blueprints/__name__/files/.gitkeep +0 -0
- package/packages/blueprint-blueprint/files/blueprints/__name__/index.js +16 -0
- package/packages/blueprint-blueprint/index.js +5 -0
- package/packages/blueprint-blueprint/package.json +13 -0
- package/{lib/models/blueprint.js → packages/blueprint-model/index.js} +11 -7
- package/packages/blueprint-model/node_modules/.bin/markdown-it +21 -0
- package/packages/blueprint-model/package.json +31 -0
- package/packages/blueprint-model/utilities/directory-for-package-name.js +31 -0
- package/packages/blueprint-model/utilities/edit-file-diff.js +64 -0
- package/packages/blueprint-model/utilities/experiments.js +63 -0
- package/packages/blueprint-model/utilities/file-info.js +170 -0
- package/packages/blueprint-model/utilities/open-editor.js +44 -0
- package/packages/blueprint-model/utilities/prepend-emoji.js +12 -0
- package/packages/blueprint-model/utilities/process-template.js +10 -0
- package/patches/ember-cli-blueprint-test-helpers.patch +15 -0
- package/tests/helpers/acceptance.js +6 -5
- /package/{lib → packages/blueprint-model}/utilities/clean-remove.js +0 -0
- /package/{lib → packages/blueprint-model}/utilities/insert-into-file.js +0 -0
- /package/{lib → packages/blueprint-model}/utilities/is-addon.js +0 -0
- /package/{lib → packages/blueprint-model}/utilities/markdown-color.js +0 -0
- /package/{lib → packages/blueprint-model}/utilities/print-command.js +0 -0
- /package/{lib → packages/blueprint-model}/utilities/sequence.js +0 -0
- /package/{lib → packages/blueprint-model}/utilities/walk-up-path.js +0 -0
package/lib/commands/generate.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const { default: chalk } = require('chalk');
|
|
5
5
|
const Command = require('../models/command');
|
|
6
|
-
const Blueprint = require('
|
|
6
|
+
const Blueprint = require('@ember-tooling/blueprint-model');
|
|
7
7
|
const mergeBlueprintOptions = require('../utilities/merge-blueprint-options');
|
|
8
8
|
const merge = require('lodash/merge');
|
|
9
9
|
const reject = require('lodash/reject');
|
package/lib/models/command.js
CHANGED
|
@@ -6,7 +6,7 @@ const path = require('path');
|
|
|
6
6
|
const isGitRepo = require('is-git-url');
|
|
7
7
|
const camelize = require('ember-cli-string-utils').camelize;
|
|
8
8
|
const getCallerFile = require('get-caller-file');
|
|
9
|
-
const printCommand = require('
|
|
9
|
+
const printCommand = require('@ember-tooling/blueprint-model/utilities/print-command');
|
|
10
10
|
const union = require('lodash/union');
|
|
11
11
|
const defaults = require('lodash/defaults');
|
|
12
12
|
const uniq = require('lodash/uniq');
|
|
@@ -4,7 +4,7 @@ const path = require('path');
|
|
|
4
4
|
const ErrorList = require('./error-list');
|
|
5
5
|
const Errors = require('./errors');
|
|
6
6
|
const AddonInfo = require('../addon-info');
|
|
7
|
-
const isAddon = require('
|
|
7
|
+
const isAddon = require('@ember-tooling/blueprint-model/utilities/is-addon');
|
|
8
8
|
const isEngine = require('../../utilities/is-engine');
|
|
9
9
|
const isLazyEngine = require('../../utilities/is-lazy-engine');
|
|
10
10
|
const logger = require('heimdalljs-logger')('ember-cli:package-info-cache:package-info');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const Blueprint = require('
|
|
3
|
+
const Blueprint = require('@ember-tooling/blueprint-model');
|
|
4
4
|
const Task = require('../models/task');
|
|
5
5
|
const parseOptions = require('../utilities/parse-options');
|
|
6
6
|
const logger = require('heimdalljs-logger')('ember-cli:generate-from-blueprint');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const fs = require('fs-extra');
|
|
4
|
-
const Blueprint = require('
|
|
4
|
+
const Blueprint = require('@ember-tooling/blueprint-model');
|
|
5
5
|
const Task = require('../models/task');
|
|
6
6
|
const os = require('os');
|
|
7
7
|
const path = require('path');
|
|
@@ -186,7 +186,9 @@ class InstallBlueprintTask extends Task {
|
|
|
186
186
|
logger.info(`Checking for "ember-blueprint" keyword in "${packageName}" module ...`);
|
|
187
187
|
let pkg = require(this._resolvePackageJSON(modulePath));
|
|
188
188
|
if (!pkg || !pkg.keywords || pkg.keywords.indexOf('ember-blueprint') === -1) {
|
|
189
|
-
throw new SilentError(
|
|
189
|
+
throw new SilentError(
|
|
190
|
+
`The package '${packageName}' is not a valid Ember CLI blueprint. The package.json keywords list must include "ember-blueprint".`
|
|
191
|
+
);
|
|
190
192
|
}
|
|
191
193
|
}
|
|
192
194
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-cli",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0-alpha.1",
|
|
4
4
|
"description": "Command line tool for developing ambitious ember.js apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -31,13 +31,11 @@
|
|
|
31
31
|
"minor": "prerelease",
|
|
32
32
|
"patch": "prerelease"
|
|
33
33
|
},
|
|
34
|
-
"semverIncrementTag": "
|
|
35
|
-
"publishTag": "
|
|
34
|
+
"semverIncrementTag": "alpha",
|
|
35
|
+
"publishTag": "alpha"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@ember
|
|
39
|
-
"@ember-tooling/blueprint-model": "^0.6.3",
|
|
40
|
-
"@ember/app-blueprint": "~7.1.0-beta.1",
|
|
38
|
+
"@ember/app-blueprint": "~7.2.0-alpha.1",
|
|
41
39
|
"@pnpm/find-workspace-dir": "^1000.1.5",
|
|
42
40
|
"babel-remove-types": "^2.0.0",
|
|
43
41
|
"broccoli": "^4.0.0",
|
|
@@ -106,7 +104,7 @@
|
|
|
106
104
|
"resolve-package-path": "^4.0.3",
|
|
107
105
|
"safe-stable-stringify": "^2.5.0",
|
|
108
106
|
"sane": "^5.0.1",
|
|
109
|
-
"semver": "^7.8.
|
|
107
|
+
"semver": "^7.8.1",
|
|
110
108
|
"semver-deprecate": "^1.1.0",
|
|
111
109
|
"silent-error": "^1.1.1",
|
|
112
110
|
"sort-package-json": "^3.6.1",
|
|
@@ -114,12 +112,14 @@
|
|
|
114
112
|
"testem": "^3.20.0",
|
|
115
113
|
"tiny-lr": "^2.0.0",
|
|
116
114
|
"tree-sync": "^2.1.0",
|
|
117
|
-
"walk-sync": "^4.0.
|
|
115
|
+
"walk-sync": "^4.0.2",
|
|
118
116
|
"watch-detector": "^1.0.2",
|
|
119
117
|
"workerpool": "^10.0.2",
|
|
120
118
|
"yam": "^1.0.0",
|
|
121
|
-
"@ember-tooling/
|
|
122
|
-
"@ember-tooling/classic-build-app-blueprint": "7.
|
|
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"
|
|
123
123
|
},
|
|
124
124
|
"devDependencies": {
|
|
125
125
|
"broccoli-plugin": "^4.0.7",
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
"fixturify-project": "^2.1.1",
|
|
141
141
|
"jsdom": "^21.1.2",
|
|
142
142
|
"latest-version": "^9.0.0",
|
|
143
|
-
"mocha": "^11.7.
|
|
143
|
+
"mocha": "^11.7.6",
|
|
144
144
|
"nock": "^14.0.15",
|
|
145
145
|
"nyc": "^17.1.0",
|
|
146
146
|
"prettier": "3.7.4",
|
|
@@ -18,6 +18,16 @@ ember install <%= addonName %>
|
|
|
18
18
|
|
|
19
19
|
[Longer description of how to use the addon in apps.]
|
|
20
20
|
|
|
21
|
+
> TODO: Document the package's public API.
|
|
22
|
+
>
|
|
23
|
+
> For each public api (including components, helpers, modifiers, and other apis) include:
|
|
24
|
+
>
|
|
25
|
+
> - The import path for a consumer (e.g. `import MyAddonsComponent from 'my-addon/components/my-addons-component'`)
|
|
26
|
+
> - What it does
|
|
27
|
+
> - Parameters/options
|
|
28
|
+
> - Return value
|
|
29
|
+
> - Example usage
|
|
30
|
+
|
|
21
31
|
## Contributing
|
|
22
32
|
|
|
23
33
|
See the [Contributing](CONTRIBUTING.md) guide for details.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-tooling/classic-build-addon-blueprint",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0-alpha.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/ember-cli/ember-cli.git",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"ember-blueprint"
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@ember-tooling/blueprint-model": "
|
|
14
|
+
"@ember-tooling/blueprint-model": "workspace:*",
|
|
15
15
|
"chalk": "^5.6.2",
|
|
16
16
|
"ember-cli-normalize-entity-name": "^1.0.0",
|
|
17
17
|
"ember-cli-string-utils": "^1.1.0",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"minor": "prerelease",
|
|
27
27
|
"patch": "prerelease"
|
|
28
28
|
},
|
|
29
|
-
"semverIncrementTag": "
|
|
30
|
-
"publishTag": "
|
|
29
|
+
"semverIncrementTag": "alpha",
|
|
30
|
+
"publishTag": "alpha"
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -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.
|
|
66
|
+
"ember-cli": "~7.2.0-alpha.1",
|
|
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",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"ember-page-title": "^9.0.3",
|
|
80
80
|
"ember-qunit": "^9.0.4",
|
|
81
81
|
"ember-resolver": "^13.2.0",
|
|
82
|
-
"ember-source": "~7.
|
|
82
|
+
"ember-source": "~7.2.0-alpha.3",
|
|
83
83
|
"ember-template-imports": "^4.4.0",
|
|
84
84
|
"ember-template-lint": "^6.1.0<% if (welcome) { %>",
|
|
85
85
|
"ember-welcome-page": "^8.0.5<% } %>",
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"stylelint": "^16.26.1",
|
|
99
99
|
"stylelint-config-standard": "^36.0.1<% if (typescript) { %>",
|
|
100
100
|
"typescript": "^5.9.3",
|
|
101
|
-
"typescript-eslint": "^8.59.
|
|
102
|
-
"webpack": "^5.
|
|
101
|
+
"typescript-eslint": "^8.59.4<% } %>",
|
|
102
|
+
"webpack": "^5.107.1"
|
|
103
103
|
},
|
|
104
104
|
"engines": {
|
|
105
105
|
"node": ">= 20.19"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-tooling/classic-build-app-blueprint",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0-alpha.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/ember-cli/ember-cli.git",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"ember-blueprint"
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@ember-tooling/blueprint-model": "
|
|
14
|
+
"@ember-tooling/blueprint-model": "workspace:*",
|
|
15
15
|
"chalk": "^5.6.2",
|
|
16
16
|
"ember-cli-string-utils": "^1.1.0"
|
|
17
17
|
},
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"minor": "prerelease",
|
|
21
21
|
"patch": "prerelease"
|
|
22
22
|
},
|
|
23
|
-
"semverIncrementTag": "
|
|
24
|
-
"publishTag": "
|
|
23
|
+
"semverIncrementTag": "alpha",
|
|
24
|
+
"publishTag": "alpha"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
description: ''
|
|
5
|
+
|
|
6
|
+
// locals(options) {
|
|
7
|
+
// // Return custom template variables here.
|
|
8
|
+
// return {
|
|
9
|
+
// foo: options.entity.options.foo
|
|
10
|
+
// };
|
|
11
|
+
// }
|
|
12
|
+
|
|
13
|
+
// afterInstall(options) {
|
|
14
|
+
// // Perform extra work here.
|
|
15
|
+
// }
|
|
16
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ember-tooling/blueprint-blueprint",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/ember-cli/ember-cli.git",
|
|
7
|
+
"directory": "packages/blueprint-blueprint"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"keywords": [
|
|
11
|
+
"ember-blueprint"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
const FileInfo = require('@ember-tooling/blueprint-model/utilities/file-info');
|
|
7
7
|
const { default: chalk } = require('chalk');
|
|
8
|
-
const MarkdownColor = require('
|
|
9
|
-
const sequence = require('
|
|
10
|
-
const printCommand = require('
|
|
11
|
-
const insertIntoFile = require('
|
|
12
|
-
const cleanRemove = require('
|
|
8
|
+
const MarkdownColor = require('@ember-tooling/blueprint-model/utilities/markdown-color');
|
|
9
|
+
const sequence = require('./utilities/sequence');
|
|
10
|
+
const printCommand = require('@ember-tooling/blueprint-model/utilities/print-command');
|
|
11
|
+
const insertIntoFile = require('@ember-tooling/blueprint-model/utilities/insert-into-file');
|
|
12
|
+
const cleanRemove = require('@ember-tooling/blueprint-model/utilities/clean-remove');
|
|
13
13
|
const fs = require('fs-extra');
|
|
14
14
|
const { pluralize } = require('inflection');
|
|
15
15
|
const { minimatch } = require('minimatch');
|
|
@@ -28,7 +28,7 @@ const CoreObject = require('core-object');
|
|
|
28
28
|
const EOL = require('os').EOL;
|
|
29
29
|
const logger = require('heimdalljs-logger')('ember-cli:blueprint');
|
|
30
30
|
const normalizeEntityName = require('ember-cli-normalize-entity-name');
|
|
31
|
-
const isAddon = require('
|
|
31
|
+
const isAddon = require('@ember-tooling/blueprint-model/utilities/is-addon');
|
|
32
32
|
|
|
33
33
|
const initialIgnoredFiles = ['.DS_Store'];
|
|
34
34
|
|
|
@@ -1474,7 +1474,11 @@ Blueprint.load = function (blueprintPath, blueprintOptions) {
|
|
|
1474
1474
|
|
|
1475
1475
|
let constructorPath = path.resolve(blueprintPath, 'index.js');
|
|
1476
1476
|
if (Blueprint._existsSync(constructorPath)) {
|
|
1477
|
-
|
|
1477
|
+
let blueprintModule = require(constructorPath);
|
|
1478
|
+
|
|
1479
|
+
if (blueprintModule.__esModule) {
|
|
1480
|
+
blueprintModule = blueprintModule.default;
|
|
1481
|
+
}
|
|
1478
1482
|
|
|
1479
1483
|
if (typeof blueprintModule === 'function') {
|
|
1480
1484
|
Constructor = blueprintModule;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
+
basedir=`cygpath -w "$basedir"`
|
|
8
|
+
fi
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
if [ -z "$NODE_PATH" ]; then
|
|
13
|
+
export NODE_PATH="/home/runner/work/ember-cli/ember-cli/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/bin/node_modules:/home/runner/work/ember-cli/ember-cli/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/node_modules:/home/runner/work/ember-cli/ember-cli/node_modules/.pnpm/markdown-it@14.1.1/node_modules:/home/runner/work/ember-cli/ember-cli/node_modules/.pnpm/node_modules"
|
|
14
|
+
else
|
|
15
|
+
export NODE_PATH="/home/runner/work/ember-cli/ember-cli/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/bin/node_modules:/home/runner/work/ember-cli/ember-cli/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/node_modules:/home/runner/work/ember-cli/ember-cli/node_modules/.pnpm/markdown-it@14.1.1/node_modules:/home/runner/work/ember-cli/ember-cli/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
+
fi
|
|
17
|
+
if [ -x "$basedir/node" ]; then
|
|
18
|
+
exec "$basedir/node" "$basedir/../markdown-it/bin/markdown-it.mjs" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../markdown-it/bin/markdown-it.mjs" "$@"
|
|
21
|
+
fi
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ember-tooling/blueprint-model",
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/ember-cli/ember-cli.git",
|
|
7
|
+
"directory": "packages/blueprint-model"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"babel-remove-types": "^2.0.0",
|
|
12
|
+
"chalk": "^5.6.2",
|
|
13
|
+
"content-tag": "^4.0.0",
|
|
14
|
+
"core-object": "^3.1.5",
|
|
15
|
+
"diff": "^8.0.4",
|
|
16
|
+
"ember-cli-normalize-entity-name": "^1.0.0",
|
|
17
|
+
"ember-cli-string-utils": "^1.1.0",
|
|
18
|
+
"fs-extra": "^11.3.4",
|
|
19
|
+
"heimdalljs-logger": "^0.1.10",
|
|
20
|
+
"inflection": "^3.0.2",
|
|
21
|
+
"isbinaryfile": "^5.0.7",
|
|
22
|
+
"lodash": "^4.17.23",
|
|
23
|
+
"markdown-it": "^14.1.0",
|
|
24
|
+
"markdown-it-terminal": "^0.4.0",
|
|
25
|
+
"minimatch": "^10.1.1",
|
|
26
|
+
"promise.hash.helper": "^1.0.8",
|
|
27
|
+
"quick-temp": "^0.1.9",
|
|
28
|
+
"silent-error": "^1.1.1",
|
|
29
|
+
"walk-sync": "^4.0.0"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Derive a directory name from a package name.
|
|
7
|
+
* Takes scoped packages into account.
|
|
8
|
+
*
|
|
9
|
+
* @method directoryForPackageName
|
|
10
|
+
* @param {String} packageName
|
|
11
|
+
* @return {String} Derived directory name.
|
|
12
|
+
*/
|
|
13
|
+
module.exports = function directoryForPackageName(packageName) {
|
|
14
|
+
let isScoped = packageName[0] === '@' && packageName.includes('/');
|
|
15
|
+
|
|
16
|
+
if (isScoped) {
|
|
17
|
+
let slashIndex = packageName.indexOf('/');
|
|
18
|
+
let scopeName = packageName.substring(1, slashIndex);
|
|
19
|
+
let packageNameWithoutScope = packageName.substring(slashIndex + 1);
|
|
20
|
+
let pathParts = process.cwd().split(path.sep);
|
|
21
|
+
let parentDirectoryContainsScopeName = pathParts.includes(scopeName);
|
|
22
|
+
|
|
23
|
+
if (parentDirectoryContainsScopeName) {
|
|
24
|
+
return packageNameWithoutScope;
|
|
25
|
+
} else {
|
|
26
|
+
return `${scopeName}-${packageNameWithoutScope}`;
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
return packageName;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const util = require('util');
|
|
5
|
+
const { applyPatch, createPatch } = require('diff');
|
|
6
|
+
const quickTemp = require('quick-temp');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
const SilentError = require('silent-error');
|
|
9
|
+
const openEditor = require('./open-editor');
|
|
10
|
+
const hash = require('promise.hash.helper');
|
|
11
|
+
|
|
12
|
+
const readFile = util.promisify(fs.readFile);
|
|
13
|
+
const writeFile = util.promisify(fs.writeFile);
|
|
14
|
+
|
|
15
|
+
class EditFileDiff {
|
|
16
|
+
constructor(options) {
|
|
17
|
+
this.info = options.info;
|
|
18
|
+
|
|
19
|
+
quickTemp.makeOrRemake(this, 'tmpDifferenceDir');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
edit() {
|
|
23
|
+
return hash({
|
|
24
|
+
input: this.info.render(),
|
|
25
|
+
output: readFile(this.info.outputPath),
|
|
26
|
+
})
|
|
27
|
+
.then(this.invokeEditor.bind(this))
|
|
28
|
+
.then(this.applyPatch.bind(this))
|
|
29
|
+
.finally(this.cleanUp.bind(this));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
cleanUp() {
|
|
33
|
+
quickTemp.remove(this, 'tmpDifferenceDir');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
applyPatch(resultHash) {
|
|
37
|
+
return hash({
|
|
38
|
+
diffString: readFile(resultHash.diffPath),
|
|
39
|
+
currentString: readFile(resultHash.outputPath),
|
|
40
|
+
}).then((result) => {
|
|
41
|
+
let appliedDiff = applyPatch(result.currentString.toString(), result.diffString.toString());
|
|
42
|
+
|
|
43
|
+
if (!appliedDiff) {
|
|
44
|
+
let message = 'Patch was not cleanly applied.';
|
|
45
|
+
this.info.ui.writeLine(`${message} Please choose another action.`);
|
|
46
|
+
throw new SilentError(message);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return writeFile(resultHash.outputPath, appliedDiff);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
invokeEditor(result) {
|
|
54
|
+
let info = this.info;
|
|
55
|
+
let diff = createPatch(info.outputPath, result.output.toString(), result.input);
|
|
56
|
+
let diffPath = path.join(this.tmpDifferenceDir, 'currentDiff.diff');
|
|
57
|
+
|
|
58
|
+
return writeFile(diffPath, diff)
|
|
59
|
+
.then(() => openEditor(diffPath))
|
|
60
|
+
.then(() => ({ outputPath: info.outputPath, diffPath }));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
module.exports = EditFileDiff;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { default: chalk } = require('chalk');
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
If you're here to remove the VITE experiment flag in favor of it being
|
|
7
|
+
permanently on, you can't do that until addressing
|
|
8
|
+
https://github.com/ember-cli/ember-cli/pull/10781#pullrequestreview-3230644293
|
|
9
|
+
|
|
10
|
+
A lot of test coverage would otherwise be lost, because valid tests are being
|
|
11
|
+
run only when the VITE experiment is off.
|
|
12
|
+
*/
|
|
13
|
+
const availableExperiments = Object.freeze(['EMBROIDER', 'CLASSIC', 'VITE']);
|
|
14
|
+
|
|
15
|
+
const deprecatedExperiments = Object.freeze([]);
|
|
16
|
+
const enabledExperiments = Object.freeze(['VITE']);
|
|
17
|
+
const deprecatedExperimentsDeprecationsIssued = [];
|
|
18
|
+
|
|
19
|
+
function isExperimentEnabled(experimentName) {
|
|
20
|
+
if (!availableExperiments.includes(experimentName)) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (process.env.EMBER_CLI_ENABLE_ALL_EXPERIMENTS && deprecatedExperiments.includes(experimentName)) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (process.env.EMBER_CLI_ENABLE_ALL_EXPERIMENTS) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (process.env.EMBER_CLI_CLASSIC && experimentName === 'EMBROIDER') {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let experimentEnvironmentVariable = `EMBER_CLI_${experimentName}`;
|
|
37
|
+
let experimentValue = process.env[experimentEnvironmentVariable];
|
|
38
|
+
|
|
39
|
+
if (deprecatedExperiments.includes(experimentName)) {
|
|
40
|
+
let deprecationPreviouslyIssued = deprecatedExperimentsDeprecationsIssued.includes(experimentName);
|
|
41
|
+
let isSpecifiedByUser = experimentValue !== undefined;
|
|
42
|
+
|
|
43
|
+
if (!deprecationPreviouslyIssued && isSpecifiedByUser) {
|
|
44
|
+
console.warn(
|
|
45
|
+
chalk.yellow(`The ${experimentName} experiment in ember-cli has been deprecated and will be removed.`)
|
|
46
|
+
);
|
|
47
|
+
deprecatedExperimentsDeprecationsIssued.push(experimentName);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (enabledExperiments.includes(experimentName)) {
|
|
52
|
+
return experimentValue !== 'false';
|
|
53
|
+
} else {
|
|
54
|
+
return experimentValue !== undefined && experimentValue !== 'false';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
module.exports = {
|
|
59
|
+
isExperimentEnabled,
|
|
60
|
+
|
|
61
|
+
// exported for testing purposes
|
|
62
|
+
_deprecatedExperimentsDeprecationsIssued: deprecatedExperimentsDeprecationsIssued,
|
|
63
|
+
};
|