@herodevs/cli 0.2.3-rc1 → 0.2.4
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/{main.js → cli.cjs} +133 -95
- package/hd-cli.js +1 -0
- package/package.json +4 -5
package/{main.js → cli.cjs}
RENAMED
|
@@ -1,56 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (typeof require !== "undefined")
|
|
6
|
-
return require.apply(this, arguments);
|
|
7
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
8
|
-
});
|
|
9
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
10
9
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
10
|
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
12
32
|
|
|
13
33
|
// apps/cli/package.json
|
|
14
34
|
var require_package = __commonJS({
|
|
15
|
-
"apps/cli/package.json"(
|
|
16
|
-
|
|
35
|
+
"apps/cli/package.json"(exports2, module2) {
|
|
36
|
+
module2.exports = {
|
|
17
37
|
name: "@herodevs/cli",
|
|
18
38
|
version: "0.0.0",
|
|
19
|
-
bin: "./
|
|
39
|
+
bin: "./hd-cli.js",
|
|
20
40
|
dependencies: {
|
|
21
41
|
tslib: "^2.3.0"
|
|
22
42
|
},
|
|
23
|
-
type: "
|
|
24
|
-
main: "./
|
|
43
|
+
type: "commonjs",
|
|
44
|
+
main: "./hd-cli.js"
|
|
25
45
|
};
|
|
26
46
|
}
|
|
27
47
|
});
|
|
28
48
|
|
|
29
49
|
// apps/cli/src/lib/cli.ts
|
|
30
|
-
|
|
31
|
-
|
|
50
|
+
var cli_exports = {};
|
|
51
|
+
__export(cli_exports, {
|
|
52
|
+
cli: () => cli
|
|
53
|
+
});
|
|
54
|
+
module.exports = __toCommonJS(cli_exports);
|
|
55
|
+
var yargs = __toESM(require("yargs"));
|
|
56
|
+
var import_helpers = require("yargs/helpers");
|
|
32
57
|
|
|
33
58
|
// libs/report/committers/src/lib/committers.ts
|
|
34
|
-
|
|
59
|
+
var import_date_fns2 = require("date-fns");
|
|
35
60
|
|
|
36
61
|
// libs/utility/src/lib/get-root-dir.ts
|
|
37
|
-
|
|
38
|
-
|
|
62
|
+
var import_fs = require("fs");
|
|
63
|
+
var import_path = require("path");
|
|
39
64
|
function getRootDir(directory) {
|
|
40
|
-
if (existsSync(join(directory, "package.json"))) {
|
|
65
|
+
if ((0, import_fs.existsSync)((0, import_path.join)(directory, "package.json"))) {
|
|
41
66
|
return directory;
|
|
42
67
|
}
|
|
43
|
-
return getRootDir(resolve(join(directory, "..")));
|
|
68
|
+
return getRootDir((0, import_path.resolve)((0, import_path.join)(directory, "..")));
|
|
44
69
|
}
|
|
45
70
|
|
|
46
71
|
// libs/utility/src/lib/run-command.ts
|
|
47
|
-
|
|
72
|
+
var import_child_process = require("child_process");
|
|
48
73
|
async function runCommand(cmd) {
|
|
49
74
|
return new Promise((resolve4, reject) => {
|
|
50
75
|
const options = {
|
|
51
76
|
timeout: 1e4
|
|
52
77
|
};
|
|
53
|
-
exec(cmd, options, (err, stdout, stderr) => {
|
|
78
|
+
(0, import_child_process.exec)(cmd, options, (err, stdout, stderr) => {
|
|
54
79
|
if (err) {
|
|
55
80
|
const rejection = {
|
|
56
81
|
err,
|
|
@@ -70,11 +95,11 @@ async function runCommand(cmd) {
|
|
|
70
95
|
}
|
|
71
96
|
|
|
72
97
|
// libs/utility/src/lib/get-project-types.ts
|
|
73
|
-
|
|
74
|
-
var path =
|
|
98
|
+
var import_fs2 = require("fs");
|
|
99
|
+
var path = require("path");
|
|
75
100
|
function getProjectTypes() {
|
|
76
101
|
const types = [];
|
|
77
|
-
if (
|
|
102
|
+
if ((0, import_fs2.existsSync)(path.join(process.cwd(), "package.json"))) {
|
|
78
103
|
types.push("npm");
|
|
79
104
|
}
|
|
80
105
|
return types;
|
|
@@ -86,11 +111,11 @@ function sortByName(a, b) {
|
|
|
86
111
|
}
|
|
87
112
|
|
|
88
113
|
// libs/report/committers/src/lib/parse-date-flags.ts
|
|
89
|
-
|
|
114
|
+
var import_date_fns = require("date-fns");
|
|
90
115
|
function parseDateFlags(dateFormat2, startDate, endDate) {
|
|
91
116
|
return {
|
|
92
|
-
endDate: parse(endDate, dateFormat2, /* @__PURE__ */ new Date()),
|
|
93
|
-
startDate: parse(startDate, dateFormat2, /* @__PURE__ */ new Date())
|
|
117
|
+
endDate: (0, import_date_fns.parse)(endDate, dateFormat2, /* @__PURE__ */ new Date()),
|
|
118
|
+
startDate: (0, import_date_fns.parse)(startDate, dateFormat2, /* @__PURE__ */ new Date())
|
|
94
119
|
};
|
|
95
120
|
}
|
|
96
121
|
|
|
@@ -129,7 +154,7 @@ var reportCommittersCommand = {
|
|
|
129
154
|
builder: {
|
|
130
155
|
startDate: {
|
|
131
156
|
alias: "s",
|
|
132
|
-
default: format(/* @__PURE__ */ new Date(), dateFormat),
|
|
157
|
+
default: (0, import_date_fns2.format)(/* @__PURE__ */ new Date(), dateFormat),
|
|
133
158
|
describe: `Start Date (format: ${dateFormat})`,
|
|
134
159
|
string: true
|
|
135
160
|
},
|
|
@@ -137,13 +162,19 @@ var reportCommittersCommand = {
|
|
|
137
162
|
alias: "e",
|
|
138
163
|
describe: `End Date (format: ${dateFormat})`,
|
|
139
164
|
required: false,
|
|
140
|
-
default: format(subMonths(/* @__PURE__ */ new Date(), monthsToSubtract), dateFormat)
|
|
165
|
+
default: (0, import_date_fns2.format)((0, import_date_fns2.subMonths)(/* @__PURE__ */ new Date(), monthsToSubtract), dateFormat)
|
|
141
166
|
},
|
|
142
167
|
exclude: {
|
|
143
168
|
alias: "x",
|
|
144
169
|
array: true,
|
|
145
170
|
describe: 'Path Exclusions (eg -x="./src/bin" -x="./dist")',
|
|
146
171
|
required: false
|
|
172
|
+
},
|
|
173
|
+
json: {
|
|
174
|
+
describe: "Output to JSON format",
|
|
175
|
+
required: false,
|
|
176
|
+
default: false,
|
|
177
|
+
boolean: true
|
|
147
178
|
}
|
|
148
179
|
// monthly: {
|
|
149
180
|
// alias: 'm',
|
|
@@ -162,15 +193,18 @@ async function run(args) {
|
|
|
162
193
|
const result = await runCommand(gitCommand);
|
|
163
194
|
const rawEntries = result.split("\n");
|
|
164
195
|
if (rawEntries.length === 1 && rawEntries[0] === "") {
|
|
165
|
-
const startDateStr = format(startDate, "yyyy-MM-dd");
|
|
166
|
-
const endDateStr = format(endDate, "yyyy-MM-dd");
|
|
196
|
+
const startDateStr = (0, import_date_fns2.format)(startDate, "yyyy-MM-dd");
|
|
197
|
+
const endDateStr = (0, import_date_fns2.format)(endDate, "yyyy-MM-dd");
|
|
167
198
|
console.log(`No commits found between ${endDateStr} and ${startDateStr}`);
|
|
168
199
|
return;
|
|
169
200
|
}
|
|
170
201
|
const entries = parseGitLogEntries(rawEntries);
|
|
171
|
-
console.error(`entries: ${JSON.stringify(entries, null, 2)}`);
|
|
172
202
|
const committerCounts = getCommitterCounts(entries);
|
|
173
|
-
|
|
203
|
+
if (args.json) {
|
|
204
|
+
outputCommittersJson(committerCounts);
|
|
205
|
+
} else {
|
|
206
|
+
outputCommitters(committerCounts);
|
|
207
|
+
}
|
|
174
208
|
}
|
|
175
209
|
function outputCommitters(committerCounts) {
|
|
176
210
|
const longestNameLength = committerCounts.reduce((acc, c) => {
|
|
@@ -189,17 +223,20 @@ function outputCommitters(committerCounts) {
|
|
|
189
223
|
}).join("\n")
|
|
190
224
|
);
|
|
191
225
|
}
|
|
226
|
+
function outputCommittersJson(committerCounts) {
|
|
227
|
+
console.log(JSON.stringify(committerCounts, null, 2));
|
|
228
|
+
}
|
|
192
229
|
|
|
193
230
|
// libs/report/diagnostics/src/lib/diagnostics.ts
|
|
194
|
-
|
|
231
|
+
var import_prompts = require("@inquirer/prompts");
|
|
195
232
|
|
|
196
233
|
// libs/report/diagnostics/src/lib/get-file-contents.ts
|
|
197
|
-
|
|
234
|
+
var import_fs3 = require("fs");
|
|
198
235
|
function getFileContents(filePath) {
|
|
199
|
-
if (!
|
|
236
|
+
if (!(0, import_fs3.existsSync)(filePath)) {
|
|
200
237
|
return `${filePath} not found`;
|
|
201
238
|
}
|
|
202
|
-
const diagData = readFileSync(filePath, "utf8");
|
|
239
|
+
const diagData = (0, import_fs3.readFileSync)(filePath, "utf8");
|
|
203
240
|
return diagData;
|
|
204
241
|
}
|
|
205
242
|
|
|
@@ -252,7 +289,7 @@ var reportDiagnosticsCommand = {
|
|
|
252
289
|
async function run2(args) {
|
|
253
290
|
const consentPrompt = "Data produced may contain sensitive data, please review before sharing it.";
|
|
254
291
|
if (!args.consent) {
|
|
255
|
-
const answer = await confirm({
|
|
292
|
+
const answer = await (0, import_prompts.confirm)({
|
|
256
293
|
message: `${consentPrompt} Continue?`
|
|
257
294
|
});
|
|
258
295
|
if (!answer) {
|
|
@@ -265,7 +302,7 @@ async function run2(args) {
|
|
|
265
302
|
...d,
|
|
266
303
|
checked: true
|
|
267
304
|
}));
|
|
268
|
-
const diagTypes = args.all ? diagTypeList.map((d) => d.value) : await checkbox({
|
|
305
|
+
const diagTypes = args.all ? diagTypeList.map((d) => d.value) : await (0, import_prompts.checkbox)({
|
|
269
306
|
message: "select diagnostic(s) to run",
|
|
270
307
|
choices: diagTypeList,
|
|
271
308
|
required: true,
|
|
@@ -333,8 +370,8 @@ var defaultConfig = {
|
|
|
333
370
|
};
|
|
334
371
|
|
|
335
372
|
// libs/tracker/init/src/lib/init.ts
|
|
336
|
-
|
|
337
|
-
|
|
373
|
+
var import_path2 = require("path");
|
|
374
|
+
var import_fs4 = require("fs");
|
|
338
375
|
var trackerInitCommand = {
|
|
339
376
|
command: "init",
|
|
340
377
|
describe: "Initialize the tracker configuration",
|
|
@@ -345,33 +382,33 @@ var trackerInitCommand = {
|
|
|
345
382
|
function run3(args) {
|
|
346
383
|
const rootDir = getRootDir(global.process.cwd());
|
|
347
384
|
const output = JSON.stringify(defaultConfig, null, 2);
|
|
348
|
-
const dir =
|
|
349
|
-
if (!
|
|
350
|
-
mkdirSync(dir);
|
|
385
|
+
const dir = (0, import_path2.join)(rootDir, "hd-tracker");
|
|
386
|
+
if (!(0, import_fs4.existsSync)(dir)) {
|
|
387
|
+
(0, import_fs4.mkdirSync)(dir);
|
|
351
388
|
}
|
|
352
|
-
writeFileSync(
|
|
389
|
+
(0, import_fs4.writeFileSync)((0, import_path2.join)(dir, "config.json"), output);
|
|
353
390
|
}
|
|
354
391
|
|
|
355
392
|
// libs/tracker/shared/src/lib/read-config.ts
|
|
356
|
-
|
|
357
|
-
|
|
393
|
+
var import_fs5 = require("fs");
|
|
394
|
+
var import_path3 = require("path");
|
|
358
395
|
function readConfig(rootDirectory, optionsPath) {
|
|
359
|
-
const path3 = optionsPath &&
|
|
360
|
-
const contents =
|
|
396
|
+
const path3 = optionsPath && (0, import_fs5.existsSync)((0, import_path3.join)(rootDirectory, optionsPath)) ? (0, import_path3.join)(rootDirectory, optionsPath) : (0, import_path3.join)(rootDirectory, "hd-tracker", "config.json");
|
|
397
|
+
const contents = (0, import_fs5.readFileSync)(path3).toString("utf-8");
|
|
361
398
|
return JSON.parse(contents);
|
|
362
399
|
}
|
|
363
400
|
|
|
364
401
|
// libs/tracker/run/src/lib/run.ts
|
|
365
|
-
|
|
402
|
+
var import_path6 = require("path");
|
|
366
403
|
|
|
367
404
|
// libs/tracker/run/src/lib/process-category.ts
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
405
|
+
var sloc = __toESM(require("sloc"));
|
|
406
|
+
var import_fs6 = require("fs");
|
|
407
|
+
var import_path4 = require("path");
|
|
371
408
|
function processCategory(rootDirectory, category, ignorePatterns) {
|
|
372
409
|
console.log(`Processing "${category.name}"...`);
|
|
373
410
|
const allFiles = category.includes.reduce((acc, include) => {
|
|
374
|
-
return [...acc, ...findAllFilesInDirectory(
|
|
411
|
+
return [...acc, ...findAllFilesInDirectory((0, import_path4.join)(rootDirectory, include))];
|
|
375
412
|
}, []);
|
|
376
413
|
const includedFiles = findIncludedFiles(category, ignorePatterns, allFiles);
|
|
377
414
|
console.log(` ${includedFiles.length} files...`);
|
|
@@ -448,7 +485,7 @@ function aggregateResults(results) {
|
|
|
448
485
|
}, {});
|
|
449
486
|
}
|
|
450
487
|
function getFileStats(file) {
|
|
451
|
-
const contents =
|
|
488
|
+
const contents = (0, import_fs6.readFileSync)(file).toString("utf-8");
|
|
452
489
|
const fileType = getFileExt(file);
|
|
453
490
|
const stats = sloc(contents, fileType);
|
|
454
491
|
return {
|
|
@@ -499,21 +536,21 @@ function findIncludedFiles(category, ignorePatterns, allFiles) {
|
|
|
499
536
|
});
|
|
500
537
|
}
|
|
501
538
|
function findAllFilesInDirectory(directory) {
|
|
502
|
-
const results = readdirSync(directory);
|
|
503
|
-
const subfiles = results.filter((result) => lstatSync(
|
|
504
|
-
const files2 = findAllFilesInDirectory(
|
|
539
|
+
const results = (0, import_fs6.readdirSync)(directory);
|
|
540
|
+
const subfiles = results.filter((result) => (0, import_fs6.lstatSync)((0, import_path4.join)(directory, result)).isDirectory()).reduce((acc, subdir) => {
|
|
541
|
+
const files2 = findAllFilesInDirectory((0, import_path4.join)(directory, subdir));
|
|
505
542
|
return [...acc, ...files2];
|
|
506
543
|
}, []);
|
|
507
|
-
const files = results.filter((result) => lstatSync(
|
|
544
|
+
const files = results.filter((result) => (0, import_fs6.lstatSync)((0, import_path4.join)(directory, result)).isFile()).map((fileName) => (0, import_path4.join)(directory, fileName));
|
|
508
545
|
return [...files, ...subfiles];
|
|
509
546
|
}
|
|
510
547
|
function getFileExt(file) {
|
|
511
|
-
return extname(file).replace(/\./g, "");
|
|
548
|
+
return (0, import_path4.extname)(file).replace(/\./g, "");
|
|
512
549
|
}
|
|
513
550
|
|
|
514
551
|
// libs/tracker/run/src/lib/get-git-commit.ts
|
|
515
|
-
|
|
516
|
-
|
|
552
|
+
var import_date_fns3 = require("date-fns");
|
|
553
|
+
var import_git_last_commit = require("git-last-commit");
|
|
517
554
|
async function getGitCommit() {
|
|
518
555
|
const commit = await getLastCommitAsPromise();
|
|
519
556
|
return {
|
|
@@ -523,7 +560,7 @@ async function getGitCommit() {
|
|
|
523
560
|
}
|
|
524
561
|
function getLastCommitAsPromise() {
|
|
525
562
|
return new Promise((resolve4, reject) => {
|
|
526
|
-
getLastCommit((err, commit) => {
|
|
563
|
+
(0, import_git_last_commit.getLastCommit)((err, commit) => {
|
|
527
564
|
if (err) {
|
|
528
565
|
reject(err);
|
|
529
566
|
}
|
|
@@ -532,7 +569,7 @@ function getLastCommitAsPromise() {
|
|
|
532
569
|
});
|
|
533
570
|
}
|
|
534
571
|
function formatDate(date) {
|
|
535
|
-
return
|
|
572
|
+
return (0, import_date_fns3.format)(date, "yyyy-MM-dd-HH-mm-ss-SSS");
|
|
536
573
|
}
|
|
537
574
|
function getGitDate(date) {
|
|
538
575
|
return new Date(+date * 1e3);
|
|
@@ -557,26 +594,26 @@ async function processConfig(config, rootDirectory) {
|
|
|
557
594
|
}
|
|
558
595
|
|
|
559
596
|
// libs/tracker/run/src/lib/get-data.ts
|
|
560
|
-
|
|
597
|
+
var import_fs7 = require("fs");
|
|
561
598
|
|
|
562
599
|
// libs/tracker/run/src/lib/get-data-filepath.ts
|
|
563
|
-
|
|
600
|
+
var import_path5 = require("path");
|
|
564
601
|
function getDataFilePath(localRootDir, outputDir) {
|
|
565
|
-
return
|
|
602
|
+
return (0, import_path5.resolve)((0, import_path5.join)(localRootDir, outputDir, "data.json"));
|
|
566
603
|
}
|
|
567
604
|
|
|
568
605
|
// libs/tracker/run/src/lib/get-data.ts
|
|
569
606
|
function getData(localRootDir, outputDir) {
|
|
570
607
|
const outputPath = getDataFilePath(localRootDir, outputDir);
|
|
571
608
|
let contents = "";
|
|
572
|
-
if (
|
|
573
|
-
contents =
|
|
609
|
+
if ((0, import_fs7.existsSync)(outputPath)) {
|
|
610
|
+
contents = (0, import_fs7.readFileSync)(outputPath).toString("utf-8");
|
|
574
611
|
}
|
|
575
612
|
return contents === "" ? [] : JSON.parse(contents);
|
|
576
613
|
}
|
|
577
614
|
|
|
578
615
|
// libs/tracker/run/src/lib/save-results.ts
|
|
579
|
-
|
|
616
|
+
var import_fs8 = require("fs");
|
|
580
617
|
function saveResults(localRootDir, outputDir, results) {
|
|
581
618
|
console.log("Outputting file");
|
|
582
619
|
const output = getData(localRootDir, outputDir);
|
|
@@ -586,7 +623,7 @@ function saveResults(localRootDir, outputDir, results) {
|
|
|
586
623
|
output.push(results);
|
|
587
624
|
const outputPath = getDataFilePath(localRootDir, outputDir);
|
|
588
625
|
const outputText = JSON.stringify(output, null, 2);
|
|
589
|
-
|
|
626
|
+
(0, import_fs8.writeFileSync)(outputPath, outputText);
|
|
590
627
|
console.log(`Output written to: ${outputPath}`);
|
|
591
628
|
}
|
|
592
629
|
|
|
@@ -603,7 +640,7 @@ var trackerRunCommand = {
|
|
|
603
640
|
};
|
|
604
641
|
async function run4(args) {
|
|
605
642
|
const localRootDir = getRootDir(global.process.cwd());
|
|
606
|
-
const rootDirectory = args.root ?
|
|
643
|
+
const rootDirectory = args.root ? (0, import_path6.resolve)(args.root) : localRootDir;
|
|
607
644
|
const config = readConfig(localRootDir, args.config);
|
|
608
645
|
const results = await processConfig(config, rootDirectory);
|
|
609
646
|
saveResults(localRootDir, config.outputDir, results);
|
|
@@ -634,7 +671,7 @@ function createGroupCommand(group, description, subCommand, subCommandDescriptio
|
|
|
634
671
|
}
|
|
635
672
|
|
|
636
673
|
// libs/nes/init/src/lib/init.ts
|
|
637
|
-
|
|
674
|
+
var import_prompts2 = require("@inquirer/prompts");
|
|
638
675
|
|
|
639
676
|
// libs/nes/init/src/lib/verify-project-type.ts
|
|
640
677
|
function verifyProjectType() {
|
|
@@ -653,15 +690,15 @@ function verifyProjectType() {
|
|
|
653
690
|
}
|
|
654
691
|
|
|
655
692
|
// libs/nes/init/src/lib/get-release-trains.ts
|
|
656
|
-
|
|
693
|
+
var import_core = require("@apollo/client/core");
|
|
657
694
|
async function getReleaseTrains(accessToken, types) {
|
|
658
|
-
const client = new ApolloClient({
|
|
659
|
-
cache: new InMemoryCache(),
|
|
695
|
+
const client = new import_core.ApolloClient({
|
|
696
|
+
cache: new import_core.InMemoryCache(),
|
|
660
697
|
uri: "https://api.nes.herodevs.com/graphql"
|
|
661
698
|
});
|
|
662
699
|
try {
|
|
663
700
|
const queryResult = await client.query({
|
|
664
|
-
query: gql`
|
|
701
|
+
query: import_core.gql`
|
|
665
702
|
query RT($input: LicensingReleaseTrainsInput) {
|
|
666
703
|
licensing {
|
|
667
704
|
releaseTrains(input: $input) {
|
|
@@ -720,15 +757,15 @@ function getPackageChoices(releaseTrain) {
|
|
|
720
757
|
}
|
|
721
758
|
|
|
722
759
|
// libs/nes/init/src/lib/npm/configure-npm-project.ts
|
|
723
|
-
|
|
724
|
-
var path2 =
|
|
760
|
+
var import_fs9 = require("fs");
|
|
761
|
+
var path2 = require("path");
|
|
725
762
|
function configureNpmProject(accessToken, packages) {
|
|
726
763
|
updatePackageJson(packages);
|
|
727
764
|
updateNpmrc(accessToken);
|
|
728
765
|
}
|
|
729
766
|
function updatePackageJson(packages) {
|
|
730
767
|
const packageJsonPath = path2.join(process.cwd(), "package.json");
|
|
731
|
-
const packageJsonContents =
|
|
768
|
+
const packageJsonContents = (0, import_fs9.readFileSync)(packageJsonPath, "utf8");
|
|
732
769
|
const packageJson = JSON.parse(packageJsonContents);
|
|
733
770
|
const pkgUpdates = packages.map((p) => ({
|
|
734
771
|
key: p.packageVersion.origination?.name || p.packageVersion.name,
|
|
@@ -763,13 +800,13 @@ function updatePackageJson(packages) {
|
|
|
763
800
|
...packageJson.overrides || {},
|
|
764
801
|
...pkgUpdates.overrides
|
|
765
802
|
};
|
|
766
|
-
|
|
803
|
+
(0, import_fs9.writeFileSync)(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
767
804
|
}
|
|
768
805
|
function updateNpmrc(accessToken) {
|
|
769
806
|
const npmrcPath = path2.join(process.cwd(), ".npmrc");
|
|
770
807
|
let npmrcContents = "";
|
|
771
|
-
if (
|
|
772
|
-
npmrcContents =
|
|
808
|
+
if ((0, import_fs9.existsSync)(npmrcPath)) {
|
|
809
|
+
npmrcContents = (0, import_fs9.readFileSync)(npmrcPath, "utf8");
|
|
773
810
|
}
|
|
774
811
|
if (npmrcContents.includes(`@neverendingsupport:registry`)) {
|
|
775
812
|
return;
|
|
@@ -778,7 +815,7 @@ function updateNpmrc(accessToken) {
|
|
|
778
815
|
|
|
779
816
|
@neverendingsupport:registry=https://registry.nes.herodevs.com/npm/pkg/
|
|
780
817
|
//registry.nes.herodevs.com/npm/pkg/:_authToken="${accessToken}"`;
|
|
781
|
-
|
|
818
|
+
(0, import_fs9.writeFileSync)(npmrcPath, updatedContents);
|
|
782
819
|
}
|
|
783
820
|
|
|
784
821
|
// libs/nes/init/src/lib/configure-project.ts
|
|
@@ -789,7 +826,7 @@ function configureProject(accessToken, projectTypes, packages) {
|
|
|
789
826
|
}
|
|
790
827
|
|
|
791
828
|
// libs/nes/init/src/lib/init.ts
|
|
792
|
-
|
|
829
|
+
var ora = __toESM(require("ora"));
|
|
793
830
|
var nesInitCommand = {
|
|
794
831
|
command: "init",
|
|
795
832
|
describe: "Initialize the NES project",
|
|
@@ -804,19 +841,19 @@ async function run5(args) {
|
|
|
804
841
|
console.error(projectType.error);
|
|
805
842
|
return;
|
|
806
843
|
}
|
|
807
|
-
if (!await
|
|
844
|
+
if (!await (0, import_prompts2.confirm)({
|
|
808
845
|
message: "Before initializing, please commit all changes. Continue?"
|
|
809
846
|
})) {
|
|
810
847
|
return;
|
|
811
848
|
}
|
|
812
|
-
const accessToken = await password({
|
|
849
|
+
const accessToken = await (0, import_prompts2.password)({
|
|
813
850
|
message: "Enter access token",
|
|
814
851
|
mask: "*"
|
|
815
852
|
});
|
|
816
853
|
spinner.start("loading your products");
|
|
817
854
|
const productList = await getProductChoices(accessToken, projectType.types);
|
|
818
855
|
spinner.stop();
|
|
819
|
-
const releaseTrain = await select({
|
|
856
|
+
const releaseTrain = await (0, import_prompts2.select)({
|
|
820
857
|
message: "select a product",
|
|
821
858
|
choices: productList,
|
|
822
859
|
pageSize: productList.length
|
|
@@ -826,7 +863,7 @@ async function run5(args) {
|
|
|
826
863
|
...p,
|
|
827
864
|
checked: true
|
|
828
865
|
}));
|
|
829
|
-
const packages = await
|
|
866
|
+
const packages = await (0, import_prompts2.checkbox)({
|
|
830
867
|
message: `select the package(s)`,
|
|
831
868
|
choices: packageList,
|
|
832
869
|
loop: false,
|
|
@@ -871,7 +908,7 @@ function getCommands() {
|
|
|
871
908
|
}
|
|
872
909
|
|
|
873
910
|
// apps/cli/src/lib/ensure-version.ts
|
|
874
|
-
|
|
911
|
+
var getJson = __toESM(require("get-json"));
|
|
875
912
|
|
|
876
913
|
// apps/cli/src/lib/log-colors.ts
|
|
877
914
|
function color(color2) {
|
|
@@ -952,8 +989,9 @@ function cli() {
|
|
|
952
989
|
const pkg = require_package();
|
|
953
990
|
const packageName = pkg.name;
|
|
954
991
|
const packageVersion = pkg.version;
|
|
955
|
-
yargs.scriptName(packageName).usage("Usage: $0 <command> [options]").middleware(() => ensureVersionIsUpToDate(packageName, packageVersion)).command(commands).parse(hideBin(process.argv));
|
|
992
|
+
yargs.scriptName(packageName).usage("Usage: $0 <command> [options]").middleware(() => ensureVersionIsUpToDate(packageName, packageVersion)).command(commands).parse((0, import_helpers.hideBin)(process.argv));
|
|
956
993
|
}
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
cli
|
|
994
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
995
|
+
0 && (module.exports = {
|
|
996
|
+
cli
|
|
997
|
+
});
|
package/hd-cli.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require('./cli.cjs').cli();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@herodevs/cli",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"bin": "./
|
|
3
|
+
"version": "0.2.4",
|
|
4
|
+
"bin": "./hd-cli.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@apollo/client": "3.10.4",
|
|
7
7
|
"@inquirer/prompts": "5.0.4",
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
"tslib": "^2.3.0",
|
|
14
14
|
"yargs": "17.7.2"
|
|
15
15
|
},
|
|
16
|
-
"type": "
|
|
17
|
-
"main": "./
|
|
18
|
-
"module": "./main.js"
|
|
16
|
+
"type": "commonjs",
|
|
17
|
+
"main": "./cli.cjs"
|
|
19
18
|
}
|