alex-c-line 1.30.1 → 1.31.0
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.d.cts +1 -1
- package/dist/configs/index.d.ts +1 -1
- package/dist/configs/internal/index.d.cts +1 -1
- package/dist/configs/internal/index.d.ts +1 -1
- package/dist/index.cjs +71 -51
- package/dist/index.js +71 -51
- package/package.json +2 -2
package/dist/configs/index.d.cts
CHANGED
|
@@ -23,7 +23,7 @@ interface CreatePullRequestTemplateInfrastructureConfig extends CreatePullReques
|
|
|
23
23
|
}
|
|
24
24
|
type CreatePullRequestTemplateConfig = CreatePullRequestTemplateGeneralConfig | CreatePullRequestTemplateInfrastructureConfig;
|
|
25
25
|
//#endregion
|
|
26
|
-
//#region src/commands/pre-commit/createStepRunner.d.ts
|
|
26
|
+
//#region src/cli/commands/pre-commit/createStepRunner.d.ts
|
|
27
27
|
interface BaseOptions {
|
|
28
28
|
stdio: "inherit";
|
|
29
29
|
reject: false;
|
package/dist/configs/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ interface CreatePullRequestTemplateInfrastructureConfig extends CreatePullReques
|
|
|
24
24
|
}
|
|
25
25
|
type CreatePullRequestTemplateConfig = CreatePullRequestTemplateGeneralConfig | CreatePullRequestTemplateInfrastructureConfig;
|
|
26
26
|
//#endregion
|
|
27
|
-
//#region src/commands/pre-commit/createStepRunner.d.ts
|
|
27
|
+
//#region src/cli/commands/pre-commit/createStepRunner.d.ts
|
|
28
28
|
interface BaseOptions {
|
|
29
29
|
stdio: "inherit";
|
|
30
30
|
reject: false;
|
|
@@ -22,7 +22,7 @@ interface CreatePullRequestTemplateInfrastructureConfig extends CreatePullReques
|
|
|
22
22
|
}
|
|
23
23
|
type CreatePullRequestTemplateConfig = CreatePullRequestTemplateGeneralConfig | CreatePullRequestTemplateInfrastructureConfig;
|
|
24
24
|
//#endregion
|
|
25
|
-
//#region src/commands/pre-commit/createStepRunner.d.ts
|
|
25
|
+
//#region src/cli/commands/pre-commit/createStepRunner.d.ts
|
|
26
26
|
interface BaseOptions {
|
|
27
27
|
stdio: "inherit";
|
|
28
28
|
reject: false;
|
|
@@ -22,7 +22,7 @@ interface CreatePullRequestTemplateInfrastructureConfig extends CreatePullReques
|
|
|
22
22
|
}
|
|
23
23
|
type CreatePullRequestTemplateConfig = CreatePullRequestTemplateGeneralConfig | CreatePullRequestTemplateInfrastructureConfig;
|
|
24
24
|
//#endregion
|
|
25
|
-
//#region src/commands/pre-commit/createStepRunner.d.ts
|
|
25
|
+
//#region src/cli/commands/pre-commit/createStepRunner.d.ts
|
|
26
26
|
interface BaseOptions {
|
|
27
27
|
stdio: "inherit";
|
|
28
28
|
reject: false;
|
package/dist/index.cjs
CHANGED
|
@@ -58,15 +58,19 @@ gray_matter = __toESM(gray_matter);
|
|
|
58
58
|
let _alextheman_utility_node = require("@alextheman/utility/node");
|
|
59
59
|
let supports_color = require("supports-color");
|
|
60
60
|
supports_color = __toESM(supports_color);
|
|
61
|
+
let node_crypto = require("node:crypto");
|
|
61
62
|
|
|
62
63
|
//#region src/utility/miscellaneous/asciiToPng.ts
|
|
63
64
|
async function asciiToPng(ascii, options) {
|
|
64
|
-
const { fileName = "artwork/alex-c-line", width = 3e3, height = 3e3, backgroundColor = "#0b1020", titleColor = "#facc15", subtitleColor =
|
|
65
|
+
const { fileName = "artwork/alex-c-line", width = 3e3, height = 3e3, backgroundColor = "#0b1020", titleColor = "#facc15", subtitleColor = {
|
|
66
|
+
green: "#22c55e",
|
|
67
|
+
white: "#ffffff"
|
|
68
|
+
}[options?.subtitleColor ?? "green"], fontSize = 48, fontFamily = [
|
|
65
69
|
"Menlo",
|
|
66
70
|
"Monaco",
|
|
67
71
|
"Consolas",
|
|
68
72
|
"monospace"
|
|
69
|
-
], subtitleLineCount = 1 } = options ?? {};
|
|
73
|
+
], subtitleLineCount = options?.subtitleLineCount ?? 1 } = options ?? {};
|
|
70
74
|
const canvas$1 = (0, canvas.createCanvas)(width, height);
|
|
71
75
|
const context = canvas$1.getContext("2d");
|
|
72
76
|
context.fillStyle = backgroundColor;
|
|
@@ -119,28 +123,29 @@ async function createAlexCLineArtwork(options) {
|
|
|
119
123
|
}
|
|
120
124
|
|
|
121
125
|
//#endregion
|
|
122
|
-
//#region src/commands/artwork.ts
|
|
126
|
+
//#region src/cli/commands/artwork.ts
|
|
123
127
|
function artwork(program) {
|
|
124
|
-
program.command("artwork").description("Create the artwork for alex-c-line").option("--subtitle-text <subtitleText>", "Customise the subtitle text").option("--subtitle-color <subtitleColor>", "Customise the subtitle color", (subtitleColor) => {
|
|
125
|
-
|
|
128
|
+
program.command("artwork").description("Create the artwork for alex-c-line").option("--subtitle-text <subtitleText>", "Customise the subtitle text").option("--subtitle-color <subtitleColor>", "Customise the subtitle color").option("--save-png [fileName]", "Save the artwork as a PNG file, optionally specifying the path").action(async ({ savePng: fileName, subtitleText, subtitleColor = "green" }) => {
|
|
129
|
+
if (subtitleColor !== "green" && subtitleColor !== "white") throw new _alextheman_utility.DataError({ subtitleColor }, "INVALID_SUBTITLE_COLOR", "Subtitle color must either be green or white.");
|
|
130
|
+
const chalkColour = {
|
|
126
131
|
green: chalk.default.green,
|
|
127
132
|
white: chalk.default.white
|
|
128
133
|
}[subtitleColor];
|
|
129
|
-
}).option("--save-png [fileName]", "Save the artwork as a PNG file, optionally specifying the path").action(async ({ savePng: fileName, subtitleText, subtitleColor }) => {
|
|
130
134
|
console.info(await createAlexCLineArtwork({
|
|
131
135
|
includeBox: true,
|
|
132
136
|
includeColors: true,
|
|
133
137
|
subtitleText,
|
|
134
|
-
subtitleColor
|
|
138
|
+
subtitleColor: chalkColour
|
|
135
139
|
}));
|
|
136
140
|
if (fileName) await asciiToPng(await createAlexCLineArtwork({
|
|
137
141
|
includeBox: false,
|
|
138
142
|
includeColors: false,
|
|
139
|
-
subtitleText
|
|
140
|
-
subtitleColor
|
|
143
|
+
subtitleText
|
|
141
144
|
}), {
|
|
142
145
|
fileName: typeof fileName === "string" ? fileName : void 0,
|
|
143
|
-
fontSize: 90
|
|
146
|
+
fontSize: 90,
|
|
147
|
+
subtitleColor,
|
|
148
|
+
subtitleLineCount: subtitleText?.split("\n").length
|
|
144
149
|
});
|
|
145
150
|
});
|
|
146
151
|
}
|
|
@@ -152,7 +157,7 @@ const { cache: ALEX_C_LINE_GLOBAL_CACHE_DIRECTORY } = alexCLineEnvPaths;
|
|
|
152
157
|
const ALEX_C_LINE_GLOBAL_CACHE_PATH = node_path.default.join(ALEX_C_LINE_GLOBAL_CACHE_DIRECTORY, "cache.json");
|
|
153
158
|
|
|
154
159
|
//#endregion
|
|
155
|
-
//#region src/commands/cache-path.ts
|
|
160
|
+
//#region src/cli/commands/cache-path.ts
|
|
156
161
|
function cachePath(program) {
|
|
157
162
|
program.command("cache-path").description("Log the path to the alex-c-line cache files.").action(() => {
|
|
158
163
|
console.info(ALEX_C_LINE_GLOBAL_CACHE_PATH);
|
|
@@ -160,7 +165,7 @@ function cachePath(program) {
|
|
|
160
165
|
}
|
|
161
166
|
|
|
162
167
|
//#endregion
|
|
163
|
-
//#region src/commands/check-for-file-dependencies.ts
|
|
168
|
+
//#region src/cli/commands/check-for-file-dependencies.ts
|
|
164
169
|
function findFileDependencies(dependencies) {
|
|
165
170
|
const fileDependencies = {};
|
|
166
171
|
if (!dependencies) return {};
|
|
@@ -189,7 +194,7 @@ function checkForFileDependencies(program) {
|
|
|
189
194
|
}
|
|
190
195
|
|
|
191
196
|
//#endregion
|
|
192
|
-
//#region src/commands/check-lockfile-version-discrepancy.ts
|
|
197
|
+
//#region src/cli/commands/check-lockfile-version-discrepancy.ts
|
|
193
198
|
function checkLockfileVersionDiscrepancy(program) {
|
|
194
199
|
program.command("check-lockfile-version-discrepancy").description("Check that version numbers in package.json and package-lock.json match").action(async () => {
|
|
195
200
|
console.info("Checking for package.json and package-lock.json discrepancies...");
|
|
@@ -205,7 +210,7 @@ function checkLockfileVersionDiscrepancy(program) {
|
|
|
205
210
|
}
|
|
206
211
|
|
|
207
212
|
//#endregion
|
|
208
|
-
//#region src/commands/deprecated/check-version-number-change.ts
|
|
213
|
+
//#region src/cli/commands/deprecated/check-version-number-change.ts
|
|
209
214
|
function checkVersionNumberChange(program) {
|
|
210
215
|
program.command("check-version-number-change").description("Check that version number on branch has changed if source code differs between main and current branch").action(async () => {
|
|
211
216
|
console.info("Checking for version change...");
|
|
@@ -301,7 +306,7 @@ function getPullRequestTemplates(packageName) {
|
|
|
301
306
|
}
|
|
302
307
|
|
|
303
308
|
//#endregion
|
|
304
|
-
//#region src/commands/deprecated/create-pull-request-templates.ts
|
|
309
|
+
//#region src/cli/commands/deprecated/create-pull-request-templates.ts
|
|
305
310
|
const deprecationMessage$2 = "[DEPRECATED]: This command does not support the new markdown-native templates and alex-c-line config system. Please use `pre-commit-2` instead.";
|
|
306
311
|
function createPullRequestTemplates(program) {
|
|
307
312
|
program.command("create-pull-request-templates").description(_alextheman_utility.normaliseIndents`
|
|
@@ -397,7 +402,7 @@ function getReleaseNoteTemplate(packageName, version, status = "In progress", co
|
|
|
397
402
|
}
|
|
398
403
|
|
|
399
404
|
//#endregion
|
|
400
|
-
//#region src/commands/deprecated/create-release-note.ts
|
|
405
|
+
//#region src/cli/commands/deprecated/create-release-note.ts
|
|
401
406
|
function createReleaseNote(program) {
|
|
402
407
|
program.command("create-release-note").argument("[versionType]", "The version type to increment by (`major|minor|patch`). Note that this performs the version calculation without changing package.json. If left blank it will use the version in package.json", _alextheman_utility.parseVersionType).description("Create release notes based on the current version in package.json.").action(async (versionType) => {
|
|
403
408
|
const { name, version } = JSON.parse(await (0, node_fs_promises.readFile)(node_path.default.join(process.cwd(), "package.json"), "utf-8"));
|
|
@@ -420,7 +425,7 @@ function createReleaseNote(program) {
|
|
|
420
425
|
}
|
|
421
426
|
|
|
422
427
|
//#endregion
|
|
423
|
-
//#region src/commands/deprecated/edit-env.ts
|
|
428
|
+
//#region src/cli/commands/deprecated/edit-env.ts
|
|
424
429
|
const deprecationMessage$1 = "[DEPRECATED]: Please use `edit-env-2` instead.";
|
|
425
430
|
function editEnv(program) {
|
|
426
431
|
program.command("edit-env <key> [value]").description(_alextheman_utility.normaliseIndents`
|
|
@@ -443,7 +448,7 @@ function editEnv(program) {
|
|
|
443
448
|
}
|
|
444
449
|
|
|
445
450
|
//#endregion
|
|
446
|
-
//#region src/commands/deprecated/pre-commit.ts
|
|
451
|
+
//#region src/cli/commands/deprecated/pre-commit.ts
|
|
447
452
|
const deprecationMessage = "[DEPRECATED]: This command does not support the new alex-c-line config system. Please use `pre-commit-2` instead.";
|
|
448
453
|
function preCommit(program) {
|
|
449
454
|
program.command("pre-commit").description(_alextheman_utility.normaliseIndents`
|
|
@@ -492,7 +497,7 @@ function isValidReleaseDocument(packageName, version, initialDocument) {
|
|
|
492
497
|
}
|
|
493
498
|
|
|
494
499
|
//#endregion
|
|
495
|
-
//#region src/commands/deprecated/set-release-status.ts
|
|
500
|
+
//#region src/cli/commands/deprecated/set-release-status.ts
|
|
496
501
|
function setReleaseStatus(program) {
|
|
497
502
|
program.command("set-release-status").description("Change the release status on a given release document initially generated from the `create-release-note` command.").argument("<documentPath>", "The path to the document").action(async (documentPath) => {
|
|
498
503
|
const { name: packageName } = JSON.parse(await (0, node_fs_promises.readFile)(node_path.default.join(process.cwd(), "package.json"), "utf-8"));
|
|
@@ -526,7 +531,7 @@ async function upsertDotenvFile(contents, envFilePath) {
|
|
|
526
531
|
}
|
|
527
532
|
|
|
528
533
|
//#endregion
|
|
529
|
-
//#region src/commands/edit-env-file/addVariable.ts
|
|
534
|
+
//#region src/cli/commands/edit-env-file/addVariable.ts
|
|
530
535
|
async function addVariable(program, envFileContents, file) {
|
|
531
536
|
const newVariableName = await (0, _inquirer_prompts.input)({ message: "Please enter the name of the environment variable you would like to add." });
|
|
532
537
|
if (newVariableName in envFileContents) program.error(`
|
|
@@ -552,7 +557,7 @@ async function addVariable(program, envFileContents, file) {
|
|
|
552
557
|
}
|
|
553
558
|
|
|
554
559
|
//#endregion
|
|
555
|
-
//#region src/commands/edit-env-file/deleteVariable.ts
|
|
560
|
+
//#region src/cli/commands/edit-env-file/deleteVariable.ts
|
|
556
561
|
async function deleteVariable(envFileContents, variableToEdit, file) {
|
|
557
562
|
if (!await (0, _inquirer_prompts.confirm)({ message: `Are you sure you want to delete \`${String(variableToEdit)}\`?` })) {
|
|
558
563
|
console.info("Deletion aborted");
|
|
@@ -563,7 +568,7 @@ async function deleteVariable(envFileContents, variableToEdit, file) {
|
|
|
563
568
|
}
|
|
564
569
|
|
|
565
570
|
//#endregion
|
|
566
|
-
//#region src/commands/edit-env-file/editVariable.ts
|
|
571
|
+
//#region src/cli/commands/edit-env-file/editVariable.ts
|
|
567
572
|
async function editVariable(envFileContents, variableToEdit, file) {
|
|
568
573
|
const newValue = await (0, _inquirer_prompts.password)({ message: `Please enter new value for \`${String(variableToEdit)}\`` });
|
|
569
574
|
await upsertDotenvFile({
|
|
@@ -582,7 +587,7 @@ function redact(secretString) {
|
|
|
582
587
|
}
|
|
583
588
|
|
|
584
589
|
//#endregion
|
|
585
|
-
//#region src/commands/edit-env-file/changeExistingVariable.ts
|
|
590
|
+
//#region src/cli/commands/edit-env-file/changeExistingVariable.ts
|
|
586
591
|
async function changeExistingVariable(envFileContents, variableToEdit, file) {
|
|
587
592
|
switch (await (0, _inquirer_prompts.select)({
|
|
588
593
|
message: _alextheman_utility.normaliseIndents`
|
|
@@ -620,7 +625,7 @@ async function parseDotenvFile(envFilePath) {
|
|
|
620
625
|
}
|
|
621
626
|
|
|
622
627
|
//#endregion
|
|
623
|
-
//#region src/commands/edit-env-file/index.ts
|
|
628
|
+
//#region src/cli/commands/edit-env-file/index.ts
|
|
624
629
|
function editEnvFile(program) {
|
|
625
630
|
program.command("edit-env-file").description("Edit properties in a .env file").option("--interactive", "Enable interactive mode", true).option("--file <filePath>", "The path to the .env file you want to edit, relative to the working directory this command is run", ".env").action(async ({ interactive, file }) => {
|
|
626
631
|
if (interactive) {
|
|
@@ -667,7 +672,7 @@ function editEnvFile(program) {
|
|
|
667
672
|
}
|
|
668
673
|
|
|
669
674
|
//#endregion
|
|
670
|
-
//#region src/commands/encrypt-with-key.ts
|
|
675
|
+
//#region src/cli/commands/encrypt-with-key.ts
|
|
671
676
|
function encryptWithKey(program) {
|
|
672
677
|
program.command("encrypt-with-key").alias("encrypt").description("Encrypt a secret given the public base64 key and the thing you want to encrypt.").argument("<publicKey>", "The public base64 key to encrypt with").argument("<plaintextValue>", "The value to encrypt in plaintext").action(async (publicKey, plaintextValue) => {
|
|
673
678
|
try {
|
|
@@ -682,7 +687,7 @@ function encryptWithKey(program) {
|
|
|
682
687
|
}
|
|
683
688
|
|
|
684
689
|
//#endregion
|
|
685
|
-
//#region src/commands/git-post-merge-cleanup.ts
|
|
690
|
+
//#region src/cli/commands/git-post-merge-cleanup.ts
|
|
686
691
|
function gitPostMergeCleanup(program) {
|
|
687
692
|
program.command("git-post-merge-cleanup").alias("git-cleanup").description("Run after merging into a given branch to quickly clean up").argument("[branch]", "The branch you want to merge into", "main").option("--rebase", "Enable if your repository mainly rebases into main").action(async (branch, { rebase: rebaseOption }) => {
|
|
688
693
|
let alexCLineConfigJSON;
|
|
@@ -731,7 +736,7 @@ function gitPostMergeCleanup(program) {
|
|
|
731
736
|
}
|
|
732
737
|
|
|
733
738
|
//#endregion
|
|
734
|
-
//#region src/commands/pre-commit/createStepRunner.ts
|
|
739
|
+
//#region src/cli/commands/pre-commit/createStepRunner.ts
|
|
735
740
|
const runCommandAndLogToConsole = (0, execa.execa)({
|
|
736
741
|
stdio: "inherit",
|
|
737
742
|
reject: false
|
|
@@ -767,7 +772,7 @@ function createStepRunner(program) {
|
|
|
767
772
|
}
|
|
768
773
|
|
|
769
774
|
//#endregion
|
|
770
|
-
//#region src/commands/pre-commit/getCommandArguments.ts
|
|
775
|
+
//#region src/cli/commands/pre-commit/getCommandArguments.ts
|
|
771
776
|
function getCommandArguments(program, script, scripts, args) {
|
|
772
777
|
if (!(script in (scripts ?? {}))) program.error(`Could not find script \`${script}\` in package.json.`, {
|
|
773
778
|
exitCode: 1,
|
|
@@ -871,7 +876,7 @@ async function loadAlexCLineConfig(filePath) {
|
|
|
871
876
|
}
|
|
872
877
|
|
|
873
878
|
//#endregion
|
|
874
|
-
//#region src/commands/pre-commit/pre-commit-2.ts
|
|
879
|
+
//#region src/cli/commands/pre-commit/pre-commit-2.ts
|
|
875
880
|
function preCommit2(program) {
|
|
876
881
|
program.command("pre-commit-2").description("Run the pre-commit scripts specified in the alex-c-line config (v2 experiment).").option("--allow-no-staged-changes", "Run even if nothing is staged").option("--no-update-index").option("--update-index", "Update the git index after the run").action(async (options) => {
|
|
877
882
|
const configPath = await findAlexCLineConfig(process.cwd());
|
|
@@ -911,7 +916,7 @@ function preCommit2(program) {
|
|
|
911
916
|
}
|
|
912
917
|
|
|
913
918
|
//#endregion
|
|
914
|
-
//#region src/commands/say-hello.ts
|
|
919
|
+
//#region src/cli/commands/say-hello.ts
|
|
915
920
|
function sayHello(program) {
|
|
916
921
|
program.command("say-hello").description("Quick test command").action(() => {
|
|
917
922
|
console.info("Hello!");
|
|
@@ -1003,7 +1008,7 @@ async function getPullRequestTemplatesFromMarkdown(config) {
|
|
|
1003
1008
|
}
|
|
1004
1009
|
|
|
1005
1010
|
//#endregion
|
|
1006
|
-
//#region src/commands/template/pullRequest/create-pull-request-template-2.ts
|
|
1011
|
+
//#region src/cli/commands/template/pullRequest/create-pull-request-template-2.ts
|
|
1007
1012
|
function createPullRequestTemplate(program) {
|
|
1008
1013
|
program.command("create-pull-request-template").alias("create-pull-request-template-2").option("--category <category>", "The category of pull request templates to get (can be either `general` or `infrastructure`)", (rawValue) => {
|
|
1009
1014
|
return (0, _alextheman_utility.parseZodSchema)(zod.default.enum(PullRequestTemplateCategory), rawValue, () => {
|
|
@@ -1115,7 +1120,7 @@ async function validateReleaseDocument(projectName, version, content, allowedRel
|
|
|
1115
1120
|
}
|
|
1116
1121
|
|
|
1117
1122
|
//#endregion
|
|
1118
|
-
//#region src/commands/template/releaseNote/check-release-note.ts
|
|
1123
|
+
//#region src/cli/commands/template/releaseNote/check-release-note.ts
|
|
1119
1124
|
function checkReleaseNote(program) {
|
|
1120
1125
|
program.command("check-release-note").argument("<documentPath>", "The path to the document", _alextheman_utility_node.parseFilePath).option("--expected-release-status <expectedReleaseStatus>", "The expected release status of the document once we read it in.", parseReleaseStatus).description("Check whether a given release note is valid according to the templates or not. Returns exit code 0 for valid release note and non-zero otherwise.").action(async (documentPath, { expectedReleaseStatus }) => {
|
|
1121
1126
|
const fileContents = await (0, node_fs_promises.readFile)(node_path.default.join(process.cwd(), documentPath.fullPath), "utf-8");
|
|
@@ -1165,7 +1170,7 @@ async function getReleaseNoteTemplateFromMarkdown(projectName, version, metadata
|
|
|
1165
1170
|
}
|
|
1166
1171
|
|
|
1167
1172
|
//#endregion
|
|
1168
|
-
//#region src/commands/template/releaseNote/create-release-note-2.ts
|
|
1173
|
+
//#region src/cli/commands/template/releaseNote/create-release-note-2.ts
|
|
1169
1174
|
function createReleaseNote2(program) {
|
|
1170
1175
|
program.command("create-release-note-2").argument("[createFor]", _alextheman_utility.normaliseIndents`
|
|
1171
1176
|
Decide what version to create a release note for exactly:
|
|
@@ -1207,7 +1212,7 @@ function createReleaseNote2(program) {
|
|
|
1207
1212
|
}
|
|
1208
1213
|
|
|
1209
1214
|
//#endregion
|
|
1210
|
-
//#region src/commands/template/releaseNote/migrate-release-notes.ts
|
|
1215
|
+
//#region src/cli/commands/template/releaseNote/migrate-release-notes.ts
|
|
1211
1216
|
function migrateReleaseNotes(program) {
|
|
1212
1217
|
program.command("migrate-release-notes").description(_alextheman_utility.normaliseIndents`
|
|
1213
1218
|
Migrate the docs/releases folder generated from \`create-release-note\` to be more compatible with v2.
|
|
@@ -1263,7 +1268,7 @@ function migrateReleaseNotes(program) {
|
|
|
1263
1268
|
}
|
|
1264
1269
|
|
|
1265
1270
|
//#endregion
|
|
1266
|
-
//#region src/commands/template/releaseNote/set-release-status-2.ts
|
|
1271
|
+
//#region src/cli/commands/template/releaseNote/set-release-status-2.ts
|
|
1267
1272
|
function setReleaseStatus2(program) {
|
|
1268
1273
|
program.command("set-release-status-2").description("Change the release status on a given release document initially generated from the `create-release-note` command.").argument("<documentPath>", "The path to the document").argument("[status]", "The status to set the document to", parseReleaseStatus, ReleaseStatus.RELEASED).action(async (documentPath, status) => {
|
|
1269
1274
|
const packageInfo = JSON.parse(await (0, node_fs_promises.readFile)(node_path.default.join(process.cwd(), "package.json"), "utf-8"));
|
|
@@ -1311,7 +1316,7 @@ function parseZodSchemaForProgram(programError, schema, data) {
|
|
|
1311
1316
|
//#endregion
|
|
1312
1317
|
//#region package.json
|
|
1313
1318
|
var name = "alex-c-line";
|
|
1314
|
-
var version = "1.
|
|
1319
|
+
var version = "1.31.0";
|
|
1315
1320
|
var description = "Command-line tool with commands to streamline the developer workflow.";
|
|
1316
1321
|
|
|
1317
1322
|
//#endregion
|
|
@@ -1347,7 +1352,7 @@ async function checkUpdate(options) {
|
|
|
1347
1352
|
}
|
|
1348
1353
|
|
|
1349
1354
|
//#endregion
|
|
1350
|
-
//#region src/commands/update.ts
|
|
1355
|
+
//#region src/cli/commands/update.ts
|
|
1351
1356
|
const optionsSchema = zod.default.object({ check: zod.default.boolean().optional() });
|
|
1352
1357
|
function update(program) {
|
|
1353
1358
|
program.command("update").description("Handle updates of the currently installed alex-c-line").option("--check", "Check for available updates").option("--apply", "Apply the latest update").action(async (rawOptions) => {
|
|
@@ -1446,7 +1451,7 @@ async function removeAllTarballs(packagePath, packageName) {
|
|
|
1446
1451
|
}
|
|
1447
1452
|
|
|
1448
1453
|
//#endregion
|
|
1449
|
-
//#region src/commands/use-local-package.ts
|
|
1454
|
+
//#region src/cli/commands/use-local-package.ts
|
|
1450
1455
|
function useLocalPackage(program) {
|
|
1451
1456
|
program.command("use-local-package").description(_alextheman_utility.normaliseIndents`
|
|
1452
1457
|
${experimentalHeader}
|
|
@@ -1549,7 +1554,27 @@ function useLocalPackage(program) {
|
|
|
1549
1554
|
}
|
|
1550
1555
|
|
|
1551
1556
|
//#endregion
|
|
1552
|
-
//#region src/commands/
|
|
1557
|
+
//#region src/cli/commands/uuid/generate.ts
|
|
1558
|
+
function generateUUID(program) {
|
|
1559
|
+
program.command("generate").description("Generate a random UUID").action(() => {
|
|
1560
|
+
console.info((0, node_crypto.randomUUID)());
|
|
1561
|
+
});
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
//#endregion
|
|
1565
|
+
//#region src/utility/miscellaneous/loadCommands.ts
|
|
1566
|
+
function loadCommands(program, commandMap) {
|
|
1567
|
+
for (const loader of Object.values(commandMap)) loader(program);
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
//#endregion
|
|
1571
|
+
//#region src/cli/commands/uuid/index.ts
|
|
1572
|
+
function uuid(program) {
|
|
1573
|
+
loadCommands(program.command("uuid").description("Commands to help manage UUIDs"), { generateUUID });
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
//#endregion
|
|
1577
|
+
//#region src/cli/commands/versioning/get-major-version.ts
|
|
1553
1578
|
function getMajorVersion(program) {
|
|
1554
1579
|
program.command("get-major-version").description("Get the major representation of a version number (e.g. v2, v3 etc...)").argument("<version>", "The version to get the major representation of", (rawValue) => {
|
|
1555
1580
|
return new _alextheman_utility.VersionNumber(rawValue);
|
|
@@ -1559,7 +1584,7 @@ function getMajorVersion(program) {
|
|
|
1559
1584
|
}
|
|
1560
1585
|
|
|
1561
1586
|
//#endregion
|
|
1562
|
-
//#region src/commands/versioning/get-minor-version.ts
|
|
1587
|
+
//#region src/cli/commands/versioning/get-minor-version.ts
|
|
1563
1588
|
function getMinorVersion(program) {
|
|
1564
1589
|
program.command("get-minor-version").description("Get the minor representation of a version number (e.g. v2.1, v3.1 etc...)").argument("<version>", "The version to get the minor representation of", (rawValue) => {
|
|
1565
1590
|
return new _alextheman_utility.VersionNumber(rawValue);
|
|
@@ -1569,7 +1594,7 @@ function getMinorVersion(program) {
|
|
|
1569
1594
|
}
|
|
1570
1595
|
|
|
1571
1596
|
//#endregion
|
|
1572
|
-
//#region src/commands/versioning/get-version-type.ts
|
|
1597
|
+
//#region src/cli/commands/versioning/get-version-type.ts
|
|
1573
1598
|
function getVersionType(program) {
|
|
1574
1599
|
program.command("get-version-type").description("Gets the version type of the given version number.").argument("<version>", "The version to get the version type from", (rawVersion) => {
|
|
1575
1600
|
return new _alextheman_utility.VersionNumber(rawVersion);
|
|
@@ -1579,7 +1604,7 @@ function getVersionType(program) {
|
|
|
1579
1604
|
}
|
|
1580
1605
|
|
|
1581
1606
|
//#endregion
|
|
1582
|
-
//#region src/commands/versioning/increment-version.ts
|
|
1607
|
+
//#region src/cli/commands/versioning/increment-version.ts
|
|
1583
1608
|
function incrementVersion(program) {
|
|
1584
1609
|
program.command("increment-version").description("Increments the given input version depending on the given increment type.").argument("<version>", "The version to increment", (rawVersion) => {
|
|
1585
1610
|
return new _alextheman_utility.VersionNumber(rawVersion);
|
|
@@ -1595,13 +1620,7 @@ function incrementVersion(program) {
|
|
|
1595
1620
|
}
|
|
1596
1621
|
|
|
1597
1622
|
//#endregion
|
|
1598
|
-
//#region src/
|
|
1599
|
-
function loadCommands(program, commandMap) {
|
|
1600
|
-
for (const loader of Object.values(commandMap)) loader(program);
|
|
1601
|
-
}
|
|
1602
|
-
|
|
1603
|
-
//#endregion
|
|
1604
|
-
//#region src/commands/index.ts
|
|
1623
|
+
//#region src/cli/commands/index.ts
|
|
1605
1624
|
function createCommands(program) {
|
|
1606
1625
|
loadCommands(program, {
|
|
1607
1626
|
artwork,
|
|
@@ -1629,7 +1648,8 @@ function createCommands(program) {
|
|
|
1629
1648
|
setReleaseStatus,
|
|
1630
1649
|
setReleaseStatus2,
|
|
1631
1650
|
update,
|
|
1632
|
-
useLocalPackage
|
|
1651
|
+
useLocalPackage,
|
|
1652
|
+
uuid
|
|
1633
1653
|
});
|
|
1634
1654
|
}
|
|
1635
1655
|
|
|
@@ -1705,7 +1725,7 @@ async function runAutomatedUpdateCheck() {
|
|
|
1705
1725
|
}
|
|
1706
1726
|
|
|
1707
1727
|
//#endregion
|
|
1708
|
-
//#region src/index.ts
|
|
1728
|
+
//#region src/cli/index.ts
|
|
1709
1729
|
(async () => {
|
|
1710
1730
|
try {
|
|
1711
1731
|
const program = new commander.Command();
|
package/dist/index.js
CHANGED
|
@@ -20,15 +20,19 @@ import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
20
20
|
import matter from "gray-matter";
|
|
21
21
|
import { parseFilePath } from "@alextheman/utility/node";
|
|
22
22
|
import supportsColor from "supports-color";
|
|
23
|
+
import { randomUUID } from "node:crypto";
|
|
23
24
|
|
|
24
25
|
//#region src/utility/miscellaneous/asciiToPng.ts
|
|
25
26
|
async function asciiToPng(ascii, options) {
|
|
26
|
-
const { fileName = "artwork/alex-c-line", width = 3e3, height = 3e3, backgroundColor = "#0b1020", titleColor = "#facc15", subtitleColor =
|
|
27
|
+
const { fileName = "artwork/alex-c-line", width = 3e3, height = 3e3, backgroundColor = "#0b1020", titleColor = "#facc15", subtitleColor = {
|
|
28
|
+
green: "#22c55e",
|
|
29
|
+
white: "#ffffff"
|
|
30
|
+
}[options?.subtitleColor ?? "green"], fontSize = 48, fontFamily = [
|
|
27
31
|
"Menlo",
|
|
28
32
|
"Monaco",
|
|
29
33
|
"Consolas",
|
|
30
34
|
"monospace"
|
|
31
|
-
], subtitleLineCount = 1 } = options ?? {};
|
|
35
|
+
], subtitleLineCount = options?.subtitleLineCount ?? 1 } = options ?? {};
|
|
32
36
|
const canvas = createCanvas(width, height);
|
|
33
37
|
const context = canvas.getContext("2d");
|
|
34
38
|
context.fillStyle = backgroundColor;
|
|
@@ -81,28 +85,29 @@ async function createAlexCLineArtwork(options) {
|
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
//#endregion
|
|
84
|
-
//#region src/commands/artwork.ts
|
|
88
|
+
//#region src/cli/commands/artwork.ts
|
|
85
89
|
function artwork(program) {
|
|
86
|
-
program.command("artwork").description("Create the artwork for alex-c-line").option("--subtitle-text <subtitleText>", "Customise the subtitle text").option("--subtitle-color <subtitleColor>", "Customise the subtitle color", (subtitleColor) => {
|
|
87
|
-
|
|
90
|
+
program.command("artwork").description("Create the artwork for alex-c-line").option("--subtitle-text <subtitleText>", "Customise the subtitle text").option("--subtitle-color <subtitleColor>", "Customise the subtitle color").option("--save-png [fileName]", "Save the artwork as a PNG file, optionally specifying the path").action(async ({ savePng: fileName, subtitleText, subtitleColor = "green" }) => {
|
|
91
|
+
if (subtitleColor !== "green" && subtitleColor !== "white") throw new DataError({ subtitleColor }, "INVALID_SUBTITLE_COLOR", "Subtitle color must either be green or white.");
|
|
92
|
+
const chalkColour = {
|
|
88
93
|
green: chalk.green,
|
|
89
94
|
white: chalk.white
|
|
90
95
|
}[subtitleColor];
|
|
91
|
-
}).option("--save-png [fileName]", "Save the artwork as a PNG file, optionally specifying the path").action(async ({ savePng: fileName, subtitleText, subtitleColor }) => {
|
|
92
96
|
console.info(await createAlexCLineArtwork({
|
|
93
97
|
includeBox: true,
|
|
94
98
|
includeColors: true,
|
|
95
99
|
subtitleText,
|
|
96
|
-
subtitleColor
|
|
100
|
+
subtitleColor: chalkColour
|
|
97
101
|
}));
|
|
98
102
|
if (fileName) await asciiToPng(await createAlexCLineArtwork({
|
|
99
103
|
includeBox: false,
|
|
100
104
|
includeColors: false,
|
|
101
|
-
subtitleText
|
|
102
|
-
subtitleColor
|
|
105
|
+
subtitleText
|
|
103
106
|
}), {
|
|
104
107
|
fileName: typeof fileName === "string" ? fileName : void 0,
|
|
105
|
-
fontSize: 90
|
|
108
|
+
fontSize: 90,
|
|
109
|
+
subtitleColor,
|
|
110
|
+
subtitleLineCount: subtitleText?.split("\n").length
|
|
106
111
|
});
|
|
107
112
|
});
|
|
108
113
|
}
|
|
@@ -114,7 +119,7 @@ const { cache: ALEX_C_LINE_GLOBAL_CACHE_DIRECTORY } = alexCLineEnvPaths;
|
|
|
114
119
|
const ALEX_C_LINE_GLOBAL_CACHE_PATH = path.join(ALEX_C_LINE_GLOBAL_CACHE_DIRECTORY, "cache.json");
|
|
115
120
|
|
|
116
121
|
//#endregion
|
|
117
|
-
//#region src/commands/cache-path.ts
|
|
122
|
+
//#region src/cli/commands/cache-path.ts
|
|
118
123
|
function cachePath(program) {
|
|
119
124
|
program.command("cache-path").description("Log the path to the alex-c-line cache files.").action(() => {
|
|
120
125
|
console.info(ALEX_C_LINE_GLOBAL_CACHE_PATH);
|
|
@@ -122,7 +127,7 @@ function cachePath(program) {
|
|
|
122
127
|
}
|
|
123
128
|
|
|
124
129
|
//#endregion
|
|
125
|
-
//#region src/commands/check-for-file-dependencies.ts
|
|
130
|
+
//#region src/cli/commands/check-for-file-dependencies.ts
|
|
126
131
|
function findFileDependencies(dependencies) {
|
|
127
132
|
const fileDependencies = {};
|
|
128
133
|
if (!dependencies) return {};
|
|
@@ -151,7 +156,7 @@ function checkForFileDependencies(program) {
|
|
|
151
156
|
}
|
|
152
157
|
|
|
153
158
|
//#endregion
|
|
154
|
-
//#region src/commands/check-lockfile-version-discrepancy.ts
|
|
159
|
+
//#region src/cli/commands/check-lockfile-version-discrepancy.ts
|
|
155
160
|
function checkLockfileVersionDiscrepancy(program) {
|
|
156
161
|
program.command("check-lockfile-version-discrepancy").description("Check that version numbers in package.json and package-lock.json match").action(async () => {
|
|
157
162
|
console.info("Checking for package.json and package-lock.json discrepancies...");
|
|
@@ -167,7 +172,7 @@ function checkLockfileVersionDiscrepancy(program) {
|
|
|
167
172
|
}
|
|
168
173
|
|
|
169
174
|
//#endregion
|
|
170
|
-
//#region src/commands/deprecated/check-version-number-change.ts
|
|
175
|
+
//#region src/cli/commands/deprecated/check-version-number-change.ts
|
|
171
176
|
function checkVersionNumberChange(program) {
|
|
172
177
|
program.command("check-version-number-change").description("Check that version number on branch has changed if source code differs between main and current branch").action(async () => {
|
|
173
178
|
console.info("Checking for version change...");
|
|
@@ -263,7 +268,7 @@ function getPullRequestTemplates(packageName) {
|
|
|
263
268
|
}
|
|
264
269
|
|
|
265
270
|
//#endregion
|
|
266
|
-
//#region src/commands/deprecated/create-pull-request-templates.ts
|
|
271
|
+
//#region src/cli/commands/deprecated/create-pull-request-templates.ts
|
|
267
272
|
const deprecationMessage$2 = "[DEPRECATED]: This command does not support the new markdown-native templates and alex-c-line config system. Please use `pre-commit-2` instead.";
|
|
268
273
|
function createPullRequestTemplates(program) {
|
|
269
274
|
program.command("create-pull-request-templates").description(normaliseIndents`
|
|
@@ -359,7 +364,7 @@ function getReleaseNoteTemplate(packageName, version, status = "In progress", co
|
|
|
359
364
|
}
|
|
360
365
|
|
|
361
366
|
//#endregion
|
|
362
|
-
//#region src/commands/deprecated/create-release-note.ts
|
|
367
|
+
//#region src/cli/commands/deprecated/create-release-note.ts
|
|
363
368
|
function createReleaseNote(program) {
|
|
364
369
|
program.command("create-release-note").argument("[versionType]", "The version type to increment by (`major|minor|patch`). Note that this performs the version calculation without changing package.json. If left blank it will use the version in package.json", parseVersionType).description("Create release notes based on the current version in package.json.").action(async (versionType) => {
|
|
365
370
|
const { name, version } = JSON.parse(await readFile(path.join(process.cwd(), "package.json"), "utf-8"));
|
|
@@ -382,7 +387,7 @@ function createReleaseNote(program) {
|
|
|
382
387
|
}
|
|
383
388
|
|
|
384
389
|
//#endregion
|
|
385
|
-
//#region src/commands/deprecated/edit-env.ts
|
|
390
|
+
//#region src/cli/commands/deprecated/edit-env.ts
|
|
386
391
|
const deprecationMessage$1 = "[DEPRECATED]: Please use `edit-env-2` instead.";
|
|
387
392
|
function editEnv(program) {
|
|
388
393
|
program.command("edit-env <key> [value]").description(normaliseIndents`
|
|
@@ -405,7 +410,7 @@ function editEnv(program) {
|
|
|
405
410
|
}
|
|
406
411
|
|
|
407
412
|
//#endregion
|
|
408
|
-
//#region src/commands/deprecated/pre-commit.ts
|
|
413
|
+
//#region src/cli/commands/deprecated/pre-commit.ts
|
|
409
414
|
const deprecationMessage = "[DEPRECATED]: This command does not support the new alex-c-line config system. Please use `pre-commit-2` instead.";
|
|
410
415
|
function preCommit(program) {
|
|
411
416
|
program.command("pre-commit").description(normaliseIndents`
|
|
@@ -454,7 +459,7 @@ function isValidReleaseDocument(packageName, version, initialDocument) {
|
|
|
454
459
|
}
|
|
455
460
|
|
|
456
461
|
//#endregion
|
|
457
|
-
//#region src/commands/deprecated/set-release-status.ts
|
|
462
|
+
//#region src/cli/commands/deprecated/set-release-status.ts
|
|
458
463
|
function setReleaseStatus(program) {
|
|
459
464
|
program.command("set-release-status").description("Change the release status on a given release document initially generated from the `create-release-note` command.").argument("<documentPath>", "The path to the document").action(async (documentPath) => {
|
|
460
465
|
const { name: packageName } = JSON.parse(await readFile(path.join(process.cwd(), "package.json"), "utf-8"));
|
|
@@ -488,7 +493,7 @@ async function upsertDotenvFile(contents, envFilePath) {
|
|
|
488
493
|
}
|
|
489
494
|
|
|
490
495
|
//#endregion
|
|
491
|
-
//#region src/commands/edit-env-file/addVariable.ts
|
|
496
|
+
//#region src/cli/commands/edit-env-file/addVariable.ts
|
|
492
497
|
async function addVariable(program, envFileContents, file) {
|
|
493
498
|
const newVariableName = await input({ message: "Please enter the name of the environment variable you would like to add." });
|
|
494
499
|
if (newVariableName in envFileContents) program.error(`
|
|
@@ -514,7 +519,7 @@ async function addVariable(program, envFileContents, file) {
|
|
|
514
519
|
}
|
|
515
520
|
|
|
516
521
|
//#endregion
|
|
517
|
-
//#region src/commands/edit-env-file/deleteVariable.ts
|
|
522
|
+
//#region src/cli/commands/edit-env-file/deleteVariable.ts
|
|
518
523
|
async function deleteVariable(envFileContents, variableToEdit, file) {
|
|
519
524
|
if (!await confirm({ message: `Are you sure you want to delete \`${String(variableToEdit)}\`?` })) {
|
|
520
525
|
console.info("Deletion aborted");
|
|
@@ -525,7 +530,7 @@ async function deleteVariable(envFileContents, variableToEdit, file) {
|
|
|
525
530
|
}
|
|
526
531
|
|
|
527
532
|
//#endregion
|
|
528
|
-
//#region src/commands/edit-env-file/editVariable.ts
|
|
533
|
+
//#region src/cli/commands/edit-env-file/editVariable.ts
|
|
529
534
|
async function editVariable(envFileContents, variableToEdit, file) {
|
|
530
535
|
const newValue = await password({ message: `Please enter new value for \`${String(variableToEdit)}\`` });
|
|
531
536
|
await upsertDotenvFile({
|
|
@@ -544,7 +549,7 @@ function redact(secretString) {
|
|
|
544
549
|
}
|
|
545
550
|
|
|
546
551
|
//#endregion
|
|
547
|
-
//#region src/commands/edit-env-file/changeExistingVariable.ts
|
|
552
|
+
//#region src/cli/commands/edit-env-file/changeExistingVariable.ts
|
|
548
553
|
async function changeExistingVariable(envFileContents, variableToEdit, file) {
|
|
549
554
|
switch (await select({
|
|
550
555
|
message: normaliseIndents`
|
|
@@ -582,7 +587,7 @@ async function parseDotenvFile(envFilePath) {
|
|
|
582
587
|
}
|
|
583
588
|
|
|
584
589
|
//#endregion
|
|
585
|
-
//#region src/commands/edit-env-file/index.ts
|
|
590
|
+
//#region src/cli/commands/edit-env-file/index.ts
|
|
586
591
|
function editEnvFile(program) {
|
|
587
592
|
program.command("edit-env-file").description("Edit properties in a .env file").option("--interactive", "Enable interactive mode", true).option("--file <filePath>", "The path to the .env file you want to edit, relative to the working directory this command is run", ".env").action(async ({ interactive, file }) => {
|
|
588
593
|
if (interactive) {
|
|
@@ -629,7 +634,7 @@ function editEnvFile(program) {
|
|
|
629
634
|
}
|
|
630
635
|
|
|
631
636
|
//#endregion
|
|
632
|
-
//#region src/commands/encrypt-with-key.ts
|
|
637
|
+
//#region src/cli/commands/encrypt-with-key.ts
|
|
633
638
|
function encryptWithKey$1(program) {
|
|
634
639
|
program.command("encrypt-with-key").alias("encrypt").description("Encrypt a secret given the public base64 key and the thing you want to encrypt.").argument("<publicKey>", "The public base64 key to encrypt with").argument("<plaintextValue>", "The value to encrypt in plaintext").action(async (publicKey, plaintextValue) => {
|
|
635
640
|
try {
|
|
@@ -644,7 +649,7 @@ function encryptWithKey$1(program) {
|
|
|
644
649
|
}
|
|
645
650
|
|
|
646
651
|
//#endregion
|
|
647
|
-
//#region src/commands/git-post-merge-cleanup.ts
|
|
652
|
+
//#region src/cli/commands/git-post-merge-cleanup.ts
|
|
648
653
|
function gitPostMergeCleanup(program) {
|
|
649
654
|
program.command("git-post-merge-cleanup").alias("git-cleanup").description("Run after merging into a given branch to quickly clean up").argument("[branch]", "The branch you want to merge into", "main").option("--rebase", "Enable if your repository mainly rebases into main").action(async (branch, { rebase: rebaseOption }) => {
|
|
650
655
|
let alexCLineConfigJSON;
|
|
@@ -693,7 +698,7 @@ function gitPostMergeCleanup(program) {
|
|
|
693
698
|
}
|
|
694
699
|
|
|
695
700
|
//#endregion
|
|
696
|
-
//#region src/commands/pre-commit/createStepRunner.ts
|
|
701
|
+
//#region src/cli/commands/pre-commit/createStepRunner.ts
|
|
697
702
|
const runCommandAndLogToConsole = execa({
|
|
698
703
|
stdio: "inherit",
|
|
699
704
|
reject: false
|
|
@@ -729,7 +734,7 @@ function createStepRunner(program) {
|
|
|
729
734
|
}
|
|
730
735
|
|
|
731
736
|
//#endregion
|
|
732
|
-
//#region src/commands/pre-commit/getCommandArguments.ts
|
|
737
|
+
//#region src/cli/commands/pre-commit/getCommandArguments.ts
|
|
733
738
|
function getCommandArguments(program, script, scripts, args) {
|
|
734
739
|
if (!(script in (scripts ?? {}))) program.error(`Could not find script \`${script}\` in package.json.`, {
|
|
735
740
|
exitCode: 1,
|
|
@@ -833,7 +838,7 @@ async function loadAlexCLineConfig(filePath) {
|
|
|
833
838
|
}
|
|
834
839
|
|
|
835
840
|
//#endregion
|
|
836
|
-
//#region src/commands/pre-commit/pre-commit-2.ts
|
|
841
|
+
//#region src/cli/commands/pre-commit/pre-commit-2.ts
|
|
837
842
|
function preCommit2(program) {
|
|
838
843
|
program.command("pre-commit-2").description("Run the pre-commit scripts specified in the alex-c-line config (v2 experiment).").option("--allow-no-staged-changes", "Run even if nothing is staged").option("--no-update-index").option("--update-index", "Update the git index after the run").action(async (options) => {
|
|
839
844
|
const configPath = await findAlexCLineConfig(process.cwd());
|
|
@@ -873,7 +878,7 @@ function preCommit2(program) {
|
|
|
873
878
|
}
|
|
874
879
|
|
|
875
880
|
//#endregion
|
|
876
|
-
//#region src/commands/say-hello.ts
|
|
881
|
+
//#region src/cli/commands/say-hello.ts
|
|
877
882
|
function sayHello(program) {
|
|
878
883
|
program.command("say-hello").description("Quick test command").action(() => {
|
|
879
884
|
console.info("Hello!");
|
|
@@ -965,7 +970,7 @@ async function getPullRequestTemplatesFromMarkdown(config) {
|
|
|
965
970
|
}
|
|
966
971
|
|
|
967
972
|
//#endregion
|
|
968
|
-
//#region src/commands/template/pullRequest/create-pull-request-template-2.ts
|
|
973
|
+
//#region src/cli/commands/template/pullRequest/create-pull-request-template-2.ts
|
|
969
974
|
function createPullRequestTemplate(program) {
|
|
970
975
|
program.command("create-pull-request-template").alias("create-pull-request-template-2").option("--category <category>", "The category of pull request templates to get (can be either `general` or `infrastructure`)", (rawValue) => {
|
|
971
976
|
return parseZodSchema(z.enum(PullRequestTemplateCategory), rawValue, () => {
|
|
@@ -1077,7 +1082,7 @@ async function validateReleaseDocument(projectName, version, content, allowedRel
|
|
|
1077
1082
|
}
|
|
1078
1083
|
|
|
1079
1084
|
//#endregion
|
|
1080
|
-
//#region src/commands/template/releaseNote/check-release-note.ts
|
|
1085
|
+
//#region src/cli/commands/template/releaseNote/check-release-note.ts
|
|
1081
1086
|
function checkReleaseNote(program) {
|
|
1082
1087
|
program.command("check-release-note").argument("<documentPath>", "The path to the document", parseFilePath).option("--expected-release-status <expectedReleaseStatus>", "The expected release status of the document once we read it in.", parseReleaseStatus).description("Check whether a given release note is valid according to the templates or not. Returns exit code 0 for valid release note and non-zero otherwise.").action(async (documentPath, { expectedReleaseStatus }) => {
|
|
1083
1088
|
const fileContents = await readFile(path.join(process.cwd(), documentPath.fullPath), "utf-8");
|
|
@@ -1127,7 +1132,7 @@ async function getReleaseNoteTemplateFromMarkdown(projectName, version, metadata
|
|
|
1127
1132
|
}
|
|
1128
1133
|
|
|
1129
1134
|
//#endregion
|
|
1130
|
-
//#region src/commands/template/releaseNote/create-release-note-2.ts
|
|
1135
|
+
//#region src/cli/commands/template/releaseNote/create-release-note-2.ts
|
|
1131
1136
|
function createReleaseNote2(program) {
|
|
1132
1137
|
program.command("create-release-note-2").argument("[createFor]", normaliseIndents`
|
|
1133
1138
|
Decide what version to create a release note for exactly:
|
|
@@ -1169,7 +1174,7 @@ function createReleaseNote2(program) {
|
|
|
1169
1174
|
}
|
|
1170
1175
|
|
|
1171
1176
|
//#endregion
|
|
1172
|
-
//#region src/commands/template/releaseNote/migrate-release-notes.ts
|
|
1177
|
+
//#region src/cli/commands/template/releaseNote/migrate-release-notes.ts
|
|
1173
1178
|
function migrateReleaseNotes(program) {
|
|
1174
1179
|
program.command("migrate-release-notes").description(normaliseIndents`
|
|
1175
1180
|
Migrate the docs/releases folder generated from \`create-release-note\` to be more compatible with v2.
|
|
@@ -1225,7 +1230,7 @@ function migrateReleaseNotes(program) {
|
|
|
1225
1230
|
}
|
|
1226
1231
|
|
|
1227
1232
|
//#endregion
|
|
1228
|
-
//#region src/commands/template/releaseNote/set-release-status-2.ts
|
|
1233
|
+
//#region src/cli/commands/template/releaseNote/set-release-status-2.ts
|
|
1229
1234
|
function setReleaseStatus2(program) {
|
|
1230
1235
|
program.command("set-release-status-2").description("Change the release status on a given release document initially generated from the `create-release-note` command.").argument("<documentPath>", "The path to the document").argument("[status]", "The status to set the document to", parseReleaseStatus, ReleaseStatus.RELEASED).action(async (documentPath, status) => {
|
|
1231
1236
|
const packageInfo = JSON.parse(await readFile(path.join(process.cwd(), "package.json"), "utf-8"));
|
|
@@ -1273,7 +1278,7 @@ function parseZodSchemaForProgram(programError, schema, data) {
|
|
|
1273
1278
|
//#endregion
|
|
1274
1279
|
//#region package.json
|
|
1275
1280
|
var name = "alex-c-line";
|
|
1276
|
-
var version = "1.
|
|
1281
|
+
var version = "1.31.0";
|
|
1277
1282
|
var description = "Command-line tool with commands to streamline the developer workflow.";
|
|
1278
1283
|
|
|
1279
1284
|
//#endregion
|
|
@@ -1309,7 +1314,7 @@ async function checkUpdate(options) {
|
|
|
1309
1314
|
}
|
|
1310
1315
|
|
|
1311
1316
|
//#endregion
|
|
1312
|
-
//#region src/commands/update.ts
|
|
1317
|
+
//#region src/cli/commands/update.ts
|
|
1313
1318
|
const optionsSchema = z.object({ check: z.boolean().optional() });
|
|
1314
1319
|
function update(program) {
|
|
1315
1320
|
program.command("update").description("Handle updates of the currently installed alex-c-line").option("--check", "Check for available updates").option("--apply", "Apply the latest update").action(async (rawOptions) => {
|
|
@@ -1408,7 +1413,7 @@ async function removeAllTarballs(packagePath, packageName) {
|
|
|
1408
1413
|
}
|
|
1409
1414
|
|
|
1410
1415
|
//#endregion
|
|
1411
|
-
//#region src/commands/use-local-package.ts
|
|
1416
|
+
//#region src/cli/commands/use-local-package.ts
|
|
1412
1417
|
function useLocalPackage(program) {
|
|
1413
1418
|
program.command("use-local-package").description(normaliseIndents`
|
|
1414
1419
|
${experimentalHeader}
|
|
@@ -1511,7 +1516,27 @@ function useLocalPackage(program) {
|
|
|
1511
1516
|
}
|
|
1512
1517
|
|
|
1513
1518
|
//#endregion
|
|
1514
|
-
//#region src/commands/
|
|
1519
|
+
//#region src/cli/commands/uuid/generate.ts
|
|
1520
|
+
function generateUUID(program) {
|
|
1521
|
+
program.command("generate").description("Generate a random UUID").action(() => {
|
|
1522
|
+
console.info(randomUUID());
|
|
1523
|
+
});
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
//#endregion
|
|
1527
|
+
//#region src/utility/miscellaneous/loadCommands.ts
|
|
1528
|
+
function loadCommands(program, commandMap) {
|
|
1529
|
+
for (const loader of Object.values(commandMap)) loader(program);
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
//#endregion
|
|
1533
|
+
//#region src/cli/commands/uuid/index.ts
|
|
1534
|
+
function uuid(program) {
|
|
1535
|
+
loadCommands(program.command("uuid").description("Commands to help manage UUIDs"), { generateUUID });
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
//#endregion
|
|
1539
|
+
//#region src/cli/commands/versioning/get-major-version.ts
|
|
1515
1540
|
function getMajorVersion(program) {
|
|
1516
1541
|
program.command("get-major-version").description("Get the major representation of a version number (e.g. v2, v3 etc...)").argument("<version>", "The version to get the major representation of", (rawValue) => {
|
|
1517
1542
|
return new VersionNumber(rawValue);
|
|
@@ -1521,7 +1546,7 @@ function getMajorVersion(program) {
|
|
|
1521
1546
|
}
|
|
1522
1547
|
|
|
1523
1548
|
//#endregion
|
|
1524
|
-
//#region src/commands/versioning/get-minor-version.ts
|
|
1549
|
+
//#region src/cli/commands/versioning/get-minor-version.ts
|
|
1525
1550
|
function getMinorVersion(program) {
|
|
1526
1551
|
program.command("get-minor-version").description("Get the minor representation of a version number (e.g. v2.1, v3.1 etc...)").argument("<version>", "The version to get the minor representation of", (rawValue) => {
|
|
1527
1552
|
return new VersionNumber(rawValue);
|
|
@@ -1531,7 +1556,7 @@ function getMinorVersion(program) {
|
|
|
1531
1556
|
}
|
|
1532
1557
|
|
|
1533
1558
|
//#endregion
|
|
1534
|
-
//#region src/commands/versioning/get-version-type.ts
|
|
1559
|
+
//#region src/cli/commands/versioning/get-version-type.ts
|
|
1535
1560
|
function getVersionType(program) {
|
|
1536
1561
|
program.command("get-version-type").description("Gets the version type of the given version number.").argument("<version>", "The version to get the version type from", (rawVersion) => {
|
|
1537
1562
|
return new VersionNumber(rawVersion);
|
|
@@ -1541,7 +1566,7 @@ function getVersionType(program) {
|
|
|
1541
1566
|
}
|
|
1542
1567
|
|
|
1543
1568
|
//#endregion
|
|
1544
|
-
//#region src/commands/versioning/increment-version.ts
|
|
1569
|
+
//#region src/cli/commands/versioning/increment-version.ts
|
|
1545
1570
|
function incrementVersion(program) {
|
|
1546
1571
|
program.command("increment-version").description("Increments the given input version depending on the given increment type.").argument("<version>", "The version to increment", (rawVersion) => {
|
|
1547
1572
|
return new VersionNumber(rawVersion);
|
|
@@ -1557,13 +1582,7 @@ function incrementVersion(program) {
|
|
|
1557
1582
|
}
|
|
1558
1583
|
|
|
1559
1584
|
//#endregion
|
|
1560
|
-
//#region src/
|
|
1561
|
-
function loadCommands(program, commandMap) {
|
|
1562
|
-
for (const loader of Object.values(commandMap)) loader(program);
|
|
1563
|
-
}
|
|
1564
|
-
|
|
1565
|
-
//#endregion
|
|
1566
|
-
//#region src/commands/index.ts
|
|
1585
|
+
//#region src/cli/commands/index.ts
|
|
1567
1586
|
function createCommands(program) {
|
|
1568
1587
|
loadCommands(program, {
|
|
1569
1588
|
artwork,
|
|
@@ -1591,7 +1610,8 @@ function createCommands(program) {
|
|
|
1591
1610
|
setReleaseStatus,
|
|
1592
1611
|
setReleaseStatus2,
|
|
1593
1612
|
update,
|
|
1594
|
-
useLocalPackage
|
|
1613
|
+
useLocalPackage,
|
|
1614
|
+
uuid
|
|
1595
1615
|
});
|
|
1596
1616
|
}
|
|
1597
1617
|
|
|
@@ -1667,7 +1687,7 @@ async function runAutomatedUpdateCheck() {
|
|
|
1667
1687
|
}
|
|
1668
1688
|
|
|
1669
1689
|
//#endregion
|
|
1670
|
-
//#region src/index.ts
|
|
1690
|
+
//#region src/cli/index.ts
|
|
1671
1691
|
(async () => {
|
|
1672
1692
|
try {
|
|
1673
1693
|
const program = new Command();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alex-c-line",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.0",
|
|
4
4
|
"description": "Command-line tool with commands to streamline the developer workflow.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"templates"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@alextheman/utility": "^5.
|
|
37
|
+
"@alextheman/utility": "^5.4.1",
|
|
38
38
|
"@inquirer/prompts": "^8.2.1",
|
|
39
39
|
"boxen": "^8.0.1",
|
|
40
40
|
"canvas": "^3.2.1",
|