@form8ion/utils-cli 12.0.0-beta.1 → 12.0.0-beta.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/bin/form8ion-utils.js +47 -450
- package/bin/form8ion-utils.js.map +1 -1
- package/package.json +10 -9
package/bin/form8ion-utils.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import yargs from 'yargs';
|
|
3
|
-
import { format
|
|
4
|
-
import {
|
|
5
|
-
import { readFileSync,
|
|
6
|
-
import
|
|
3
|
+
import { format } from 'util';
|
|
4
|
+
import { resolve, normalize } from 'path';
|
|
5
|
+
import { readFileSync, writeFile, statSync } from 'fs';
|
|
6
|
+
import 'assert';
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
8
8
|
import updateNotifier from 'update-notifier';
|
|
9
|
-
import { questionNames, scaffold as scaffold$3 } from '@form8ion/project';
|
|
9
|
+
import { questionNames as questionNames$1, scaffold as scaffold$3 } from '@form8ion/project';
|
|
10
10
|
import { packageManagers } from '@form8ion/javascript-core';
|
|
11
11
|
import * as javascriptPlugin from '@form8ion/javascript';
|
|
12
|
-
import { scaffold, lift, questionNames
|
|
12
|
+
import { scaffold, lift, questionNames, scaffoldUnitTesting } from '@form8ion/javascript';
|
|
13
13
|
import * as githubPlugin from '@form8ion/github';
|
|
14
14
|
import * as renovatePlugin from '@form8ion/renovate-scaffolder';
|
|
15
|
-
import { scaffold as scaffold$
|
|
15
|
+
import { scaffold as scaffold$6 } from '@form8ion/renovate-scaffolder';
|
|
16
16
|
import * as githubActionsPlugin from '@form8ion/github-actions-node-ci';
|
|
17
|
-
import {
|
|
17
|
+
import { lift as lift$3, test as test$1 } from '@form8ion/github-actions-node-ci';
|
|
18
18
|
import * as hapiPlugin from '@form8ion/hapi-scaffolder';
|
|
19
19
|
import * as form8ionPlugin from '@form8ion/scaffolder-scaffolder';
|
|
20
20
|
import * as remarkPlugin from '@form8ion/remark-plugin-scaffolder';
|
|
@@ -24,24 +24,14 @@ import * as vitePlugin from '@form8ion/vite';
|
|
|
24
24
|
import * as mochaPlugin from '@form8ion/mocha-scaffolder';
|
|
25
25
|
import * as vitestPlugin from '@form8ion/vitest';
|
|
26
26
|
import { ungroupObject } from '@form8ion/core';
|
|
27
|
-
import { scaffold as scaffold$
|
|
28
|
-
import { scaffold as scaffold$
|
|
27
|
+
import { scaffold as scaffold$2 } from '@form8ion/codecov';
|
|
28
|
+
import { scaffold as scaffold$1 } from '@form8ion/prettier';
|
|
29
29
|
import { lift as lift$1 } from '@form8ion/lift';
|
|
30
30
|
import { scaffold as scaffold$5 } from '@form8ion/cucumber-scaffolder';
|
|
31
31
|
import { removeGreenkeeper } from '@form8ion/remove-greenkeeper';
|
|
32
32
|
import { replace } from '@form8ion/replace-travis-ci-with-github-actions';
|
|
33
|
-
import { scaffold as scaffold$
|
|
34
|
-
import {
|
|
35
|
-
|
|
36
|
-
class YError extends Error {
|
|
37
|
-
constructor(msg) {
|
|
38
|
-
super(msg || 'yargs error');
|
|
39
|
-
this.name = 'YError';
|
|
40
|
-
if (Error.captureStackTrace) {
|
|
41
|
-
Error.captureStackTrace(this, YError);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
33
|
+
import { scaffold as scaffold$4 } from '@form8ion/ossf-scorecard';
|
|
34
|
+
import { lift as lift$2, test } from '@form8ion/jetbrains';
|
|
45
35
|
|
|
46
36
|
function getProcessArgvBinIndex() {
|
|
47
37
|
if (isBundledElectronApp())
|
|
@@ -57,9 +47,6 @@ function isElectronApp() {
|
|
|
57
47
|
function hideBin(argv) {
|
|
58
48
|
return argv.slice(getProcessArgvBinIndex() + 1);
|
|
59
49
|
}
|
|
60
|
-
function getProcessArgvBin() {
|
|
61
|
-
return process.argv[getProcessArgvBinIndex()];
|
|
62
|
-
}
|
|
63
50
|
|
|
64
51
|
/**
|
|
65
52
|
* @license
|
|
@@ -186,10 +173,10 @@ var DefaultValuesForTypeKey;
|
|
|
186
173
|
* Copyright (c) 2016, Contributors
|
|
187
174
|
* SPDX-License-Identifier: ISC
|
|
188
175
|
*/
|
|
189
|
-
let mixin
|
|
176
|
+
let mixin;
|
|
190
177
|
class YargsParser {
|
|
191
178
|
constructor(_mixin) {
|
|
192
|
-
mixin
|
|
179
|
+
mixin = _mixin;
|
|
193
180
|
}
|
|
194
181
|
parse(argsInput, options) {
|
|
195
182
|
const opts = Object.assign({
|
|
@@ -246,7 +233,7 @@ class YargsParser {
|
|
|
246
233
|
const newAliases = Object.create(null);
|
|
247
234
|
const defaulted = Object.create(null);
|
|
248
235
|
// allow a i18n handler to be passed in, default to a fake one (util.format).
|
|
249
|
-
const __ = opts.__ || mixin
|
|
236
|
+
const __ = opts.__ || mixin.format;
|
|
250
237
|
const flags = {
|
|
251
238
|
aliases: Object.create(null),
|
|
252
239
|
arrays: Object.create(null),
|
|
@@ -720,7 +707,7 @@ class YargsParser {
|
|
|
720
707
|
return val;
|
|
721
708
|
},
|
|
722
709
|
set(value) {
|
|
723
|
-
val = typeof value === 'string' ? mixin
|
|
710
|
+
val = typeof value === 'string' ? mixin.normalize(value) : value;
|
|
724
711
|
}
|
|
725
712
|
});
|
|
726
713
|
});
|
|
@@ -755,9 +742,9 @@ class YargsParser {
|
|
|
755
742
|
// Set normalized value when key is in 'normalize' and in 'arrays'
|
|
756
743
|
if (checkAllAliases(key, flags.normalize) && checkAllAliases(key, flags.arrays)) {
|
|
757
744
|
if (Array.isArray(val))
|
|
758
|
-
value = val.map((val) => { return mixin
|
|
745
|
+
value = val.map((val) => { return mixin.normalize(val); });
|
|
759
746
|
else
|
|
760
|
-
value = mixin
|
|
747
|
+
value = mixin.normalize(val);
|
|
761
748
|
}
|
|
762
749
|
return value;
|
|
763
750
|
}
|
|
@@ -784,7 +771,7 @@ class YargsParser {
|
|
|
784
771
|
if (configPath) {
|
|
785
772
|
try {
|
|
786
773
|
let config = null;
|
|
787
|
-
const resolvedConfigPath = mixin
|
|
774
|
+
const resolvedConfigPath = mixin.resolve(mixin.cwd(), configPath);
|
|
788
775
|
const resolveConfig = flags.configs[configKey];
|
|
789
776
|
if (typeof resolveConfig === 'function') {
|
|
790
777
|
try {
|
|
@@ -799,7 +786,7 @@ class YargsParser {
|
|
|
799
786
|
}
|
|
800
787
|
}
|
|
801
788
|
else {
|
|
802
|
-
config = mixin
|
|
789
|
+
config = mixin.require(resolvedConfigPath);
|
|
803
790
|
}
|
|
804
791
|
setConfigObject(config);
|
|
805
792
|
}
|
|
@@ -848,7 +835,7 @@ class YargsParser {
|
|
|
848
835
|
if (typeof envPrefix === 'undefined')
|
|
849
836
|
return;
|
|
850
837
|
const prefix = typeof envPrefix === 'string' ? envPrefix : '';
|
|
851
|
-
const env = mixin
|
|
838
|
+
const env = mixin.env();
|
|
852
839
|
Object.keys(env).forEach(function (envVar) {
|
|
853
840
|
if (prefix === '' || envVar.lastIndexOf(prefix, 0) === 0) {
|
|
854
841
|
// get array of nested keys and convert them to camel case
|
|
@@ -1235,7 +1222,7 @@ var _a, _b, _c;
|
|
|
1235
1222
|
const minNodeVersion = (process && process.env && process.env.YARGS_MIN_NODE_VERSION)
|
|
1236
1223
|
? Number(process.env.YARGS_MIN_NODE_VERSION)
|
|
1237
1224
|
: 12;
|
|
1238
|
-
const nodeVersion = (_b = (_a = process === null || process ===
|
|
1225
|
+
const nodeVersion = (_b = (_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node) !== null && _b !== void 0 ? _b : (_c = process === null || process === void 0 ? void 0 : process.version) === null || _c === void 0 ? void 0 : _c.slice(1);
|
|
1239
1226
|
if (nodeVersion) {
|
|
1240
1227
|
const major = Number(nodeVersion.match(/^([^.]+)/)[1]);
|
|
1241
1228
|
if (major < minNodeVersion) {
|
|
@@ -1244,7 +1231,7 @@ if (nodeVersion) {
|
|
|
1244
1231
|
}
|
|
1245
1232
|
// Creates a yargs-parser instance using Node.js standard libraries:
|
|
1246
1233
|
const env = process ? process.env : {};
|
|
1247
|
-
|
|
1234
|
+
new YargsParser({
|
|
1248
1235
|
cwd: process.cwd,
|
|
1249
1236
|
env: () => {
|
|
1250
1237
|
return env;
|
|
@@ -1267,359 +1254,6 @@ const parser = new YargsParser({
|
|
|
1267
1254
|
}
|
|
1268
1255
|
}
|
|
1269
1256
|
});
|
|
1270
|
-
const yargsParser = function Parser(args, opts) {
|
|
1271
|
-
const result = parser.parse(args.slice(), opts);
|
|
1272
|
-
return result.argv;
|
|
1273
|
-
};
|
|
1274
|
-
yargsParser.detailed = function (args, opts) {
|
|
1275
|
-
return parser.parse(args.slice(), opts);
|
|
1276
|
-
};
|
|
1277
|
-
yargsParser.camelCase = camelCase;
|
|
1278
|
-
yargsParser.decamelize = decamelize;
|
|
1279
|
-
yargsParser.looksLikeNumber = looksLikeNumber;
|
|
1280
|
-
|
|
1281
|
-
const align = {
|
|
1282
|
-
right: alignRight,
|
|
1283
|
-
center: alignCenter
|
|
1284
|
-
};
|
|
1285
|
-
const top = 0;
|
|
1286
|
-
const right = 1;
|
|
1287
|
-
const bottom = 2;
|
|
1288
|
-
const left = 3;
|
|
1289
|
-
class UI {
|
|
1290
|
-
constructor(opts) {
|
|
1291
|
-
var _a;
|
|
1292
|
-
this.width = opts.width;
|
|
1293
|
-
this.wrap = (_a = opts.wrap) !== null && _a !== undefined ? _a : true;
|
|
1294
|
-
this.rows = [];
|
|
1295
|
-
}
|
|
1296
|
-
span(...args) {
|
|
1297
|
-
const cols = this.div(...args);
|
|
1298
|
-
cols.span = true;
|
|
1299
|
-
}
|
|
1300
|
-
resetOutput() {
|
|
1301
|
-
this.rows = [];
|
|
1302
|
-
}
|
|
1303
|
-
div(...args) {
|
|
1304
|
-
if (args.length === 0) {
|
|
1305
|
-
this.div('');
|
|
1306
|
-
}
|
|
1307
|
-
if (this.wrap && this.shouldApplyLayoutDSL(...args) && typeof args[0] === 'string') {
|
|
1308
|
-
return this.applyLayoutDSL(args[0]);
|
|
1309
|
-
}
|
|
1310
|
-
const cols = args.map(arg => {
|
|
1311
|
-
if (typeof arg === 'string') {
|
|
1312
|
-
return this.colFromString(arg);
|
|
1313
|
-
}
|
|
1314
|
-
return arg;
|
|
1315
|
-
});
|
|
1316
|
-
this.rows.push(cols);
|
|
1317
|
-
return cols;
|
|
1318
|
-
}
|
|
1319
|
-
shouldApplyLayoutDSL(...args) {
|
|
1320
|
-
return args.length === 1 && typeof args[0] === 'string' &&
|
|
1321
|
-
/[\t\n]/.test(args[0]);
|
|
1322
|
-
}
|
|
1323
|
-
applyLayoutDSL(str) {
|
|
1324
|
-
const rows = str.split('\n').map(row => row.split('\t'));
|
|
1325
|
-
let leftColumnWidth = 0;
|
|
1326
|
-
// simple heuristic for layout, make sure the
|
|
1327
|
-
// second column lines up along the left-hand.
|
|
1328
|
-
// don't allow the first column to take up more
|
|
1329
|
-
// than 50% of the screen.
|
|
1330
|
-
rows.forEach(columns => {
|
|
1331
|
-
if (columns.length > 1 && mixin.stringWidth(columns[0]) > leftColumnWidth) {
|
|
1332
|
-
leftColumnWidth = Math.min(Math.floor(this.width * 0.5), mixin.stringWidth(columns[0]));
|
|
1333
|
-
}
|
|
1334
|
-
});
|
|
1335
|
-
// generate a table:
|
|
1336
|
-
// replacing ' ' with padding calculations.
|
|
1337
|
-
// using the algorithmically generated width.
|
|
1338
|
-
rows.forEach(columns => {
|
|
1339
|
-
this.div(...columns.map((r, i) => {
|
|
1340
|
-
return {
|
|
1341
|
-
text: r.trim(),
|
|
1342
|
-
padding: this.measurePadding(r),
|
|
1343
|
-
width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined
|
|
1344
|
-
};
|
|
1345
|
-
}));
|
|
1346
|
-
});
|
|
1347
|
-
return this.rows[this.rows.length - 1];
|
|
1348
|
-
}
|
|
1349
|
-
colFromString(text) {
|
|
1350
|
-
return {
|
|
1351
|
-
text,
|
|
1352
|
-
padding: this.measurePadding(text)
|
|
1353
|
-
};
|
|
1354
|
-
}
|
|
1355
|
-
measurePadding(str) {
|
|
1356
|
-
// measure padding without ansi escape codes
|
|
1357
|
-
const noAnsi = mixin.stripAnsi(str);
|
|
1358
|
-
return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length];
|
|
1359
|
-
}
|
|
1360
|
-
toString() {
|
|
1361
|
-
const lines = [];
|
|
1362
|
-
this.rows.forEach(row => {
|
|
1363
|
-
this.rowToString(row, lines);
|
|
1364
|
-
});
|
|
1365
|
-
// don't display any lines with the
|
|
1366
|
-
// hidden flag set.
|
|
1367
|
-
return lines
|
|
1368
|
-
.filter(line => !line.hidden)
|
|
1369
|
-
.map(line => line.text)
|
|
1370
|
-
.join('\n');
|
|
1371
|
-
}
|
|
1372
|
-
rowToString(row, lines) {
|
|
1373
|
-
this.rasterize(row).forEach((rrow, r) => {
|
|
1374
|
-
let str = '';
|
|
1375
|
-
rrow.forEach((col, c) => {
|
|
1376
|
-
const { width } = row[c]; // the width with padding.
|
|
1377
|
-
const wrapWidth = this.negatePadding(row[c]); // the width without padding.
|
|
1378
|
-
let ts = col; // temporary string used during alignment/padding.
|
|
1379
|
-
if (wrapWidth > mixin.stringWidth(col)) {
|
|
1380
|
-
ts += ' '.repeat(wrapWidth - mixin.stringWidth(col));
|
|
1381
|
-
}
|
|
1382
|
-
// align the string within its column.
|
|
1383
|
-
if (row[c].align && row[c].align !== 'left' && this.wrap) {
|
|
1384
|
-
const fn = align[row[c].align];
|
|
1385
|
-
ts = fn(ts, wrapWidth);
|
|
1386
|
-
if (mixin.stringWidth(ts) < wrapWidth) {
|
|
1387
|
-
ts += ' '.repeat((width || 0) - mixin.stringWidth(ts) - 1);
|
|
1388
|
-
}
|
|
1389
|
-
}
|
|
1390
|
-
// apply border and padding to string.
|
|
1391
|
-
const padding = row[c].padding || [0, 0, 0, 0];
|
|
1392
|
-
if (padding[left]) {
|
|
1393
|
-
str += ' '.repeat(padding[left]);
|
|
1394
|
-
}
|
|
1395
|
-
str += addBorder(row[c], ts, '| ');
|
|
1396
|
-
str += ts;
|
|
1397
|
-
str += addBorder(row[c], ts, ' |');
|
|
1398
|
-
if (padding[right]) {
|
|
1399
|
-
str += ' '.repeat(padding[right]);
|
|
1400
|
-
}
|
|
1401
|
-
// if prior row is span, try to render the
|
|
1402
|
-
// current row on the prior line.
|
|
1403
|
-
if (r === 0 && lines.length > 0) {
|
|
1404
|
-
str = this.renderInline(str, lines[lines.length - 1]);
|
|
1405
|
-
}
|
|
1406
|
-
});
|
|
1407
|
-
// remove trailing whitespace.
|
|
1408
|
-
lines.push({
|
|
1409
|
-
text: str.replace(/ +$/, ''),
|
|
1410
|
-
span: row.span
|
|
1411
|
-
});
|
|
1412
|
-
});
|
|
1413
|
-
return lines;
|
|
1414
|
-
}
|
|
1415
|
-
// if the full 'source' can render in
|
|
1416
|
-
// the target line, do so.
|
|
1417
|
-
renderInline(source, previousLine) {
|
|
1418
|
-
const match = source.match(/^ */);
|
|
1419
|
-
const leadingWhitespace = match ? match[0].length : 0;
|
|
1420
|
-
const target = previousLine.text;
|
|
1421
|
-
const targetTextWidth = mixin.stringWidth(target.trimRight());
|
|
1422
|
-
if (!previousLine.span) {
|
|
1423
|
-
return source;
|
|
1424
|
-
}
|
|
1425
|
-
// if we're not applying wrapping logic,
|
|
1426
|
-
// just always append to the span.
|
|
1427
|
-
if (!this.wrap) {
|
|
1428
|
-
previousLine.hidden = true;
|
|
1429
|
-
return target + source;
|
|
1430
|
-
}
|
|
1431
|
-
if (leadingWhitespace < targetTextWidth) {
|
|
1432
|
-
return source;
|
|
1433
|
-
}
|
|
1434
|
-
previousLine.hidden = true;
|
|
1435
|
-
return target.trimRight() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimLeft();
|
|
1436
|
-
}
|
|
1437
|
-
rasterize(row) {
|
|
1438
|
-
const rrows = [];
|
|
1439
|
-
const widths = this.columnWidths(row);
|
|
1440
|
-
let wrapped;
|
|
1441
|
-
// word wrap all columns, and create
|
|
1442
|
-
// a data-structure that is easy to rasterize.
|
|
1443
|
-
row.forEach((col, c) => {
|
|
1444
|
-
// leave room for left and right padding.
|
|
1445
|
-
col.width = widths[c];
|
|
1446
|
-
if (this.wrap) {
|
|
1447
|
-
wrapped = mixin.wrap(col.text, this.negatePadding(col), { hard: true }).split('\n');
|
|
1448
|
-
}
|
|
1449
|
-
else {
|
|
1450
|
-
wrapped = col.text.split('\n');
|
|
1451
|
-
}
|
|
1452
|
-
if (col.border) {
|
|
1453
|
-
wrapped.unshift('.' + '-'.repeat(this.negatePadding(col) + 2) + '.');
|
|
1454
|
-
wrapped.push("'" + '-'.repeat(this.negatePadding(col) + 2) + "'");
|
|
1455
|
-
}
|
|
1456
|
-
// add top and bottom padding.
|
|
1457
|
-
if (col.padding) {
|
|
1458
|
-
wrapped.unshift(...new Array(col.padding[top] || 0).fill(''));
|
|
1459
|
-
wrapped.push(...new Array(col.padding[bottom] || 0).fill(''));
|
|
1460
|
-
}
|
|
1461
|
-
wrapped.forEach((str, r) => {
|
|
1462
|
-
if (!rrows[r]) {
|
|
1463
|
-
rrows.push([]);
|
|
1464
|
-
}
|
|
1465
|
-
const rrow = rrows[r];
|
|
1466
|
-
for (let i = 0; i < c; i++) {
|
|
1467
|
-
if (rrow[i] === undefined) {
|
|
1468
|
-
rrow.push('');
|
|
1469
|
-
}
|
|
1470
|
-
}
|
|
1471
|
-
rrow.push(str);
|
|
1472
|
-
});
|
|
1473
|
-
});
|
|
1474
|
-
return rrows;
|
|
1475
|
-
}
|
|
1476
|
-
negatePadding(col) {
|
|
1477
|
-
let wrapWidth = col.width || 0;
|
|
1478
|
-
if (col.padding) {
|
|
1479
|
-
wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0);
|
|
1480
|
-
}
|
|
1481
|
-
if (col.border) {
|
|
1482
|
-
wrapWidth -= 4;
|
|
1483
|
-
}
|
|
1484
|
-
return wrapWidth;
|
|
1485
|
-
}
|
|
1486
|
-
columnWidths(row) {
|
|
1487
|
-
if (!this.wrap) {
|
|
1488
|
-
return row.map(col => {
|
|
1489
|
-
return col.width || mixin.stringWidth(col.text);
|
|
1490
|
-
});
|
|
1491
|
-
}
|
|
1492
|
-
let unset = row.length;
|
|
1493
|
-
let remainingWidth = this.width;
|
|
1494
|
-
// column widths can be set in config.
|
|
1495
|
-
const widths = row.map(col => {
|
|
1496
|
-
if (col.width) {
|
|
1497
|
-
unset--;
|
|
1498
|
-
remainingWidth -= col.width;
|
|
1499
|
-
return col.width;
|
|
1500
|
-
}
|
|
1501
|
-
return undefined;
|
|
1502
|
-
});
|
|
1503
|
-
// any unset widths should be calculated.
|
|
1504
|
-
const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0;
|
|
1505
|
-
return widths.map((w, i) => {
|
|
1506
|
-
if (w === undefined) {
|
|
1507
|
-
return Math.max(unsetWidth, _minWidth(row[i]));
|
|
1508
|
-
}
|
|
1509
|
-
return w;
|
|
1510
|
-
});
|
|
1511
|
-
}
|
|
1512
|
-
}
|
|
1513
|
-
function addBorder(col, ts, style) {
|
|
1514
|
-
if (col.border) {
|
|
1515
|
-
if (/[.']-+[.']/.test(ts)) {
|
|
1516
|
-
return '';
|
|
1517
|
-
}
|
|
1518
|
-
if (ts.trim().length !== 0) {
|
|
1519
|
-
return style;
|
|
1520
|
-
}
|
|
1521
|
-
return ' ';
|
|
1522
|
-
}
|
|
1523
|
-
return '';
|
|
1524
|
-
}
|
|
1525
|
-
// calculates the minimum width of
|
|
1526
|
-
// a column, based on padding preferences.
|
|
1527
|
-
function _minWidth(col) {
|
|
1528
|
-
const padding = col.padding || [];
|
|
1529
|
-
const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0);
|
|
1530
|
-
if (col.border) {
|
|
1531
|
-
return minWidth + 4;
|
|
1532
|
-
}
|
|
1533
|
-
return minWidth;
|
|
1534
|
-
}
|
|
1535
|
-
function getWindowWidth() {
|
|
1536
|
-
/* istanbul ignore next: depends on terminal */
|
|
1537
|
-
if (typeof process === 'object' && process.stdout && process.stdout.columns) {
|
|
1538
|
-
return process.stdout.columns;
|
|
1539
|
-
}
|
|
1540
|
-
return 80;
|
|
1541
|
-
}
|
|
1542
|
-
function alignRight(str, width) {
|
|
1543
|
-
str = str.trim();
|
|
1544
|
-
const strWidth = mixin.stringWidth(str);
|
|
1545
|
-
if (strWidth < width) {
|
|
1546
|
-
return ' '.repeat(width - strWidth) + str;
|
|
1547
|
-
}
|
|
1548
|
-
return str;
|
|
1549
|
-
}
|
|
1550
|
-
function alignCenter(str, width) {
|
|
1551
|
-
str = str.trim();
|
|
1552
|
-
const strWidth = mixin.stringWidth(str);
|
|
1553
|
-
/* istanbul ignore next */
|
|
1554
|
-
if (strWidth >= width) {
|
|
1555
|
-
return str;
|
|
1556
|
-
}
|
|
1557
|
-
return ' '.repeat((width - strWidth) >> 1) + str;
|
|
1558
|
-
}
|
|
1559
|
-
let mixin;
|
|
1560
|
-
function cliui(opts, _mixin) {
|
|
1561
|
-
mixin = _mixin;
|
|
1562
|
-
return new UI({
|
|
1563
|
-
width: (opts === null || opts === undefined ? undefined : opts.width) || getWindowWidth(),
|
|
1564
|
-
wrap: opts === null || opts === undefined ? undefined : opts.wrap
|
|
1565
|
-
});
|
|
1566
|
-
}
|
|
1567
|
-
|
|
1568
|
-
// Minimal replacement for ansi string helpers "wrap-ansi" and "strip-ansi".
|
|
1569
|
-
// to facilitate ESM and Deno modules.
|
|
1570
|
-
// TODO: look at porting https://www.npmjs.com/package/wrap-ansi to ESM.
|
|
1571
|
-
// The npm application
|
|
1572
|
-
// Copyright (c) npm, Inc. and Contributors
|
|
1573
|
-
// Licensed on the terms of The Artistic License 2.0
|
|
1574
|
-
// See: https://github.com/npm/cli/blob/4c65cd952bc8627811735bea76b9b110cc4fc80e/lib/utils/ansi-trim.js
|
|
1575
|
-
const ansi = new RegExp('\x1b(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|' +
|
|
1576
|
-
'\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)', 'g');
|
|
1577
|
-
function stripAnsi(str) {
|
|
1578
|
-
return str.replace(ansi, '');
|
|
1579
|
-
}
|
|
1580
|
-
function wrap(str, width) {
|
|
1581
|
-
const [start, end] = str.match(ansi) || ['', ''];
|
|
1582
|
-
str = stripAnsi(str);
|
|
1583
|
-
let wrapped = '';
|
|
1584
|
-
for (let i = 0; i < str.length; i++) {
|
|
1585
|
-
if (i !== 0 && (i % width) === 0) {
|
|
1586
|
-
wrapped += '\n';
|
|
1587
|
-
}
|
|
1588
|
-
wrapped += str.charAt(i);
|
|
1589
|
-
}
|
|
1590
|
-
if (start && end) {
|
|
1591
|
-
wrapped = `${start}${wrapped}${end}`;
|
|
1592
|
-
}
|
|
1593
|
-
return wrapped;
|
|
1594
|
-
}
|
|
1595
|
-
|
|
1596
|
-
// Bootstrap cliui with CommonJS dependencies:
|
|
1597
|
-
|
|
1598
|
-
function ui (opts) {
|
|
1599
|
-
return cliui(opts, {
|
|
1600
|
-
stringWidth: (str) => {
|
|
1601
|
-
return [...str].length
|
|
1602
|
-
},
|
|
1603
|
-
stripAnsi,
|
|
1604
|
-
wrap
|
|
1605
|
-
})
|
|
1606
|
-
}
|
|
1607
|
-
|
|
1608
|
-
function escalade (start, callback) {
|
|
1609
|
-
let dir = resolve('.', start);
|
|
1610
|
-
let tmp, stats = statSync(dir);
|
|
1611
|
-
|
|
1612
|
-
if (!stats.isDirectory()) {
|
|
1613
|
-
dir = dirname(dir);
|
|
1614
|
-
}
|
|
1615
|
-
|
|
1616
|
-
while (true) {
|
|
1617
|
-
tmp = callback(dir, readdirSync(dir));
|
|
1618
|
-
if (tmp) return resolve(dir, tmp);
|
|
1619
|
-
dir = dirname(tmp = dir);
|
|
1620
|
-
if (tmp === dir) break;
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
1257
|
|
|
1624
1258
|
var shim$1 = {
|
|
1625
1259
|
fs: {
|
|
@@ -1817,9 +1451,6 @@ const y18n = (opts) => {
|
|
|
1817
1451
|
return y18n$1(opts, shim$1)
|
|
1818
1452
|
};
|
|
1819
1453
|
|
|
1820
|
-
const REQUIRE_ERROR = 'require is not supported by ESM';
|
|
1821
|
-
const REQUIRE_DIRECTORY_ERROR = 'loading a directory of commands is not supported yet for ESM';
|
|
1822
|
-
|
|
1823
1454
|
let __dirname;
|
|
1824
1455
|
try {
|
|
1825
1456
|
__dirname = fileURLToPath(import.meta.url);
|
|
@@ -1829,48 +1460,13 @@ try {
|
|
|
1829
1460
|
const mainFilename = __dirname.substring(0, __dirname.lastIndexOf('node_modules'));
|
|
1830
1461
|
|
|
1831
1462
|
({
|
|
1832
|
-
assert: {
|
|
1833
|
-
notStrictEqual,
|
|
1834
|
-
strictEqual
|
|
1835
|
-
},
|
|
1836
|
-
cliui: ui,
|
|
1837
|
-
findUp: escalade,
|
|
1838
|
-
getEnv: (key) => {
|
|
1839
|
-
return process.env[key]
|
|
1840
|
-
},
|
|
1841
|
-
inspect,
|
|
1842
|
-
getCallerFile: () => {
|
|
1843
|
-
throw new YError(REQUIRE_DIRECTORY_ERROR)
|
|
1844
|
-
},
|
|
1845
|
-
getProcessArgvBin,
|
|
1846
1463
|
mainFilename: mainFilename || process.cwd(),
|
|
1847
|
-
Parser: yargsParser,
|
|
1848
|
-
path: {
|
|
1849
|
-
basename,
|
|
1850
|
-
dirname,
|
|
1851
|
-
extname,
|
|
1852
|
-
relative,
|
|
1853
|
-
resolve
|
|
1854
|
-
},
|
|
1855
1464
|
process: {
|
|
1856
|
-
argv: () => process.argv,
|
|
1857
1465
|
cwd: process.cwd,
|
|
1858
|
-
emitWarning: (warning, type) => process.emitWarning(warning, type),
|
|
1859
|
-
execPath: () => process.execPath,
|
|
1860
1466
|
exit: process.exit,
|
|
1861
1467
|
nextTick: process.nextTick,
|
|
1862
1468
|
stdColumns: typeof process.stdout.columns !== 'undefined' ? process.stdout.columns : null
|
|
1863
1469
|
},
|
|
1864
|
-
readFileSync,
|
|
1865
|
-
require: () => {
|
|
1866
|
-
throw new YError(REQUIRE_ERROR)
|
|
1867
|
-
},
|
|
1868
|
-
requireDirectory: () => {
|
|
1869
|
-
throw new YError(REQUIRE_DIRECTORY_ERROR)
|
|
1870
|
-
},
|
|
1871
|
-
stringWidth: (str) => {
|
|
1872
|
-
return [...str].length
|
|
1873
|
-
},
|
|
1874
1470
|
y18n: y18n({
|
|
1875
1471
|
directory: resolve(__dirname, '../../../locales'),
|
|
1876
1472
|
updateFiles: false
|
|
@@ -1880,7 +1476,7 @@ const mainFilename = __dirname.substring(0, __dirname.lastIndexOf('node_modules'
|
|
|
1880
1476
|
var name = "@form8ion/utils-cli";
|
|
1881
1477
|
var description = "cli for various tools for the organization";
|
|
1882
1478
|
var license = "MIT";
|
|
1883
|
-
var version = "12.0.0-beta.
|
|
1479
|
+
var version = "12.0.0-beta.3";
|
|
1884
1480
|
var type = "module";
|
|
1885
1481
|
var engines = {
|
|
1886
1482
|
node: "^18.19.0 || ^20.9.0 || >=22.11.0"
|
|
@@ -1929,7 +1525,7 @@ var publishConfig = {
|
|
|
1929
1525
|
access: "public",
|
|
1930
1526
|
provenance: true
|
|
1931
1527
|
};
|
|
1932
|
-
var packageManager = "npm@11.
|
|
1528
|
+
var packageManager = "npm@11.1.0+sha512.acf301ad9b9ddba948fcb72341e2f0fcae477f56a95cc2a092934d133a7461062633cefbf93d5934a3dc0768674e2edee9f04dcfcc4bb4c327ff0e3a7d552a1b";
|
|
1933
1529
|
var dependencies = {
|
|
1934
1530
|
"@form8ion/codecov": "6.2.0",
|
|
1935
1531
|
"@form8ion/core": "4.8.0",
|
|
@@ -1951,7 +1547,7 @@ var dependencies = {
|
|
|
1951
1547
|
"@form8ion/renovate-scaffolder": "3.0.0",
|
|
1952
1548
|
"@form8ion/replace-travis-ci-with-github-actions": "10.0.1",
|
|
1953
1549
|
"@form8ion/rollup": "6.0.0-beta.1",
|
|
1954
|
-
"@form8ion/scaffolder-scaffolder": "7.0.0-beta.
|
|
1550
|
+
"@form8ion/scaffolder-scaffolder": "7.0.0-beta.4",
|
|
1955
1551
|
"@form8ion/vite": "2.0.1",
|
|
1956
1552
|
"@form8ion/vitest": "5.0.0-beta.1",
|
|
1957
1553
|
"update-notifier": "7.3.1",
|
|
@@ -1959,11 +1555,12 @@ var dependencies = {
|
|
|
1959
1555
|
};
|
|
1960
1556
|
var devDependencies = {
|
|
1961
1557
|
"@cucumber/cucumber": "11.2.0",
|
|
1962
|
-
"@form8ion/commitlint-config": "2.0.
|
|
1558
|
+
"@form8ion/commitlint-config": "2.0.4",
|
|
1559
|
+
"@form8ion/core": "4.8.0",
|
|
1963
1560
|
"@form8ion/eslint-config": "7.0.12",
|
|
1964
1561
|
"@form8ion/eslint-config-cucumber": "1.4.1",
|
|
1965
1562
|
"@form8ion/eslint-config-mocha": "3.0.6",
|
|
1966
|
-
"@form8ion/remark-lint-preset": "6.0.
|
|
1563
|
+
"@form8ion/remark-lint-preset": "6.0.6",
|
|
1967
1564
|
"@rollup/plugin-node-resolve": "16.0.0",
|
|
1968
1565
|
"@travi/any": "3.1.2",
|
|
1969
1566
|
"ban-sensitive-files": "1.10.7",
|
|
@@ -1984,19 +1581,19 @@ var devDependencies = {
|
|
|
1984
1581
|
"ls-engines": "0.9.3",
|
|
1985
1582
|
"mdast-util-from-markdown": "2.0.2",
|
|
1986
1583
|
"mdast-zone": "6.1.0",
|
|
1987
|
-
"mock-fs": "5.
|
|
1584
|
+
"mock-fs": "5.5.0",
|
|
1988
1585
|
msw: "2.7.0",
|
|
1989
1586
|
"npm-run-all2": "7.0.2",
|
|
1990
|
-
publint: "0.3.
|
|
1587
|
+
publint: "0.3.4",
|
|
1991
1588
|
"remark-cli": "12.0.1",
|
|
1992
1589
|
rimraf: "6.0.1",
|
|
1993
|
-
rollup: "4.
|
|
1590
|
+
rollup: "4.34.6",
|
|
1994
1591
|
"rollup-plugin-auto-external": "2.0.0",
|
|
1995
1592
|
"rollup-plugin-executable": "1.6.3",
|
|
1996
1593
|
"rollup-plugin-json": "4.0.0",
|
|
1997
1594
|
testdouble: "3.20.2",
|
|
1998
1595
|
"unist-util-find": "3.0.0",
|
|
1999
|
-
vitest: "3.0.
|
|
1596
|
+
vitest: "3.0.5"
|
|
2000
1597
|
};
|
|
2001
1598
|
var pkg = {
|
|
2002
1599
|
name: name,
|
|
@@ -2071,11 +1668,11 @@ function javascript(options) {
|
|
|
2071
1668
|
}
|
|
2072
1669
|
|
|
2073
1670
|
function getEnhancedCodecovScaffolder() {
|
|
2074
|
-
return options => scaffold$
|
|
1671
|
+
return options => scaffold$2({...options, visibility: 'Public'});
|
|
2075
1672
|
}
|
|
2076
1673
|
|
|
2077
1674
|
function prettier(options) {
|
|
2078
|
-
return scaffold$
|
|
1675
|
+
return scaffold$1({...options, config: javascriptConfigs.prettier});
|
|
2079
1676
|
}
|
|
2080
1677
|
|
|
2081
1678
|
function javascriptPluginFactory(decisions) {
|
|
@@ -2102,15 +1699,15 @@ function handler$1(decisions) {
|
|
|
2102
1699
|
const traviName = 'Matt Travi';
|
|
2103
1700
|
const decisionsWithEnhancements = {
|
|
2104
1701
|
...decisions,
|
|
2105
|
-
[questionNames.COPYRIGHT_HOLDER]: traviName,
|
|
2106
|
-
[questionNames.REPO_HOST]: 'GitHub',
|
|
2107
|
-
[questionNames.DEPENDENCY_UPDATER]: 'Renovate',
|
|
1702
|
+
[questionNames$1.COPYRIGHT_HOLDER]: traviName,
|
|
1703
|
+
[questionNames$1.REPO_HOST]: 'GitHub',
|
|
1704
|
+
[questionNames$1.DEPENDENCY_UPDATER]: 'Renovate',
|
|
2108
1705
|
[githubDetailsPromptQuestionNames.GITHUB_ACCOUNT]: orgName,
|
|
2109
|
-
[questionNames
|
|
2110
|
-
[questionNames
|
|
2111
|
-
[questionNames
|
|
2112
|
-
[questionNames
|
|
2113
|
-
[questionNames
|
|
1706
|
+
[questionNames.AUTHOR_NAME]: traviName,
|
|
1707
|
+
[questionNames.AUTHOR_EMAIL]: 'npm@travi.org',
|
|
1708
|
+
[questionNames.AUTHOR_URL]: 'https://matt.travi.org',
|
|
1709
|
+
[questionNames.SCOPE]: orgName,
|
|
1710
|
+
[questionNames.PACKAGE_MANAGER]: packageManagers.NPM
|
|
2114
1711
|
};
|
|
2115
1712
|
|
|
2116
1713
|
return scaffold$3({
|
|
@@ -2137,19 +1734,19 @@ function handler({decisions}) {
|
|
|
2137
1734
|
return lift$1({
|
|
2138
1735
|
decisions,
|
|
2139
1736
|
scaffolders: {
|
|
2140
|
-
Renovate: scaffold$
|
|
1737
|
+
Renovate: scaffold$6,
|
|
2141
1738
|
'Unit Testing': unitTesting,
|
|
2142
1739
|
Cucumber: scaffold$5,
|
|
2143
1740
|
Codecov: getEnhancedCodecovScaffolder(),
|
|
2144
1741
|
Prettier: prettier,
|
|
2145
1742
|
'Remove Greenkeeper': removeGreenkeeper,
|
|
2146
1743
|
'Replace Travis CI with GitHub Actions': replace,
|
|
2147
|
-
'OSSF Scorecard': scaffold$
|
|
1744
|
+
'OSSF Scorecard': scaffold$4
|
|
2148
1745
|
},
|
|
2149
1746
|
enhancers: {
|
|
2150
1747
|
...ungroupObject(projectPlugins({})),
|
|
2151
|
-
'GitHub Actions CI': {test: test, lift: lift$
|
|
2152
|
-
JetBrains: {test: test
|
|
1748
|
+
'GitHub Actions CI': {test: test$1, lift: lift$3},
|
|
1749
|
+
JetBrains: {test: test, lift: lift$2}
|
|
2153
1750
|
}
|
|
2154
1751
|
});
|
|
2155
1752
|
}
|