ember-cli 5.3.0 → 5.4.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/CHANGELOG.md +19 -0
- package/RELEASE.md +46 -0
- package/bin/ember +0 -0
- package/blueprints/addon/additional-package.json +1 -1
- package/blueprints/addon/files/.github/workflows/ci.yml +6 -7
- package/blueprints/addon/files/.travis.yml +1 -2
- package/blueprints/addon/files/README.md +3 -3
- package/blueprints/addon/files/addon-config/ember-try.js +0 -8
- package/blueprints/addon/index.js +6 -6
- package/blueprints/app/files/.ember-cli +0 -8
- package/blueprints/app/files/.github/workflows/ci.yml +2 -2
- package/blueprints/app/files/.travis.yml +1 -1
- package/blueprints/app/files/package.json +50 -50
- package/blueprints/app/index.js +5 -5
- package/blueprints/http-mock/index.js +0 -1
- package/blueprints/http-proxy/index.js +0 -1
- 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 +458 -555
- package/lib/cli/cli.js +0 -8
- package/lib/cli/index.js +4 -53
- package/lib/commands/addon.js +5 -2
- package/lib/commands/init.js +17 -13
- package/lib/commands/install.js +8 -7
- package/lib/commands/new.js +6 -5
- package/lib/models/blueprint.js +1 -2
- package/lib/models/command.js +44 -50
- package/lib/models/watcher.js +0 -21
- package/lib/tasks/addon-install.js +1 -6
- package/lib/tasks/build-watch.js +0 -1
- package/lib/tasks/build.js +1 -21
- package/lib/tasks/generate-from-blueprint.js +0 -1
- package/lib/tasks/install-blueprint.js +0 -1
- package/lib/tasks/interactive-new.js +1 -1
- package/lib/tasks/npm-install.js +1 -2
- package/lib/tasks/npm-task.js +3 -6
- package/lib/tasks/serve.js +0 -3
- package/lib/tasks/server/express-server.js +0 -2
- package/lib/tasks/server/livereload-server.js +1 -12
- package/lib/utilities/get-lang-arg.js +3 -4
- package/lib/utilities/lint-fix.js +1 -2
- package/lib/utilities/package-managers.js +47 -0
- package/package.json +3 -7
- package/tests/helpers/acceptance.js +1 -1
- package/tests/helpers/ember.js +1 -4
- package/lib/utilities/get-package-manager-from-flags.js +0 -38
- package/lib/utilities/is-pnpm-project.js +0 -27
- package/lib/utilities/is-yarn-project.js +0 -26
- package/tests/helpers/mock-analytics.js +0 -23
package/lib/cli/cli.js
CHANGED
|
@@ -32,12 +32,6 @@ class CLI {
|
|
|
32
32
|
*/
|
|
33
33
|
this.ui = options.ui;
|
|
34
34
|
|
|
35
|
-
/**
|
|
36
|
-
* @private
|
|
37
|
-
* @property analytics
|
|
38
|
-
*/
|
|
39
|
-
this.analytics = options.analytics;
|
|
40
|
-
|
|
41
35
|
/**
|
|
42
36
|
* @private
|
|
43
37
|
* @property testing
|
|
@@ -107,7 +101,6 @@ class CLI {
|
|
|
107
101
|
*/
|
|
108
102
|
let command = new CurrentCommand({
|
|
109
103
|
ui: this.ui,
|
|
110
|
-
analytics: this.analytics,
|
|
111
104
|
commands: this._environment.commands,
|
|
112
105
|
tasks: this._environment.tasks,
|
|
113
106
|
project: this._environment.project,
|
|
@@ -248,7 +241,6 @@ class CLI {
|
|
|
248
241
|
|
|
249
242
|
let help = new HelpCommand({
|
|
250
243
|
ui: this.ui,
|
|
251
|
-
analytics: this.analytics,
|
|
252
244
|
commands: environment.commands,
|
|
253
245
|
tasks: environment.tasks,
|
|
254
246
|
project: environment.project,
|
package/lib/cli/index.js
CHANGED
|
@@ -17,16 +17,10 @@ if (instrumentation.instrumentationEnabled()) {
|
|
|
17
17
|
|
|
18
18
|
// Main entry point
|
|
19
19
|
const requireAsHash = require('../utilities/require-as-hash');
|
|
20
|
-
const packageConfig = require('../../package.json');
|
|
21
|
-
const logger = require('heimdalljs-logger')('ember-cli:cli/index');
|
|
22
20
|
const { merge } = require('ember-cli-lodash-subset');
|
|
23
21
|
const path = require('path');
|
|
24
22
|
const heimdall = require('heimdalljs');
|
|
25
23
|
|
|
26
|
-
let version = packageConfig.version;
|
|
27
|
-
let name = packageConfig.name;
|
|
28
|
-
let trackingCode = packageConfig.trackingCode;
|
|
29
|
-
|
|
30
24
|
function loadCommands() {
|
|
31
25
|
let token = heimdall.start('load-commands');
|
|
32
26
|
const Command = require('../models/command');
|
|
@@ -43,20 +37,6 @@ function loadTasks() {
|
|
|
43
37
|
return hash;
|
|
44
38
|
}
|
|
45
39
|
|
|
46
|
-
function clientId() {
|
|
47
|
-
const ConfigStore = require('configstore');
|
|
48
|
-
let configStore = new ConfigStore('ember-cli');
|
|
49
|
-
let id = configStore.get('client-id');
|
|
50
|
-
|
|
51
|
-
if (id) {
|
|
52
|
-
return id;
|
|
53
|
-
} else {
|
|
54
|
-
id = require('uuid').v4().toString();
|
|
55
|
-
configStore.set('client-id', id);
|
|
56
|
-
return id;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
40
|
function configureLogger(env) {
|
|
61
41
|
let depth = Number(env['DEBUG_DEPTH']);
|
|
62
42
|
if (depth) {
|
|
@@ -74,7 +54,6 @@ module.exports = async function (options) {
|
|
|
74
54
|
try {
|
|
75
55
|
let UI = options.UI || require('console-ui');
|
|
76
56
|
const CLI = require('./cli');
|
|
77
|
-
let Leek = options.Leek || require('leek');
|
|
78
57
|
const Project = require('../models/project');
|
|
79
58
|
let config = getConfig(options.Yam);
|
|
80
59
|
|
|
@@ -90,40 +69,8 @@ module.exports = async function (options) {
|
|
|
90
69
|
writeLevel: process.argv.indexOf('--silent') !== -1 ? 'ERROR' : undefined,
|
|
91
70
|
});
|
|
92
71
|
|
|
93
|
-
let leekOptions;
|
|
94
|
-
|
|
95
|
-
let disableAnalytics =
|
|
96
|
-
(options.cliArgs &&
|
|
97
|
-
(options.cliArgs.indexOf('--disable-analytics') > -1 ||
|
|
98
|
-
options.cliArgs.indexOf('-v') > -1 ||
|
|
99
|
-
options.cliArgs.indexOf('--version') > -1)) ||
|
|
100
|
-
config.get('disableAnalytics');
|
|
101
|
-
|
|
102
|
-
let defaultLeekOptions = {
|
|
103
|
-
trackingCode,
|
|
104
|
-
globalName: name,
|
|
105
|
-
name: clientId(),
|
|
106
|
-
version,
|
|
107
|
-
silent: disableAnalytics,
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
let defaultUpdateCheckerOptions = {
|
|
111
|
-
checkForUpdates: false,
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
if (config.get('leekOptions')) {
|
|
115
|
-
leekOptions = merge(defaultLeekOptions, config.get('leekOptions'));
|
|
116
|
-
} else {
|
|
117
|
-
leekOptions = defaultLeekOptions;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
logger.info('leek: %o', leekOptions);
|
|
121
|
-
|
|
122
|
-
let leek = new Leek(leekOptions);
|
|
123
|
-
|
|
124
72
|
let cli = new CLI({
|
|
125
73
|
ui,
|
|
126
|
-
analytics: leek,
|
|
127
74
|
testing: options.testing,
|
|
128
75
|
name: options.cli ? options.cli.name : 'ember',
|
|
129
76
|
disableDependencyChecker: options.disableDependencyChecker,
|
|
@@ -134,6 +81,10 @@ module.exports = async function (options) {
|
|
|
134
81
|
|
|
135
82
|
let project = Project.projectOrnullProject(ui, cli);
|
|
136
83
|
|
|
84
|
+
let defaultUpdateCheckerOptions = {
|
|
85
|
+
checkForUpdates: false,
|
|
86
|
+
};
|
|
87
|
+
|
|
137
88
|
let environment = {
|
|
138
89
|
tasks: loadTasks(),
|
|
139
90
|
cliArgs: options.cliArgs,
|
package/lib/commands/addon.js
CHANGED
|
@@ -13,8 +13,11 @@ module.exports = NewCommand.extend({
|
|
|
13
13
|
{ name: 'blueprint', type: String, default: 'addon', aliases: ['b'] },
|
|
14
14
|
{ name: 'skip-npm', type: Boolean, default: false, aliases: ['sn'] },
|
|
15
15
|
{ name: 'skip-git', type: Boolean, default: false, aliases: ['sg'] },
|
|
16
|
-
{
|
|
17
|
-
|
|
16
|
+
{
|
|
17
|
+
name: 'package-manager',
|
|
18
|
+
type: ['npm', 'pnpm', 'yarn'],
|
|
19
|
+
aliases: [{ npm: 'npm' }, { pnpm: 'pnpm' }, { yarn: 'yarn' }],
|
|
20
|
+
},
|
|
18
21
|
{ name: 'directory', type: String, aliases: ['dir'] },
|
|
19
22
|
{
|
|
20
23
|
name: 'lang',
|
package/lib/commands/init.js
CHANGED
|
@@ -7,9 +7,8 @@ const chalk = require('chalk');
|
|
|
7
7
|
const isValidProjectName = require('../utilities/valid-project-name');
|
|
8
8
|
const normalizeBlueprint = require('../utilities/normalize-blueprint-option');
|
|
9
9
|
const mergeBlueprintOptions = require('../utilities/merge-blueprint-options');
|
|
10
|
-
const isYarnProject = require('../utilities/
|
|
10
|
+
const { isPnpmProject, isYarnProject } = require('../utilities/package-managers');
|
|
11
11
|
const getLangArg = require('../../lib/utilities/get-lang-arg');
|
|
12
|
-
const { getPackageManagerFromFlags } = require('../utilities/get-package-manager-from-flags');
|
|
13
12
|
|
|
14
13
|
module.exports = Command.extend({
|
|
15
14
|
name: 'init',
|
|
@@ -28,8 +27,11 @@ module.exports = Command.extend({
|
|
|
28
27
|
default: true,
|
|
29
28
|
description: 'Installs and uses {{ember-welcome-page}}. Use --no-welcome to skip it.',
|
|
30
29
|
},
|
|
31
|
-
{
|
|
32
|
-
|
|
30
|
+
{
|
|
31
|
+
name: 'package-manager',
|
|
32
|
+
type: ['npm', 'pnpm', 'yarn'],
|
|
33
|
+
aliases: [{ npm: 'npm' }, { pnpm: 'pnpm' }, { yarn: 'yarn' }],
|
|
34
|
+
},
|
|
33
35
|
{ name: 'name', type: String, default: '', aliases: ['n'] },
|
|
34
36
|
{
|
|
35
37
|
name: 'lang',
|
|
@@ -80,12 +82,16 @@ module.exports = Command.extend({
|
|
|
80
82
|
commandOptions.lang = getLangArg(commandOptions.lang, this.ui);
|
|
81
83
|
}
|
|
82
84
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
if (commandOptions.packageManager === undefined && project.isEmberCLIProject()) {
|
|
86
|
+
if (await isPnpmProject(project.root)) {
|
|
87
|
+
commandOptions.packageManager = 'pnpm';
|
|
88
|
+
} else if (isYarnProject(project.root)) {
|
|
89
|
+
commandOptions.packageManager = 'yarn';
|
|
90
|
+
}
|
|
87
91
|
}
|
|
88
92
|
|
|
93
|
+
let blueprintOpts = clone(commandOptions);
|
|
94
|
+
|
|
89
95
|
merge(blueprintOpts, {
|
|
90
96
|
rawName: packageName,
|
|
91
97
|
targetFiles: rawArgs || '',
|
|
@@ -100,12 +106,10 @@ module.exports = Command.extend({
|
|
|
100
106
|
|
|
101
107
|
await this.runTask('InstallBlueprint', blueprintOpts);
|
|
102
108
|
|
|
103
|
-
let packageManager = getPackageManagerFromFlags(commandOptions);
|
|
104
|
-
|
|
105
109
|
if (!commandOptions.skipNpm) {
|
|
106
110
|
await this.runTask('NpmInstall', {
|
|
107
111
|
verbose: commandOptions.verbose,
|
|
108
|
-
packageManager,
|
|
112
|
+
packageManager: commandOptions.packageManager,
|
|
109
113
|
});
|
|
110
114
|
}
|
|
111
115
|
|
|
@@ -117,11 +121,11 @@ module.exports = Command.extend({
|
|
|
117
121
|
|
|
118
122
|
this.ui.writeLine('');
|
|
119
123
|
this.ui.writeLine(prependEmoji('🎉', `Successfully created project ${chalk.yellow(projectName)}.`));
|
|
120
|
-
this.ui.writeLine(prependEmoji('👉
|
|
124
|
+
this.ui.writeLine(prependEmoji('👉', 'Get started by typing:'));
|
|
121
125
|
this.ui.writeLine('');
|
|
122
126
|
const command = `cd ${projectName}`;
|
|
123
127
|
this.ui.writeLine(` ${chalk.gray('$')} ${chalk.cyan(command)}`);
|
|
124
|
-
this.ui.writeLine(` ${chalk.gray('$')} ${chalk.cyan(`${packageManager ?? 'npm'} start`)}`);
|
|
128
|
+
this.ui.writeLine(` ${chalk.gray('$')} ${chalk.cyan(`${commandOptions.packageManager ?? 'npm'} start`)}`);
|
|
125
129
|
this.ui.writeLine('');
|
|
126
130
|
this.ui.writeLine('Happy coding!');
|
|
127
131
|
},
|
package/lib/commands/install.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const Command = require('../models/command');
|
|
4
4
|
const SilentError = require('silent-error');
|
|
5
|
+
const { determineInstallCommand } = require('../utilities/package-managers');
|
|
5
6
|
|
|
6
7
|
module.exports = Command.extend({
|
|
7
8
|
name: 'install',
|
|
@@ -20,18 +21,19 @@ module.exports = Command.extend({
|
|
|
20
21
|
'Use this option to force the usage of a specific package manager. ' +
|
|
21
22
|
'By default, ember-cli will try to detect the right package manager ' +
|
|
22
23
|
'from any lockfiles that exist in your project.',
|
|
23
|
-
aliases: [{
|
|
24
|
+
aliases: [{ npm: 'npm' }, { pnpm: 'pnpm' }, { yarn: 'yarn' }],
|
|
24
25
|
},
|
|
25
26
|
],
|
|
26
27
|
|
|
27
28
|
anonymousOptions: ['<addon-name>'],
|
|
28
29
|
|
|
29
|
-
run(commandOptions, addonNames) {
|
|
30
|
+
async run(commandOptions, addonNames) {
|
|
30
31
|
if (!addonNames.length) {
|
|
31
|
-
let
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
let installCommand = await determineInstallCommand(this.project.root);
|
|
33
|
+
|
|
34
|
+
throw new SilentError(
|
|
35
|
+
`An addon's name is required when running the \`install\` command. If you want to install all node modules, please run \`${installCommand}\` instead.`
|
|
36
|
+
);
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
return this.runTask('AddonInstall', {
|
|
@@ -43,7 +45,6 @@ module.exports = Command.extend({
|
|
|
43
45
|
_env() {
|
|
44
46
|
return {
|
|
45
47
|
ui: this.ui,
|
|
46
|
-
analytics: this.analytics,
|
|
47
48
|
project: this.project,
|
|
48
49
|
NpmInstallTask: this.tasks.NpmInstall,
|
|
49
50
|
BlueprintTask: this.tasks.GenerateFromBlueprint,
|
package/lib/commands/new.js
CHANGED
|
@@ -25,8 +25,11 @@ module.exports = Command.extend({
|
|
|
25
25
|
default: true,
|
|
26
26
|
description: 'Installs and uses {{ember-welcome-page}}. Use --no-welcome to skip it.',
|
|
27
27
|
},
|
|
28
|
-
{
|
|
29
|
-
|
|
28
|
+
{
|
|
29
|
+
name: 'package-manager',
|
|
30
|
+
type: ['npm', 'pnpm', 'yarn'],
|
|
31
|
+
aliases: [{ npm: 'npm' }, { pnpm: 'pnpm' }, { yarn: 'yarn' }],
|
|
32
|
+
},
|
|
30
33
|
{ name: 'directory', type: String, aliases: ['dir'] },
|
|
31
34
|
{
|
|
32
35
|
name: 'lang',
|
|
@@ -74,8 +77,7 @@ module.exports = Command.extend({
|
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
if (answers.packageManager) {
|
|
77
|
-
commandOptions.
|
|
78
|
-
commandOptions.pnpm = answers.packageManager === 'pnpm';
|
|
80
|
+
commandOptions.packageManager = answers.packageManager;
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
if (answers.ciProvider) {
|
|
@@ -110,7 +112,6 @@ module.exports = Command.extend({
|
|
|
110
112
|
|
|
111
113
|
let initCommand = new InitCommand({
|
|
112
114
|
ui: this.ui,
|
|
113
|
-
analytics: this.analytics,
|
|
114
115
|
tasks: this.tasks,
|
|
115
116
|
project: Project.nullProject(this.ui, this.cli),
|
|
116
117
|
});
|
package/lib/models/blueprint.js
CHANGED
|
@@ -1240,7 +1240,7 @@ let Blueprint = CoreObject.extend({
|
|
|
1240
1240
|
|
|
1241
1241
|
/**
|
|
1242
1242
|
Used to retrieve a task with the given name. Passes the new task
|
|
1243
|
-
the standard information available (like `ui`, `
|
|
1243
|
+
the standard information available (like `ui`, `project`, etc).
|
|
1244
1244
|
|
|
1245
1245
|
@method taskFor
|
|
1246
1246
|
@param dasherizedName
|
|
@@ -1252,7 +1252,6 @@ let Blueprint = CoreObject.extend({
|
|
|
1252
1252
|
return new Task({
|
|
1253
1253
|
ui: this.ui,
|
|
1254
1254
|
project: this.project,
|
|
1255
|
-
analytics: this.analytics,
|
|
1256
1255
|
});
|
|
1257
1256
|
},
|
|
1258
1257
|
|
package/lib/models/command.js
CHANGED
|
@@ -15,7 +15,7 @@ const WatchDetector = require('watch-detector');
|
|
|
15
15
|
const SilentError = require('silent-error');
|
|
16
16
|
const execSync = require('child_process').execSync;
|
|
17
17
|
const fs = require('fs');
|
|
18
|
-
const
|
|
18
|
+
const { determineInstallCommand } = require('../utilities/package-managers');
|
|
19
19
|
|
|
20
20
|
let cache = {};
|
|
21
21
|
|
|
@@ -197,7 +197,6 @@ let Command = CoreObject.extend({
|
|
|
197
197
|
_env(/* name */) {
|
|
198
198
|
return {
|
|
199
199
|
ui: this.ui,
|
|
200
|
-
analytics: this.analytics,
|
|
201
200
|
project: this.project,
|
|
202
201
|
testing: this.testing,
|
|
203
202
|
settings: this.settings,
|
|
@@ -257,65 +256,60 @@ let Command = CoreObject.extend({
|
|
|
257
256
|
@method validateAndRun
|
|
258
257
|
@return {Promise}
|
|
259
258
|
*/
|
|
260
|
-
validateAndRun(args) {
|
|
261
|
-
|
|
262
|
-
let commandOptions = this.parseArgs(args);
|
|
263
|
-
// if the help option was passed, resolve with 'callHelp' to call help command
|
|
264
|
-
if (commandOptions && (commandOptions.options.help || commandOptions.options.h)) {
|
|
265
|
-
logger.info(`${this.name} called with help option`);
|
|
266
|
-
return resolve('callHelp');
|
|
267
|
-
}
|
|
259
|
+
async validateAndRun(args) {
|
|
260
|
+
let commandOptions = this.parseArgs(args);
|
|
268
261
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
});
|
|
262
|
+
// If the `help` option was passed, resolve with `callHelp` to call the `help` command:
|
|
263
|
+
if (commandOptions && (commandOptions.options.help || commandOptions.options.h)) {
|
|
264
|
+
logger.info(`${this.name} called with help option`);
|
|
273
265
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
266
|
+
return 'callHelp';
|
|
267
|
+
}
|
|
277
268
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
269
|
+
if (commandOptions === null) {
|
|
270
|
+
throw new SilentError();
|
|
271
|
+
}
|
|
281
272
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
let installCommand = 'npm install';
|
|
291
|
-
if (isYarnProject(this.project.root)) {
|
|
292
|
-
installCommand = 'yarn install';
|
|
293
|
-
}
|
|
273
|
+
if (this.works === 'outsideProject' && this.isWithinProject) {
|
|
274
|
+
throw new SilentError(`You cannot use the ${chalk.green(this.name)} command inside an ember-cli project.`);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (this.works === 'insideProject') {
|
|
278
|
+
if (!this.project.hasDependencies()) {
|
|
279
|
+
if (!this.isWithinProject && !this.project.isEmberCLIAddon()) {
|
|
294
280
|
throw new SilentError(
|
|
295
|
-
`
|
|
281
|
+
`You have to be inside an ember-cli project to use the ${chalk.green(this.name)} command.`
|
|
296
282
|
);
|
|
297
283
|
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
let detector = new WatchDetector({
|
|
301
|
-
ui: this.ui,
|
|
302
|
-
childProcess: { execSync },
|
|
303
|
-
fs,
|
|
304
|
-
watchmanSupportsPlatform: /^win/.test(process.platform),
|
|
305
|
-
cache,
|
|
306
|
-
root: this.project.root,
|
|
307
|
-
});
|
|
308
284
|
|
|
309
|
-
|
|
285
|
+
let installCommand = await determineInstallCommand(this.project.root);
|
|
310
286
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
this.project._watchmanInfo = watchPreference.watchmanInfo;
|
|
315
|
-
options.watcher = watchPreference.watcher;
|
|
287
|
+
throw new SilentError(
|
|
288
|
+
`Required packages are missing, run \`${installCommand}\` from this directory to install them.`
|
|
289
|
+
);
|
|
316
290
|
}
|
|
317
|
-
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
let detector = new WatchDetector({
|
|
294
|
+
ui: this.ui,
|
|
295
|
+
childProcess: { execSync },
|
|
296
|
+
fs,
|
|
297
|
+
watchmanSupportsPlatform: /^win/.test(process.platform),
|
|
298
|
+
cache,
|
|
299
|
+
root: this.project.root,
|
|
318
300
|
});
|
|
301
|
+
|
|
302
|
+
let options = commandOptions.options;
|
|
303
|
+
|
|
304
|
+
if (this.hasOption('watcher')) {
|
|
305
|
+
// Do stuff to try and provide a good experience when it comes to file watching:
|
|
306
|
+
let watchPreference = detector.findBestWatcherOption(options);
|
|
307
|
+
|
|
308
|
+
this.project._watchmanInfo = watchPreference.watchmanInfo;
|
|
309
|
+
options.watcher = watchPreference.watcher;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return this.run(options, commandOptions.args);
|
|
319
313
|
},
|
|
320
314
|
|
|
321
315
|
/**
|
package/lib/models/watcher.js
CHANGED
|
@@ -115,9 +115,6 @@ module.exports = class Watcher extends CoreObject {
|
|
|
115
115
|
didError(error) {
|
|
116
116
|
logger.info('didError %o', error);
|
|
117
117
|
this.ui.writeError(error);
|
|
118
|
-
this.analytics.trackError({
|
|
119
|
-
description: error && error.name,
|
|
120
|
-
});
|
|
121
118
|
}
|
|
122
119
|
|
|
123
120
|
didChange(results) {
|
|
@@ -135,24 +132,6 @@ module.exports = class Watcher extends CoreObject {
|
|
|
135
132
|
|
|
136
133
|
this.ui.writeLine(message);
|
|
137
134
|
|
|
138
|
-
this.analytics.track({
|
|
139
|
-
name: 'ember rebuild',
|
|
140
|
-
message: `broccoli rebuild time: ${totalTime}ms`,
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
/*
|
|
144
|
-
* We use the `rebuild` category in our analytics setup for both builds
|
|
145
|
-
* and rebuilds. This is a bit confusing, but the actual thing we
|
|
146
|
-
* delineate on in the reports is the `variable` value below. This is
|
|
147
|
-
* used both here and in `lib/tasks/build.js`.
|
|
148
|
-
*/
|
|
149
|
-
this.analytics.trackTiming({
|
|
150
|
-
category: 'rebuild',
|
|
151
|
-
variable: 'rebuild time',
|
|
152
|
-
label: 'broccoli rebuild time',
|
|
153
|
-
value: Number(totalTime),
|
|
154
|
-
});
|
|
155
|
-
|
|
156
135
|
if (this.verbose) {
|
|
157
136
|
printSlowTrees(results.graph.__heimdall__);
|
|
158
137
|
}
|
|
@@ -4,7 +4,6 @@ const Task = require('../models/task');
|
|
|
4
4
|
const SilentError = require('silent-error');
|
|
5
5
|
const { merge } = require('ember-cli-lodash-subset');
|
|
6
6
|
const getPackageBaseName = require('../utilities/get-package-base-name');
|
|
7
|
-
const { getPackageManagerFromFlags } = require('../utilities/get-package-manager-from-flags');
|
|
8
7
|
|
|
9
8
|
class AddonInstallTask extends Task {
|
|
10
9
|
constructor(options) {
|
|
@@ -23,28 +22,24 @@ class AddonInstallTask extends Task {
|
|
|
23
22
|
|
|
24
23
|
let npmInstall = new this.NpmInstallTask({
|
|
25
24
|
ui: this.ui,
|
|
26
|
-
analytics: this.analytics,
|
|
27
25
|
project: this.project,
|
|
28
26
|
});
|
|
29
27
|
|
|
30
28
|
let blueprintInstall = new this.BlueprintTask({
|
|
31
29
|
ui: this.ui,
|
|
32
|
-
analytics: this.analytics,
|
|
33
30
|
project: this.project,
|
|
34
31
|
testing: this.testing,
|
|
35
32
|
});
|
|
36
33
|
|
|
37
34
|
ui.startProgress(chalk.green('Installing addon package'), chalk.green('.'));
|
|
38
35
|
|
|
39
|
-
let packageManager = getPackageManagerFromFlags(commandOptions);
|
|
40
|
-
|
|
41
36
|
return npmInstall
|
|
42
37
|
.run({
|
|
43
38
|
packages: packageNames,
|
|
44
39
|
save: commandOptions.save,
|
|
45
40
|
'save-dev': !commandOptions.save,
|
|
46
41
|
'save-exact': commandOptions.saveExact,
|
|
47
|
-
packageManager,
|
|
42
|
+
packageManager: commandOptions.packageManager,
|
|
48
43
|
})
|
|
49
44
|
.then(() => this.project.reloadAddons())
|
|
50
45
|
.then(() => this.installBlueprint(blueprintInstall, packageNames, blueprintOptions))
|
package/lib/tasks/build-watch.js
CHANGED
package/lib/tasks/build.js
CHANGED
|
@@ -8,7 +8,6 @@ module.exports = class BuildTask extends Task {
|
|
|
8
8
|
// Options: String outputPath
|
|
9
9
|
async run(options) {
|
|
10
10
|
let ui = this.ui;
|
|
11
|
-
let analytics = this.analytics;
|
|
12
11
|
|
|
13
12
|
let builder = new Builder({
|
|
14
13
|
ui,
|
|
@@ -29,26 +28,7 @@ module.exports = class BuildTask extends Task {
|
|
|
29
28
|
changedFiles: [],
|
|
30
29
|
};
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
let totalTime = results.totalTime / 1e6;
|
|
34
|
-
|
|
35
|
-
analytics.track({
|
|
36
|
-
name: 'ember build',
|
|
37
|
-
message: `${totalTime}ms`,
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
/*
|
|
41
|
-
* We use the `rebuild` category in our analytics setup for both builds
|
|
42
|
-
* and rebuilds. This is a bit confusing, but the actual thing we
|
|
43
|
-
* delineate on in the reports is the `variable` value below. This is
|
|
44
|
-
* used both here and in `lib/models/watcher.js`.
|
|
45
|
-
*/
|
|
46
|
-
analytics.trackTiming({
|
|
47
|
-
category: 'rebuild',
|
|
48
|
-
variable: 'build time',
|
|
49
|
-
label: 'broccoli build time',
|
|
50
|
-
value: parseInt(totalTime, 10),
|
|
51
|
-
});
|
|
31
|
+
await builder.build(null, annotation);
|
|
52
32
|
} finally {
|
|
53
33
|
ui.stopProgress();
|
|
54
34
|
await builder.cleanup();
|
|
@@ -81,7 +81,7 @@ class InteractiveNewTask extends Task {
|
|
|
81
81
|
name: 'packageManager',
|
|
82
82
|
type: 'list',
|
|
83
83
|
message: 'Pick the package manager to use when installing dependencies:',
|
|
84
|
-
when: !newCommandOptions.
|
|
84
|
+
when: !newCommandOptions.packageManager,
|
|
85
85
|
choices: [
|
|
86
86
|
{
|
|
87
87
|
name: 'NPM',
|
package/lib/tasks/npm-install.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// Runs `npm install` in cwd
|
|
4
3
|
const path = require('path');
|
|
5
4
|
const fs = require('fs');
|
|
6
5
|
const NpmTask = require('./npm-task');
|
|
@@ -17,7 +16,7 @@ class NpmInstallTask extends NpmTask {
|
|
|
17
16
|
let packageJson = path.join(this.project.root, 'package.json');
|
|
18
17
|
|
|
19
18
|
if (!fs.existsSync(packageJson)) {
|
|
20
|
-
ui.writeWarnLine('Skipping
|
|
19
|
+
ui.writeWarnLine('Skipping install: `package.json` not found.');
|
|
21
20
|
return Promise.resolve();
|
|
22
21
|
} else {
|
|
23
22
|
return super.run(options);
|
package/lib/tasks/npm-task.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// Runs `npm install` in cwd
|
|
4
|
-
|
|
5
3
|
const chalk = require('chalk');
|
|
6
4
|
const execa = require('../utilities/execa');
|
|
7
|
-
const findUp = require('find-up');
|
|
8
5
|
const semver = require('semver');
|
|
9
6
|
const SilentError = require('silent-error');
|
|
10
|
-
const isYarnProject = require('../utilities/
|
|
7
|
+
const { isPnpmProject, isYarnProject } = require('../utilities/package-managers');
|
|
11
8
|
|
|
12
9
|
const logger = require('heimdalljs-logger')('ember-cli:npm-task');
|
|
13
10
|
|
|
@@ -50,8 +47,8 @@ class NpmTask extends Task {
|
|
|
50
47
|
return isYarnProject(this.project.root);
|
|
51
48
|
}
|
|
52
49
|
|
|
53
|
-
|
|
54
|
-
return
|
|
50
|
+
hasPNPMLock() {
|
|
51
|
+
return isPnpmProject(this.project.root);
|
|
55
52
|
}
|
|
56
53
|
|
|
57
54
|
async checkYarn() {
|
package/lib/tasks/serve.js
CHANGED
|
@@ -59,7 +59,6 @@ class ServeTask extends Task {
|
|
|
59
59
|
await Watcher.build({
|
|
60
60
|
ui: this.ui,
|
|
61
61
|
builder,
|
|
62
|
-
analytics: this.analytics,
|
|
63
62
|
options,
|
|
64
63
|
serving: true,
|
|
65
64
|
ignored: [path.resolve(this.project.root, options.outputPath)],
|
|
@@ -72,7 +71,6 @@ class ServeTask extends Task {
|
|
|
72
71
|
serverWatcher = (
|
|
73
72
|
await ServerWatcher.build({
|
|
74
73
|
ui: this.ui,
|
|
75
|
-
analytics: this.analytics,
|
|
76
74
|
watchedDir: path.resolve(serverRoot),
|
|
77
75
|
options,
|
|
78
76
|
})
|
|
@@ -84,7 +82,6 @@ class ServeTask extends Task {
|
|
|
84
82
|
new ExpressServer({
|
|
85
83
|
ui: this.ui,
|
|
86
84
|
project: this.project,
|
|
87
|
-
analytics: this.analytics,
|
|
88
85
|
watcher,
|
|
89
86
|
serverRoot,
|
|
90
87
|
serverWatcher,
|
|
@@ -141,7 +141,6 @@ class ExpressServerTask extends Task {
|
|
|
141
141
|
options.project = this.project;
|
|
142
142
|
options.watcher = this.watcher;
|
|
143
143
|
options.serverWatcher = this.serverWatcher;
|
|
144
|
-
options.analytics = this.analytics;
|
|
145
144
|
options.ui = this.ui;
|
|
146
145
|
|
|
147
146
|
this.startOptions = options;
|
|
@@ -242,7 +241,6 @@ class ExpressServerTask extends Task {
|
|
|
242
241
|
app: this.app,
|
|
243
242
|
ui: options.ui,
|
|
244
243
|
watcher: options.watcher,
|
|
245
|
-
analytics: options.analytics,
|
|
246
244
|
project: options.project,
|
|
247
245
|
httpServer: options.httpServer,
|
|
248
246
|
});
|