ember-cli 4.12.0-beta.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 +47 -3
- package/CONTRIBUTING.md +1 -1
- package/bin/ember +0 -0
- 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 +16 -16
- 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/blueprints/server/index.js +0 -27
- package/docs/build/data.json +628 -812
- 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
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// Runs `bower install` in cwd
|
|
4
|
-
const fs = require('fs-extra');
|
|
5
|
-
const path = require('path');
|
|
6
|
-
const execa = require('../utilities/execa');
|
|
7
|
-
const util = require('util');
|
|
8
|
-
const SilentError = require('silent-error');
|
|
9
|
-
const Task = require('../models/task');
|
|
10
|
-
const formatPackageList = require('../utilities/format-package-list');
|
|
11
|
-
|
|
12
|
-
const logger = require('heimdalljs-logger')('ember-cli:tasks:bower-install');
|
|
13
|
-
|
|
14
|
-
const resolve = util.promisify(require('resolve'));
|
|
15
|
-
|
|
16
|
-
const cliPath = path.resolve(`${__dirname}/../..`);
|
|
17
|
-
|
|
18
|
-
class BowerInstallTask extends Task {
|
|
19
|
-
resolveBower() {
|
|
20
|
-
logger.info('Resolving "bower" from %s ...', cliPath);
|
|
21
|
-
return resolve('bower', { basedir: cliPath });
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
importBower(path) {
|
|
25
|
-
logger.info('Importing "bower" from: %s', path);
|
|
26
|
-
this.bower = require(path);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
ensureBower() {
|
|
30
|
-
if (this.bower) {
|
|
31
|
-
return Promise.resolve();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return this.resolveBower()
|
|
35
|
-
.catch((error) => {
|
|
36
|
-
if (error.message.indexOf("Cannot find module 'bower'") === -1) {
|
|
37
|
-
throw error;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return this.installBower().then(() => this.resolveBower());
|
|
41
|
-
})
|
|
42
|
-
.then((bowerPath) => this.importBower(bowerPath));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
installBower() {
|
|
46
|
-
logger.info('Installing "bower" via npm into: %s', cliPath);
|
|
47
|
-
|
|
48
|
-
let ui = this.ui;
|
|
49
|
-
const chalk = require('chalk');
|
|
50
|
-
|
|
51
|
-
ui.startProgress(chalk.green('npm: Installing bower ...'));
|
|
52
|
-
|
|
53
|
-
return execa('npm', ['install', 'bower@^1.3.12'], { cwd: cliPath })
|
|
54
|
-
.finally(() => ui.stopProgress())
|
|
55
|
-
.catch((error) => this.handleInstallBowerError(error))
|
|
56
|
-
.then(() => ui.writeLine(chalk.green('npm: Installed bower')));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
handleInstallBowerError(error) {
|
|
60
|
-
if (error.message.indexOf("Cannot read property 'target' of null") !== -1) {
|
|
61
|
-
throw new SilentError(
|
|
62
|
-
'Bower could not be installed due to a bug in your npm installation.\n' +
|
|
63
|
-
'Please update your npm version by running: npm install -g npm'
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
throw error;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
get bowerJsonPath() {
|
|
71
|
-
return path.join(this.project.root, 'bower.json');
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
hasBowerJson() {
|
|
75
|
-
return fs.existsSync(this.bowerJsonPath);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
hasBowerDependencies() {
|
|
79
|
-
if (!this.hasBowerJson()) {
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
let json = fs.readJsonSync(this.bowerJsonPath);
|
|
84
|
-
let deps = Object.keys(json.dependencies || {});
|
|
85
|
-
let devDeps = Object.keys(json.devDependencies || {});
|
|
86
|
-
return deps.length || devDeps.length;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
ensureBowerJson() {
|
|
90
|
-
if (this.hasBowerJson()) {
|
|
91
|
-
return Promise.resolve();
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
let projectName = this.project.name();
|
|
95
|
-
let bowerJsonPath = this.bowerJsonPath;
|
|
96
|
-
|
|
97
|
-
logger.info('Creating "bower.json" for: %s at: %s', projectName, bowerJsonPath);
|
|
98
|
-
|
|
99
|
-
return fs.writeJson(bowerJsonPath, { name: projectName }, { spaces: 2 });
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// Options: Boolean verbose
|
|
103
|
-
run(options) {
|
|
104
|
-
let ui = this.ui;
|
|
105
|
-
|
|
106
|
-
let packages = options.packages || [];
|
|
107
|
-
let installOptions = options.installOptions || {};
|
|
108
|
-
let savePackages = installOptions.save || installOptions.saveDev;
|
|
109
|
-
|
|
110
|
-
// if we are running "bower install" from "ember init" and there is
|
|
111
|
-
// no "bower.json" we return early
|
|
112
|
-
if (!savePackages && !this.hasBowerDependencies()) {
|
|
113
|
-
logger.info('Skipping "bower install" since "bower.json" does not exist or is empty');
|
|
114
|
-
return Promise.resolve();
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// resolve "bower" and install via npm if necessary
|
|
118
|
-
// -> then check if a "bower.json" file exists and create if necessary
|
|
119
|
-
// -> then run the actual "bower install"
|
|
120
|
-
return this.ensureBower()
|
|
121
|
-
.then(() => this.ensureBowerJson())
|
|
122
|
-
.then(() => {
|
|
123
|
-
const chalk = require('chalk');
|
|
124
|
-
let bowerConfig = this.bowerConfig || require('bower-config');
|
|
125
|
-
|
|
126
|
-
let startMessage = this.formatStartMessage(packages);
|
|
127
|
-
let completeMessage = this.formatCompleteMessage(packages);
|
|
128
|
-
|
|
129
|
-
logger.info('Installing %j via Bower with options: %j', packages, installOptions);
|
|
130
|
-
|
|
131
|
-
ui.startProgress(chalk.green(startMessage));
|
|
132
|
-
|
|
133
|
-
let config = bowerConfig.read();
|
|
134
|
-
config.interactive = true;
|
|
135
|
-
|
|
136
|
-
return new Promise((resolve, reject) => {
|
|
137
|
-
this.bower.commands
|
|
138
|
-
.install(packages, installOptions, config) // Packages, options, config
|
|
139
|
-
.on('log', logBowerMessage)
|
|
140
|
-
.on('prompt', ui.prompt.bind(ui))
|
|
141
|
-
.on('error', reject)
|
|
142
|
-
.on('end', resolve);
|
|
143
|
-
})
|
|
144
|
-
.finally(() => ui.stopProgress())
|
|
145
|
-
.then(() => ui.writeLine(chalk.green(completeMessage)));
|
|
146
|
-
|
|
147
|
-
function logBowerMessage(message) {
|
|
148
|
-
if (message.level === 'conflict') {
|
|
149
|
-
// e.g.
|
|
150
|
-
// conflict Unable to find suitable version for ember-data
|
|
151
|
-
// 1) ember-data 1.0.0-beta.6
|
|
152
|
-
// 2) ember-data ~1.0.0-beta.7
|
|
153
|
-
ui.writeLine(` ${chalk.red('conflict')} ${message.message}`);
|
|
154
|
-
message.data.picks.forEach((pick, index) => {
|
|
155
|
-
ui.writeLine(` ${chalk.green(`${index + 1})`)} ${message.data.name} ${pick.endpoint.target}`);
|
|
156
|
-
});
|
|
157
|
-
} else if (message.level === 'info' && options.verbose) {
|
|
158
|
-
// e.g.
|
|
159
|
-
// cached git://example.com/some-package.git#1.0.0
|
|
160
|
-
ui.writeLine(` ${chalk.green(message.id)} ${message.message}`);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
formatStartMessage(packages) {
|
|
167
|
-
return `Bower: Installing ${formatPackageList(packages)} ...`;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
formatCompleteMessage(packages) {
|
|
171
|
-
return `Bower: Installed ${formatPackageList(packages)}`;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
module.exports = BowerInstallTask;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
module.exports = function emberCLIBabelConfigKey(emberCLIBabelInstance) {
|
|
4
|
-
// future versions of ember-cli-babel will be moving the location for its
|
|
5
|
-
// own configuration options out of `babel` and will be issuing a deprecation
|
|
6
|
-
// if used in the older way
|
|
7
|
-
//
|
|
8
|
-
// see: https://github.com/babel/ember-cli-babel/pull/105
|
|
9
|
-
let emberCLIBabelConfigKey = (emberCLIBabelInstance && emberCLIBabelInstance.configKey) || 'babel';
|
|
10
|
-
|
|
11
|
-
return emberCLIBabelConfigKey;
|
|
12
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
let HAS_FOUND_ADDON_BY_NAME = Object.create(null);
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
Finds an addon given a specific name.
|
|
7
|
-
|
|
8
|
-
The `name` value in an addon's `package.json` file takes priority over the
|
|
9
|
-
`name` value in an addon's `index.js` file.
|
|
10
|
-
*/
|
|
11
|
-
module.exports = function findAddonByName(addons, name) {
|
|
12
|
-
let exactMatchFromPkg = addons.find((addon) => addon.pkg && addon.pkg.name === name);
|
|
13
|
-
|
|
14
|
-
if (exactMatchFromPkg) {
|
|
15
|
-
return exactMatchFromPkg;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
let exactMatchFromIndex = addons.find((addon) => addon.name === name);
|
|
19
|
-
if (exactMatchFromIndex) {
|
|
20
|
-
let pkg = exactMatchFromIndex.pkg;
|
|
21
|
-
|
|
22
|
-
if (HAS_FOUND_ADDON_BY_NAME[name] !== true) {
|
|
23
|
-
HAS_FOUND_ADDON_BY_NAME[name] = true;
|
|
24
|
-
console.warn(
|
|
25
|
-
`The addon at \`${exactMatchFromIndex.root}\` has different values in its addon index.js ('${
|
|
26
|
-
exactMatchFromIndex.name
|
|
27
|
-
}') and its package.json ('${pkg && pkg.name}').`
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return exactMatchFromIndex;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return null;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
module.exports._clearCaches = function () {
|
|
38
|
-
HAS_FOUND_ADDON_BY_NAME = Object.create(null);
|
|
39
|
-
};
|