yeoman-environment 3.19.2 → 3.19.3
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/lib/environment.js +19 -36
- package/package.json +1 -1
package/lib/environment.js
CHANGED
|
@@ -11,6 +11,7 @@ const memFs = require('mem-fs');
|
|
|
11
11
|
const FileEditor = require('mem-fs-editor');
|
|
12
12
|
const debug = require('debug')('yeoman:environment');
|
|
13
13
|
const isScoped = require('is-scoped');
|
|
14
|
+
const npmlog = require('npmlog');
|
|
14
15
|
const semver = require('semver');
|
|
15
16
|
const slash = require('slash');
|
|
16
17
|
const {TrackerGroup} = require('are-we-there-yet');
|
|
@@ -51,7 +52,7 @@ function splitArgsFromString(argsString) {
|
|
|
51
52
|
if (!argsString) {
|
|
52
53
|
return result;
|
|
53
54
|
}
|
|
54
|
-
const quoteSeparatedArgs = argsString.split(/("[^"]*")/).filter(
|
|
55
|
+
const quoteSeparatedArgs = argsString.split(/("[^"]*")/).filter(x => x);
|
|
55
56
|
for (const arg of quoteSeparatedArgs) {
|
|
56
57
|
if (arg.match('\x22')) {
|
|
57
58
|
result.push(arg.replace(/"/g, ''));
|
|
@@ -1315,49 +1316,31 @@ class Environment extends Base {
|
|
|
1315
1316
|
|
|
1316
1317
|
let {log = true} = options;
|
|
1317
1318
|
|
|
1319
|
+
if (log) {
|
|
1320
|
+
npmlog.tracker = new TrackerGroup();
|
|
1321
|
+
npmlog.enableProgress();
|
|
1322
|
+
log = npmlog.newItem(name);
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1318
1325
|
if (!Array.isArray(transformStreams)) {
|
|
1319
1326
|
transformStreams = [transformStreams];
|
|
1320
1327
|
}
|
|
1321
|
-
|
|
1322
|
-
const progress = this.adapter.progress ? this.adapter.progress.bind(this.adapter) : (async callback => {
|
|
1323
|
-
const npmlog = require('npmlog');
|
|
1324
|
-
log = log && !npmlog.progressEnabled;
|
|
1325
|
-
if (log) {
|
|
1326
|
-
try {
|
|
1327
|
-
npmlog.tracker = new TrackerGroup();
|
|
1328
|
-
npmlog.enableProgress();
|
|
1329
|
-
log = npmlog.newItem(name);
|
|
1330
|
-
} catch {
|
|
1331
|
-
// Failed to enable progress.
|
|
1332
|
-
npmlog.disableProgress();
|
|
1333
|
-
log = false;
|
|
1334
|
-
}
|
|
1335
|
-
}
|
|
1336
|
-
try {
|
|
1337
|
-
await callback({
|
|
1338
|
-
step(prefix, message, ...args) {
|
|
1339
|
-
if (log) {
|
|
1340
|
-
log.completeWork(10);
|
|
1341
|
-
npmlog.info(prefix, message, ...args);
|
|
1342
|
-
}
|
|
1343
|
-
}
|
|
1344
|
-
});
|
|
1345
|
-
} finally {
|
|
1346
|
-
if (log) {
|
|
1347
|
-
log.finish();
|
|
1348
|
-
npmlog.disableProgress();
|
|
1349
|
-
}
|
|
1350
|
-
}
|
|
1351
|
-
});
|
|
1352
|
-
|
|
1353
|
-
return progress(({step}) => pipeline(
|
|
1328
|
+
return pipeline(
|
|
1354
1329
|
stream,
|
|
1355
1330
|
createModifiedTransform(),
|
|
1356
1331
|
...transformStreams,
|
|
1357
1332
|
transform(file => {
|
|
1358
|
-
|
|
1333
|
+
if (log) {
|
|
1334
|
+
log.completeWork(10);
|
|
1335
|
+
npmlog.info('Completed', path.relative(this.logCwd, file.path));
|
|
1336
|
+
}
|
|
1359
1337
|
}, 'environment:log')
|
|
1360
|
-
))
|
|
1338
|
+
).then(() => {
|
|
1339
|
+
if (log) {
|
|
1340
|
+
log.finish();
|
|
1341
|
+
npmlog.disableProgress();
|
|
1342
|
+
}
|
|
1343
|
+
});
|
|
1361
1344
|
}
|
|
1362
1345
|
|
|
1363
1346
|
/**
|