ember-cli 4.1.0 → 4.2.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 +8 -4
- package/CHANGELOG.md +34 -0
- package/README.md +1 -1
- package/bin/ember +0 -0
- package/blueprints/addon/additional-dev-dependencies.json +1 -1
- package/blueprints/addon/files/.github/workflows/ci.yml +0 -1
- package/blueprints/addon/files/.travis.yml +0 -1
- package/blueprints/addon/files/CONTRIBUTING.md +1 -1
- package/blueprints/addon/files/addon-config/ember-try.js +0 -13
- package/blueprints/app/files/README.md +2 -2
- package/blueprints/app/files/config/environment.js +1 -1
- package/blueprints/app/files/package.json +12 -12
- package/blueprints/in-repo-addon/files/__root__/__name__/index.js +0 -0
- package/blueprints/in-repo-addon/index.js +0 -0
- package/blueprints/lib/index.js +0 -0
- package/docs/build/data.json +472 -411
- package/lib/debug/assert.js +37 -0
- package/lib/debug/deprecate.js +111 -0
- package/lib/debug/index.js +6 -0
- package/package.json +10 -10
- package/tests/helpers/mock-project.js +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Verify that a certain condition is met, or throw an error if otherwise.
|
|
5
|
+
*
|
|
6
|
+
* This is useful for communicating expectations in the code to other human
|
|
7
|
+
* readers as well as catching bugs that accidentally violate these expectations.
|
|
8
|
+
*
|
|
9
|
+
* ```js
|
|
10
|
+
* const { assert } = require('ember-cli/lib/debug');
|
|
11
|
+
*
|
|
12
|
+
* // Test for truthiness:
|
|
13
|
+
* assert('Must pass a string.', typeof str === 'string');
|
|
14
|
+
*
|
|
15
|
+
* // Fail unconditionally:
|
|
16
|
+
* assert('This code path should never run.');
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @method assert
|
|
20
|
+
* @param {String} description Describes the condition.
|
|
21
|
+
* This will become the message of the error thrown if the assertion fails.
|
|
22
|
+
* @param {Any} condition Must be truthy for the assertion to pass.
|
|
23
|
+
* If falsy, an error will be thrown.
|
|
24
|
+
*/
|
|
25
|
+
function assert(description, condition) {
|
|
26
|
+
if (!description) {
|
|
27
|
+
throw new Error('When calling `assert`, you must provide a description as the first argument.');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (condition) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
throw new Error(`ASSERTION FAILED: ${description}`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = assert;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
const semver = require('semver');
|
|
5
|
+
const assert = require('./assert');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Display a deprecation message.
|
|
9
|
+
*
|
|
10
|
+
* ```js
|
|
11
|
+
* const { deprecate } = require('ember-cli/lib/debug');
|
|
12
|
+
*
|
|
13
|
+
* deprecate('The `foo` method is deprecated.', false, {
|
|
14
|
+
* for: 'ember-cli',
|
|
15
|
+
* id: 'ember-cli.foo-method',
|
|
16
|
+
* since: {
|
|
17
|
+
* available: '4.1.0',
|
|
18
|
+
* enabled: '4.2.0',
|
|
19
|
+
* },
|
|
20
|
+
* until: '5.0.0',
|
|
21
|
+
* url: 'https://example.com',
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @method deprecate
|
|
26
|
+
* @param {String} description Describes the deprecation.
|
|
27
|
+
* @param {Any} condition If falsy, the deprecation message will be displayed.
|
|
28
|
+
* @param {Object} options An object including the deprecation's details:
|
|
29
|
+
* - `for` The library that the deprecation is for
|
|
30
|
+
* - `id` The deprecation's unique id
|
|
31
|
+
* - `since.available` A SemVer version indicating when the deprecation was made available
|
|
32
|
+
* - `since.enabled` A SemVer version indicating when the deprecation was enabled
|
|
33
|
+
* - `until` A SemVer version indicating until when the deprecation will be active
|
|
34
|
+
* - `url` A URL that refers to additional information about the deprecation
|
|
35
|
+
*/
|
|
36
|
+
function deprecate(description, condition, options) {
|
|
37
|
+
assert('When calling `deprecate`, you must provide a description as the first argument.', description);
|
|
38
|
+
assert('When calling `deprecate`, you must provide a condition as the second argument.', arguments.length > 1);
|
|
39
|
+
|
|
40
|
+
assert(
|
|
41
|
+
'When calling `deprecate`, you must provide an options object as the third argument. The options object must include the `for`, `id`, `since` and `until` options (`url` is optional).',
|
|
42
|
+
options
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
assert('When calling `deprecate`, you must provide the `for` option.', options.for);
|
|
46
|
+
assert('When calling `deprecate`, you must provide the `id` option.', options.id);
|
|
47
|
+
|
|
48
|
+
assert(
|
|
49
|
+
'When calling `deprecate`, you must provide the `since` option. `since` must include the `available` and/or the `enabled` option.',
|
|
50
|
+
options.since
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
assert(
|
|
54
|
+
'When calling `deprecate`, you must provide the `since.available` and/or the `since.enabled` option.',
|
|
55
|
+
options.since.available || options.since.enabled
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
assert(
|
|
59
|
+
'`since.available` must be a valid SemVer version.',
|
|
60
|
+
!options.since.available || isSemVer(options.since.available)
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
assert('`since.enabled` must be a valid SemVer version.', !options.since.enabled || isSemVer(options.since.enabled));
|
|
64
|
+
|
|
65
|
+
assert(
|
|
66
|
+
'When calling `deprecate`, you must provide a valid SemVer version for the `until` option.',
|
|
67
|
+
isSemVer(options.until)
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
if (condition) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
let message = formatMessage(description, options);
|
|
75
|
+
|
|
76
|
+
warn(message);
|
|
77
|
+
warn(getStackTrace());
|
|
78
|
+
|
|
79
|
+
// Return the message for testing purposes.
|
|
80
|
+
// This can be removed once we can register deprecation handlers.
|
|
81
|
+
return message;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function isSemVer(version) {
|
|
85
|
+
return semver.valid(version) !== null;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function formatMessage(description, options) {
|
|
89
|
+
let message = [`DEPRECATION: ${description}`, `[ID: ${options.id}]`];
|
|
90
|
+
|
|
91
|
+
if (options.url) {
|
|
92
|
+
message.push(`See ${options.url} for more details.`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return message.join(' ');
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function getStackTrace() {
|
|
99
|
+
let error = new Error();
|
|
100
|
+
let lines = error.stack.split('\n');
|
|
101
|
+
|
|
102
|
+
lines.shift(); // Remove the word `Error`.
|
|
103
|
+
|
|
104
|
+
return lines.map((line) => line.trim()).join('\n');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function warn(message) {
|
|
108
|
+
console.warn(chalk.yellow(message));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
module.exports = deprecate;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-cli",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Command line tool for developing ambitious ember.js apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"ember.js",
|
|
13
13
|
"kit"
|
|
14
14
|
],
|
|
15
|
-
"homepage": "https://
|
|
15
|
+
"homepage": "https://cli.emberjs.com/release/",
|
|
16
16
|
"bugs": {
|
|
17
17
|
"url": "https://github.com/ember-cli/ember-cli/issues"
|
|
18
18
|
},
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"test:slow": "node --unhandled-rejections=strict tests/runner slow"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@babel/core": "^7.16.
|
|
41
|
-
"@babel/plugin-transform-modules-amd": "^7.
|
|
40
|
+
"@babel/core": "^7.16.7",
|
|
41
|
+
"@babel/plugin-transform-modules-amd": "^7.16.7",
|
|
42
42
|
"amd-name-resolver": "^1.3.1",
|
|
43
43
|
"babel-plugin-module-resolver": "^4.1.0",
|
|
44
44
|
"bower-config": "^1.4.3",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"ensure-posix-path": "^1.1.1",
|
|
79
79
|
"execa": "^5.1.1",
|
|
80
80
|
"exit": "^0.1.2",
|
|
81
|
-
"express": "^4.17.
|
|
81
|
+
"express": "^4.17.2",
|
|
82
82
|
"filesize": "^8.0.6",
|
|
83
83
|
"find-up": "^5.0.0",
|
|
84
84
|
"find-yarn-workspace-root": "^2.0.0",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"sort-package-json": "^1.49.0",
|
|
121
121
|
"symlink-or-copy": "^1.3.1",
|
|
122
122
|
"temp": "0.9.4",
|
|
123
|
-
"testem": "^3.
|
|
123
|
+
"testem": "^3.6.0",
|
|
124
124
|
"tiny-lr": "^2.0.0",
|
|
125
125
|
"tree-sync": "^2.1.0",
|
|
126
126
|
"uuid": "^8.3.2",
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
"chai-jest-snapshot": "^2.0.0",
|
|
141
141
|
"ember-cli-blueprint-test-helpers": "^0.19.2",
|
|
142
142
|
"ember-cli-internal-test-helpers": "^0.9.1",
|
|
143
|
-
"eslint": "^
|
|
143
|
+
"eslint": "^8.6.0",
|
|
144
144
|
"eslint-config-prettier": "^7.2.0",
|
|
145
145
|
"eslint-plugin-chai-expect": "^3.0.0",
|
|
146
146
|
"eslint-plugin-mocha": "^9.0.0",
|
|
@@ -149,15 +149,15 @@
|
|
|
149
149
|
"fixturify": "^2.1.0",
|
|
150
150
|
"jsdom": "^19.0.0",
|
|
151
151
|
"latest-version": "^5.1.0",
|
|
152
|
-
"mocha": "^
|
|
152
|
+
"mocha": "^9.1.3",
|
|
153
153
|
"nock": "^13.2.1",
|
|
154
154
|
"nyc": "^15.1.0",
|
|
155
155
|
"prettier": "2.5.1",
|
|
156
|
-
"release-it": "^14.11.
|
|
156
|
+
"release-it": "^14.11.8",
|
|
157
157
|
"rimraf": "^3.0.2",
|
|
158
158
|
"strip-ansi": "^6.0.0",
|
|
159
159
|
"supertest": "^6.1.6",
|
|
160
|
-
"testdouble": "^3.16.
|
|
160
|
+
"testdouble": "^3.16.4",
|
|
161
161
|
"tmp": "^0.2.1",
|
|
162
162
|
"websocket": "^1.0.32",
|
|
163
163
|
"which": "2.0.2",
|