adapt-cli 2.1.11 → 3.0.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/.bowerrc +2 -2
- package/.eslintignore +1 -0
- package/.eslintrc.json +14 -0
- package/.travis.yml +46 -46
- package/README.md +266 -266
- package/bin/adapt.js +3 -0
- package/json/help-create/component.json +9 -9
- package/json/help-create/course.json +9 -9
- package/json/help-create/question.json +9 -0
- package/json/help-create.json +12 -11
- package/json/help-devinstall.json +9 -9
- package/json/help-install.json +10 -10
- package/json/help-ls.json +7 -7
- package/json/help-register.json +7 -7
- package/json/help-rename.json +7 -7
- package/json/help-search.json +8 -8
- package/json/help-uninstall.json +7 -7
- package/json/help-unregister.json +8 -8
- package/json/help-update.json +12 -12
- package/json/help-version.json +7 -7
- package/json/help.json +19 -19
- package/lib/api.js +260 -0
- package/lib/cli.js +69 -52
- package/lib/commands/authenticate.js +18 -0
- package/lib/commands/create/component.js +64 -81
- package/lib/commands/create/course.js +26 -87
- package/lib/commands/create/question.js +18 -0
- package/lib/commands/create.js +85 -104
- package/lib/commands/devinstall.js +35 -97
- package/lib/commands/help.js +31 -52
- package/lib/commands/install.js +16 -856
- package/lib/commands/ls.js +9 -24
- package/lib/commands/register.js +11 -201
- package/lib/commands/rename.js +14 -138
- package/lib/commands/search.js +11 -29
- package/lib/commands/uninstall.js +9 -136
- package/lib/commands/unregister.js +12 -105
- package/lib/commands/update.js +12 -889
- package/lib/commands/version.js +13 -15
- package/lib/integration/AdaptFramework/build.js +39 -0
- package/lib/integration/AdaptFramework/clone.js +27 -0
- package/lib/integration/AdaptFramework/deleteSrcCore.js +9 -0
- package/lib/integration/AdaptFramework/deleteSrcCourse.js +9 -0
- package/lib/integration/AdaptFramework/download.js +21 -0
- package/lib/integration/AdaptFramework/erase.js +34 -0
- package/lib/integration/AdaptFramework/getLatestVersion.js +79 -0
- package/lib/integration/AdaptFramework/npmInstall.js +21 -0
- package/lib/integration/AdaptFramework.js +19 -0
- package/lib/integration/Plugin.js +403 -0
- package/lib/integration/PluginManagement/autenticate.js +56 -0
- package/lib/integration/PluginManagement/install.js +222 -0
- package/lib/integration/PluginManagement/print.js +52 -0
- package/lib/integration/PluginManagement/register.js +130 -0
- package/lib/integration/PluginManagement/rename.js +101 -0
- package/lib/integration/PluginManagement/schemas.js +8 -0
- package/lib/integration/PluginManagement/search.js +46 -0
- package/lib/integration/PluginManagement/uninstall.js +141 -0
- package/lib/integration/PluginManagement/unregister.js +101 -0
- package/lib/integration/PluginManagement/update.js +224 -0
- package/lib/integration/PluginManagement.js +21 -0
- package/lib/integration/Project.js +146 -0
- package/lib/integration/Target.js +296 -0
- package/lib/integration/getBowerRegistryConfig.js +34 -0
- package/lib/logger.js +28 -0
- package/lib/util/JSONReadValidate.js +34 -0
- package/lib/util/constants.js +38 -0
- package/lib/util/createPromptTask.js +7 -0
- package/lib/util/download.js +45 -0
- package/lib/util/errors.js +58 -0
- package/lib/util/extract.js +24 -0
- package/lib/util/getDirNameFromImportMeta.js +6 -0
- package/lib/util/promises.js +36 -0
- package/package.json +40 -49
- package/TESTING.md +0 -25
- package/bin/adapt +0 -3
- package/gruntfile.js +0 -18
- package/lib/AdaptConsoleApplication.js +0 -19
- package/lib/CommandParser.js +0 -19
- package/lib/CommandTranslator.js +0 -15
- package/lib/ConsoleRenderer.js +0 -10
- package/lib/Constants.js +0 -69
- package/lib/JsonLoader.js +0 -40
- package/lib/JsonWriter.js +0 -21
- package/lib/PackageMeta.js +0 -41
- package/lib/Plugin.js +0 -53
- package/lib/PluginTypeResolver.js +0 -47
- package/lib/Project.js +0 -89
- package/lib/RendererHelpers.js +0 -51
- package/lib/RepositoryDownloader.js +0 -64
- package/lib/Slug.js +0 -5
- package/lib/VersionChecker.js +0 -7
- package/lib/commands/create/index.js +0 -6
- package/lib/commands/index.js +0 -16
- package/lib/commands/install/InstallLog.js +0 -32
- package/lib/commands/install/InstallTarget.js +0 -259
- package/lib/commands/install/extend.js +0 -31
- package/lib/download.js +0 -101
- package/lib/errors.js +0 -58
- package/lib/promise/authenticate.js +0 -64
- package/lib/promise/build.js +0 -20
- package/lib/promise/cloneInstall.js +0 -35
- package/lib/promise/confirmBuild.js +0 -7
- package/lib/promise/exec.js +0 -39
- package/lib/promise/getRepository.js +0 -26
- package/lib/promise/highest.js +0 -109
- package/lib/promise/install.js +0 -31
- package/lib/promise/installAdaptDependencies.js +0 -30
- package/lib/promise/installNodeDependencies.js +0 -28
- package/lib/promise/removeTemporaryDownload.js +0 -8
- package/lib/promise/replaceTextContent.js +0 -10
- package/lib/promise/uninstallPackage.js +0 -15
- package/lib/promise/update.js +0 -33
- package/lib/promise/util.js +0 -16
- package/test/fixtures/adapt-with-plugins.json +0 -6
- package/test/specs/command_translation_concerns.js +0 -13
- package/test/specs/create_command_concerns.js +0 -22
- package/test/specs/create_concerns.js +0 -30
- package/test/specs/install_concerns.js +0 -31
- package/test/specs/installing_compatible_plugins_concerns.js +0 -126
- package/test/specs/installing_incompatible_plugins_concerns.js +0 -103
- package/test/specs/ls_concerns.js +0 -28
- package/test/specs/plugin_name_concerns.js +0 -82
- package/test/specs/project_concerns.js +0 -128
- package/test/specs/registration_concerns.js +0 -31
- package/test/specs/repository_downloader_concerns.js +0 -55
- package/test/specs/search_concerns.js +0 -30
- package/test/specs/type_resolution_concerns.js +0 -71
- package/test/specs/uninstall_command_concerns.js +0 -64
- package/test/specs/uninstall_concerns.js +0 -31
package/lib/commands/install.js
CHANGED
@@ -1,856 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
var Project = require('../Project');
|
18
|
-
var PluginTypeResolver = require('../PluginTypeResolver');
|
19
|
-
var RendererHelpers = require('../RendererHelpers');
|
20
|
-
var install = require('../promise/install');
|
21
|
-
var promise = require('../promise/util');
|
22
|
-
var InstallTarget = require('./install/InstallTarget');
|
23
|
-
var InstallLog = require('./install/InstallLog');
|
24
|
-
|
25
|
-
module.exports = function (dependencies) {
|
26
|
-
|
27
|
-
// standard output
|
28
|
-
var logger;
|
29
|
-
// a representation of the target Adapt project
|
30
|
-
var project;
|
31
|
-
// a list of plugin name/version pairs
|
32
|
-
var itinerary;
|
33
|
-
// the plugins to install (`Plugin` instances)
|
34
|
-
var plugins;
|
35
|
-
// whether to summarise installation without modifying anything
|
36
|
-
var isDryRun = false;
|
37
|
-
// whether to target the latest compatible version for all plugin installations (overrides constraints)
|
38
|
-
var isCompatibleEnabled = false;
|
39
|
-
// whether adapt.json is being used to compile the list of plugins to install
|
40
|
-
var isUsingManifest = false;
|
41
|
-
// whether this command is being performed on the command line
|
42
|
-
var isInteractive = true;
|
43
|
-
|
44
|
-
return {
|
45
|
-
apiinstall: function(pluginName, cwd) {
|
46
|
-
isInteractive = false;
|
47
|
-
|
48
|
-
Constants.setCwd(cwd);
|
49
|
-
|
50
|
-
project = new Project(Constants.DefaultProjectManifestPath, Constants.DefaultProjectFrameworkPath);
|
51
|
-
|
52
|
-
if(!project.isProjectContainsManifestFile()) {
|
53
|
-
return Q.reject({error:Errors.ERROR_COURSE_DIR});
|
54
|
-
}
|
55
|
-
|
56
|
-
itinerary = {};
|
57
|
-
plugins = [];
|
58
|
-
|
59
|
-
return init(pluginName ? [pluginName] : [])
|
60
|
-
.then(createPlugins)
|
61
|
-
.then(getInitialInfo)
|
62
|
-
.then(findCompatibleVersions)
|
63
|
-
.then(checkConstraints)
|
64
|
-
.then(createInstallationManifest)
|
65
|
-
.then(performInstallation)
|
66
|
-
.then(summariseInstallation);
|
67
|
-
},
|
68
|
-
install: function(renderer) {
|
69
|
-
var args = [].slice.call(arguments, 1);
|
70
|
-
var done = args.pop() || function() {};
|
71
|
-
|
72
|
-
logger = renderer;
|
73
|
-
|
74
|
-
project = new Project(Constants.DefaultProjectManifestPath, Constants.DefaultProjectFrameworkPath);
|
75
|
-
|
76
|
-
if(!project.isProjectContainsManifestFile()) {
|
77
|
-
RendererHelpers.reportInvalidFrameworkDirectory(renderer, done)(true);
|
78
|
-
return;
|
79
|
-
}
|
80
|
-
|
81
|
-
itinerary = {};
|
82
|
-
plugins = [];
|
83
|
-
|
84
|
-
var dryRunArgIndex = args.indexOf('--dry-run');
|
85
|
-
var compatibleArgIndex = args.indexOf('--compatible');
|
86
|
-
|
87
|
-
if (dryRunArgIndex >= 0) {
|
88
|
-
args.splice(dryRunArgIndex, 1);
|
89
|
-
isDryRun = true;
|
90
|
-
}
|
91
|
-
|
92
|
-
if (compatibleArgIndex >= 0) {
|
93
|
-
args.splice(compatibleArgIndex, 1);
|
94
|
-
isCompatibleEnabled = true;
|
95
|
-
}
|
96
|
-
|
97
|
-
if (isDryRun) {
|
98
|
-
init(args)
|
99
|
-
.then(createPlugins)
|
100
|
-
.then(getInitialInfo)
|
101
|
-
.then(findCompatibleVersions)
|
102
|
-
.then(checkConstraints)
|
103
|
-
.then(createInstallationManifest)
|
104
|
-
.then(summariseDryRun)
|
105
|
-
.then(done)
|
106
|
-
.fail(function(){console.log('Error:', arguments)});
|
107
|
-
} else {
|
108
|
-
init(args)
|
109
|
-
.then(createPlugins)
|
110
|
-
.then(getInitialInfo)
|
111
|
-
.then(findCompatibleVersions)
|
112
|
-
.then(checkConstraints)
|
113
|
-
.then(createInstallationManifest)
|
114
|
-
.then(performInstallation)
|
115
|
-
.then(updateManifest)
|
116
|
-
.then(summariseInstallation)
|
117
|
-
.then(done)
|
118
|
-
.fail(function(){console.log('Error:', arguments)});
|
119
|
-
}
|
120
|
-
}
|
121
|
-
};
|
122
|
-
|
123
|
-
function init(args) {
|
124
|
-
if (args.length == 0) {
|
125
|
-
getItineraryFromManifest();
|
126
|
-
} else {
|
127
|
-
getItineraryFromArguments(args);
|
128
|
-
}
|
129
|
-
|
130
|
-
return Q.resolve();
|
131
|
-
}
|
132
|
-
|
133
|
-
function getItineraryFromManifest() {
|
134
|
-
isUsingManifest = true;
|
135
|
-
|
136
|
-
itinerary = JsonLoader.readJSONSync(Constants.DefaultProjectManifestPath).dependencies;
|
137
|
-
}
|
138
|
-
|
139
|
-
function getItineraryFromArguments(args) {
|
140
|
-
isUsingManifest = false;
|
141
|
-
|
142
|
-
args.forEach(function(arg) {
|
143
|
-
var tokens = arg.split(/[#@]/);
|
144
|
-
var name = tokens[0];
|
145
|
-
var version = tokens[1];
|
146
|
-
|
147
|
-
switch (tokens.length) {
|
148
|
-
case 1: itinerary[name] = '*'; break;
|
149
|
-
case 2: itinerary[name] = version; break;
|
150
|
-
default: return;
|
151
|
-
}
|
152
|
-
});
|
153
|
-
}
|
154
|
-
|
155
|
-
function createPlugins() {
|
156
|
-
Object.keys(itinerary).forEach(function(name) {
|
157
|
-
var plugin = new InstallTarget(name, itinerary[name], isCompatibleEnabled);
|
158
|
-
plugins.push(plugin);
|
159
|
-
});
|
160
|
-
|
161
|
-
return Q.resolve();
|
162
|
-
}
|
163
|
-
|
164
|
-
function getInitialInfo() {
|
165
|
-
//console.log('install::getInitialInfo');
|
166
|
-
|
167
|
-
var promises = [];
|
168
|
-
|
169
|
-
for (var i=0, c=plugins.length; i<c; i++) {
|
170
|
-
promises.push(plugins[i].getInitialInfo());
|
171
|
-
}
|
172
|
-
|
173
|
-
if (isInteractive) {
|
174
|
-
return Q.all(promises).progress(progressUpdate).then(conclude);
|
175
|
-
}
|
176
|
-
|
177
|
-
return Q.all(promises);
|
178
|
-
|
179
|
-
function progressUpdate() {
|
180
|
-
var settled = plugins.filter(function(plugin) {return plugin._rawInfo || plugin._isMissingAtRepo;}).length;
|
181
|
-
var total = plugins.length;
|
182
|
-
InstallLog.logProgress(chalk.bold.cyan('<info>')+' Getting plugin info '+Math.round(100*settled/total)+'% complete');
|
183
|
-
}
|
184
|
-
|
185
|
-
function conclude() {
|
186
|
-
InstallLog.logProgressConclusion(chalk.bold.cyan('<info>')+' Getting plugin info 100% complete');
|
187
|
-
return Q.resolve();
|
188
|
-
}
|
189
|
-
}
|
190
|
-
|
191
|
-
function findCompatibleVersions() {
|
192
|
-
//console.log('install::findCompatibleVersions');
|
193
|
-
|
194
|
-
var promises = [];
|
195
|
-
var present = plugins.filter(isPresent);
|
196
|
-
|
197
|
-
for (var i=0, c=present.length; i<c; i++) {
|
198
|
-
promises.push(present[i].findCompatibleVersion(project.getFrameworkVersion()));
|
199
|
-
}
|
200
|
-
|
201
|
-
if (isInteractive) {
|
202
|
-
return Q.all(promises).progress(progressUpdate).then(conclude);
|
203
|
-
}
|
204
|
-
|
205
|
-
return Q.all(promises);
|
206
|
-
|
207
|
-
function progressUpdate() {
|
208
|
-
var settled = present.filter(function(plugin) {return plugin._latestCompatibleVersion != undefined;}).length;
|
209
|
-
var total = present.length;
|
210
|
-
InstallLog.logProgress(chalk.bold.cyan('<info>')+' Finding compatible versions '+Math.round(100*settled/total)+'% complete');
|
211
|
-
}
|
212
|
-
|
213
|
-
function conclude() {
|
214
|
-
InstallLog.logProgressConclusion(chalk.bold.cyan('<info>')+' Finding compatible versions 100% complete');
|
215
|
-
return Q.resolve();
|
216
|
-
}
|
217
|
-
}
|
218
|
-
|
219
|
-
function checkConstraints() {
|
220
|
-
//console.log('install::checkConstraints');
|
221
|
-
|
222
|
-
var promises = [];
|
223
|
-
var present = plugins.filter(isPresent);
|
224
|
-
|
225
|
-
for (var i=0, c=present.length; i<c; i++) {
|
226
|
-
promises.push(present[i].checkConstraint(project.getFrameworkVersion()));
|
227
|
-
}
|
228
|
-
|
229
|
-
if (isInteractive) {
|
230
|
-
return Q.all(promises).progress(progressUpdate).then(conclude);
|
231
|
-
}
|
232
|
-
|
233
|
-
return Q.all(promises);
|
234
|
-
|
235
|
-
function progressUpdate() {
|
236
|
-
var settled = present.filter(function(plugin) {return plugin._constraintChecked != undefined;}).length;
|
237
|
-
var total = present.length;
|
238
|
-
InstallLog.logProgress(chalk.bold.cyan('<info>')+' Checking constraints '+Math.round(100*settled/total)+'% complete');
|
239
|
-
}
|
240
|
-
|
241
|
-
function conclude() {
|
242
|
-
InstallLog.logProgressConclusion(chalk.bold.cyan('<info>')+' Checking constraints 100% complete');
|
243
|
-
return Q.resolve();
|
244
|
-
}
|
245
|
-
}
|
246
|
-
|
247
|
-
function createInstallationManifest() {
|
248
|
-
//console.log('install::createInstallationManifest');
|
249
|
-
|
250
|
-
var present = plugins.filter(isPresent);
|
251
|
-
|
252
|
-
var verifiedForInstallation = present.filter(isVerifiedForInstallation);
|
253
|
-
|
254
|
-
verifiedForInstallation.forEach(function(p) {p.markLatestCompatibleForInstallation();});
|
255
|
-
|
256
|
-
// there is no compatible version, but the user requested a valid version which is not the latest (prompt for (r)equested, (l)atest or (s)kip)
|
257
|
-
var incompatibleWithOldConstraint = present.filter(isIncompatibleWithOldConstraint);
|
258
|
-
// there is no compatible version, but the user requested the latest version (prompt for (l)atest or (s)kip)
|
259
|
-
var incompatibleWithLatestConstraint = present.filter(isIncompatibleWithLatestConstraint);
|
260
|
-
// there is no compatible version, but the user requested an invalid version (prompt for (l)atest or (s)kip)
|
261
|
-
var incompatibleWithBadConstraint = present.filter(isIncompatibleWithBadConstraint);
|
262
|
-
// there is no compatible version and no constraint was given (prompt for (l)atest or (s)kip)
|
263
|
-
var incompatibleWithNoConstraint = present.filter(isIncompatibleWithNoConstraint);
|
264
|
-
|
265
|
-
// a compatible version exists but the user requested an older version that isn't compatible (prompt for (r)equested, (l)atest compatible or (s)kip)
|
266
|
-
var compatibleWithOldIncompatibleConstraint = present.filter(isCompatibleWithOldIncompatibleConstraint);
|
267
|
-
// a compatible version exists but the user requested an older version that is compatible (prompt for (r)equested, (l)atest compatible or (s)kip)
|
268
|
-
var compatibleWithOldCompatibleConstraint = present.filter(isCompatibleWithOldCompatibleConstraint);
|
269
|
-
// a compatible version exists but the user gave a bad constraint (prompt for (c)ompatible or (s)kip)
|
270
|
-
var compatibleWithBadConstraint = present.filter(isCompatibleWithBadConstraint);
|
271
|
-
// a compatible version exists but user has requested a valid version that is later than the latest compatible version (prompt for (r)equested, (l)atest compatible or (s)kip)
|
272
|
-
var compatibleWithUnmetConstraint = present.filter(isCompatibleWithUnmetConstraint);
|
273
|
-
|
274
|
-
if (!isInteractive) {
|
275
|
-
|
276
|
-
incompatibleWithOldConstraint.forEach(function(p) {
|
277
|
-
p._error = Errors.ERROR_INCOMPATIBLE_VALID_REQUEST;
|
278
|
-
});
|
279
|
-
incompatibleWithLatestConstraint.forEach(function(p) {
|
280
|
-
p._error = Errors.ERROR_INCOMPATIBLE_VALID_REQUEST;
|
281
|
-
});
|
282
|
-
incompatibleWithBadConstraint.forEach(function(p) {
|
283
|
-
p._error = Errors.ERROR_INCOMPATIBLE_BAD_REQUEST;
|
284
|
-
});
|
285
|
-
incompatibleWithNoConstraint.forEach(function(p) {
|
286
|
-
p._error = Errors.ERROR_INCOMPATIBLE;
|
287
|
-
});
|
288
|
-
compatibleWithOldIncompatibleConstraint.forEach(function(p) {
|
289
|
-
p._error = Errors.ERROR_COMPATIBLE_INC_REQUEST;
|
290
|
-
});
|
291
|
-
compatibleWithBadConstraint.forEach(function(p) {
|
292
|
-
p._error = Errors.ERROR_COMPATIBLE_BAD_REQUEST;
|
293
|
-
});
|
294
|
-
compatibleWithUnmetConstraint.forEach(function(p) {
|
295
|
-
p._error = Errors.ERROR_COMPATIBLE_INC_REQUEST;
|
296
|
-
});
|
297
|
-
|
298
|
-
compatibleWithOldCompatibleConstraint.forEach(function(p) {
|
299
|
-
p.markRequestedForInstallation();
|
300
|
-
});
|
301
|
-
|
302
|
-
return Q.resolve();
|
303
|
-
}
|
304
|
-
|
305
|
-
var allPromises = [];
|
306
|
-
|
307
|
-
add(incompatibleWithOldConstraint, 'There is no compatible version of the following plugins:', getPrompt_incompatibleGeneric);
|
308
|
-
|
309
|
-
add(incompatibleWithLatestConstraint, 'There is no compatible version of the following plugins:', getPrompt_incompatibleGeneric);
|
310
|
-
|
311
|
-
add(incompatibleWithBadConstraint, 'An invalid constraint was given, but there is no compatible version of the following plugins:', getPrompt_incompatibleGeneric);
|
312
|
-
|
313
|
-
add(incompatibleWithNoConstraint, 'There is no compatible version of the following plugins:', getPrompt_incompatibleGeneric);
|
314
|
-
|
315
|
-
add(compatibleWithOldIncompatibleConstraint, 'An older incompatible version has been requested for the following plugins:', getPrompt_compatibleWithOldIncompatibleConstraint);
|
316
|
-
|
317
|
-
add(compatibleWithOldCompatibleConstraint, 'A compatible but older version has been requested for the following plugins:', getPrompt_compatibleWithOldCompatibleConstraint);
|
318
|
-
|
319
|
-
add(compatibleWithBadConstraint, 'An invalid constraint was given but a compatible version exists for the following plugins:', getPrompt_compatibleWithBadConstraint);
|
320
|
-
|
321
|
-
add(compatibleWithUnmetConstraint, 'The requested version is incompatible but a compatible version exists for the following plugins:', getPrompt_compatibleWithUnmetConstraint);
|
322
|
-
|
323
|
-
if (allPromises.length == 0) return Q.resolve();
|
324
|
-
|
325
|
-
return promise.serialise(allPromises, execute);
|
326
|
-
|
327
|
-
function add(list, header, prompt) {
|
328
|
-
if (list.length > 0) {
|
329
|
-
allPromises.push({
|
330
|
-
header: chalk.cyan('<info> ') + header,
|
331
|
-
list: list,
|
332
|
-
prompt: prompt
|
333
|
-
});
|
334
|
-
}
|
335
|
-
}
|
336
|
-
|
337
|
-
function execute(obj) {
|
338
|
-
console.log(obj.header);
|
339
|
-
return promise.serialise(obj.list, obj.prompt);
|
340
|
-
}
|
341
|
-
|
342
|
-
function getPackageName(p) {
|
343
|
-
return p.packageName;
|
344
|
-
}
|
345
|
-
}
|
346
|
-
|
347
|
-
function updateManifest() {
|
348
|
-
if (isUsingManifest) return Q.resolve();
|
349
|
-
|
350
|
-
return createPromptTask({
|
351
|
-
message: chalk.bold.yellow('<confirm>'),
|
352
|
-
description: chalk.white('Update the manifest (adapt.json)? Please specify (y)es or (n)o.'),
|
353
|
-
pattern: /^y$|^n$/i,
|
354
|
-
type: 'string',
|
355
|
-
default: 'y',
|
356
|
-
required: true,
|
357
|
-
onlyRejectOnError: true,
|
358
|
-
before: function(value) { return value; }
|
359
|
-
})
|
360
|
-
.then(function (result) {
|
361
|
-
var shouldUpdate = /^y$/i.test(result);
|
362
|
-
|
363
|
-
if (shouldUpdate) {
|
364
|
-
Object.keys(itinerary).forEach(function(name) {
|
365
|
-
project.add(new Plugin(name, itinerary[name]));
|
366
|
-
});
|
367
|
-
}
|
368
|
-
|
369
|
-
return Q.resolve();
|
370
|
-
});
|
371
|
-
}
|
372
|
-
|
373
|
-
function getPrompt_incompatibleWithOldConstraint(p) {
|
374
|
-
return createPromptTask({
|
375
|
-
message: chalk.bold.yellow('<confirm install>'),
|
376
|
-
description: chalk.reset(p.packageName + ' (r)equested version, (l)atest version or (s)kip: '),
|
377
|
-
pattern: /^r$|^l$|^s$/i,
|
378
|
-
type: 'string',
|
379
|
-
default: 's',
|
380
|
-
required: true,
|
381
|
-
onlyRejectOnError: true,
|
382
|
-
before: function(value) { return value; }
|
383
|
-
})
|
384
|
-
.then(function (result) {
|
385
|
-
var installRequested = /^r$/i.test(result);
|
386
|
-
var installLatest = /^l$/i.test(result);
|
387
|
-
|
388
|
-
if (installRequested) p.markRequestedForInstallation();
|
389
|
-
if (installLatest) p.markLatestForInstallation();
|
390
|
-
|
391
|
-
return Q.resolve();
|
392
|
-
});
|
393
|
-
}
|
394
|
-
|
395
|
-
function getPrompt_incompatibleGeneric(p) {
|
396
|
-
return createPromptTask({
|
397
|
-
message: chalk.bold.yellow('<confirm install>'),
|
398
|
-
description: chalk.reset(p.packageName + ' (l)atest version or (s)kip: '),
|
399
|
-
pattern: /^l$|^s$/i,
|
400
|
-
type: 'string',
|
401
|
-
default: 's',
|
402
|
-
required: true,
|
403
|
-
onlyRejectOnError: true,
|
404
|
-
before: function(value) { return value; }
|
405
|
-
})
|
406
|
-
.then(function (result) {
|
407
|
-
var installLatest = /^l$/i.test(result);
|
408
|
-
|
409
|
-
if (installLatest) p.markLatestForInstallation();
|
410
|
-
|
411
|
-
return Q.resolve();
|
412
|
-
});
|
413
|
-
}
|
414
|
-
|
415
|
-
function getPrompt_compatibleWithOldIncompatibleConstraint(p) {
|
416
|
-
var str = p.packageName +
|
417
|
-
' ' +chalk.yellowBright('(r)')+'equested version [' + semver.maxSatisfying(p._versions, p.version) + ']' +
|
418
|
-
', '+chalk.yellowBright('(l)')+'atest compatible version [' + p._latestCompatibleVersion + ']' +
|
419
|
-
' or '+chalk.yellowBright('(s)')+'kip:';
|
420
|
-
|
421
|
-
return createPromptTask({
|
422
|
-
message: chalk.bold.yellow('<confirm install>'),
|
423
|
-
description: chalk.white(str),
|
424
|
-
pattern: /^r$|^l$|^s$/i,
|
425
|
-
type: 'string',
|
426
|
-
default: 's',
|
427
|
-
required: true,
|
428
|
-
onlyRejectOnError: true,
|
429
|
-
before: function(value) { return value; }
|
430
|
-
})
|
431
|
-
.then(function (result) {
|
432
|
-
var installRequested = /^r$/i.test(result);
|
433
|
-
var installLatestCompatible = /^l$/i.test(result);
|
434
|
-
|
435
|
-
if (installRequested) p.markRequestedForInstallation();
|
436
|
-
if (installLatestCompatible) p.markLatestCompatibleForInstallation();
|
437
|
-
|
438
|
-
return Q.resolve();
|
439
|
-
});
|
440
|
-
}
|
441
|
-
|
442
|
-
function getPrompt_compatibleWithOldCompatibleConstraint(p) {
|
443
|
-
var str = p.packageName +
|
444
|
-
' ' +chalk.yellowBright('(r)')+'equested version [' + p._resolvedConstraint + ']' +
|
445
|
-
', '+chalk.yellowBright('(l)')+'atest compatible version [' + p._latestCompatibleVersion + ']' +
|
446
|
-
' or '+chalk.yellowBright('(s)')+'kip:';
|
447
|
-
|
448
|
-
return createPromptTask({
|
449
|
-
message: chalk.bold.yellow('<confirm install>'),
|
450
|
-
description: chalk.white(str),
|
451
|
-
pattern: /^r$|^l$|^s$/i,
|
452
|
-
type: 'string',
|
453
|
-
default: 's',
|
454
|
-
required: true,
|
455
|
-
onlyRejectOnError: true,
|
456
|
-
before: function(value) { return value; }
|
457
|
-
})
|
458
|
-
.then(function (result) {
|
459
|
-
var installRequested = /^r$/i.test(result);
|
460
|
-
var installLatestCompatible = /^l$/i.test(result);
|
461
|
-
|
462
|
-
if (installRequested) p.markRequestedForInstallation();
|
463
|
-
if (installLatestCompatible) p.markLatestCompatibleForInstallation();
|
464
|
-
|
465
|
-
return Q.resolve();
|
466
|
-
});
|
467
|
-
}
|
468
|
-
|
469
|
-
function getPrompt_compatibleWithBadConstraint(p) {
|
470
|
-
var str = p.packageName +
|
471
|
-
' '+chalk.yellowBright('(c)')+'ompatible version [' + p._latestCompatibleVersion + ']' +
|
472
|
-
' or '+chalk.yellowBright('(s)')+'kip:';
|
473
|
-
|
474
|
-
return createPromptTask({
|
475
|
-
message: chalk.bold.yellow('<confirm install>'),
|
476
|
-
description: chalk.white(str),
|
477
|
-
pattern: /^c$|^s$/i,
|
478
|
-
type: 'string',
|
479
|
-
default: 's',
|
480
|
-
required: true,
|
481
|
-
onlyRejectOnError: true,
|
482
|
-
before: function(value) { return value; }
|
483
|
-
})
|
484
|
-
.then(function (result) {
|
485
|
-
var installLatestCompatible = /^c$/i.test(result);
|
486
|
-
|
487
|
-
if (installLatestCompatible) p.markLatestCompatibleForInstallation();
|
488
|
-
|
489
|
-
return Q.resolve();
|
490
|
-
});
|
491
|
-
}
|
492
|
-
|
493
|
-
function getPrompt_compatibleWithUnmetConstraint(p) {
|
494
|
-
var str = p.packageName +
|
495
|
-
' ' +chalk.yellowBright('(r)')+'equested version [' + semver.maxSatisfying(p._versions, p.version) + ']' +
|
496
|
-
', '+chalk.yellowBright('(l)')+'atest compatible version [' + p._latestCompatibleVersion + ']' +
|
497
|
-
' or '+chalk.yellowBright('(s)')+'kip:';
|
498
|
-
|
499
|
-
return createPromptTask({
|
500
|
-
message: chalk.bold.yellow('<confirm install>'),
|
501
|
-
description: chalk.white(str),
|
502
|
-
pattern: /^r$|^l$|^s$/i,
|
503
|
-
type: 'string',
|
504
|
-
default: 's',
|
505
|
-
required: true,
|
506
|
-
onlyRejectOnError: true,
|
507
|
-
before: function(value) { return value; }
|
508
|
-
})
|
509
|
-
.then(function (result) {
|
510
|
-
var installRequested = /^r$/i.test(result);
|
511
|
-
var installLatestCompatible = /^l$/i.test(result);
|
512
|
-
|
513
|
-
if (installRequested) p.markRequestedForInstallation();
|
514
|
-
if (installLatestCompatible) p.markLatestCompatibleForInstallation();
|
515
|
-
|
516
|
-
return Q.resolve();
|
517
|
-
});
|
518
|
-
}
|
519
|
-
|
520
|
-
function summariseDryRun() {
|
521
|
-
var toBeInstalled = plugins.filter(isToBeInstalled);
|
522
|
-
var toBeSkipped = plugins.filter(isSkipped);
|
523
|
-
var missing = plugins.filter(isMissing);
|
524
|
-
|
525
|
-
summarise(toBeInstalled, toBeInstalledPrinter, 'The following plugins will be installed:');
|
526
|
-
summarise(toBeSkipped, packageNamePrinter, 'The following plugins will be skipped:');
|
527
|
-
summarise(missing, packageNamePrinter, 'There was a problem locating the following plugins:');
|
528
|
-
|
529
|
-
function summarise(list, iterator, header) {
|
530
|
-
if (!list || !iterator || list.length == 0) return;
|
531
|
-
|
532
|
-
console.log(chalk.cyanBright(header));
|
533
|
-
list.forEach(iterator);
|
534
|
-
}
|
535
|
-
|
536
|
-
return Q.resolve();
|
537
|
-
}
|
538
|
-
|
539
|
-
function summariseInstallation() {
|
540
|
-
//console.log('install::summariseInstallation');
|
541
|
-
|
542
|
-
var installSucceeded = plugins.filter(isInstallSuccessful);
|
543
|
-
var installSkipped = plugins.filter(isSkipped);
|
544
|
-
var installErrored = plugins.filter(isInstallFailure);
|
545
|
-
var missing = plugins.filter(isMissing);
|
546
|
-
|
547
|
-
var allSuccess = 'All requested plugins were successfully installed. Summary of installation:';
|
548
|
-
var someSuccess = 'The following plugins were successfully installed:';
|
549
|
-
var noSuccess = 'None of the requested plugins could be installed';
|
550
|
-
var successMsg;
|
551
|
-
|
552
|
-
if (!isInteractive) {
|
553
|
-
var report = [];
|
554
|
-
|
555
|
-
if (plugins.length == 1) {
|
556
|
-
var p = plugins[0];
|
557
|
-
|
558
|
-
if (installSucceeded.length == 1) {
|
559
|
-
var bowerPath = path.join(Constants.cwd, 'src', p._belongsTo, p.packageName, 'bower.json');
|
560
|
-
return Q.resolve(JsonLoader.readJSONSync(bowerPath));
|
561
|
-
}
|
562
|
-
if (installSkipped.length == 1) {
|
563
|
-
return Q.reject(p._error);
|
564
|
-
}
|
565
|
-
if (installErrored.length == 1) {
|
566
|
-
var error = _.clone(Errors.ERROR_INSTALL_ERROR);
|
567
|
-
|
568
|
-
if (p._installError) error.message = p._installError;
|
569
|
-
|
570
|
-
return Q.reject(error);
|
571
|
-
}
|
572
|
-
return Q.reject(Errors.ERROR_NOT_FOUND);
|
573
|
-
}
|
574
|
-
|
575
|
-
installSucceeded.forEach(function(p) {
|
576
|
-
var bowerPath = path.join(Constants.cwd, 'src', p._belongsTo, p.packageName, 'bower.json');
|
577
|
-
report.push({
|
578
|
-
name:p.packageName,
|
579
|
-
status:'fulfilled',
|
580
|
-
pluginData:JsonLoader.readJSONSync(bowerPath)
|
581
|
-
});
|
582
|
-
});
|
583
|
-
|
584
|
-
installSkipped.forEach(function(p) {
|
585
|
-
report.push({
|
586
|
-
name:p.packageName,
|
587
|
-
status:'rejected',
|
588
|
-
reason:p._error
|
589
|
-
});
|
590
|
-
});
|
591
|
-
|
592
|
-
installErrored.forEach(function(p) {
|
593
|
-
var error = _.clone(Errors.ERROR_INSTALL_ERROR);
|
594
|
-
|
595
|
-
if (p._installError) error.message = p._installError;
|
596
|
-
|
597
|
-
report.push({
|
598
|
-
name:p.packageName,
|
599
|
-
status:'rejected',
|
600
|
-
reason:error
|
601
|
-
});
|
602
|
-
});
|
603
|
-
|
604
|
-
missing.forEach(function(p) {
|
605
|
-
report.push({
|
606
|
-
name:p.packageName,
|
607
|
-
status:'rejected',
|
608
|
-
reason:Errors.ERROR_NOT_FOUND
|
609
|
-
});
|
610
|
-
});
|
611
|
-
|
612
|
-
return Q.resolve(report);
|
613
|
-
}
|
614
|
-
|
615
|
-
if (installErrored.length == 0 && missing.length == 0) successMsg = allSuccess;
|
616
|
-
else if (installSucceeded.length == 0) successMsg = noSuccess;
|
617
|
-
else successMsg = someSuccess;
|
618
|
-
|
619
|
-
summarise(installSucceeded, installSucceededPrinter, successMsg);
|
620
|
-
summarise(installSkipped, packageNamePrinter, 'The following plugins were skipped:');
|
621
|
-
summarise(installErrored, installErroredPrinter, 'The following plugins could not be installed:');
|
622
|
-
summarise(missing, packageNamePrinter, 'There was a problem locating the following plugins:');
|
623
|
-
|
624
|
-
function summarise(list, iterator, header) {
|
625
|
-
if (!list || !iterator || list.length == 0) return;
|
626
|
-
|
627
|
-
console.log(chalk.cyanBright(header));
|
628
|
-
list.forEach(iterator);
|
629
|
-
}
|
630
|
-
|
631
|
-
return Q.resolve();
|
632
|
-
}
|
633
|
-
|
634
|
-
function isToBeInstalled(p) {
|
635
|
-
return p._versionToInstall != undefined;
|
636
|
-
}
|
637
|
-
|
638
|
-
function isInstallSuccessful(p) {
|
639
|
-
return p._versionToInstall != undefined && p._wasInstalled === true;
|
640
|
-
}
|
641
|
-
|
642
|
-
function isInstallFailure(p) {
|
643
|
-
return p._versionToInstall != undefined && p._wasInstalled === false;
|
644
|
-
}
|
645
|
-
|
646
|
-
function isSkipped(p) {
|
647
|
-
return !p._isMissingAtRepo && p._versionToInstall == undefined;
|
648
|
-
}
|
649
|
-
|
650
|
-
// output formatting
|
651
|
-
|
652
|
-
function highlight(str) {
|
653
|
-
var sub1 = 'adapt-contrib-';
|
654
|
-
var sub2 = 'adapt-';
|
655
|
-
|
656
|
-
if (str.indexOf(sub1) == 0) {
|
657
|
-
return chalk.reset(sub1)+chalk.yellowBright(str.substring(sub1.length));
|
658
|
-
}
|
659
|
-
|
660
|
-
if (str.indexOf(sub2) == 0) {
|
661
|
-
return chalk.reset(sub2)+chalk.yellowBright(str.substring(sub2.length));
|
662
|
-
}
|
663
|
-
|
664
|
-
return str;
|
665
|
-
}
|
666
|
-
|
667
|
-
function green(str) {
|
668
|
-
return chalk.greenBright(str);
|
669
|
-
}
|
670
|
-
|
671
|
-
function greenIfEqual(v1, v2) {
|
672
|
-
var colourFunc = semver.satisfies(v1, v2) ? chalk.greenBright : chalk.magentaBright;
|
673
|
-
|
674
|
-
return colourFunc(v2);
|
675
|
-
}
|
676
|
-
|
677
|
-
function toBeInstalledPrinter(p) {
|
678
|
-
var v_i = p._versionToInstall, v_lc = p._latestCompatibleVersion;
|
679
|
-
|
680
|
-
if (v_lc == '*') {
|
681
|
-
console.log(highlight(p.packageName), '(no version information)');
|
682
|
-
} else {
|
683
|
-
console.log(highlight(p.packageName), '@'+green(v_i), '(latest compatible version is '+greenIfEqual(v_i, v_lc)+')');
|
684
|
-
}
|
685
|
-
}
|
686
|
-
|
687
|
-
function installSucceededPrinter(p) {
|
688
|
-
var v_i = p._versionToInstall, v_lc = p._latestCompatibleVersion;
|
689
|
-
|
690
|
-
if (v_lc == '*') {
|
691
|
-
console.log(highlight(p.packageName), '(no version information)');
|
692
|
-
} else {
|
693
|
-
console.log(highlight(p.packageName), '@'+green(v_i), '(latest compatible version is '+greenIfEqual(v_i, v_lc)+')');
|
694
|
-
}
|
695
|
-
}
|
696
|
-
|
697
|
-
function installErroredPrinter(p) {
|
698
|
-
console.log(highlight(p.packageName), p._installError ? '(error: ' + p._installError + ')' : '(unknown error)');
|
699
|
-
}
|
700
|
-
|
701
|
-
function packageNamePrinter(p) {
|
702
|
-
console.log(highlight(p.packageName));
|
703
|
-
}
|
704
|
-
|
705
|
-
// composite filter for when no user input is required to determine which version to install
|
706
|
-
|
707
|
-
function isVerifiedForInstallation(p) {
|
708
|
-
return isCompatible(p) && (!isConstrained(p) || semver.satisfies(p._resolvedConstraint, p._latestCompatibleVersion));
|
709
|
-
}
|
710
|
-
|
711
|
-
// composite filters for when no compatible version exists
|
712
|
-
|
713
|
-
function isIncompatibleWithOldConstraint(p) {
|
714
|
-
return !isCompatible(p) && isConstrained(p) && isGoodConstraint(p) && semver.lt(semver.maxSatisfying(p._versions, p.version), p._latestVersion);
|
715
|
-
}
|
716
|
-
|
717
|
-
function isIncompatibleWithLatestConstraint(p) {
|
718
|
-
return !isCompatible(p) && isConstrained(p) && isGoodConstraint(p) && semver.satisfies(semver.maxSatisfying(p._versions, p.version), p._latestVersion);
|
719
|
-
}
|
720
|
-
|
721
|
-
function isIncompatibleWithBadConstraint(p) {
|
722
|
-
return !isCompatible(p) && isConstrained(p) && isBadConstraint(p);
|
723
|
-
}
|
724
|
-
|
725
|
-
function isIncompatibleWithNoConstraint(p) {
|
726
|
-
return !isCompatible(p) && !isConstrained(p);
|
727
|
-
}
|
728
|
-
|
729
|
-
// composite filters for when a compatible version exists
|
730
|
-
|
731
|
-
function isCompatibleWithOldCompatibleConstraint(p) {
|
732
|
-
return isCompatible(p) && isConstraintCompatible(p) && semver.lt(p._resolvedConstraint, p._latestCompatibleVersion);
|
733
|
-
}
|
734
|
-
|
735
|
-
function isCompatibleWithBadConstraint(p) {
|
736
|
-
return isCompatible(p) && isBadConstraint(p);
|
737
|
-
}
|
738
|
-
|
739
|
-
function isCompatibleWithOldIncompatibleConstraint(p) {
|
740
|
-
// when the following elements of the filter are true they imply:
|
741
|
-
//
|
742
|
-
// isCompatible(p) - there exists a compatible version
|
743
|
-
// isConstrained(p) - a constraint was given (i.e. not a wildcard '*')
|
744
|
-
// isGoodConstraint(p) - the constraint resolved to a version of the plugin
|
745
|
-
// !isConstraintCompatible(p) - the constraint did not resolve to a compatible version
|
746
|
-
//
|
747
|
-
// the last element determines if the constraint only specified version(s) less than the latest compatible version
|
748
|
-
return isCompatible(p) && isConstrained(p) && isGoodConstraint(p) && !isConstraintCompatible(p) && semver.lt(semver.maxSatisfying(p._versions, p.version), p._latestCompatibleVersion);
|
749
|
-
}
|
750
|
-
|
751
|
-
function isCompatibleWithUnmetConstraint(p) {
|
752
|
-
// when the following elements of the filter are true they imply:
|
753
|
-
//
|
754
|
-
// isCompatible(p) - there exists a compatible version
|
755
|
-
// isConstrained(p) - a constraint was given (i.e. not a wildcard '*')
|
756
|
-
// isGoodConstraint(p) - the constraint resolved to a version of the plugin
|
757
|
-
// !isConstraintCompatible(p) - the constraint did not resolve to a compatible version
|
758
|
-
//
|
759
|
-
// the last element determines if the constraint specified version(s) greater than the latest compatible version
|
760
|
-
return isCompatible(p) && isConstrained(p) && isGoodConstraint(p) && !isConstraintCompatible(p) && semver.gt(semver.maxSatisfying(p._versions, p.version), p._latestCompatibleVersion);
|
761
|
-
}
|
762
|
-
|
763
|
-
// simple filters
|
764
|
-
|
765
|
-
function isConstraintCompatible(p) {
|
766
|
-
return p._resolvedConstraint != undefined && p._resolvedConstraint != null;
|
767
|
-
}
|
768
|
-
|
769
|
-
function isCompatible(p) {
|
770
|
-
return p._latestCompatibleVersion != undefined && p._latestCompatibleVersion != null;
|
771
|
-
}
|
772
|
-
|
773
|
-
function isConstrained(plugin) {
|
774
|
-
return plugin.version != '*';
|
775
|
-
}
|
776
|
-
|
777
|
-
function isGoodConstraint(plugin) {
|
778
|
-
return plugin._isBadConstraint === false;
|
779
|
-
}
|
780
|
-
|
781
|
-
function isBadConstraint(plugin) {
|
782
|
-
return plugin._isBadConstraint === true;
|
783
|
-
}
|
784
|
-
|
785
|
-
function isMissing(plugin) {
|
786
|
-
return plugin._isMissingAtRepo === true;
|
787
|
-
}
|
788
|
-
|
789
|
-
function isPresent(plugin) {
|
790
|
-
return !isMissing(plugin);
|
791
|
-
}
|
792
|
-
|
793
|
-
function createPromptTask(params) {
|
794
|
-
var deferred = Q.defer();
|
795
|
-
var defaultConfig = {
|
796
|
-
description: chalk.cyan('Hit <Enter> to continue'),
|
797
|
-
onlyRejectOnError: false,
|
798
|
-
before:function(){return true;}
|
799
|
-
};
|
800
|
-
var config = _.extend({}, defaultConfig, params);
|
801
|
-
var schema = {properties: {question: config}};
|
802
|
-
prompt.message = params.message || '';
|
803
|
-
prompt.delimiter = ' ';
|
804
|
-
prompt.start();
|
805
|
-
prompt.get(schema, function (err, confirmation) {
|
806
|
-
if (err) return deferred.reject(err);
|
807
|
-
if (!config.onlyRejectOnError && !confirmation.question) deferred.reject(new Error('Aborted. Nothing has been updated.'));
|
808
|
-
deferred.resolve(confirmation.question);
|
809
|
-
});
|
810
|
-
return deferred.promise;
|
811
|
-
}
|
812
|
-
|
813
|
-
function performInstallation() {
|
814
|
-
if (isInteractive) {
|
815
|
-
return Q.all(plugins.filter(isToBeInstalled).map(createInstallationTask)).progress(progressUpdate).then(conclude);
|
816
|
-
}
|
817
|
-
|
818
|
-
return Q.all(plugins.filter(isToBeInstalled).map(createInstallationTask));
|
819
|
-
|
820
|
-
function progressUpdate() {
|
821
|
-
var list = plugins.filter(isPresent).filter(isToBeInstalled);
|
822
|
-
var settled = list.filter(function(p) {return isInstallSuccessful(p) || isInstallFailure(p);}).length;
|
823
|
-
var total = list.length;
|
824
|
-
InstallLog.logProgress(chalk.bold.cyan('<info>')+' Installing plugins '+Math.round(100*settled/total)+'% complete');
|
825
|
-
}
|
826
|
-
|
827
|
-
function conclude() {
|
828
|
-
InstallLog.logProgressConclusion(chalk.bold.cyan('<info>')+' Installing plugins 100% complete');
|
829
|
-
return Q.resolve();
|
830
|
-
}
|
831
|
-
}
|
832
|
-
|
833
|
-
function createInstallationTask(plugin) {
|
834
|
-
return PackageMeta.getKeywords(plugin, { registry: Constants.getRegistry(), cwd: Constants.cwd }).then(doInstall).then(conclude);
|
835
|
-
|
836
|
-
function doInstall(keywords) {
|
837
|
-
var resolver = new PluginTypeResolver(),
|
838
|
-
pluginType = resolver.resolve(keywords);
|
839
|
-
|
840
|
-
// this lookup should probably be moved InstallTarget
|
841
|
-
plugin._belongsTo = pluginType.belongsTo;
|
842
|
-
|
843
|
-
return install(plugin, {
|
844
|
-
directory: path.join('src', pluginType.belongsTo),
|
845
|
-
registry: Constants.getRegistry(),
|
846
|
-
cwd: Constants.cwd
|
847
|
-
});
|
848
|
-
}
|
849
|
-
|
850
|
-
function conclude(result) {
|
851
|
-
plugin._wasInstalled = result._wasInstalled === true;
|
852
|
-
if (result.error) plugin._installError = result.error.code;
|
853
|
-
//renderUpdateProgress();
|
854
|
-
}
|
855
|
-
}
|
856
|
-
};
|
1
|
+
import { install as pluginsInstall } from '../integration/PluginManagement.js'
|
2
|
+
|
3
|
+
export default async function install (logger, ...args) {
|
4
|
+
/** strip flags */
|
5
|
+
const isClean = args.includes('--clean')
|
6
|
+
const isDryRun = args.includes('--dry-run') || args.includes('--check')
|
7
|
+
const isCompatibleEnabled = args.includes('--compatible')
|
8
|
+
const plugins = args.filter(arg => !String(arg).startsWith('--'))
|
9
|
+
await pluginsInstall({
|
10
|
+
logger,
|
11
|
+
isClean,
|
12
|
+
isDryRun,
|
13
|
+
isCompatibleEnabled,
|
14
|
+
plugins
|
15
|
+
})
|
16
|
+
}
|