alex-c-line 2.0.1 → 2.0.2
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/dist/configs/index.cjs +16 -35
- package/dist/configs/index.js +4 -18
- package/dist/configs/internal/index.cjs +2 -7
- package/dist/configs/internal/index.d.ts +0 -1
- package/dist/configs/internal/index.js +1 -5
- package/dist/index.cjs +13 -120
- package/dist/index.js +7 -109
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -20,7 +20,6 @@ import { parseFilePath } from "@alextheman/utility/node";
|
|
|
20
20
|
import supportsColor from "supports-color";
|
|
21
21
|
import { randomUUID } from "node:crypto";
|
|
22
22
|
import { minVersion, prerelease } from "semver";
|
|
23
|
-
|
|
24
23
|
//#region src/utility/miscellaneous/centerLine.ts
|
|
25
24
|
function centerLine(text, width) {
|
|
26
25
|
const padding = Math.max(0, width - text.length);
|
|
@@ -28,7 +27,6 @@ function centerLine(text, width) {
|
|
|
28
27
|
const right = padding - left;
|
|
29
28
|
return " ".repeat(left) + text + " ".repeat(right);
|
|
30
29
|
}
|
|
31
|
-
|
|
32
30
|
//#endregion
|
|
33
31
|
//#region src/utility/miscellaneous/createAlexCLineArtwork.ts
|
|
34
32
|
async function createAlexCLineArtwork(options) {
|
|
@@ -49,7 +47,6 @@ async function createAlexCLineArtwork(options) {
|
|
|
49
47
|
borderColor: "cyanBright"
|
|
50
48
|
}) : output;
|
|
51
49
|
}
|
|
52
|
-
|
|
53
50
|
//#endregion
|
|
54
51
|
//#region src/cli/commands/artwork/log.ts
|
|
55
52
|
function artworkLog(program) {
|
|
@@ -67,7 +64,6 @@ function artworkLog(program) {
|
|
|
67
64
|
}));
|
|
68
65
|
});
|
|
69
66
|
}
|
|
70
|
-
|
|
71
67
|
//#endregion
|
|
72
68
|
//#region src/utility/miscellaneous/asciiToPng.ts
|
|
73
69
|
async function asciiToPng(ascii, options) {
|
|
@@ -100,7 +96,6 @@ async function asciiToPng(ascii, options) {
|
|
|
100
96
|
await mkdir(path.dirname(outputPath), { recursive: true });
|
|
101
97
|
await writeFile(outputPath, canvas.toBuffer("image/png"));
|
|
102
98
|
}
|
|
103
|
-
|
|
104
99
|
//#endregion
|
|
105
100
|
//#region src/cli/commands/artwork/save.ts
|
|
106
101
|
function artworkSave(program) {
|
|
@@ -119,13 +114,11 @@ function artworkSave(program) {
|
|
|
119
114
|
console.info(`Artwork saved successfully to ${path.resolve(filePath.endsWith(".png") ? filePath : `${filePath}.png`)}`);
|
|
120
115
|
});
|
|
121
116
|
}
|
|
122
|
-
|
|
123
117
|
//#endregion
|
|
124
118
|
//#region src/utility/miscellaneous/loadCommands.ts
|
|
125
119
|
function loadCommands(program, commandMap) {
|
|
126
120
|
for (const loader of Object.values(commandMap)) loader(program);
|
|
127
121
|
}
|
|
128
|
-
|
|
129
122
|
//#endregion
|
|
130
123
|
//#region src/cli/commands/artwork/index.ts
|
|
131
124
|
function artwork(program) {
|
|
@@ -134,13 +127,8 @@ function artwork(program) {
|
|
|
134
127
|
artworkSave
|
|
135
128
|
});
|
|
136
129
|
}
|
|
137
|
-
|
|
138
|
-
//#endregion
|
|
139
|
-
//#region src/cache/global/envPaths.ts
|
|
140
|
-
const alexCLineEnvPaths = envPaths("alex-c-line");
|
|
141
|
-
const { cache: ALEX_C_LINE_GLOBAL_CACHE_DIRECTORY } = alexCLineEnvPaths;
|
|
130
|
+
const { cache: ALEX_C_LINE_GLOBAL_CACHE_DIRECTORY } = envPaths("alex-c-line");
|
|
142
131
|
const ALEX_C_LINE_GLOBAL_CACHE_PATH = path.join(ALEX_C_LINE_GLOBAL_CACHE_DIRECTORY, "cache.json");
|
|
143
|
-
|
|
144
132
|
//#endregion
|
|
145
133
|
//#region src/cli/commands/cache/path.ts
|
|
146
134
|
function cachePath(program) {
|
|
@@ -148,23 +136,19 @@ function cachePath(program) {
|
|
|
148
136
|
console.info(ALEX_C_LINE_GLOBAL_CACHE_PATH);
|
|
149
137
|
});
|
|
150
138
|
}
|
|
151
|
-
|
|
152
139
|
//#endregion
|
|
153
140
|
//#region src/cli/commands/cache/index.ts
|
|
154
141
|
function cache(program) {
|
|
155
142
|
loadCommands(program.command("cache").description("Commands related to the alex-c-line cache"), { cachePath });
|
|
156
143
|
}
|
|
157
|
-
|
|
158
144
|
//#endregion
|
|
159
145
|
//#region src/utility/constants/errorPrefix.ts
|
|
160
146
|
const errorPrefix = "❌ ERROR:";
|
|
161
|
-
|
|
162
147
|
//#endregion
|
|
163
148
|
//#region src/utility/envFile/upsertDotenvFile.ts
|
|
164
149
|
async function upsertDotenvFile(contents, envFilePath) {
|
|
165
150
|
await writeFile(path.join(process.cwd(), envFilePath), stringifyDotenv(contents));
|
|
166
151
|
}
|
|
167
|
-
|
|
168
152
|
//#endregion
|
|
169
153
|
//#region src/cli/commands/env-file/edit/addVariable.ts
|
|
170
154
|
async function addVariable(program, envFileContents, file) {
|
|
@@ -190,7 +174,6 @@ async function addVariable(program, envFileContents, file) {
|
|
|
190
174
|
}, file);
|
|
191
175
|
console.info(`${newVariableName} successfully added.`);
|
|
192
176
|
}
|
|
193
|
-
|
|
194
177
|
//#endregion
|
|
195
178
|
//#region src/cli/commands/env-file/edit/deleteVariable.ts
|
|
196
179
|
async function deleteVariable(envFileContents, variableToEdit, file) {
|
|
@@ -201,7 +184,6 @@ async function deleteVariable(envFileContents, variableToEdit, file) {
|
|
|
201
184
|
await upsertDotenvFile(omitProperties(envFileContents, variableToEdit), file);
|
|
202
185
|
console.info(`${String(variableToEdit)} successfully deleted.`);
|
|
203
186
|
}
|
|
204
|
-
|
|
205
187
|
//#endregion
|
|
206
188
|
//#region src/cli/commands/env-file/edit/editVariable.ts
|
|
207
189
|
async function editVariable(envFileContents, variableToEdit, file) {
|
|
@@ -212,7 +194,6 @@ async function editVariable(envFileContents, variableToEdit, file) {
|
|
|
212
194
|
}, file);
|
|
213
195
|
console.info(`${String(variableToEdit)} successfully updated.`);
|
|
214
196
|
}
|
|
215
|
-
|
|
216
197
|
//#endregion
|
|
217
198
|
//#region src/utility/envFile/redact.ts
|
|
218
199
|
function redact(secretString) {
|
|
@@ -220,7 +201,6 @@ function redact(secretString) {
|
|
|
220
201
|
return "*";
|
|
221
202
|
}, secretString.length).join("")} (redacted for security)>`;
|
|
222
203
|
}
|
|
223
|
-
|
|
224
204
|
//#endregion
|
|
225
205
|
//#region src/cli/commands/env-file/edit/changeExistingVariable.ts
|
|
226
206
|
async function changeExistingVariable(envFileContents, variableToEdit, file) {
|
|
@@ -247,7 +227,6 @@ async function changeExistingVariable(envFileContents, variableToEdit, file) {
|
|
|
247
227
|
default: console.error("Unrecognised option");
|
|
248
228
|
}
|
|
249
229
|
}
|
|
250
|
-
|
|
251
230
|
//#endregion
|
|
252
231
|
//#region src/utility/envFile/parseDotenvFile.ts
|
|
253
232
|
async function parseDotenvFile(envFilePath) {
|
|
@@ -258,7 +237,6 @@ async function parseDotenvFile(envFilePath) {
|
|
|
258
237
|
throw error;
|
|
259
238
|
}
|
|
260
239
|
}
|
|
261
|
-
|
|
262
240
|
//#endregion
|
|
263
241
|
//#region src/cli/commands/env-file/edit/index.ts
|
|
264
242
|
function envFileEdit(program) {
|
|
@@ -305,13 +283,11 @@ function envFileEdit(program) {
|
|
|
305
283
|
}
|
|
306
284
|
});
|
|
307
285
|
}
|
|
308
|
-
|
|
309
286
|
//#endregion
|
|
310
287
|
//#region src/cli/commands/env-file/index.ts
|
|
311
288
|
function envFile(program) {
|
|
312
289
|
loadCommands(program.command("env-file").description("Interact with a .env file"), { envFileEdit });
|
|
313
290
|
}
|
|
314
|
-
|
|
315
291
|
//#endregion
|
|
316
292
|
//#region src/cli/commands/internal/check-lockfile-version-discrepancy.ts
|
|
317
293
|
function checkLockfileVersionDiscrepancy(program) {
|
|
@@ -327,7 +303,6 @@ function checkLockfileVersionDiscrepancy(program) {
|
|
|
327
303
|
console.info("package.json and package-lock.json versions in sync.");
|
|
328
304
|
});
|
|
329
305
|
}
|
|
330
|
-
|
|
331
306
|
//#endregion
|
|
332
307
|
//#region src/cli/commands/internal/git-post-merge-cleanup.ts
|
|
333
308
|
function gitPostMergeCleanup(program) {
|
|
@@ -369,7 +344,6 @@ function gitPostMergeCleanup(program) {
|
|
|
369
344
|
}
|
|
370
345
|
});
|
|
371
346
|
}
|
|
372
|
-
|
|
373
347
|
//#endregion
|
|
374
348
|
//#region src/utility/fileSystem/findPackageRoot.ts
|
|
375
349
|
async function findPackageRoot(startDirectory, packageName) {
|
|
@@ -385,12 +359,10 @@ async function findPackageRoot(startDirectory, packageName) {
|
|
|
385
359
|
}
|
|
386
360
|
throw new DataError({ packageName }, "PACKAGE_ROOT_NOT_FOUND", `Could not find package root for ${packageName}`);
|
|
387
361
|
}
|
|
388
|
-
|
|
389
362
|
//#endregion
|
|
390
363
|
//#region src/utility/constants/alexCLinePackageRoot.ts
|
|
391
364
|
const __filename$2 = fileURLToPath(import.meta.url);
|
|
392
365
|
const ALEX_C_LINE_PACKAGE_ROOT = findPackageRoot(path.dirname(__filename$2), "alex-c-line");
|
|
393
|
-
|
|
394
366
|
//#endregion
|
|
395
367
|
//#region src/cli/commands/internal/outdated-dependencies.ts
|
|
396
368
|
function outdatedDependencies(program) {
|
|
@@ -413,7 +385,6 @@ function outdatedDependencies(program) {
|
|
|
413
385
|
}).join("\n")));
|
|
414
386
|
});
|
|
415
387
|
}
|
|
416
|
-
|
|
417
388
|
//#endregion
|
|
418
389
|
//#region src/cli/commands/internal/index.ts
|
|
419
390
|
function internal(program) {
|
|
@@ -423,7 +394,6 @@ function internal(program) {
|
|
|
423
394
|
outdatedDependencies
|
|
424
395
|
});
|
|
425
396
|
}
|
|
426
|
-
|
|
427
397
|
//#endregion
|
|
428
398
|
//#region src/cache/project/createAlexCLineProjectCache.ts
|
|
429
399
|
async function createAlexCLineProjectCache(cacheContents) {
|
|
@@ -431,7 +401,6 @@ async function createAlexCLineProjectCache(cacheContents) {
|
|
|
431
401
|
await mkdir(path.dirname(cacheFilePath), { recursive: true });
|
|
432
402
|
await writeFile(cacheFilePath, JSON.stringify(cacheContents, void 0, 2));
|
|
433
403
|
}
|
|
434
|
-
|
|
435
404
|
//#endregion
|
|
436
405
|
//#region src/configs/helpers/preCommit/definePreCommitConfig.ts
|
|
437
406
|
const preCommitStepOptionsSchema = z.strictObject({ arguments: z.array(z.string()).optional() });
|
|
@@ -448,7 +417,6 @@ const preCommitConfigSchema = z.strictObject({
|
|
|
448
417
|
])),
|
|
449
418
|
updateIndex: z.boolean().optional()
|
|
450
419
|
});
|
|
451
|
-
|
|
452
420
|
//#endregion
|
|
453
421
|
//#region src/configs/helpers/template/pullRequest/defineTemplatePullRequestSchema.ts
|
|
454
422
|
const templatePullRequestBaseSchema = z.strictObject({ projectName: z.string().optional() });
|
|
@@ -463,7 +431,6 @@ const templatePullRequestSchema = z.discriminatedUnion("category", [templatePull
|
|
|
463
431
|
function parseTemplatePullRequestConfig(input) {
|
|
464
432
|
return parseZodSchema(templatePullRequestSchema, input);
|
|
465
433
|
}
|
|
466
|
-
|
|
467
434
|
//#endregion
|
|
468
435
|
//#region src/configs/helpers/defineAlexCLineConfig.ts
|
|
469
436
|
const alexCLineConfigSchema = z.strictObject({
|
|
@@ -473,7 +440,6 @@ const alexCLineConfigSchema = z.strictObject({
|
|
|
473
440
|
async function parseAlexCLineConfig(input) {
|
|
474
441
|
return await parseZodSchemaAsync(alexCLineConfigSchema, input);
|
|
475
442
|
}
|
|
476
|
-
|
|
477
443
|
//#endregion
|
|
478
444
|
//#region src/configs/types/ConfigFileName.ts
|
|
479
445
|
const ConfigFileName = {
|
|
@@ -486,14 +452,12 @@ const PrivateConfigFileName = {
|
|
|
486
452
|
ES_MODULES_JAVASCRIPT: ".alex-c-line.private.config.mjs",
|
|
487
453
|
COMMON_JS_JAVASCRIPT: ".alex-c-line.private.config.cjs"
|
|
488
454
|
};
|
|
489
|
-
|
|
490
455
|
//#endregion
|
|
491
456
|
//#region src/configs/types/template/pullRequest/PullRequestTemplateCategory.ts
|
|
492
457
|
const PullRequestTemplateCategory = {
|
|
493
458
|
GENERAL: "general",
|
|
494
459
|
INFRASTRUCTURE: "infrastructure"
|
|
495
460
|
};
|
|
496
|
-
|
|
497
461
|
//#endregion
|
|
498
462
|
//#region src/configs/helpers/defineAlexCLinePrivateConfig.ts
|
|
499
463
|
const alexCLinePrivateConfigSchema = z.object({ localPackage: z.strictObject({
|
|
@@ -509,7 +473,6 @@ const alexCLinePrivateConfigSchema = z.object({ localPackage: z.strictObject({
|
|
|
509
473
|
function parseAlexCLinePrivateConfig(data) {
|
|
510
474
|
return parseZodSchema(alexCLinePrivateConfigSchema, data);
|
|
511
475
|
}
|
|
512
|
-
|
|
513
476
|
//#endregion
|
|
514
477
|
//#region src/cache/project/types/AlexCLineProjectCache.ts
|
|
515
478
|
const alexCLineProjectCacheSchema = z.object({ useLocalPackage: z.object({ dependencies: z.record(z.string(), z.object({
|
|
@@ -519,13 +482,11 @@ const alexCLineProjectCacheSchema = z.object({ useLocalPackage: z.object({ depen
|
|
|
519
482
|
}),
|
|
520
483
|
dependencyGroup: z.enum(DependencyGroup)
|
|
521
484
|
})) }).partial() }).partial();
|
|
522
|
-
|
|
523
485
|
//#endregion
|
|
524
486
|
//#region src/cache/project/parseAlexCLineProjectCache.ts
|
|
525
487
|
function parseAlexCLineProjectCache(data) {
|
|
526
488
|
return parseZodSchema(alexCLineProjectCacheSchema, data);
|
|
527
489
|
}
|
|
528
|
-
|
|
529
490
|
//#endregion
|
|
530
491
|
//#region src/cache/project/loadAlexCLineProjectCache.ts
|
|
531
492
|
async function loadAlexCLineProjectCache(cachePath = path.join(".alex-c-line", "cache.json")) {
|
|
@@ -537,7 +498,6 @@ async function loadAlexCLineProjectCache(cachePath = path.join(".alex-c-line", "
|
|
|
537
498
|
throw error;
|
|
538
499
|
}
|
|
539
500
|
}
|
|
540
|
-
|
|
541
501
|
//#endregion
|
|
542
502
|
//#region src/utility/fileSystem/doesFileExist.ts
|
|
543
503
|
async function doesFileExist(filePath) {
|
|
@@ -549,7 +509,6 @@ async function doesFileExist(filePath) {
|
|
|
549
509
|
throw error;
|
|
550
510
|
}
|
|
551
511
|
}
|
|
552
|
-
|
|
553
512
|
//#endregion
|
|
554
513
|
//#region src/utility/configs/findAlexCLineConfig.ts
|
|
555
514
|
async function findAlexCLineConfig(cwd, validConfigFileNames = [
|
|
@@ -562,7 +521,6 @@ async function findAlexCLineConfig(cwd, validConfigFileNames = [
|
|
|
562
521
|
if (await doesFileExist(fullPath)) return fullPath;
|
|
563
522
|
}
|
|
564
523
|
}
|
|
565
|
-
|
|
566
524
|
//#endregion
|
|
567
525
|
//#region src/utility/configs/loadAlexCLinePrivateConfig.ts
|
|
568
526
|
const require$1 = createRequire(import.meta.url);
|
|
@@ -574,7 +532,6 @@ async function loadAlexCLinePrivateConfig(filePath) {
|
|
|
574
532
|
const module = await import(pathToFileURL(filePath).href);
|
|
575
533
|
return parseAlexCLinePrivateConfig(module.default ?? module);
|
|
576
534
|
}
|
|
577
|
-
|
|
578
535
|
//#endregion
|
|
579
536
|
//#region src/utility/fileSystem/findTgzFile.ts
|
|
580
537
|
async function findTgzFile(packagePath, packageManager) {
|
|
@@ -596,7 +553,6 @@ async function findTgzFile(packagePath, packageManager) {
|
|
|
596
553
|
}, "AMBIGUOUS_RESOLUTION", "There are too many .tgz files with the expected file name.");
|
|
597
554
|
return expectedTgzFileName;
|
|
598
555
|
}
|
|
599
|
-
|
|
600
556
|
//#endregion
|
|
601
557
|
//#region src/utility/miscellaneous/removeAllTarballs.ts
|
|
602
558
|
async function removeAllTarballs(packagePath, packageName) {
|
|
@@ -608,7 +564,6 @@ async function removeAllTarballs(packagePath, packageName) {
|
|
|
608
564
|
return rm(path.join(packagePath, file), { force: true });
|
|
609
565
|
}));
|
|
610
566
|
}
|
|
611
|
-
|
|
612
567
|
//#endregion
|
|
613
568
|
//#region src/cli/commands/local-package/use.ts
|
|
614
569
|
function localPackageUse(program) {
|
|
@@ -712,13 +667,11 @@ function localPackageUse(program) {
|
|
|
712
667
|
}
|
|
713
668
|
});
|
|
714
669
|
}
|
|
715
|
-
|
|
716
670
|
//#endregion
|
|
717
671
|
//#region src/cli/commands/local-package/index.ts
|
|
718
672
|
function localPackage(program) {
|
|
719
673
|
loadCommands(program.command("local-package").description("Manage the use of local packages in your JavaScript project."), { localPackageUse });
|
|
720
674
|
}
|
|
721
|
-
|
|
722
675
|
//#endregion
|
|
723
676
|
//#region src/cli/commands/root/encrypt-with-key.ts
|
|
724
677
|
function encryptWithKey$1(program) {
|
|
@@ -733,16 +686,15 @@ function encryptWithKey$1(program) {
|
|
|
733
686
|
}
|
|
734
687
|
});
|
|
735
688
|
}
|
|
736
|
-
|
|
737
689
|
//#endregion
|
|
738
690
|
//#region src/cli/commands/root/pre-commit/createStepRunner.ts
|
|
739
691
|
const runCommandAndLogToConsole = execa({
|
|
740
692
|
stdio: "inherit",
|
|
741
693
|
reject: false
|
|
742
694
|
});
|
|
743
|
-
async function evaluateResult(program, promisedResult, failedCommand) {
|
|
695
|
+
async function evaluateResult(program, promisedResult, failedCommand, boundOptions) {
|
|
744
696
|
const result = await promisedResult;
|
|
745
|
-
if (result.exitCode !== 0) program.error(`Command failed: ${failedCommand}`, {
|
|
697
|
+
if (result.exitCode !== 0 && (boundOptions.reject ?? true)) program.error(`Command failed: ${failedCommand}`, {
|
|
746
698
|
exitCode: result.exitCode ?? 1,
|
|
747
699
|
code: "PRE_COMMIT_FAILED"
|
|
748
700
|
});
|
|
@@ -753,11 +705,11 @@ function bindStepRunner(program, boundOptions) {
|
|
|
753
705
|
if (typeof first === "string") {
|
|
754
706
|
const command = first;
|
|
755
707
|
const args = second[0] ?? [];
|
|
756
|
-
return evaluateResult(program, runCommandAndLogToConsole(boundOptions)(command, args), `${command}${args.length ? ` ${args.join(" ")}` : ""}
|
|
708
|
+
return evaluateResult(program, runCommandAndLogToConsole(boundOptions)(command, args), `${command}${args.length ? ` ${args.join(" ")}` : ""}`, boundOptions);
|
|
757
709
|
}
|
|
758
710
|
if (isTemplateStringsArray(first)) {
|
|
759
711
|
const args = getStringsAndInterpolations(first, ...second);
|
|
760
|
-
return evaluateResult(program, runCommandAndLogToConsole(boundOptions)(...args), interpolate(...args));
|
|
712
|
+
return evaluateResult(program, runCommandAndLogToConsole(boundOptions)(...args), interpolate(...args), boundOptions);
|
|
761
713
|
}
|
|
762
714
|
return bindStepRunner(program, {
|
|
763
715
|
...boundOptions,
|
|
@@ -769,7 +721,6 @@ function bindStepRunner(program, boundOptions) {
|
|
|
769
721
|
function createStepRunner(program) {
|
|
770
722
|
return bindStepRunner(program, {});
|
|
771
723
|
}
|
|
772
|
-
|
|
773
724
|
//#endregion
|
|
774
725
|
//#region src/cli/commands/root/pre-commit/getCommandArguments.ts
|
|
775
726
|
function getCommandArguments(program, script, scripts, args) {
|
|
@@ -781,7 +732,6 @@ function getCommandArguments(program, script, scripts, args) {
|
|
|
781
732
|
if (args) result.push(...args);
|
|
782
733
|
return result;
|
|
783
734
|
}
|
|
784
|
-
|
|
785
735
|
//#endregion
|
|
786
736
|
//#region src/utility/configs/loadAlexCLineConfig.ts
|
|
787
737
|
const require = createRequire(import.meta.url);
|
|
@@ -793,7 +743,6 @@ async function loadAlexCLineConfig(filePath) {
|
|
|
793
743
|
const module = await import(pathToFileURL(filePath).href);
|
|
794
744
|
return await parseAlexCLineConfig(module.default ?? module);
|
|
795
745
|
}
|
|
796
|
-
|
|
797
746
|
//#endregion
|
|
798
747
|
//#region src/cli/commands/root/pre-commit/pre-commit.ts
|
|
799
748
|
function preCommit(program) {
|
|
@@ -830,7 +779,6 @@ function preCommit(program) {
|
|
|
830
779
|
if (updateIndex) await stepRunner`git update-index --again`;
|
|
831
780
|
});
|
|
832
781
|
}
|
|
833
|
-
|
|
834
782
|
//#endregion
|
|
835
783
|
//#region src/cli/commands/root/say-hello.ts
|
|
836
784
|
function sayHello(program) {
|
|
@@ -838,7 +786,6 @@ function sayHello(program) {
|
|
|
838
786
|
console.info("Hello!");
|
|
839
787
|
});
|
|
840
788
|
}
|
|
841
|
-
|
|
842
789
|
//#endregion
|
|
843
790
|
//#region src/cli/commands/root/index.ts
|
|
844
791
|
function root(program) {
|
|
@@ -848,7 +795,6 @@ function root(program) {
|
|
|
848
795
|
sayHello
|
|
849
796
|
});
|
|
850
797
|
}
|
|
851
|
-
|
|
852
798
|
//#endregion
|
|
853
799
|
//#region src/utility/markdownTemplates/pullRequest/getPullRequestTemplatesFromMarkdown.ts
|
|
854
800
|
const __filename$1 = fileURLToPath(import.meta.url);
|
|
@@ -886,7 +832,6 @@ async function getPullRequestTemplatesFromMarkdown(config) {
|
|
|
886
832
|
}
|
|
887
833
|
return allTemplates;
|
|
888
834
|
}
|
|
889
|
-
|
|
890
835
|
//#endregion
|
|
891
836
|
//#region src/cli/commands/template/pullRequest/create.ts
|
|
892
837
|
function templatePullRequestCreate(program) {
|
|
@@ -919,17 +864,14 @@ function templatePullRequestCreate(program) {
|
|
|
919
864
|
console.info("Pull request templates created.");
|
|
920
865
|
});
|
|
921
866
|
}
|
|
922
|
-
|
|
923
867
|
//#endregion
|
|
924
868
|
//#region src/cli/commands/template/pullRequest/index.ts
|
|
925
869
|
function templatePullRequest(program) {
|
|
926
870
|
loadCommands(program.command("pull-request").description("Manage the pull request templates."), { templatePullRequestCreate });
|
|
927
871
|
}
|
|
928
|
-
|
|
929
872
|
//#endregion
|
|
930
873
|
//#region src/utility/constants/successPrefix.ts
|
|
931
874
|
const successPrefix = chalk.green("✓");
|
|
932
|
-
|
|
933
875
|
//#endregion
|
|
934
876
|
//#region src/utility/errors/convertDataErrorToProgramError.ts
|
|
935
877
|
function convertDataErrorToProgramError(dataError, program, options) {
|
|
@@ -938,14 +880,12 @@ function convertDataErrorToProgramError(dataError, program, options) {
|
|
|
938
880
|
code: dataError.code
|
|
939
881
|
});
|
|
940
882
|
}
|
|
941
|
-
|
|
942
883
|
//#endregion
|
|
943
884
|
//#region src/utility/markdownTemplates/releaseNote/types/ReleaseStatus.ts
|
|
944
885
|
const ReleaseStatus = {
|
|
945
886
|
IN_PROGRESS: "In progress",
|
|
946
887
|
RELEASED: "Released"
|
|
947
888
|
};
|
|
948
|
-
|
|
949
889
|
//#endregion
|
|
950
890
|
//#region src/utility/markdownTemplates/releaseNote/parseReleaseStatus.ts
|
|
951
891
|
function parseReleaseStatus(data) {
|
|
@@ -953,20 +893,17 @@ function parseReleaseStatus(data) {
|
|
|
953
893
|
if (!Object.keys(ReleaseStatus).includes(normalisedStringifiedData)) new DataError({ data }, "INVALID_RELEASE_STATUS", "Invalid release status. The release status must be one of \"In progress\" or \"Released\"");
|
|
954
894
|
return ReleaseStatus[normalisedStringifiedData];
|
|
955
895
|
}
|
|
956
|
-
|
|
957
896
|
//#endregion
|
|
958
897
|
//#region src/utility/markdownTemplates/createMarkdownComment.ts
|
|
959
898
|
function createMarkdownComment(comment) {
|
|
960
899
|
if (comment.startsWith("<!--") && comment.endsWith("-->")) return comment;
|
|
961
900
|
return `<!-- ${comment} -->`;
|
|
962
901
|
}
|
|
963
|
-
|
|
964
902
|
//#endregion
|
|
965
903
|
//#region src/utility/markdownTemplates/createMarkdownCommentPair.ts
|
|
966
904
|
function createMarkdownCommentPair(comment) {
|
|
967
905
|
return [createMarkdownComment(`${comment}-start`), createMarkdownComment(`${comment}-end`)];
|
|
968
906
|
}
|
|
969
|
-
|
|
970
907
|
//#endregion
|
|
971
908
|
//#region src/utility/markdownTemplates/getMarkdownBlock.ts
|
|
972
909
|
function getMarkdownBlock(content, startMarker, endMarker) {
|
|
@@ -975,7 +912,6 @@ function getMarkdownBlock(content, startMarker, endMarker) {
|
|
|
975
912
|
if (startIndex === -1 || endIndex === -1 || endIndex < startIndex) return null;
|
|
976
913
|
return content.slice(startIndex + startMarker.length, endIndex).trim();
|
|
977
914
|
}
|
|
978
|
-
|
|
979
915
|
//#endregion
|
|
980
916
|
//#region src/utility/markdownTemplates/normaliseMarkdown.ts
|
|
981
917
|
function normaliseMarkdown(markdownString) {
|
|
@@ -983,7 +919,6 @@ function normaliseMarkdown(markdownString) {
|
|
|
983
919
|
return line.trim();
|
|
984
920
|
}).filter(Boolean).join(" ").trim();
|
|
985
921
|
}
|
|
986
|
-
|
|
987
922
|
//#endregion
|
|
988
923
|
//#region src/utility/markdownTemplates/releaseNote/getReleaseStatus.ts
|
|
989
924
|
function getReleaseStatus(content) {
|
|
@@ -991,7 +926,6 @@ function getReleaseStatus(content) {
|
|
|
991
926
|
if (releaseStatus === null) throw new DataError({ releaseStatus }, "RELEASE_STATUS_NOT_FOUND", "Could not find release status in document.");
|
|
992
927
|
return parseZodSchema(z.enum(ReleaseStatus), normaliseMarkdown(releaseStatus.split(":")[1]));
|
|
993
928
|
}
|
|
994
|
-
|
|
995
929
|
//#endregion
|
|
996
930
|
//#region src/utility/markdownTemplates/releaseNote/validateReleaseDocument.ts
|
|
997
931
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -1029,7 +963,6 @@ async function validateReleaseDocument(projectName, version, content, allowedRel
|
|
|
1029
963
|
if (!content.includes("## Description of Changes")) throw new DataError({ content }, "DESCRIPTION_NOT_FOUND", "Expected to find a description of changes but it was not found.");
|
|
1030
964
|
if (version.type === "major" && !content.includes("## Migration Notes")) throw new DataError({ content }, "MIGRATION_NOTES_NOT_FOUND", "Major version notes must have migration notes as major versions are expected to be breaking changes that require users to migrate and refactor their code.");
|
|
1031
965
|
}
|
|
1032
|
-
|
|
1033
966
|
//#endregion
|
|
1034
967
|
//#region src/cli/commands/template/releaseNote/check.ts
|
|
1035
968
|
function templateReleaseNoteCheck(program) {
|
|
@@ -1050,26 +983,22 @@ function templateReleaseNoteCheck(program) {
|
|
|
1050
983
|
}
|
|
1051
984
|
});
|
|
1052
985
|
}
|
|
1053
|
-
|
|
1054
986
|
//#endregion
|
|
1055
987
|
//#region src/utility/markdownTemplates/releaseNote/getReleaseNotePath.ts
|
|
1056
988
|
function getReleaseNotePath(versionNumber) {
|
|
1057
989
|
return path.join("docs", "releases", versionNumber.format({ omitMinor: true }), versionNumber.format({ omitPatch: true }), `${versionNumber}.md`);
|
|
1058
990
|
}
|
|
1059
|
-
|
|
1060
991
|
//#endregion
|
|
1061
992
|
//#region src/utility/markdownTemplates/getReleaseNoteTemplatesPath.ts
|
|
1062
993
|
async function getReleaseNoteTemplatesPath() {
|
|
1063
994
|
return path.join(await ALEX_C_LINE_PACKAGE_ROOT, "templates", "releases");
|
|
1064
995
|
}
|
|
1065
|
-
|
|
1066
996
|
//#endregion
|
|
1067
997
|
//#region src/utility/markdownTemplates/getEditableSectionFromTemplate.ts
|
|
1068
998
|
async function getEditableSectionFromTemplate(version) {
|
|
1069
999
|
const templatesPath = await getReleaseNoteTemplatesPath();
|
|
1070
1000
|
return await readFile(path.join(templatesPath, version.type === "major" ? "editableSectionMajor.md" : "editableSection.md"), "utf-8");
|
|
1071
1001
|
}
|
|
1072
|
-
|
|
1073
1002
|
//#endregion
|
|
1074
1003
|
//#region src/utility/markdownTemplates/replaceMarkdownPlaceholders.ts
|
|
1075
1004
|
function replaceMarkdownPlaceholders(rawContent, templateVariables) {
|
|
@@ -1082,7 +1011,6 @@ function replaceMarkdownPlaceholders(rawContent, templateVariables) {
|
|
|
1082
1011
|
}
|
|
1083
1012
|
return finalContent;
|
|
1084
1013
|
}
|
|
1085
|
-
|
|
1086
1014
|
//#endregion
|
|
1087
1015
|
//#region src/utility/markdownTemplates/releaseNote/getReleaseNoteTemplateFromMarkdown.ts
|
|
1088
1016
|
async function getTemplateVariables(projectName, version, templateVariables) {
|
|
@@ -1113,7 +1041,6 @@ async function getReleaseNoteTemplateFromMarkdown(projectName, version, metadata
|
|
|
1113
1041
|
const templatesPath = path.join(await ALEX_C_LINE_PACKAGE_ROOT, "templates", "releases");
|
|
1114
1042
|
return replaceMarkdownPlaceholders(await readFile(path.join(templatesPath, `${version.type}.md`), "utf-8"), templateVariables);
|
|
1115
1043
|
}
|
|
1116
|
-
|
|
1117
1044
|
//#endregion
|
|
1118
1045
|
//#region src/cli/commands/template/releaseNote/create.ts
|
|
1119
1046
|
function templateReleaseNoteCreate(program) {
|
|
@@ -1150,7 +1077,6 @@ function templateReleaseNoteCreate(program) {
|
|
|
1150
1077
|
console.info(`Release notes for ${versionNumber} have been created in ${path.relative(process.cwd(), releaseNotePath)}`);
|
|
1151
1078
|
});
|
|
1152
1079
|
}
|
|
1153
|
-
|
|
1154
1080
|
//#endregion
|
|
1155
1081
|
//#region src/cli/commands/template/releaseNote/migrate.ts
|
|
1156
1082
|
function templateReleaseNoteMigrate(program) {
|
|
@@ -1206,7 +1132,6 @@ function templateReleaseNoteMigrate(program) {
|
|
|
1206
1132
|
console.info(dryRun ? `Dry run complete! ${filesMovedCount} files would be moved.` : `Migration complete! ${filesMovedCount} files moved.`);
|
|
1207
1133
|
});
|
|
1208
1134
|
}
|
|
1209
|
-
|
|
1210
1135
|
//#endregion
|
|
1211
1136
|
//#region src/cli/commands/template/releaseNote/path.ts
|
|
1212
1137
|
function templateReleaseNotePath(program) {
|
|
@@ -1221,7 +1146,6 @@ function templateReleaseNotePath(program) {
|
|
|
1221
1146
|
console.info(getReleaseNotePath(version));
|
|
1222
1147
|
});
|
|
1223
1148
|
}
|
|
1224
|
-
|
|
1225
1149
|
//#endregion
|
|
1226
1150
|
//#region src/cli/commands/template/releaseNote/set-status.ts
|
|
1227
1151
|
function templateReleaseNoteSetStatus(program) {
|
|
@@ -1248,7 +1172,6 @@ function templateReleaseNoteSetStatus(program) {
|
|
|
1248
1172
|
console.info(`Setting the status of ${documentPath} to "${status}"`);
|
|
1249
1173
|
});
|
|
1250
1174
|
}
|
|
1251
|
-
|
|
1252
1175
|
//#endregion
|
|
1253
1176
|
//#region src/cli/commands/template/releaseNote/index.ts
|
|
1254
1177
|
function templateReleaseNote(program) {
|
|
@@ -1260,7 +1183,6 @@ function templateReleaseNote(program) {
|
|
|
1260
1183
|
templateReleaseNoteSetStatus
|
|
1261
1184
|
});
|
|
1262
1185
|
}
|
|
1263
|
-
|
|
1264
1186
|
//#endregion
|
|
1265
1187
|
//#region src/cli/commands/template/index.ts
|
|
1266
1188
|
function template(program) {
|
|
@@ -1269,13 +1191,11 @@ function template(program) {
|
|
|
1269
1191
|
templateReleaseNote
|
|
1270
1192
|
});
|
|
1271
1193
|
}
|
|
1272
|
-
|
|
1273
1194
|
//#endregion
|
|
1274
1195
|
//#region package.json
|
|
1275
1196
|
var name = "alex-c-line";
|
|
1276
|
-
var version$1 = "2.0.
|
|
1197
|
+
var version$1 = "2.0.2";
|
|
1277
1198
|
var description = "Command-line tool with commands to streamline the developer workflow.";
|
|
1278
|
-
|
|
1279
1199
|
//#endregion
|
|
1280
1200
|
//#region src/utility/updates/checkUpdate.ts
|
|
1281
1201
|
async function checkUpdate(options) {
|
|
@@ -1307,7 +1227,6 @@ async function checkUpdate(options) {
|
|
|
1307
1227
|
} else console.info(messageWithArtwork);
|
|
1308
1228
|
} else if (options?.logNoUpdates) console.info(`alex-c-line is up to date (${currentVersion}).`);
|
|
1309
1229
|
}
|
|
1310
|
-
|
|
1311
1230
|
//#endregion
|
|
1312
1231
|
//#region src/cli/commands/update/check.ts
|
|
1313
1232
|
function checkUpdateCommand(program) {
|
|
@@ -1318,13 +1237,11 @@ function checkUpdateCommand(program) {
|
|
|
1318
1237
|
});
|
|
1319
1238
|
});
|
|
1320
1239
|
}
|
|
1321
|
-
|
|
1322
1240
|
//#endregion
|
|
1323
1241
|
//#region src/cli/commands/update/index.ts
|
|
1324
1242
|
function update(program) {
|
|
1325
1243
|
loadCommands(program.command("update").description("Handle updates of the currently installed alex-c-line"), { checkUpdateCommand });
|
|
1326
1244
|
}
|
|
1327
|
-
|
|
1328
1245
|
//#endregion
|
|
1329
1246
|
//#region src/cli/commands/uuid/generate.ts
|
|
1330
1247
|
function generateUUID(program) {
|
|
@@ -1332,13 +1249,11 @@ function generateUUID(program) {
|
|
|
1332
1249
|
console.info(randomUUID());
|
|
1333
1250
|
});
|
|
1334
1251
|
}
|
|
1335
|
-
|
|
1336
1252
|
//#endregion
|
|
1337
1253
|
//#region src/cli/commands/uuid/index.ts
|
|
1338
1254
|
function uuid(program) {
|
|
1339
1255
|
loadCommands(program.command("uuid").description("Commands to help manage UUIDs"), { generateUUID });
|
|
1340
1256
|
}
|
|
1341
|
-
|
|
1342
1257
|
//#endregion
|
|
1343
1258
|
//#region src/utility/miscellaneous/parseZodSchemaForProgram.ts
|
|
1344
1259
|
function parseZodSchemaForProgram(program, schema, data) {
|
|
@@ -1349,7 +1264,6 @@ function parseZodSchemaForProgram(program, schema, data) {
|
|
|
1349
1264
|
throw error;
|
|
1350
1265
|
}
|
|
1351
1266
|
}
|
|
1352
|
-
|
|
1353
1267
|
//#endregion
|
|
1354
1268
|
//#region src/cli/commands/version/format.ts
|
|
1355
1269
|
const versionFormatOptionsBaseSchema = z.object({ prefix: z.boolean().optional() });
|
|
@@ -1374,7 +1288,6 @@ function versionFormat(program) {
|
|
|
1374
1288
|
}));
|
|
1375
1289
|
});
|
|
1376
1290
|
}
|
|
1377
|
-
|
|
1378
1291
|
//#endregion
|
|
1379
1292
|
//#region src/cli/commands/version/increment.ts
|
|
1380
1293
|
function versionIncrement(program) {
|
|
@@ -1390,7 +1303,6 @@ function versionIncrement(program) {
|
|
|
1390
1303
|
console.info(version.increment(incrementType).format({ omitPrefix: !prefix }));
|
|
1391
1304
|
});
|
|
1392
1305
|
}
|
|
1393
|
-
|
|
1394
1306
|
//#endregion
|
|
1395
1307
|
//#region src/cli/commands/version/type.ts
|
|
1396
1308
|
function versionType(program) {
|
|
@@ -1400,7 +1312,6 @@ function versionType(program) {
|
|
|
1400
1312
|
console.info(version.type);
|
|
1401
1313
|
});
|
|
1402
1314
|
}
|
|
1403
|
-
|
|
1404
1315
|
//#endregion
|
|
1405
1316
|
//#region src/cli/commands/version/index.ts
|
|
1406
1317
|
function version(program) {
|
|
@@ -1410,7 +1321,6 @@ function version(program) {
|
|
|
1410
1321
|
versionType
|
|
1411
1322
|
});
|
|
1412
1323
|
}
|
|
1413
|
-
|
|
1414
1324
|
//#endregion
|
|
1415
1325
|
//#region src/cli/commands/package-json/check/noFileDependencies.ts
|
|
1416
1326
|
function findFileDependencies(dependencies) {
|
|
@@ -1437,7 +1347,6 @@ async function noFileDependencies(program) {
|
|
|
1437
1347
|
});
|
|
1438
1348
|
console.info(`${successPrefix} No file dependencies found!`);
|
|
1439
1349
|
}
|
|
1440
|
-
|
|
1441
1350
|
//#endregion
|
|
1442
1351
|
//#region src/cli/commands/package-json/check/noPreReleaseDependencies.ts
|
|
1443
1352
|
function isPreRelease(dependencyVersionRange) {
|
|
@@ -1465,7 +1374,6 @@ async function noPreReleaseDependencies(program) {
|
|
|
1465
1374
|
});
|
|
1466
1375
|
console.info(`${successPrefix} No pre-release versions found!`);
|
|
1467
1376
|
}
|
|
1468
|
-
|
|
1469
1377
|
//#endregion
|
|
1470
1378
|
//#region src/cli/commands/package-json/check/index.ts
|
|
1471
1379
|
const RuleName = {
|
|
@@ -1482,13 +1390,11 @@ function packageJsonCheck(program) {
|
|
|
1482
1390
|
console.info(`${successPrefix} Success! All checks passed!`);
|
|
1483
1391
|
});
|
|
1484
1392
|
}
|
|
1485
|
-
|
|
1486
1393
|
//#endregion
|
|
1487
1394
|
//#region src/cli/commands/package-json/index.ts
|
|
1488
1395
|
function packageJson(program) {
|
|
1489
1396
|
loadCommands(program.command("package-json").description("Manage the package.json file"), { packageJsonCheck });
|
|
1490
1397
|
}
|
|
1491
|
-
|
|
1492
1398
|
//#endregion
|
|
1493
1399
|
//#region src/cli/commands/index.ts
|
|
1494
1400
|
function createCommands(program) {
|
|
@@ -1506,7 +1412,6 @@ function createCommands(program) {
|
|
|
1506
1412
|
version
|
|
1507
1413
|
});
|
|
1508
1414
|
}
|
|
1509
|
-
|
|
1510
1415
|
//#endregion
|
|
1511
1416
|
//#region src/utility/errors/formatError.ts
|
|
1512
1417
|
function formatError(error) {
|
|
@@ -1529,24 +1434,20 @@ function formatError(error) {
|
|
|
1529
1434
|
}
|
|
1530
1435
|
throw error;
|
|
1531
1436
|
}
|
|
1532
|
-
|
|
1533
1437
|
//#endregion
|
|
1534
1438
|
//#region src/cache/global/createAlexCLineGlobalCache.ts
|
|
1535
1439
|
async function createAlexCLineGlobalCache(cacheData) {
|
|
1536
1440
|
await mkdir(ALEX_C_LINE_GLOBAL_CACHE_DIRECTORY, { recursive: true });
|
|
1537
1441
|
await writeFile(ALEX_C_LINE_GLOBAL_CACHE_PATH, `${JSON.stringify(cacheData, null, 2)}\n`);
|
|
1538
1442
|
}
|
|
1539
|
-
|
|
1540
1443
|
//#endregion
|
|
1541
1444
|
//#region src/cache/global/types/AlexCLineGlobalCache.ts
|
|
1542
1445
|
const alexCLineGlobalCacheSchema = z.looseObject({ updateChecks: z.record(z.string(), z.string()).optional() });
|
|
1543
|
-
|
|
1544
1446
|
//#endregion
|
|
1545
1447
|
//#region src/cache/global/parseAlexCLineGlobalCache.ts
|
|
1546
1448
|
function parseAlexCLineGlobalCache(input) {
|
|
1547
1449
|
return parseZodSchema(alexCLineGlobalCacheSchema, input);
|
|
1548
1450
|
}
|
|
1549
|
-
|
|
1550
1451
|
//#endregion
|
|
1551
1452
|
//#region src/cache/global/loadAlexCLineGlobalCache.ts
|
|
1552
1453
|
async function loadAlexCLineGlobalCache() {
|
|
@@ -1557,7 +1458,6 @@ async function loadAlexCLineGlobalCache() {
|
|
|
1557
1458
|
throw error;
|
|
1558
1459
|
}
|
|
1559
1460
|
}
|
|
1560
|
-
|
|
1561
1461
|
//#endregion
|
|
1562
1462
|
//#region src/utility/updates/runAutomatedUpdateCheck.ts
|
|
1563
1463
|
async function runAutomatedUpdateCheck() {
|
|
@@ -1577,7 +1477,6 @@ async function runAutomatedUpdateCheck() {
|
|
|
1577
1477
|
}
|
|
1578
1478
|
} catch {}
|
|
1579
1479
|
}
|
|
1580
|
-
|
|
1581
1480
|
//#endregion
|
|
1582
1481
|
//#region src/cli/index.ts
|
|
1583
1482
|
(async () => {
|
|
@@ -1591,6 +1490,5 @@ async function runAutomatedUpdateCheck() {
|
|
|
1591
1490
|
formatError(error);
|
|
1592
1491
|
}
|
|
1593
1492
|
})();
|
|
1594
|
-
|
|
1595
1493
|
//#endregion
|
|
1596
|
-
export {
|
|
1494
|
+
export {};
|