ember-cli 4.12.0 → 4.13.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.
- package/.github/workflows/ci.yml +4 -5
- package/CHANGELOG.md +44 -0
- package/CONTRIBUTING.md +1 -1
- package/blueprints/addon/files/.github/workflows/ci.yml +3 -3
- package/blueprints/addon/files/.travis.yml +1 -1
- package/blueprints/addon/files/README.md +1 -1
- package/blueprints/addon/files/npmignore +0 -6
- package/blueprints/app/files/.eslintignore +0 -12
- package/blueprints/app/files/.github/workflows/ci.yml +2 -2
- package/blueprints/app/files/.prettierignore +1 -13
- package/blueprints/app/files/.travis.yml +1 -1
- package/blueprints/app/files/.watchmanconfig +1 -1
- package/blueprints/app/files/gitignore +0 -8
- package/blueprints/app/files/package.json +1 -1
- package/blueprints/server/index.js +0 -27
- package/docs/build/data.json +217 -401
- package/lib/broccoli/default-packager.js +2 -79
- package/lib/broccoli/ember-addon.js +0 -4
- package/lib/broccoli/ember-app.js +19 -460
- package/lib/cli/cli.js +0 -9
- package/lib/commands/addon.js +0 -1
- package/lib/commands/init.js +0 -8
- package/lib/commands/install.js +2 -2
- package/lib/commands/new.js +0 -1
- package/lib/commands/serve.js +1 -1
- package/lib/experiments/index.js +2 -2
- package/lib/models/addon.js +38 -113
- package/lib/models/blueprint.js +0 -115
- package/lib/models/command.js +3 -4
- package/lib/models/package-info-cache/package-info.js +1 -5
- package/lib/models/project.js +2 -87
- package/lib/tasks/interactive-new.js +1 -1
- package/lib/tasks/npm-task.js +0 -15
- package/lib/tasks/server/express-server.js +0 -1
- package/lib/tasks/server/middleware/broccoli-watcher/index.js +5 -5
- package/lib/tasks/server/middleware/history-support/index.js +6 -7
- package/lib/tasks/server/middleware/testem-url-rewriter/index.js +0 -10
- package/lib/tasks/server/middleware/tests-server/index.js +8 -9
- package/lib/utilities/ember-app-utils.js +1 -21
- package/lib/utilities/get-serve-url.js +2 -2
- package/package.json +13 -23
- package/tests/helpers/acceptance.js +1 -3
- package/tests/helpers/command-generator.js +2 -2
- package/tests/helpers/default-packager.js +3 -9
- package/tests/helpers/init-app.js +1 -1
- package/tests/helpers/mock-project.js +1 -1
- package/tests/helpers/package-cache.js +2 -19
- package/blueprints/server/files/server/.jshintrc +0 -3
- package/blueprints/vendor-shim/files/vendor/shims/__name__.js +0 -12
- package/blueprints/vendor-shim/index.js +0 -30
- package/lib/broccoli/babel-process-modules-only.js +0 -18
- package/lib/models/installation-checker.js +0 -87
- package/lib/tasks/bower-install.js +0 -175
- package/lib/utilities/ember-cli-babel-config-key.js +0 -12
- package/lib/utilities/find-addon-by-name.js +0 -39
package/lib/tasks/npm-task.js
CHANGED
|
@@ -211,21 +211,6 @@ class NpmTask extends Task {
|
|
|
211
211
|
} else {
|
|
212
212
|
let args = this.toNpmArgs(this.command, options);
|
|
213
213
|
await this.npm(args);
|
|
214
|
-
|
|
215
|
-
// as of 2018-10-09 npm 5 and 6 _break_ the hierarchy of `node_modules`
|
|
216
|
-
// after a `npm install foo` (deletes files/folders other than
|
|
217
|
-
// what was directly installed) in some circumstances, see:
|
|
218
|
-
//
|
|
219
|
-
// * https://github.com/npm/npm/issues/16853
|
|
220
|
-
// * https://github.com/npm/npm/issues/17379
|
|
221
|
-
//
|
|
222
|
-
// this ensures that we run a full `npm install` **after** any `npm
|
|
223
|
-
// install foo` runs to ensure that we have a fully functional
|
|
224
|
-
// node_modules hierarchy
|
|
225
|
-
let npmVersion = this.packageManager.version;
|
|
226
|
-
if (npmVersion && semver.lt(npmVersion, '5.7.1')) {
|
|
227
|
-
await this.npm(['install']);
|
|
228
|
-
}
|
|
229
214
|
}
|
|
230
215
|
} finally {
|
|
231
216
|
ui.stopProgress();
|
|
@@ -251,7 +251,6 @@ class ExpressServerTask extends Task {
|
|
|
251
251
|
const config = this.project.config(options.environment);
|
|
252
252
|
const middlewareOptions = Object.assign({}, options, {
|
|
253
253
|
rootURL: config.rootURL,
|
|
254
|
-
baseURL: config.baseURL || '/',
|
|
255
254
|
});
|
|
256
255
|
|
|
257
256
|
await liveReloadServer.setupMiddleware(this.startOptions);
|
|
@@ -27,20 +27,20 @@ class WatcherAddon {
|
|
|
27
27
|
autoIndex: false, // disable directory listings
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
let
|
|
30
|
+
let rootURL = options.rootURL === '' ? '/' : cleanBaseURL(options.rootURL);
|
|
31
31
|
|
|
32
|
-
logger.info('serverMiddleware:
|
|
32
|
+
logger.info('serverMiddleware: rootURL: %s', rootURL);
|
|
33
33
|
|
|
34
34
|
app.use((req, res, next) => {
|
|
35
35
|
let oldURL = req.url;
|
|
36
36
|
let url = req.serveUrl || req.url;
|
|
37
37
|
logger.info('serving: %s', url);
|
|
38
38
|
|
|
39
|
-
let actualPrefix = req.url.slice(0,
|
|
40
|
-
let expectedPrefix =
|
|
39
|
+
let actualPrefix = req.url.slice(0, rootURL.length - 1); // Don't care
|
|
40
|
+
let expectedPrefix = rootURL.slice(0, rootURL.length - 1); // about last slash
|
|
41
41
|
|
|
42
42
|
if (actualPrefix === expectedPrefix) {
|
|
43
|
-
let urlToBeServed = url.slice(actualPrefix.length); // Remove
|
|
43
|
+
let urlToBeServed = url.slice(actualPrefix.length); // Remove rootURL prefix
|
|
44
44
|
req.url = urlToBeServed;
|
|
45
45
|
logger.info('serving: (prefix stripped) %s, was: %s', urlToBeServed, url);
|
|
46
46
|
|
|
@@ -44,8 +44,7 @@ class HistorySupportAddon {
|
|
|
44
44
|
let app = config.app;
|
|
45
45
|
let options = config.options;
|
|
46
46
|
let watcher = options.watcher;
|
|
47
|
-
|
|
48
|
-
let baseURL = options.rootURL === '' ? '/' : cleanBaseURL(options.rootURL || options.baseURL);
|
|
47
|
+
let rootURL = options.rootURL === '' ? '/' : cleanBaseURL(options.rootURL);
|
|
49
48
|
|
|
50
49
|
app.use(async (req, _, next) => {
|
|
51
50
|
try {
|
|
@@ -60,7 +59,7 @@ class HistorySupportAddon {
|
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
if (this.shouldHandleRequest(req, options)) {
|
|
63
|
-
let assetPath = req.path.slice(
|
|
62
|
+
let assetPath = req.path.slice(rootURL.length);
|
|
64
63
|
let isFile = false;
|
|
65
64
|
|
|
66
65
|
try {
|
|
@@ -69,7 +68,7 @@ class HistorySupportAddon {
|
|
|
69
68
|
/* ignore */
|
|
70
69
|
}
|
|
71
70
|
if (!isFile) {
|
|
72
|
-
req.serveUrl = `${
|
|
71
|
+
req.serveUrl = `${rootURL}index.html`;
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
74
|
} finally {
|
|
@@ -87,9 +86,9 @@ class HistorySupportAddon {
|
|
|
87
86
|
if (!hasHTMLHeader) {
|
|
88
87
|
return false;
|
|
89
88
|
}
|
|
90
|
-
let
|
|
91
|
-
let
|
|
92
|
-
return
|
|
89
|
+
let rootURL = options.rootURL === '' ? '/' : cleanBaseURL(options.rootURL);
|
|
90
|
+
let rootURLRegexp = new RegExp(`^${rootURL}`);
|
|
91
|
+
return rootURLRegexp.test(req.path);
|
|
93
92
|
}
|
|
94
93
|
}
|
|
95
94
|
|
|
@@ -16,16 +16,6 @@ class TestemUrlRewriterAddon {
|
|
|
16
16
|
let config = this.project.config(env);
|
|
17
17
|
logger.info('config.rootURL = %s', config.rootURL);
|
|
18
18
|
|
|
19
|
-
this.project.ui.writeDeprecateLine(
|
|
20
|
-
'Using the `baseURL` setting is deprecated, use `rootURL` instead.',
|
|
21
|
-
!(!('rootURL' in config) && config.baseURL)
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
this.project.ui.writeWarnLine(
|
|
25
|
-
'The `baseURL` and `rootURL` settings should not be used at the same time.',
|
|
26
|
-
!('rootURL' in config && config.baseURL)
|
|
27
|
-
);
|
|
28
|
-
|
|
29
19
|
let rootURL = cleanBaseURL(config.rootURL) || '/';
|
|
30
20
|
logger.info('rootURL = %s', rootURL);
|
|
31
21
|
|
|
@@ -8,7 +8,7 @@ const logger = require('heimdalljs-logger')('ember-cli:test-server');
|
|
|
8
8
|
module.exports = class TestsServerAddon {
|
|
9
9
|
/**
|
|
10
10
|
* This addon is used to serve the QUnit or Mocha test runner
|
|
11
|
-
* at `
|
|
11
|
+
* at `rootURL + '/tests'`.
|
|
12
12
|
*
|
|
13
13
|
* @class TestsServerAddon
|
|
14
14
|
* @constructor
|
|
@@ -22,9 +22,8 @@ module.exports = class TestsServerAddon {
|
|
|
22
22
|
let app = config.app;
|
|
23
23
|
let options = config.options;
|
|
24
24
|
let watcher = options.watcher;
|
|
25
|
-
|
|
26
|
-
let
|
|
27
|
-
let testsPath = `${baseURL}tests`;
|
|
25
|
+
let rootURL = options.rootURL === '' ? '/' : cleanBaseURL(options.rootURL);
|
|
26
|
+
let testsPath = `${rootURL}tests`;
|
|
28
27
|
|
|
29
28
|
app.use(async (req, _, next) => {
|
|
30
29
|
let results;
|
|
@@ -42,7 +41,7 @@ module.exports = class TestsServerAddon {
|
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
if (watcherSuccess) {
|
|
45
|
-
rewriteRequestUrlIfBasePageIsNeeded(req, testsPath,
|
|
44
|
+
rewriteRequestUrlIfBasePageIsNeeded(req, testsPath, rootURL, results.directory);
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
next();
|
|
@@ -54,7 +53,7 @@ module.exports = class TestsServerAddon {
|
|
|
54
53
|
}
|
|
55
54
|
};
|
|
56
55
|
|
|
57
|
-
function rewriteRequestUrlIfBasePageIsNeeded(req, testsPath,
|
|
56
|
+
function rewriteRequestUrlIfBasePageIsNeeded(req, testsPath, rootURL, directory) {
|
|
58
57
|
let acceptHeaders = req.headers.accept || [];
|
|
59
58
|
let hasHTMLHeader = acceptHeaders.indexOf('text/html') !== -1;
|
|
60
59
|
let hasWildcardHeader = acceptHeaders.indexOf('*/*') !== -1;
|
|
@@ -64,12 +63,12 @@ function rewriteRequestUrlIfBasePageIsNeeded(req, testsPath, baseURL, directory)
|
|
|
64
63
|
logger.info('isForTests: %o', isForTests);
|
|
65
64
|
|
|
66
65
|
if (isForTests && (hasHTMLHeader || hasWildcardHeader) && req.method === 'GET') {
|
|
67
|
-
let assetPath = req.path.slice(
|
|
66
|
+
let assetPath = req.path.slice(rootURL.length);
|
|
68
67
|
let filePath = path.join(directory, assetPath);
|
|
69
68
|
|
|
70
69
|
if (!fs.existsSync(filePath) || !fs.statSync(filePath).isFile()) {
|
|
71
|
-
// N.B., `
|
|
72
|
-
let newURL = `${
|
|
70
|
+
// N.B., `rootURL` will end with a slash as it went through `cleanBaseURL`
|
|
71
|
+
let newURL = `${rootURL}tests/index.html`;
|
|
73
72
|
logger.info('url: %s resolved to path: %s which is not a file. Assuming %s instead', req.path, filePath, newURL);
|
|
74
73
|
req.url = newURL;
|
|
75
74
|
}
|
|
@@ -34,24 +34,6 @@ function convertObjectToString(env) {
|
|
|
34
34
|
return JSON.stringify(env || {});
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
/**
|
|
38
|
-
* Returns the <base> tag for index.html.
|
|
39
|
-
*
|
|
40
|
-
* @method calculateBaseTag
|
|
41
|
-
* @param {String} baseURL
|
|
42
|
-
* @param {String} locationType 'history', 'none' or 'hash'.
|
|
43
|
-
* @return {String} Base tag or an empty string
|
|
44
|
-
*/
|
|
45
|
-
function calculateBaseTag(baseURL, locationType) {
|
|
46
|
-
let normalizedBaseUrl = cleanBaseURL(baseURL);
|
|
47
|
-
|
|
48
|
-
if (locationType === 'hash') {
|
|
49
|
-
return '';
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return normalizedBaseUrl ? `<base href="${normalizedBaseUrl}" />` : '';
|
|
53
|
-
}
|
|
54
|
-
|
|
55
37
|
/**
|
|
56
38
|
* Returns the content for a specific type (section) for index.html.
|
|
57
39
|
*
|
|
@@ -90,8 +72,6 @@ function contentFor(config, match, type, options) {
|
|
|
90
72
|
|
|
91
73
|
switch (type) {
|
|
92
74
|
case 'head':
|
|
93
|
-
content.push(calculateBaseTag(config.baseURL, config.locationType));
|
|
94
|
-
|
|
95
75
|
if (options.storeConfigInMeta) {
|
|
96
76
|
content.push(
|
|
97
77
|
`<meta name="${config.modulePrefix}/config/environment" content="${encodeURIComponent(
|
|
@@ -195,4 +175,4 @@ function configReplacePatterns(options) {
|
|
|
195
175
|
];
|
|
196
176
|
}
|
|
197
177
|
|
|
198
|
-
module.exports = { normalizeUrl, convertObjectToString,
|
|
178
|
+
module.exports = { normalizeUrl, convertObjectToString, contentFor, configReplacePatterns };
|
|
@@ -4,7 +4,7 @@ const cleanBaseURL = require('clean-base-url');
|
|
|
4
4
|
|
|
5
5
|
module.exports = function (options, project) {
|
|
6
6
|
let config = project.config(options.environment);
|
|
7
|
+
let rootURL = config.rootURL === '' ? '/' : cleanBaseURL(config.rootURL || '/');
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
return `http${options.ssl ? 's' : ''}://${options.host || 'localhost'}:${options.port}${baseURL}`;
|
|
9
|
+
return `http${options.ssl ? 's' : ''}://${options.host || 'localhost'}:${options.port}${rootURL}`;
|
|
10
10
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-cli",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.13.0-beta.0",
|
|
4
4
|
"description": "Command line tool for developing ambitious ember.js apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -37,15 +37,8 @@
|
|
|
37
37
|
"test:slow": "node --unhandled-rejections=strict tests/runner slow"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@babel/core": "^7.21.
|
|
41
|
-
"@babel/plugin-transform-modules-amd": "^7.20.11",
|
|
42
|
-
"amd-name-resolver": "^1.3.1",
|
|
43
|
-
"babel-plugin-module-resolver": "^4.1.0",
|
|
44
|
-
"bower-config": "^1.4.3",
|
|
45
|
-
"bower-endpoint-parser": "0.2.2",
|
|
40
|
+
"@babel/core": "^7.21.4",
|
|
46
41
|
"broccoli": "^3.5.2",
|
|
47
|
-
"broccoli-amd-funnel": "^2.0.1",
|
|
48
|
-
"broccoli-babel-transpiler": "^7.8.1",
|
|
49
42
|
"broccoli-builder": "^0.18.14",
|
|
50
43
|
"broccoli-concat": "^4.2.5",
|
|
51
44
|
"broccoli-config-loader": "^1.0.1",
|
|
@@ -82,7 +75,7 @@
|
|
|
82
75
|
"find-up": "^5.0.0",
|
|
83
76
|
"find-yarn-workspace-root": "^2.0.0",
|
|
84
77
|
"fixturify-project": "^2.1.1",
|
|
85
|
-
"fs-extra": "^11.1.
|
|
78
|
+
"fs-extra": "^11.1.1",
|
|
86
79
|
"fs-tree-diff": "^2.0.1",
|
|
87
80
|
"get-caller-file": "^2.0.5",
|
|
88
81
|
"git-repo-info": "^2.1.1",
|
|
@@ -93,7 +86,7 @@
|
|
|
93
86
|
"heimdalljs-logger": "^0.1.10",
|
|
94
87
|
"http-proxy": "^1.18.1",
|
|
95
88
|
"inflection": "^2.0.1",
|
|
96
|
-
"inquirer": "^
|
|
89
|
+
"inquirer": "^9.1.5",
|
|
97
90
|
"is-git-url": "^1.0.0",
|
|
98
91
|
"is-language-code": "^3.1.0",
|
|
99
92
|
"isbinaryfile": "^5.0.0",
|
|
@@ -102,7 +95,7 @@
|
|
|
102
95
|
"lodash.template": "^4.5.0",
|
|
103
96
|
"markdown-it": "^13.0.1",
|
|
104
97
|
"markdown-it-terminal": "^0.4.0",
|
|
105
|
-
"minimatch": "^7.4.
|
|
98
|
+
"minimatch": "^7.4.3",
|
|
106
99
|
"morgan": "^1.10.0",
|
|
107
100
|
"nopt": "^3.0.6",
|
|
108
101
|
"npm-package-arg": "^10.1.0",
|
|
@@ -141,20 +134,20 @@
|
|
|
141
134
|
"chai-jest-snapshot": "^2.0.0",
|
|
142
135
|
"ember-cli-blueprint-test-helpers": "^0.19.2",
|
|
143
136
|
"ember-cli-internal-test-helpers": "^0.9.1",
|
|
144
|
-
"eslint": "^8.
|
|
137
|
+
"eslint": "^8.37.0",
|
|
145
138
|
"eslint-config-prettier": "^8.6.0",
|
|
146
139
|
"eslint-plugin-chai-expect": "^3.0.0",
|
|
147
140
|
"eslint-plugin-mocha": "^10.1.0",
|
|
148
|
-
"eslint-plugin-n": "^15.
|
|
141
|
+
"eslint-plugin-n": "^15.7.0",
|
|
149
142
|
"eslint-plugin-prettier": "^4.2.1",
|
|
150
143
|
"fixturify": "^3.0.0",
|
|
151
|
-
"jsdom": "^21.1.
|
|
144
|
+
"jsdom": "^21.1.1",
|
|
152
145
|
"latest-version": "^5.1.0",
|
|
153
146
|
"mocha": "^10.0.0",
|
|
154
|
-
"nock": "^13.
|
|
147
|
+
"nock": "^13.3.0",
|
|
155
148
|
"nyc": "^15.1.0",
|
|
156
|
-
"prettier": "2.8.
|
|
157
|
-
"release-it": "^15.
|
|
149
|
+
"prettier": "2.8.7",
|
|
150
|
+
"release-it": "^15.10.0",
|
|
158
151
|
"rimraf": "^3.0.2",
|
|
159
152
|
"strip-ansi": "^6.0.0",
|
|
160
153
|
"supertest": "^6.3.1",
|
|
@@ -166,15 +159,12 @@
|
|
|
166
159
|
"yuidocjs": "0.10.2"
|
|
167
160
|
},
|
|
168
161
|
"engines": {
|
|
169
|
-
"node": ">=
|
|
162
|
+
"node": ">= 16"
|
|
170
163
|
},
|
|
171
164
|
"publishConfig": {
|
|
172
165
|
"registry": "https://registry.npmjs.org"
|
|
173
166
|
},
|
|
174
167
|
"release-it": {
|
|
175
|
-
"hooks": {
|
|
176
|
-
"after:release": "node ./dev/update-output-repos.js"
|
|
177
|
-
},
|
|
178
168
|
"git": {
|
|
179
169
|
"tagName": "v${version}"
|
|
180
170
|
},
|
|
@@ -186,7 +176,7 @@
|
|
|
186
176
|
},
|
|
187
177
|
"trackingCode": "UA-49225444-1",
|
|
188
178
|
"volta": {
|
|
189
|
-
"node": "
|
|
179
|
+
"node": "16.19.1",
|
|
190
180
|
"yarn": "1.22.19"
|
|
191
181
|
}
|
|
192
182
|
}
|
|
@@ -64,9 +64,7 @@ function createTestTargets(projectName, options) {
|
|
|
64
64
|
options = options || {};
|
|
65
65
|
options.command = options.command || 'new';
|
|
66
66
|
|
|
67
|
-
return applyCommand(options.command, projectName, '--skip-npm',
|
|
68
|
-
handleResult
|
|
69
|
-
);
|
|
67
|
+
return applyCommand(options.command, projectName, '--skip-npm', `--directory=${outputDir}`).catch(handleResult);
|
|
70
68
|
}
|
|
71
69
|
|
|
72
70
|
/**
|
|
@@ -9,8 +9,8 @@ const execa = require('../../lib/utilities/execa');
|
|
|
9
9
|
* Usage:
|
|
10
10
|
*
|
|
11
11
|
* ```
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* let npm = new CommandGenerator('npm');
|
|
13
|
+
* npm.invoke('install', 'ember-source', '--save-dev');
|
|
14
14
|
* ```
|
|
15
15
|
*
|
|
16
16
|
* @private
|
|
@@ -10,7 +10,6 @@ const assert = require('assert');
|
|
|
10
10
|
const DEFAULT_ADDON_MODULES = {
|
|
11
11
|
'ember-cli-foobar': '^1.0.0',
|
|
12
12
|
};
|
|
13
|
-
const DEFAULT_BOWER_COMPONENTS = {};
|
|
14
13
|
|
|
15
14
|
const DEFAULT_NODE_MODULES = {
|
|
16
15
|
'broccoli-asset-rev': {
|
|
@@ -72,9 +71,6 @@ const DEFAULT_VENDOR = {
|
|
|
72
71
|
'loader.js': 'W',
|
|
73
72
|
},
|
|
74
73
|
ember: {
|
|
75
|
-
jquery: {
|
|
76
|
-
'jquery.js': 'window.$ = function() {}',
|
|
77
|
-
},
|
|
78
74
|
'ember.js': 'window.Ember = {};',
|
|
79
75
|
'ember.debug.js': 'window.Ember = {};',
|
|
80
76
|
},
|
|
@@ -151,7 +147,7 @@ const DEFAULT_SOURCE = {
|
|
|
151
147
|
|
|
152
148
|
/*
|
|
153
149
|
* Generates an object that represents an unpackaged Ember application tree,
|
|
154
|
-
* including application source, addons, vendor
|
|
150
|
+
* including application source, addons, vendor and node.js files.
|
|
155
151
|
*
|
|
156
152
|
* @param {String} name The name of the app
|
|
157
153
|
* @param {Object} options Customize output object
|
|
@@ -162,14 +158,12 @@ function getDefaultUnpackagedDist(name, options) {
|
|
|
162
158
|
options = options || {};
|
|
163
159
|
|
|
164
160
|
const addonModules = Object.assign({}, DEFAULT_ADDON_MODULES, options.addonModules);
|
|
165
|
-
const bowerComponents = options.bowerComponents || DEFAULT_BOWER_COMPONENTS;
|
|
166
161
|
const nodeModules = options.nodeModules || DEFAULT_NODE_MODULES;
|
|
167
162
|
const application = Object.assign({}, DEFAULT_SOURCE, options.source);
|
|
168
163
|
const vendor = Object.assign({}, DEFAULT_VENDOR, options.vendor);
|
|
169
164
|
|
|
170
165
|
return {
|
|
171
166
|
'addon-modules': addonModules,
|
|
172
|
-
bower_components: bowerComponents,
|
|
173
167
|
node_modules: nodeModules,
|
|
174
168
|
[name]: application,
|
|
175
169
|
vendor,
|
|
@@ -209,8 +203,8 @@ function validateDefaultPackagedDist(name, obj) {
|
|
|
209
203
|
}
|
|
210
204
|
|
|
211
205
|
/*
|
|
212
|
-
* Generates an object that represents a "dependency" on the disk.
|
|
213
|
-
*
|
|
206
|
+
* Generates an object that represents a "dependency" on the disk.
|
|
207
|
+
* Could be used for generating node dependencies.
|
|
214
208
|
*
|
|
215
209
|
* ```javascript
|
|
216
210
|
* getDependencyFor('moment', {
|
|
@@ -22,18 +22,6 @@ cases where we use this.
|
|
|
22
22
|
*/
|
|
23
23
|
let DEPENDENCY_KEYS = ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies'];
|
|
24
24
|
|
|
25
|
-
/**
|
|
26
|
-
* The `bower` command helper.
|
|
27
|
-
*
|
|
28
|
-
* @private
|
|
29
|
-
* @method bower
|
|
30
|
-
* @param {String} subcommand The subcommand to be passed into bower.
|
|
31
|
-
* @param {String} [...arguments] Arguments to be passed into the bower subcommand.
|
|
32
|
-
* @param {Object} [options={}] The options passed into child_process.spawnSync.
|
|
33
|
-
* (https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options)
|
|
34
|
-
*/
|
|
35
|
-
let bower = new CommandGenerator('bower');
|
|
36
|
-
|
|
37
25
|
/**
|
|
38
26
|
* The `npm` command helper.
|
|
39
27
|
*
|
|
@@ -61,7 +49,6 @@ let yarn = new CommandGenerator('yarn');
|
|
|
61
49
|
// This lookup exists to make it possible to look the commands up based upon context.
|
|
62
50
|
let originals;
|
|
63
51
|
let commands = {
|
|
64
|
-
bower,
|
|
65
52
|
npm,
|
|
66
53
|
yarn,
|
|
67
54
|
};
|
|
@@ -69,17 +56,14 @@ let commands = {
|
|
|
69
56
|
// The definition list of translation terms.
|
|
70
57
|
let lookups = {
|
|
71
58
|
manifest: {
|
|
72
|
-
bower: 'bower.json',
|
|
73
59
|
npm: 'package.json',
|
|
74
60
|
yarn: 'package.json',
|
|
75
61
|
},
|
|
76
62
|
path: {
|
|
77
|
-
bower: 'bower_components',
|
|
78
63
|
npm: 'node_modules',
|
|
79
64
|
yarn: 'node_modules',
|
|
80
65
|
},
|
|
81
66
|
upgrade: {
|
|
82
|
-
bower: 'update',
|
|
83
67
|
npm: 'install',
|
|
84
68
|
yarn: 'upgrade',
|
|
85
69
|
},
|
|
@@ -92,7 +76,7 @@ let lookups = {
|
|
|
92
76
|
*
|
|
93
77
|
* @private
|
|
94
78
|
* @method translate
|
|
95
|
-
* @param {String} type Either '
|
|
79
|
+
* @param {String} type Either 'npm' or 'yarn'.
|
|
96
80
|
* @param {String} lookup Either 'manifest', 'path', or 'upgrade'.
|
|
97
81
|
*/
|
|
98
82
|
function translate(type, lookup) {
|
|
@@ -217,7 +201,6 @@ function translate(type, lookup) {
|
|
|
217
201
|
* is "best effort" only. Be sure to review upstream behavior to identify if you
|
|
218
202
|
* rely on those features for your code to function:
|
|
219
203
|
*
|
|
220
|
-
* - [bower](https://github.com/bower/bower/blob/master/lib/commands/link.js)
|
|
221
204
|
* - [npm](https://github.com/npm/npm/blob/latest/lib/link.js)
|
|
222
205
|
* - [yarn](https://github.com/yarnpkg/yarn/blob/master/src/cli/commands/link.js)
|
|
223
206
|
*
|
|
@@ -570,7 +553,7 @@ module.exports = class PackageCache {
|
|
|
570
553
|
}
|
|
571
554
|
|
|
572
555
|
_canUpgrade(label, type) {
|
|
573
|
-
return type === '
|
|
556
|
+
return type === 'yarn' && fs.existsSync(path.join(this.dirs[label], 'yarn.lock'));
|
|
574
557
|
}
|
|
575
558
|
|
|
576
559
|
// PUBLIC API BELOW
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const stringUtil = require('ember-cli-string-utils');
|
|
4
|
-
const { deprecate } = require('../../lib/debug');
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
description: 'Generates an ES6 module shim for global libraries.',
|
|
8
|
-
|
|
9
|
-
beforeInstall() {
|
|
10
|
-
deprecate('The `vendor-shim` blueprint is deprecated. Please use `ember-auto-import` instead.', false, {
|
|
11
|
-
for: 'ember-cli',
|
|
12
|
-
id: 'ember-cli.vendor-shim-blueprint',
|
|
13
|
-
since: {
|
|
14
|
-
available: '4.6.0',
|
|
15
|
-
enabled: '4.6.0',
|
|
16
|
-
},
|
|
17
|
-
until: '5.0.0',
|
|
18
|
-
});
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
locals(options) {
|
|
22
|
-
let entity = options.entity;
|
|
23
|
-
let rawName = entity.name;
|
|
24
|
-
let name = stringUtil.dasherize(rawName);
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
name,
|
|
28
|
-
};
|
|
29
|
-
},
|
|
30
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
module.exports = function processModulesOnly(tree, annotation) {
|
|
4
|
-
const ResolveModulePaths = require('amd-name-resolver/relative-module-paths');
|
|
5
|
-
|
|
6
|
-
let options = {
|
|
7
|
-
plugins: [
|
|
8
|
-
[require.resolve('babel-plugin-module-resolver'), { resolvePath: ResolveModulePaths.resolveRelativeModulePath }],
|
|
9
|
-
[require.resolve('@babel/plugin-transform-modules-amd'), { noInterop: true }],
|
|
10
|
-
],
|
|
11
|
-
moduleIds: true,
|
|
12
|
-
getModuleId: ResolveModulePaths.getRelativeModulePath,
|
|
13
|
-
annotation,
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const Babel = require('broccoli-babel-transpiler');
|
|
17
|
-
return new Babel(tree, options);
|
|
18
|
-
};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const logger = require('heimdalljs-logger')('ember-cli:installation-checker');
|
|
4
|
-
const fs = require('fs-extra');
|
|
5
|
-
const path = require('path');
|
|
6
|
-
const SilentError = require('silent-error');
|
|
7
|
-
|
|
8
|
-
class InstallationChecker {
|
|
9
|
-
constructor(options) {
|
|
10
|
-
this.project = options.project;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Check if npm and bower installation directories are present,
|
|
15
|
-
* and raise an error message with instructions on how to proceed.
|
|
16
|
-
*
|
|
17
|
-
* If some of these package managers aren't being used in the project
|
|
18
|
-
* we just ignore them. Their usage is considered by checking the
|
|
19
|
-
* presence of your manifest files: package.json for npm and bower.json for bower.
|
|
20
|
-
*
|
|
21
|
-
* @method checkInstallations
|
|
22
|
-
*/
|
|
23
|
-
checkInstallations() {
|
|
24
|
-
let commands = [];
|
|
25
|
-
|
|
26
|
-
if (this.usingNpm() && this.npmDependenciesNotPresent()) {
|
|
27
|
-
logger.info('npm dependencies not installed');
|
|
28
|
-
const command = this.usingYarn() ? '`yarn`' : '`npm install`';
|
|
29
|
-
commands.push(command);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (this.usingBower() && this.bowerDependenciesNotPresent()) {
|
|
33
|
-
logger.info('bower dependencies not installed');
|
|
34
|
-
commands.push('`bower install`');
|
|
35
|
-
}
|
|
36
|
-
if (commands.length) {
|
|
37
|
-
let commandText = commands.join(' and ');
|
|
38
|
-
throw new SilentError(`No dependencies installed. Run ${commandText} to install missing dependencies.`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
hasBowerDeps() {
|
|
43
|
-
return hasDependencies(readJSON(path.join(this.project.root, 'bower.json')));
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
usingBower() {
|
|
47
|
-
return fs.existsSync(path.join(this.project.root, 'bower.json')) && this.hasBowerDeps();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
bowerDependenciesNotPresent() {
|
|
51
|
-
return !fs.existsSync(this.project._bowerDirectory);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
hasNpmDeps() {
|
|
55
|
-
return hasDependencies(readJSON(path.join(this.project.root, 'package.json')));
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
usingNpm() {
|
|
59
|
-
return this.fileExistsInRoot('package.json') && this.hasNpmDeps();
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
usingYarn() {
|
|
63
|
-
return this.fileExistsInRoot('yarn.lock') && this.hasNpmDeps();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
fileExistsInRoot(fileName) {
|
|
67
|
-
return fs.existsSync(path.join(this.project.root, fileName));
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
npmDependenciesNotPresent() {
|
|
71
|
-
return !this.project.hasDependencies();
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
module.exports = InstallationChecker;
|
|
76
|
-
|
|
77
|
-
function hasDependencies(pkg) {
|
|
78
|
-
return (pkg.dependencies && pkg.dependencies.length) || (pkg.devDependencies && pkg.devDependencies.length);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function readJSON(path) {
|
|
82
|
-
try {
|
|
83
|
-
return fs.readJsonSync(path);
|
|
84
|
-
} catch (e) {
|
|
85
|
-
throw new SilentError(`InstallationChecker: Unable to parse: ${path}`);
|
|
86
|
-
}
|
|
87
|
-
}
|