@herodevs/cli 0.2.3-rc1 → 0.2.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/{main.js → main.cjs} +119 -92
- package/package.json +4 -5
package/{main.js → main.cjs}
RENAMED
|
@@ -1,56 +1,71 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
12
27
|
|
|
13
28
|
// apps/cli/package.json
|
|
14
29
|
var require_package = __commonJS({
|
|
15
|
-
"apps/cli/package.json"(
|
|
16
|
-
|
|
30
|
+
"apps/cli/package.json"(exports2, module2) {
|
|
31
|
+
module2.exports = {
|
|
17
32
|
name: "@herodevs/cli",
|
|
18
33
|
version: "0.0.0",
|
|
19
|
-
bin: "./main.
|
|
34
|
+
bin: "./main.cjs",
|
|
20
35
|
dependencies: {
|
|
21
36
|
tslib: "^2.3.0"
|
|
22
37
|
},
|
|
23
|
-
type: "
|
|
24
|
-
main: "./main.
|
|
38
|
+
type: "commonjs",
|
|
39
|
+
main: "./main.cjs"
|
|
25
40
|
};
|
|
26
41
|
}
|
|
27
42
|
});
|
|
28
43
|
|
|
29
44
|
// apps/cli/src/lib/cli.ts
|
|
30
|
-
|
|
31
|
-
|
|
45
|
+
var yargs = __toESM(require("yargs"));
|
|
46
|
+
var import_helpers = require("yargs/helpers");
|
|
32
47
|
|
|
33
48
|
// libs/report/committers/src/lib/committers.ts
|
|
34
|
-
|
|
49
|
+
var import_date_fns2 = require("date-fns");
|
|
35
50
|
|
|
36
51
|
// libs/utility/src/lib/get-root-dir.ts
|
|
37
|
-
|
|
38
|
-
|
|
52
|
+
var import_fs = require("fs");
|
|
53
|
+
var import_path = require("path");
|
|
39
54
|
function getRootDir(directory) {
|
|
40
|
-
if (existsSync(join(directory, "package.json"))) {
|
|
55
|
+
if ((0, import_fs.existsSync)((0, import_path.join)(directory, "package.json"))) {
|
|
41
56
|
return directory;
|
|
42
57
|
}
|
|
43
|
-
return getRootDir(resolve(join(directory, "..")));
|
|
58
|
+
return getRootDir((0, import_path.resolve)((0, import_path.join)(directory, "..")));
|
|
44
59
|
}
|
|
45
60
|
|
|
46
61
|
// libs/utility/src/lib/run-command.ts
|
|
47
|
-
|
|
62
|
+
var import_child_process = require("child_process");
|
|
48
63
|
async function runCommand(cmd) {
|
|
49
64
|
return new Promise((resolve4, reject) => {
|
|
50
65
|
const options = {
|
|
51
66
|
timeout: 1e4
|
|
52
67
|
};
|
|
53
|
-
exec(cmd, options, (err, stdout, stderr) => {
|
|
68
|
+
(0, import_child_process.exec)(cmd, options, (err, stdout, stderr) => {
|
|
54
69
|
if (err) {
|
|
55
70
|
const rejection = {
|
|
56
71
|
err,
|
|
@@ -70,11 +85,11 @@ async function runCommand(cmd) {
|
|
|
70
85
|
}
|
|
71
86
|
|
|
72
87
|
// libs/utility/src/lib/get-project-types.ts
|
|
73
|
-
|
|
74
|
-
var path =
|
|
88
|
+
var import_fs2 = require("fs");
|
|
89
|
+
var path = require("path");
|
|
75
90
|
function getProjectTypes() {
|
|
76
91
|
const types = [];
|
|
77
|
-
if (
|
|
92
|
+
if ((0, import_fs2.existsSync)(path.join(process.cwd(), "package.json"))) {
|
|
78
93
|
types.push("npm");
|
|
79
94
|
}
|
|
80
95
|
return types;
|
|
@@ -86,11 +101,11 @@ function sortByName(a, b) {
|
|
|
86
101
|
}
|
|
87
102
|
|
|
88
103
|
// libs/report/committers/src/lib/parse-date-flags.ts
|
|
89
|
-
|
|
104
|
+
var import_date_fns = require("date-fns");
|
|
90
105
|
function parseDateFlags(dateFormat2, startDate, endDate) {
|
|
91
106
|
return {
|
|
92
|
-
endDate: parse(endDate, dateFormat2, /* @__PURE__ */ new Date()),
|
|
93
|
-
startDate: parse(startDate, dateFormat2, /* @__PURE__ */ new Date())
|
|
107
|
+
endDate: (0, import_date_fns.parse)(endDate, dateFormat2, /* @__PURE__ */ new Date()),
|
|
108
|
+
startDate: (0, import_date_fns.parse)(startDate, dateFormat2, /* @__PURE__ */ new Date())
|
|
94
109
|
};
|
|
95
110
|
}
|
|
96
111
|
|
|
@@ -129,7 +144,7 @@ var reportCommittersCommand = {
|
|
|
129
144
|
builder: {
|
|
130
145
|
startDate: {
|
|
131
146
|
alias: "s",
|
|
132
|
-
default: format(/* @__PURE__ */ new Date(), dateFormat),
|
|
147
|
+
default: (0, import_date_fns2.format)(/* @__PURE__ */ new Date(), dateFormat),
|
|
133
148
|
describe: `Start Date (format: ${dateFormat})`,
|
|
134
149
|
string: true
|
|
135
150
|
},
|
|
@@ -137,13 +152,19 @@ var reportCommittersCommand = {
|
|
|
137
152
|
alias: "e",
|
|
138
153
|
describe: `End Date (format: ${dateFormat})`,
|
|
139
154
|
required: false,
|
|
140
|
-
default: format(subMonths(/* @__PURE__ */ new Date(), monthsToSubtract), dateFormat)
|
|
155
|
+
default: (0, import_date_fns2.format)((0, import_date_fns2.subMonths)(/* @__PURE__ */ new Date(), monthsToSubtract), dateFormat)
|
|
141
156
|
},
|
|
142
157
|
exclude: {
|
|
143
158
|
alias: "x",
|
|
144
159
|
array: true,
|
|
145
160
|
describe: 'Path Exclusions (eg -x="./src/bin" -x="./dist")',
|
|
146
161
|
required: false
|
|
162
|
+
},
|
|
163
|
+
json: {
|
|
164
|
+
describe: "Output to JSON format",
|
|
165
|
+
required: false,
|
|
166
|
+
default: false,
|
|
167
|
+
boolean: true
|
|
147
168
|
}
|
|
148
169
|
// monthly: {
|
|
149
170
|
// alias: 'm',
|
|
@@ -162,15 +183,18 @@ async function run(args) {
|
|
|
162
183
|
const result = await runCommand(gitCommand);
|
|
163
184
|
const rawEntries = result.split("\n");
|
|
164
185
|
if (rawEntries.length === 1 && rawEntries[0] === "") {
|
|
165
|
-
const startDateStr = format(startDate, "yyyy-MM-dd");
|
|
166
|
-
const endDateStr = format(endDate, "yyyy-MM-dd");
|
|
186
|
+
const startDateStr = (0, import_date_fns2.format)(startDate, "yyyy-MM-dd");
|
|
187
|
+
const endDateStr = (0, import_date_fns2.format)(endDate, "yyyy-MM-dd");
|
|
167
188
|
console.log(`No commits found between ${endDateStr} and ${startDateStr}`);
|
|
168
189
|
return;
|
|
169
190
|
}
|
|
170
191
|
const entries = parseGitLogEntries(rawEntries);
|
|
171
|
-
console.error(`entries: ${JSON.stringify(entries, null, 2)}`);
|
|
172
192
|
const committerCounts = getCommitterCounts(entries);
|
|
173
|
-
|
|
193
|
+
if (args.json) {
|
|
194
|
+
outputCommittersJson(committerCounts);
|
|
195
|
+
} else {
|
|
196
|
+
outputCommitters(committerCounts);
|
|
197
|
+
}
|
|
174
198
|
}
|
|
175
199
|
function outputCommitters(committerCounts) {
|
|
176
200
|
const longestNameLength = committerCounts.reduce((acc, c) => {
|
|
@@ -189,17 +213,20 @@ function outputCommitters(committerCounts) {
|
|
|
189
213
|
}).join("\n")
|
|
190
214
|
);
|
|
191
215
|
}
|
|
216
|
+
function outputCommittersJson(committerCounts) {
|
|
217
|
+
console.log(JSON.stringify(committerCounts, null, 2));
|
|
218
|
+
}
|
|
192
219
|
|
|
193
220
|
// libs/report/diagnostics/src/lib/diagnostics.ts
|
|
194
|
-
|
|
221
|
+
var import_prompts = require("@inquirer/prompts");
|
|
195
222
|
|
|
196
223
|
// libs/report/diagnostics/src/lib/get-file-contents.ts
|
|
197
|
-
|
|
224
|
+
var import_fs3 = require("fs");
|
|
198
225
|
function getFileContents(filePath) {
|
|
199
|
-
if (!
|
|
226
|
+
if (!(0, import_fs3.existsSync)(filePath)) {
|
|
200
227
|
return `${filePath} not found`;
|
|
201
228
|
}
|
|
202
|
-
const diagData = readFileSync(filePath, "utf8");
|
|
229
|
+
const diagData = (0, import_fs3.readFileSync)(filePath, "utf8");
|
|
203
230
|
return diagData;
|
|
204
231
|
}
|
|
205
232
|
|
|
@@ -252,7 +279,7 @@ var reportDiagnosticsCommand = {
|
|
|
252
279
|
async function run2(args) {
|
|
253
280
|
const consentPrompt = "Data produced may contain sensitive data, please review before sharing it.";
|
|
254
281
|
if (!args.consent) {
|
|
255
|
-
const answer = await confirm({
|
|
282
|
+
const answer = await (0, import_prompts.confirm)({
|
|
256
283
|
message: `${consentPrompt} Continue?`
|
|
257
284
|
});
|
|
258
285
|
if (!answer) {
|
|
@@ -265,7 +292,7 @@ async function run2(args) {
|
|
|
265
292
|
...d,
|
|
266
293
|
checked: true
|
|
267
294
|
}));
|
|
268
|
-
const diagTypes = args.all ? diagTypeList.map((d) => d.value) : await checkbox({
|
|
295
|
+
const diagTypes = args.all ? diagTypeList.map((d) => d.value) : await (0, import_prompts.checkbox)({
|
|
269
296
|
message: "select diagnostic(s) to run",
|
|
270
297
|
choices: diagTypeList,
|
|
271
298
|
required: true,
|
|
@@ -333,8 +360,8 @@ var defaultConfig = {
|
|
|
333
360
|
};
|
|
334
361
|
|
|
335
362
|
// libs/tracker/init/src/lib/init.ts
|
|
336
|
-
|
|
337
|
-
|
|
363
|
+
var import_path2 = require("path");
|
|
364
|
+
var import_fs4 = require("fs");
|
|
338
365
|
var trackerInitCommand = {
|
|
339
366
|
command: "init",
|
|
340
367
|
describe: "Initialize the tracker configuration",
|
|
@@ -345,33 +372,33 @@ var trackerInitCommand = {
|
|
|
345
372
|
function run3(args) {
|
|
346
373
|
const rootDir = getRootDir(global.process.cwd());
|
|
347
374
|
const output = JSON.stringify(defaultConfig, null, 2);
|
|
348
|
-
const dir =
|
|
349
|
-
if (!
|
|
350
|
-
mkdirSync(dir);
|
|
375
|
+
const dir = (0, import_path2.join)(rootDir, "hd-tracker");
|
|
376
|
+
if (!(0, import_fs4.existsSync)(dir)) {
|
|
377
|
+
(0, import_fs4.mkdirSync)(dir);
|
|
351
378
|
}
|
|
352
|
-
writeFileSync(
|
|
379
|
+
(0, import_fs4.writeFileSync)((0, import_path2.join)(dir, "config.json"), output);
|
|
353
380
|
}
|
|
354
381
|
|
|
355
382
|
// libs/tracker/shared/src/lib/read-config.ts
|
|
356
|
-
|
|
357
|
-
|
|
383
|
+
var import_fs5 = require("fs");
|
|
384
|
+
var import_path3 = require("path");
|
|
358
385
|
function readConfig(rootDirectory, optionsPath) {
|
|
359
|
-
const path3 = optionsPath &&
|
|
360
|
-
const contents =
|
|
386
|
+
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");
|
|
387
|
+
const contents = (0, import_fs5.readFileSync)(path3).toString("utf-8");
|
|
361
388
|
return JSON.parse(contents);
|
|
362
389
|
}
|
|
363
390
|
|
|
364
391
|
// libs/tracker/run/src/lib/run.ts
|
|
365
|
-
|
|
392
|
+
var import_path6 = require("path");
|
|
366
393
|
|
|
367
394
|
// libs/tracker/run/src/lib/process-category.ts
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
395
|
+
var sloc = __toESM(require("sloc"));
|
|
396
|
+
var import_fs6 = require("fs");
|
|
397
|
+
var import_path4 = require("path");
|
|
371
398
|
function processCategory(rootDirectory, category, ignorePatterns) {
|
|
372
399
|
console.log(`Processing "${category.name}"...`);
|
|
373
400
|
const allFiles = category.includes.reduce((acc, include) => {
|
|
374
|
-
return [...acc, ...findAllFilesInDirectory(
|
|
401
|
+
return [...acc, ...findAllFilesInDirectory((0, import_path4.join)(rootDirectory, include))];
|
|
375
402
|
}, []);
|
|
376
403
|
const includedFiles = findIncludedFiles(category, ignorePatterns, allFiles);
|
|
377
404
|
console.log(` ${includedFiles.length} files...`);
|
|
@@ -448,7 +475,7 @@ function aggregateResults(results) {
|
|
|
448
475
|
}, {});
|
|
449
476
|
}
|
|
450
477
|
function getFileStats(file) {
|
|
451
|
-
const contents =
|
|
478
|
+
const contents = (0, import_fs6.readFileSync)(file).toString("utf-8");
|
|
452
479
|
const fileType = getFileExt(file);
|
|
453
480
|
const stats = sloc(contents, fileType);
|
|
454
481
|
return {
|
|
@@ -499,21 +526,21 @@ function findIncludedFiles(category, ignorePatterns, allFiles) {
|
|
|
499
526
|
});
|
|
500
527
|
}
|
|
501
528
|
function findAllFilesInDirectory(directory) {
|
|
502
|
-
const results = readdirSync(directory);
|
|
503
|
-
const subfiles = results.filter((result) => lstatSync(
|
|
504
|
-
const files2 = findAllFilesInDirectory(
|
|
529
|
+
const results = (0, import_fs6.readdirSync)(directory);
|
|
530
|
+
const subfiles = results.filter((result) => (0, import_fs6.lstatSync)((0, import_path4.join)(directory, result)).isDirectory()).reduce((acc, subdir) => {
|
|
531
|
+
const files2 = findAllFilesInDirectory((0, import_path4.join)(directory, subdir));
|
|
505
532
|
return [...acc, ...files2];
|
|
506
533
|
}, []);
|
|
507
|
-
const files = results.filter((result) => lstatSync(
|
|
534
|
+
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
535
|
return [...files, ...subfiles];
|
|
509
536
|
}
|
|
510
537
|
function getFileExt(file) {
|
|
511
|
-
return extname(file).replace(/\./g, "");
|
|
538
|
+
return (0, import_path4.extname)(file).replace(/\./g, "");
|
|
512
539
|
}
|
|
513
540
|
|
|
514
541
|
// libs/tracker/run/src/lib/get-git-commit.ts
|
|
515
|
-
|
|
516
|
-
|
|
542
|
+
var import_date_fns3 = require("date-fns");
|
|
543
|
+
var import_git_last_commit = require("git-last-commit");
|
|
517
544
|
async function getGitCommit() {
|
|
518
545
|
const commit = await getLastCommitAsPromise();
|
|
519
546
|
return {
|
|
@@ -523,7 +550,7 @@ async function getGitCommit() {
|
|
|
523
550
|
}
|
|
524
551
|
function getLastCommitAsPromise() {
|
|
525
552
|
return new Promise((resolve4, reject) => {
|
|
526
|
-
getLastCommit((err, commit) => {
|
|
553
|
+
(0, import_git_last_commit.getLastCommit)((err, commit) => {
|
|
527
554
|
if (err) {
|
|
528
555
|
reject(err);
|
|
529
556
|
}
|
|
@@ -532,7 +559,7 @@ function getLastCommitAsPromise() {
|
|
|
532
559
|
});
|
|
533
560
|
}
|
|
534
561
|
function formatDate(date) {
|
|
535
|
-
return
|
|
562
|
+
return (0, import_date_fns3.format)(date, "yyyy-MM-dd-HH-mm-ss-SSS");
|
|
536
563
|
}
|
|
537
564
|
function getGitDate(date) {
|
|
538
565
|
return new Date(+date * 1e3);
|
|
@@ -557,26 +584,26 @@ async function processConfig(config, rootDirectory) {
|
|
|
557
584
|
}
|
|
558
585
|
|
|
559
586
|
// libs/tracker/run/src/lib/get-data.ts
|
|
560
|
-
|
|
587
|
+
var import_fs7 = require("fs");
|
|
561
588
|
|
|
562
589
|
// libs/tracker/run/src/lib/get-data-filepath.ts
|
|
563
|
-
|
|
590
|
+
var import_path5 = require("path");
|
|
564
591
|
function getDataFilePath(localRootDir, outputDir) {
|
|
565
|
-
return
|
|
592
|
+
return (0, import_path5.resolve)((0, import_path5.join)(localRootDir, outputDir, "data.json"));
|
|
566
593
|
}
|
|
567
594
|
|
|
568
595
|
// libs/tracker/run/src/lib/get-data.ts
|
|
569
596
|
function getData(localRootDir, outputDir) {
|
|
570
597
|
const outputPath = getDataFilePath(localRootDir, outputDir);
|
|
571
598
|
let contents = "";
|
|
572
|
-
if (
|
|
573
|
-
contents =
|
|
599
|
+
if ((0, import_fs7.existsSync)(outputPath)) {
|
|
600
|
+
contents = (0, import_fs7.readFileSync)(outputPath).toString("utf-8");
|
|
574
601
|
}
|
|
575
602
|
return contents === "" ? [] : JSON.parse(contents);
|
|
576
603
|
}
|
|
577
604
|
|
|
578
605
|
// libs/tracker/run/src/lib/save-results.ts
|
|
579
|
-
|
|
606
|
+
var import_fs8 = require("fs");
|
|
580
607
|
function saveResults(localRootDir, outputDir, results) {
|
|
581
608
|
console.log("Outputting file");
|
|
582
609
|
const output = getData(localRootDir, outputDir);
|
|
@@ -586,7 +613,7 @@ function saveResults(localRootDir, outputDir, results) {
|
|
|
586
613
|
output.push(results);
|
|
587
614
|
const outputPath = getDataFilePath(localRootDir, outputDir);
|
|
588
615
|
const outputText = JSON.stringify(output, null, 2);
|
|
589
|
-
|
|
616
|
+
(0, import_fs8.writeFileSync)(outputPath, outputText);
|
|
590
617
|
console.log(`Output written to: ${outputPath}`);
|
|
591
618
|
}
|
|
592
619
|
|
|
@@ -603,7 +630,7 @@ var trackerRunCommand = {
|
|
|
603
630
|
};
|
|
604
631
|
async function run4(args) {
|
|
605
632
|
const localRootDir = getRootDir(global.process.cwd());
|
|
606
|
-
const rootDirectory = args.root ?
|
|
633
|
+
const rootDirectory = args.root ? (0, import_path6.resolve)(args.root) : localRootDir;
|
|
607
634
|
const config = readConfig(localRootDir, args.config);
|
|
608
635
|
const results = await processConfig(config, rootDirectory);
|
|
609
636
|
saveResults(localRootDir, config.outputDir, results);
|
|
@@ -634,7 +661,7 @@ function createGroupCommand(group, description, subCommand, subCommandDescriptio
|
|
|
634
661
|
}
|
|
635
662
|
|
|
636
663
|
// libs/nes/init/src/lib/init.ts
|
|
637
|
-
|
|
664
|
+
var import_prompts2 = require("@inquirer/prompts");
|
|
638
665
|
|
|
639
666
|
// libs/nes/init/src/lib/verify-project-type.ts
|
|
640
667
|
function verifyProjectType() {
|
|
@@ -653,15 +680,15 @@ function verifyProjectType() {
|
|
|
653
680
|
}
|
|
654
681
|
|
|
655
682
|
// libs/nes/init/src/lib/get-release-trains.ts
|
|
656
|
-
|
|
683
|
+
var import_core = require("@apollo/client/core");
|
|
657
684
|
async function getReleaseTrains(accessToken, types) {
|
|
658
|
-
const client = new ApolloClient({
|
|
659
|
-
cache: new InMemoryCache(),
|
|
685
|
+
const client = new import_core.ApolloClient({
|
|
686
|
+
cache: new import_core.InMemoryCache(),
|
|
660
687
|
uri: "https://api.nes.herodevs.com/graphql"
|
|
661
688
|
});
|
|
662
689
|
try {
|
|
663
690
|
const queryResult = await client.query({
|
|
664
|
-
query: gql`
|
|
691
|
+
query: import_core.gql`
|
|
665
692
|
query RT($input: LicensingReleaseTrainsInput) {
|
|
666
693
|
licensing {
|
|
667
694
|
releaseTrains(input: $input) {
|
|
@@ -720,15 +747,15 @@ function getPackageChoices(releaseTrain) {
|
|
|
720
747
|
}
|
|
721
748
|
|
|
722
749
|
// libs/nes/init/src/lib/npm/configure-npm-project.ts
|
|
723
|
-
|
|
724
|
-
var path2 =
|
|
750
|
+
var import_fs9 = require("fs");
|
|
751
|
+
var path2 = require("path");
|
|
725
752
|
function configureNpmProject(accessToken, packages) {
|
|
726
753
|
updatePackageJson(packages);
|
|
727
754
|
updateNpmrc(accessToken);
|
|
728
755
|
}
|
|
729
756
|
function updatePackageJson(packages) {
|
|
730
757
|
const packageJsonPath = path2.join(process.cwd(), "package.json");
|
|
731
|
-
const packageJsonContents =
|
|
758
|
+
const packageJsonContents = (0, import_fs9.readFileSync)(packageJsonPath, "utf8");
|
|
732
759
|
const packageJson = JSON.parse(packageJsonContents);
|
|
733
760
|
const pkgUpdates = packages.map((p) => ({
|
|
734
761
|
key: p.packageVersion.origination?.name || p.packageVersion.name,
|
|
@@ -763,13 +790,13 @@ function updatePackageJson(packages) {
|
|
|
763
790
|
...packageJson.overrides || {},
|
|
764
791
|
...pkgUpdates.overrides
|
|
765
792
|
};
|
|
766
|
-
|
|
793
|
+
(0, import_fs9.writeFileSync)(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
767
794
|
}
|
|
768
795
|
function updateNpmrc(accessToken) {
|
|
769
796
|
const npmrcPath = path2.join(process.cwd(), ".npmrc");
|
|
770
797
|
let npmrcContents = "";
|
|
771
|
-
if (
|
|
772
|
-
npmrcContents =
|
|
798
|
+
if ((0, import_fs9.existsSync)(npmrcPath)) {
|
|
799
|
+
npmrcContents = (0, import_fs9.readFileSync)(npmrcPath, "utf8");
|
|
773
800
|
}
|
|
774
801
|
if (npmrcContents.includes(`@neverendingsupport:registry`)) {
|
|
775
802
|
return;
|
|
@@ -778,7 +805,7 @@ function updateNpmrc(accessToken) {
|
|
|
778
805
|
|
|
779
806
|
@neverendingsupport:registry=https://registry.nes.herodevs.com/npm/pkg/
|
|
780
807
|
//registry.nes.herodevs.com/npm/pkg/:_authToken="${accessToken}"`;
|
|
781
|
-
|
|
808
|
+
(0, import_fs9.writeFileSync)(npmrcPath, updatedContents);
|
|
782
809
|
}
|
|
783
810
|
|
|
784
811
|
// libs/nes/init/src/lib/configure-project.ts
|
|
@@ -789,7 +816,7 @@ function configureProject(accessToken, projectTypes, packages) {
|
|
|
789
816
|
}
|
|
790
817
|
|
|
791
818
|
// libs/nes/init/src/lib/init.ts
|
|
792
|
-
|
|
819
|
+
var ora = __toESM(require("ora"));
|
|
793
820
|
var nesInitCommand = {
|
|
794
821
|
command: "init",
|
|
795
822
|
describe: "Initialize the NES project",
|
|
@@ -804,19 +831,19 @@ async function run5(args) {
|
|
|
804
831
|
console.error(projectType.error);
|
|
805
832
|
return;
|
|
806
833
|
}
|
|
807
|
-
if (!await
|
|
834
|
+
if (!await (0, import_prompts2.confirm)({
|
|
808
835
|
message: "Before initializing, please commit all changes. Continue?"
|
|
809
836
|
})) {
|
|
810
837
|
return;
|
|
811
838
|
}
|
|
812
|
-
const accessToken = await password({
|
|
839
|
+
const accessToken = await (0, import_prompts2.password)({
|
|
813
840
|
message: "Enter access token",
|
|
814
841
|
mask: "*"
|
|
815
842
|
});
|
|
816
843
|
spinner.start("loading your products");
|
|
817
844
|
const productList = await getProductChoices(accessToken, projectType.types);
|
|
818
845
|
spinner.stop();
|
|
819
|
-
const releaseTrain = await select({
|
|
846
|
+
const releaseTrain = await (0, import_prompts2.select)({
|
|
820
847
|
message: "select a product",
|
|
821
848
|
choices: productList,
|
|
822
849
|
pageSize: productList.length
|
|
@@ -826,7 +853,7 @@ async function run5(args) {
|
|
|
826
853
|
...p,
|
|
827
854
|
checked: true
|
|
828
855
|
}));
|
|
829
|
-
const packages = await
|
|
856
|
+
const packages = await (0, import_prompts2.checkbox)({
|
|
830
857
|
message: `select the package(s)`,
|
|
831
858
|
choices: packageList,
|
|
832
859
|
loop: false,
|
|
@@ -871,7 +898,7 @@ function getCommands() {
|
|
|
871
898
|
}
|
|
872
899
|
|
|
873
900
|
// apps/cli/src/lib/ensure-version.ts
|
|
874
|
-
|
|
901
|
+
var getJson = __toESM(require("get-json"));
|
|
875
902
|
|
|
876
903
|
// apps/cli/src/lib/log-colors.ts
|
|
877
904
|
function color(color2) {
|
|
@@ -952,7 +979,7 @@ function cli() {
|
|
|
952
979
|
const pkg = require_package();
|
|
953
980
|
const packageName = pkg.name;
|
|
954
981
|
const packageVersion = pkg.version;
|
|
955
|
-
yargs.scriptName(packageName).usage("Usage: $0 <command> [options]").middleware(() => ensureVersionIsUpToDate(packageName, packageVersion)).command(commands).parse(hideBin(process.argv));
|
|
982
|
+
yargs.scriptName(packageName).usage("Usage: $0 <command> [options]").middleware(() => ensureVersionIsUpToDate(packageName, packageVersion)).command(commands).parse((0, import_helpers.hideBin)(process.argv));
|
|
956
983
|
}
|
|
957
984
|
|
|
958
985
|
// apps/cli/src/main.ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@herodevs/cli",
|
|
3
|
-
"version": "0.2.3
|
|
4
|
-
"bin": "./main.
|
|
3
|
+
"version": "0.2.3",
|
|
4
|
+
"bin": "./main.cjs",
|
|
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": "./main.
|
|
18
|
-
"module": "./main.js"
|
|
16
|
+
"type": "commonjs",
|
|
17
|
+
"main": "./main.cjs"
|
|
19
18
|
}
|