alex-c-line 1.17.2 → 1.17.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/dist/index.cjs +65 -58
- package/dist/index.js +65 -58
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -53,8 +53,8 @@ function findFileDependencies(dependencies$1) {
|
|
|
53
53
|
for (const dependency in dependencies$1) if (dependencies$1[dependency].includes("file:")) fileDependencies[dependency] = dependencies$1[dependency];
|
|
54
54
|
return fileDependencies;
|
|
55
55
|
}
|
|
56
|
-
function checkForFileDependencies(program
|
|
57
|
-
program
|
|
56
|
+
function checkForFileDependencies(program) {
|
|
57
|
+
program.command("check-for-file-dependencies").description("Check for existence of file dependencies in package.json and give exit code 1 if such dependencies are found").action(async () => {
|
|
58
58
|
console.info("Checking for file dependencies...");
|
|
59
59
|
const { dependencies: dependencies$1, devDependencies: devDependencies$1, peerDependencies } = JSON.parse(await (0, node_fs_promises.readFile)(node_path.default.resolve(process.cwd(), "package.json"), "utf-8"));
|
|
60
60
|
const allFileDependencies = {
|
|
@@ -65,7 +65,7 @@ function checkForFileDependencies(program$1) {
|
|
|
65
65
|
if (Object.keys(allFileDependencies.dependencies ?? {}).length === 0) delete allFileDependencies.dependencies;
|
|
66
66
|
if (Object.keys(allFileDependencies.devDependencies ?? {}).length === 0) delete allFileDependencies.devDependencies;
|
|
67
67
|
if (Object.keys(allFileDependencies.peerDependencies ?? {}).length === 0) delete allFileDependencies.peerDependencies;
|
|
68
|
-
if (Object.keys(allFileDependencies).length !== 0) program
|
|
68
|
+
if (Object.keys(allFileDependencies).length !== 0) program.error(`ERROR: File dependencies found:\n\n${JSON.stringify(allFileDependencies, void 0, 2)}
|
|
69
69
|
`, {
|
|
70
70
|
exitCode: 1,
|
|
71
71
|
code: "FILE_DEPENDENCIES_FOUND"
|
|
@@ -77,8 +77,8 @@ var check_for_file_dependencies_default = checkForFileDependencies;
|
|
|
77
77
|
|
|
78
78
|
//#endregion
|
|
79
79
|
//#region src/commands/check-lockfile-version-discrepancy.ts
|
|
80
|
-
function checkLockfileVersionDiscrepancy(program
|
|
81
|
-
program
|
|
80
|
+
function checkLockfileVersionDiscrepancy(program) {
|
|
81
|
+
program.command("check-lockfile-version-discrepancy").description("Check that version numbers in package.json and package-lock.json match").action(() => {
|
|
82
82
|
console.info("Checking for package.json and package-lock.json discrepancies...");
|
|
83
83
|
const { version: packageVersion } = JSON.parse((0, node_fs.readFileSync)(node_path.default.resolve(process.cwd(), "package.json"), "utf-8"));
|
|
84
84
|
const { version: packageLockVersion } = JSON.parse((0, node_fs.readFileSync)(node_path.default.resolve(process.cwd(), "package-lock.json"), "utf-8"));
|
|
@@ -113,8 +113,8 @@ async function execaNoFail(command, args, options) {
|
|
|
113
113
|
|
|
114
114
|
//#endregion
|
|
115
115
|
//#region src/commands/check-version-number-change.ts
|
|
116
|
-
function checkVersionNumberChange(program
|
|
117
|
-
program
|
|
116
|
+
function checkVersionNumberChange(program) {
|
|
117
|
+
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 () => {
|
|
118
118
|
console.info("Checking for version change...");
|
|
119
119
|
const { exitCode } = await execaNoFail("git", [
|
|
120
120
|
"diff",
|
|
@@ -133,7 +133,7 @@ function checkVersionNumberChange(program$1) {
|
|
|
133
133
|
const newMajorVersion = `${parseInt(currentBranchMajor) + 1}.0.0`;
|
|
134
134
|
const newMinorVersion = `${currentBranchMajor}.${parseInt(currentBranchMinor) + 1}.0`;
|
|
135
135
|
const newPatchVersion = `${currentBranchMajor}.${currentBranchMinor}.${parseInt(currentBranchPatch) + 1}`;
|
|
136
|
-
if (mainPackageVersion === currentBranchPackageVersion) program
|
|
136
|
+
if (mainPackageVersion === currentBranchPackageVersion) program.error(_alextheman_utility.normaliseIndents`
|
|
137
137
|
❌ Version needs updating. Please run one of the following:
|
|
138
138
|
- npm version major -m "Change version number to v%s" (v${mainPackageVersion} -> v${newMajorVersion})
|
|
139
139
|
- npm version minor -m "Change version number to v%s" (v${mainPackageVersion} -> v${newMinorVersion})
|
|
@@ -217,8 +217,8 @@ var getPullRequestTemplates_default = getPullRequestTemplates;
|
|
|
217
217
|
|
|
218
218
|
//#endregion
|
|
219
219
|
//#region src/commands/create-pull-request-templates.ts
|
|
220
|
-
function createPullRequestTemplates(program
|
|
221
|
-
program
|
|
220
|
+
function createPullRequestTemplates(program) {
|
|
221
|
+
program.command("create-pull-request-templates").description("Create the standard pull request templates as found in my repositories").action(async () => {
|
|
222
222
|
const { name: name$1 } = JSON.parse(await (0, node_fs_promises.readFile)(node_path.default.join(process.cwd(), "package.json"), "utf-8"));
|
|
223
223
|
const gitHubPath = node_path.default.join(process.cwd(), ".github");
|
|
224
224
|
const pullRequestTemplatePath = node_path.default.join(gitHubPath, "PULL_REQUEST_TEMPLATE");
|
|
@@ -312,10 +312,10 @@ var getReleaseNoteTemplate_default = getReleaseNoteTemplate;
|
|
|
312
312
|
|
|
313
313
|
//#endregion
|
|
314
314
|
//#region src/commands/create-release-note.ts
|
|
315
|
-
function createReleaseNote(program
|
|
316
|
-
program
|
|
315
|
+
function createReleaseNote(program) {
|
|
316
|
+
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) => {
|
|
317
317
|
const { name: name$1, version: version$1 } = JSON.parse(await (0, node_fs_promises.readFile)(node_path.default.join(process.cwd(), "package.json"), "utf-8"));
|
|
318
|
-
const versionNumber = versionType ? new _alextheman_utility.VersionNumber(version$1).increment(
|
|
318
|
+
const versionNumber = versionType ? new _alextheman_utility.VersionNumber(version$1).increment(versionType) : new _alextheman_utility.VersionNumber(version$1);
|
|
319
319
|
const releaseNotePath = `${`docs/releases/${versionNumber.type}`}/${versionNumber}.md`;
|
|
320
320
|
const fullReleaseNotePath = node_path.default.join(process.cwd(), releaseNotePath);
|
|
321
321
|
const releaseNoteTemplate = getReleaseNoteTemplate_default(name$1, versionNumber, "In progress");
|
|
@@ -323,7 +323,7 @@ function createReleaseNote(program$1) {
|
|
|
323
323
|
await (0, node_fs_promises.mkdir)(node_path.default.dirname(fullReleaseNotePath), { recursive: true });
|
|
324
324
|
await (0, node_fs_promises.writeFile)(fullReleaseNotePath, releaseNoteTemplate, { flag: "wx" });
|
|
325
325
|
} catch (error) {
|
|
326
|
-
if (error instanceof Error && "code" in error && error.code === "EEXIST") program
|
|
326
|
+
if (error instanceof Error && "code" in error && error.code === "EEXIST") program.error("❌ ERROR: Release notes already exist.", {
|
|
327
327
|
exitCode: 1,
|
|
328
328
|
code: "RELEASE_NOTE_EXISTS"
|
|
329
329
|
});
|
|
@@ -336,8 +336,8 @@ var create_release_note_default = createReleaseNote;
|
|
|
336
336
|
|
|
337
337
|
//#endregion
|
|
338
338
|
//#region src/commands/edit-env.ts
|
|
339
|
-
function editEnv(program
|
|
340
|
-
program
|
|
339
|
+
function editEnv(program) {
|
|
340
|
+
program.command("edit-env <key> [value]").description("Edit property in .env file (leave value blank to delete property)").option("--file <file>", "The file to edit", ".env").action(async (key, value, { file }) => {
|
|
341
341
|
let newValue = value;
|
|
342
342
|
if (typeof newValue === "string" && newValue.startsWith("--")) newValue = void 0;
|
|
343
343
|
let currentEnvFileContents;
|
|
@@ -356,12 +356,12 @@ var edit_env_default = editEnv;
|
|
|
356
356
|
|
|
357
357
|
//#endregion
|
|
358
358
|
//#region src/commands/encrypt-with-key.ts
|
|
359
|
-
function encryptWithKey(program
|
|
360
|
-
program
|
|
359
|
+
function encryptWithKey(program) {
|
|
360
|
+
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) => {
|
|
361
361
|
try {
|
|
362
362
|
console.info(await (0, _alextheman_utility.encryptWithKey)(publicKey, plaintextValue));
|
|
363
363
|
} catch {
|
|
364
|
-
program
|
|
364
|
+
program.error("Encryption failed. Please double-check that the given key is a valid base 64 string.", {
|
|
365
365
|
exitCode: 1,
|
|
366
366
|
code: "ENCRYPTION_FAILED"
|
|
367
367
|
});
|
|
@@ -372,17 +372,19 @@ var encrypt_with_key_default = encryptWithKey;
|
|
|
372
372
|
|
|
373
373
|
//#endregion
|
|
374
374
|
//#region src/commands/get-version-type.ts
|
|
375
|
-
function getVersionType(program
|
|
376
|
-
program
|
|
377
|
-
|
|
375
|
+
function getVersionType(program) {
|
|
376
|
+
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) => {
|
|
377
|
+
return new _alextheman_utility.VersionNumber(rawVersion);
|
|
378
|
+
}).action((version$1) => {
|
|
379
|
+
console.info(version$1.type);
|
|
378
380
|
});
|
|
379
381
|
}
|
|
380
382
|
var get_version_type_default = getVersionType;
|
|
381
383
|
|
|
382
384
|
//#endregion
|
|
383
385
|
//#region src/commands/git-post-merge-cleanup.ts
|
|
384
|
-
function gitPostMergeCleanup(program
|
|
385
|
-
program
|
|
386
|
+
function gitPostMergeCleanup(program) {
|
|
387
|
+
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 }) => {
|
|
386
388
|
let alexCLineConfigJSON;
|
|
387
389
|
try {
|
|
388
390
|
alexCLineConfigJSON = await (0, node_fs_promises.readFile)(node_path.default.join(process.env.HOME ?? node_os.default.homedir(), "alex-c-line-config.json"), "utf-8");
|
|
@@ -391,7 +393,7 @@ function gitPostMergeCleanup(program$1) {
|
|
|
391
393
|
const rebase = JSON.parse(alexCLineConfigJSON)["git-post-merge-cleanup"]?.rebase ?? rebaseOption;
|
|
392
394
|
console.info(`Running git-post-merge-cleanup in ${rebase ? "rebase" : "merge"} mode...`);
|
|
393
395
|
const { stdout: currentBranch } = await execa.execa`git branch --show-current`;
|
|
394
|
-
if (currentBranch === branch) program
|
|
396
|
+
if (currentBranch === branch) program.error(`❌ ERROR: Cannot run cleanup on ${branch} branch!`, {
|
|
395
397
|
exitCode: 1,
|
|
396
398
|
code: "INVALID_BRANCH"
|
|
397
399
|
});
|
|
@@ -419,7 +421,7 @@ function gitPostMergeCleanup(program$1) {
|
|
|
419
421
|
const { stdout: changes } = await execa.execa`git diff ${branch}..${currentBranch}`;
|
|
420
422
|
if (changes) {
|
|
421
423
|
await execa.execa`git checkout ${currentBranch}`;
|
|
422
|
-
program
|
|
424
|
+
program.error("❌ ERROR: Changes on branch not fully merged!", {
|
|
423
425
|
exitCode: 1,
|
|
424
426
|
code: "CHANGES_NOT_MERGED"
|
|
425
427
|
});
|
|
@@ -435,7 +437,7 @@ function gitPostMergeCleanup(program$1) {
|
|
|
435
437
|
} catch (error) {
|
|
436
438
|
if (error instanceof execa.ExecaError) {
|
|
437
439
|
await execa.execa`git checkout ${currentBranch}`;
|
|
438
|
-
program
|
|
440
|
+
program.error("❌ ERROR: Changes on branch not fully merged!", {
|
|
439
441
|
exitCode: 1,
|
|
440
442
|
code: "CHANGES_NOT_MERGED"
|
|
441
443
|
});
|
|
@@ -447,15 +449,17 @@ var git_post_merge_cleanup_default = gitPostMergeCleanup;
|
|
|
447
449
|
|
|
448
450
|
//#endregion
|
|
449
451
|
//#region src/commands/increment-version.ts
|
|
450
|
-
function incrementVersion(program
|
|
451
|
-
program
|
|
452
|
+
function incrementVersion(program) {
|
|
453
|
+
program.command("increment-version").description("Increments the given input version depending on the given increment type.").argument("<version>", "The version to increment", (rawVersion) => {
|
|
454
|
+
return new _alextheman_utility.VersionNumber(rawVersion);
|
|
455
|
+
}).argument("<incrementType>", _alextheman_utility.normaliseIndents`
|
|
452
456
|
The type of increment. Can be one of the following:
|
|
453
457
|
|
|
454
458
|
- "major": Change the major version v1.2.3 → v2.0.0
|
|
455
459
|
- "minor": Change the minor version v1.2.3 → v1.3.0
|
|
456
460
|
- "patch": Change the patch version v1.2.3 → v1.2.4
|
|
457
|
-
|
|
458
|
-
console.info(
|
|
461
|
+
`, _alextheman_utility.parseVersionType).option("--no-prefix").option("--prefix", "Whether to add the `v` prefix from the output version or not (defaults to true).").action((version$1, incrementType, { prefix }) => {
|
|
462
|
+
console.info(version$1.increment(incrementType).toString({ omitPrefix: !prefix }));
|
|
459
463
|
});
|
|
460
464
|
}
|
|
461
465
|
var increment_version_default = incrementVersion;
|
|
@@ -463,8 +467,8 @@ var increment_version_default = incrementVersion;
|
|
|
463
467
|
//#endregion
|
|
464
468
|
//#region src/commands/pre-commit.ts
|
|
465
469
|
const deprecationMessage = "[DEPRECATED]: This command does not support the new alex-c-line config system. Please use `pre-commit-2` instead.";
|
|
466
|
-
function preCommit(program
|
|
467
|
-
program
|
|
470
|
+
function preCommit(program) {
|
|
471
|
+
program.command("pre-commit").description(_alextheman_utility.normaliseIndents`
|
|
468
472
|
${deprecationMessage}
|
|
469
473
|
Run the standard pre-commits used across all my repositories.`).option("--no-build", "Skip the build").option("--no-tests", "Skip the tests").option("--allow-unstaged", "Run even if nothing is staged").option("--repository-manager <repositoryManager>", "The repository manager if it is a monorepo (Only Turborepo is supported as of now)").action(async ({ build: shouldIncludeBuild, tests: shouldIncludeTests, allowUnstaged, repositoryManager: rawRepositoryManager }) => {
|
|
470
474
|
console.warn(deprecationMessage);
|
|
@@ -475,7 +479,7 @@ function preCommit(program$1) {
|
|
|
475
479
|
"--quiet"
|
|
476
480
|
]);
|
|
477
481
|
switch (diffExitCode) {
|
|
478
|
-
case 128: program
|
|
482
|
+
case 128: program.error("Not currently in a Git repository", {
|
|
479
483
|
exitCode: 1,
|
|
480
484
|
code: "GIT_DIFF_FAILED"
|
|
481
485
|
});
|
|
@@ -488,7 +492,7 @@ function preCommit(program$1) {
|
|
|
488
492
|
const newArguments = [...args ?? []];
|
|
489
493
|
if (repositoryManager === "turborepo") newArguments.push("--ui=stream");
|
|
490
494
|
const result = await execaNoFail(command, newArguments, { stdio: "inherit" });
|
|
491
|
-
if (result.exitCode !== 0) program
|
|
495
|
+
if (result.exitCode !== 0) program.error(`Command failed: ${command}${newArguments.length ? ` ${newArguments.join(" ")}` : ""}`, {
|
|
492
496
|
exitCode: result.exitCode ?? 1,
|
|
493
497
|
code: "PRE_COMMIT_FAILED"
|
|
494
498
|
});
|
|
@@ -583,15 +587,15 @@ var findAlexCLineConfig_default = findAlexCLineConfig;
|
|
|
583
587
|
|
|
584
588
|
//#endregion
|
|
585
589
|
//#region src/commands/pre-commit-2.ts
|
|
586
|
-
function preCommit2(program
|
|
587
|
-
program
|
|
590
|
+
function preCommit2(program) {
|
|
591
|
+
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").action(async ({ allowNoStagedChanges }) => {
|
|
588
592
|
const configPath = await findAlexCLineConfig_default(process.cwd());
|
|
589
|
-
if (!configPath) program
|
|
593
|
+
if (!configPath) program.error("Could not find the path to the alex-c-line config file. Does it exist?", {
|
|
590
594
|
exitCode: 1,
|
|
591
595
|
code: "ALEX_C_LINE_CONFIG_NOT_FOUND"
|
|
592
596
|
});
|
|
593
597
|
const { preCommit: preCommitConfig } = await loadAlexCLineConfig_default(configPath);
|
|
594
|
-
if (!preCommitConfig) program
|
|
598
|
+
if (!preCommitConfig) program.error("Could not find the pre-commit config in alex-c-line config.", {
|
|
595
599
|
exitCode: 1,
|
|
596
600
|
code: "PRE_COMMIT_CONFIG_NOT_FOUND"
|
|
597
601
|
});
|
|
@@ -601,7 +605,7 @@ function preCommit2(program$1) {
|
|
|
601
605
|
"--quiet"
|
|
602
606
|
]);
|
|
603
607
|
switch (diffExitCode) {
|
|
604
|
-
case 128: program
|
|
608
|
+
case 128: program.error("Not currently in a Git repository", {
|
|
605
609
|
exitCode: 1,
|
|
606
610
|
code: "GIT_DIFF_FAILED"
|
|
607
611
|
});
|
|
@@ -612,7 +616,7 @@ function preCommit2(program$1) {
|
|
|
612
616
|
}
|
|
613
617
|
async function runCommandAndLogToConsole(command, args) {
|
|
614
618
|
const result = await execaNoFail(command, args, { stdio: "inherit" });
|
|
615
|
-
if (result.exitCode !== 0) program
|
|
619
|
+
if (result.exitCode !== 0) program.error(`Command failed: ${command}${args?.length ? ` ${args.join(" ")}` : ""}`, {
|
|
616
620
|
exitCode: result.exitCode ?? 1,
|
|
617
621
|
code: "PRE_COMMIT_FAILED"
|
|
618
622
|
});
|
|
@@ -622,7 +626,7 @@ function preCommit2(program$1) {
|
|
|
622
626
|
const rawPackageManager = preCommitConfig.packageManager ?? (typeof packagePackageManager === "string" ? packagePackageManager.split("@")[0] : void 0);
|
|
623
627
|
const packageManager$1 = (0, _alextheman_utility.parseZodSchema)(zod.default.enum(PackageManager), rawPackageManager, new _alextheman_utility.DataError(rawPackageManager, "UNSUPPORTED_PACKAGE_MANAGER", `This repository manager is not currently supported. Only the following are supported: ${Object.values(PackageManager).join(", ")}`));
|
|
624
628
|
function getCommandArguments(script, args) {
|
|
625
|
-
if (!(script in (scripts$1 ?? {}))) program
|
|
629
|
+
if (!(script in (scripts$1 ?? {}))) program.error(`Could not find script \`${script}\` in package.json.`, {
|
|
626
630
|
exitCode: 1,
|
|
627
631
|
code: "SCRIPT_NOT_FOUND"
|
|
628
632
|
});
|
|
@@ -642,8 +646,8 @@ var pre_commit_2_default = preCommit2;
|
|
|
642
646
|
|
|
643
647
|
//#endregion
|
|
644
648
|
//#region src/commands/say-hello.ts
|
|
645
|
-
function sayHello(program
|
|
646
|
-
program
|
|
649
|
+
function sayHello(program) {
|
|
650
|
+
program.command("say-hello").description("Quick test command").action(() => {
|
|
647
651
|
console.info("Hello!");
|
|
648
652
|
});
|
|
649
653
|
}
|
|
@@ -662,10 +666,10 @@ var isValidReleaseDocument_default = isValidReleaseDocument;
|
|
|
662
666
|
|
|
663
667
|
//#endregion
|
|
664
668
|
//#region src/commands/set-release-status.ts
|
|
665
|
-
function setReleaseStatus(program
|
|
666
|
-
program
|
|
669
|
+
function setReleaseStatus(program) {
|
|
670
|
+
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) => {
|
|
667
671
|
const { name: packageName } = JSON.parse(await (0, node_fs_promises.readFile)(node_path.default.join(process.cwd(), "package.json"), "utf-8"));
|
|
668
|
-
if (!documentPath.endsWith("md")) program
|
|
672
|
+
if (!documentPath.endsWith("md")) program.error("❌ ERROR: Invalid file path. Path must lead to a .md file.", {
|
|
669
673
|
exitCode: 1,
|
|
670
674
|
code: "INVALID_FILE_PATH"
|
|
671
675
|
});
|
|
@@ -675,7 +679,7 @@ function setReleaseStatus(program$1) {
|
|
|
675
679
|
}).join("."));
|
|
676
680
|
const fullDocumentPath = node_path.default.join(process.cwd(), documentPath);
|
|
677
681
|
const initialDocument = await (0, node_fs_promises.readFile)(fullDocumentPath, "utf-8");
|
|
678
|
-
if (!isValidReleaseDocument_default(packageName, versionNumber, initialDocument)) program
|
|
682
|
+
if (!isValidReleaseDocument_default(packageName, versionNumber, initialDocument)) program.error("❌ ERROR: Document does not match a valid release note template.", {
|
|
679
683
|
exitCode: 1,
|
|
680
684
|
code: "INVALID_RELEASE_NOTE"
|
|
681
685
|
});
|
|
@@ -687,15 +691,15 @@ var set_release_status_default = setReleaseStatus;
|
|
|
687
691
|
|
|
688
692
|
//#endregion
|
|
689
693
|
//#region src/utility/loadCommands.ts
|
|
690
|
-
function loadCommands(program
|
|
691
|
-
for (const loader of Object.values(commandMap)) loader(program
|
|
694
|
+
function loadCommands(program, commandMap) {
|
|
695
|
+
for (const loader of Object.values(commandMap)) loader(program);
|
|
692
696
|
}
|
|
693
697
|
var loadCommands_default = loadCommands;
|
|
694
698
|
|
|
695
699
|
//#endregion
|
|
696
700
|
//#region src/commands/index.ts
|
|
697
|
-
function createCommands(program
|
|
698
|
-
loadCommands_default(program
|
|
701
|
+
function createCommands(program) {
|
|
702
|
+
loadCommands_default(program, {
|
|
699
703
|
checkForFileDependencies: check_for_file_dependencies_default,
|
|
700
704
|
checkLockfileVersionDiscrepancy: check_lockfile_version_discrepancy_default,
|
|
701
705
|
checkVersionNumberChange: check_version_number_change_default,
|
|
@@ -716,7 +720,7 @@ var commands_default = createCommands;
|
|
|
716
720
|
|
|
717
721
|
//#endregion
|
|
718
722
|
//#region package.json
|
|
719
|
-
var version = "1.17.
|
|
723
|
+
var version = "1.17.3";
|
|
720
724
|
var package_default = {
|
|
721
725
|
name: "alex-c-line",
|
|
722
726
|
version,
|
|
@@ -792,6 +796,7 @@ var package_default = {
|
|
|
792
796
|
},
|
|
793
797
|
devDependencies: {
|
|
794
798
|
"@alextheman/eslint-plugin": "^5.4.2",
|
|
799
|
+
"@commander-js/extra-typings": "^14.0.0",
|
|
795
800
|
"@types/eslint": "^9.6.1",
|
|
796
801
|
"@types/libsodium-wrappers": "^0.7.14",
|
|
797
802
|
"@types/node": "^25.0.3",
|
|
@@ -817,10 +822,12 @@ var package_default = {
|
|
|
817
822
|
|
|
818
823
|
//#endregion
|
|
819
824
|
//#region src/index.ts
|
|
820
|
-
|
|
821
|
-
program
|
|
822
|
-
(
|
|
823
|
-
|
|
824
|
-
program
|
|
825
|
+
(async () => {
|
|
826
|
+
const program = new commander.Command();
|
|
827
|
+
program.name("alex-c-line").description("CLI tool built by Alex").version(version);
|
|
828
|
+
(0, update_notifier.default)({ pkg: package_default }).notify();
|
|
829
|
+
commands_default(program);
|
|
830
|
+
await program.parseAsync(process.argv);
|
|
831
|
+
})();
|
|
825
832
|
|
|
826
833
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -20,8 +20,8 @@ function findFileDependencies(dependencies$1) {
|
|
|
20
20
|
for (const dependency in dependencies$1) if (dependencies$1[dependency].includes("file:")) fileDependencies[dependency] = dependencies$1[dependency];
|
|
21
21
|
return fileDependencies;
|
|
22
22
|
}
|
|
23
|
-
function checkForFileDependencies(program
|
|
24
|
-
program
|
|
23
|
+
function checkForFileDependencies(program) {
|
|
24
|
+
program.command("check-for-file-dependencies").description("Check for existence of file dependencies in package.json and give exit code 1 if such dependencies are found").action(async () => {
|
|
25
25
|
console.info("Checking for file dependencies...");
|
|
26
26
|
const { dependencies: dependencies$1, devDependencies: devDependencies$1, peerDependencies } = JSON.parse(await readFile(path.resolve(process.cwd(), "package.json"), "utf-8"));
|
|
27
27
|
const allFileDependencies = {
|
|
@@ -32,7 +32,7 @@ function checkForFileDependencies(program$1) {
|
|
|
32
32
|
if (Object.keys(allFileDependencies.dependencies ?? {}).length === 0) delete allFileDependencies.dependencies;
|
|
33
33
|
if (Object.keys(allFileDependencies.devDependencies ?? {}).length === 0) delete allFileDependencies.devDependencies;
|
|
34
34
|
if (Object.keys(allFileDependencies.peerDependencies ?? {}).length === 0) delete allFileDependencies.peerDependencies;
|
|
35
|
-
if (Object.keys(allFileDependencies).length !== 0) program
|
|
35
|
+
if (Object.keys(allFileDependencies).length !== 0) program.error(`ERROR: File dependencies found:\n\n${JSON.stringify(allFileDependencies, void 0, 2)}
|
|
36
36
|
`, {
|
|
37
37
|
exitCode: 1,
|
|
38
38
|
code: "FILE_DEPENDENCIES_FOUND"
|
|
@@ -44,8 +44,8 @@ var check_for_file_dependencies_default = checkForFileDependencies;
|
|
|
44
44
|
|
|
45
45
|
//#endregion
|
|
46
46
|
//#region src/commands/check-lockfile-version-discrepancy.ts
|
|
47
|
-
function checkLockfileVersionDiscrepancy(program
|
|
48
|
-
program
|
|
47
|
+
function checkLockfileVersionDiscrepancy(program) {
|
|
48
|
+
program.command("check-lockfile-version-discrepancy").description("Check that version numbers in package.json and package-lock.json match").action(() => {
|
|
49
49
|
console.info("Checking for package.json and package-lock.json discrepancies...");
|
|
50
50
|
const { version: packageVersion } = JSON.parse(readFileSync(path.resolve(process.cwd(), "package.json"), "utf-8"));
|
|
51
51
|
const { version: packageLockVersion } = JSON.parse(readFileSync(path.resolve(process.cwd(), "package-lock.json"), "utf-8"));
|
|
@@ -80,8 +80,8 @@ async function execaNoFail(command, args, options) {
|
|
|
80
80
|
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region src/commands/check-version-number-change.ts
|
|
83
|
-
function checkVersionNumberChange(program
|
|
84
|
-
program
|
|
83
|
+
function checkVersionNumberChange(program) {
|
|
84
|
+
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 () => {
|
|
85
85
|
console.info("Checking for version change...");
|
|
86
86
|
const { exitCode } = await execaNoFail("git", [
|
|
87
87
|
"diff",
|
|
@@ -100,7 +100,7 @@ function checkVersionNumberChange(program$1) {
|
|
|
100
100
|
const newMajorVersion = `${parseInt(currentBranchMajor) + 1}.0.0`;
|
|
101
101
|
const newMinorVersion = `${currentBranchMajor}.${parseInt(currentBranchMinor) + 1}.0`;
|
|
102
102
|
const newPatchVersion = `${currentBranchMajor}.${currentBranchMinor}.${parseInt(currentBranchPatch) + 1}`;
|
|
103
|
-
if (mainPackageVersion === currentBranchPackageVersion) program
|
|
103
|
+
if (mainPackageVersion === currentBranchPackageVersion) program.error(normaliseIndents`
|
|
104
104
|
❌ Version needs updating. Please run one of the following:
|
|
105
105
|
- npm version major -m "Change version number to v%s" (v${mainPackageVersion} -> v${newMajorVersion})
|
|
106
106
|
- npm version minor -m "Change version number to v%s" (v${mainPackageVersion} -> v${newMinorVersion})
|
|
@@ -184,8 +184,8 @@ var getPullRequestTemplates_default = getPullRequestTemplates;
|
|
|
184
184
|
|
|
185
185
|
//#endregion
|
|
186
186
|
//#region src/commands/create-pull-request-templates.ts
|
|
187
|
-
function createPullRequestTemplates(program
|
|
188
|
-
program
|
|
187
|
+
function createPullRequestTemplates(program) {
|
|
188
|
+
program.command("create-pull-request-templates").description("Create the standard pull request templates as found in my repositories").action(async () => {
|
|
189
189
|
const { name: name$1 } = JSON.parse(await readFile(path.join(process.cwd(), "package.json"), "utf-8"));
|
|
190
190
|
const gitHubPath = path.join(process.cwd(), ".github");
|
|
191
191
|
const pullRequestTemplatePath = path.join(gitHubPath, "PULL_REQUEST_TEMPLATE");
|
|
@@ -279,10 +279,10 @@ var getReleaseNoteTemplate_default = getReleaseNoteTemplate;
|
|
|
279
279
|
|
|
280
280
|
//#endregion
|
|
281
281
|
//#region src/commands/create-release-note.ts
|
|
282
|
-
function createReleaseNote(program
|
|
283
|
-
program
|
|
282
|
+
function createReleaseNote(program) {
|
|
283
|
+
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) => {
|
|
284
284
|
const { name: name$1, version: version$1 } = JSON.parse(await readFile(path.join(process.cwd(), "package.json"), "utf-8"));
|
|
285
|
-
const versionNumber = versionType ? new VersionNumber(version$1).increment(
|
|
285
|
+
const versionNumber = versionType ? new VersionNumber(version$1).increment(versionType) : new VersionNumber(version$1);
|
|
286
286
|
const releaseNotePath = `${`docs/releases/${versionNumber.type}`}/${versionNumber}.md`;
|
|
287
287
|
const fullReleaseNotePath = path.join(process.cwd(), releaseNotePath);
|
|
288
288
|
const releaseNoteTemplate = getReleaseNoteTemplate_default(name$1, versionNumber, "In progress");
|
|
@@ -290,7 +290,7 @@ function createReleaseNote(program$1) {
|
|
|
290
290
|
await mkdir(path.dirname(fullReleaseNotePath), { recursive: true });
|
|
291
291
|
await writeFile(fullReleaseNotePath, releaseNoteTemplate, { flag: "wx" });
|
|
292
292
|
} catch (error) {
|
|
293
|
-
if (error instanceof Error && "code" in error && error.code === "EEXIST") program
|
|
293
|
+
if (error instanceof Error && "code" in error && error.code === "EEXIST") program.error("❌ ERROR: Release notes already exist.", {
|
|
294
294
|
exitCode: 1,
|
|
295
295
|
code: "RELEASE_NOTE_EXISTS"
|
|
296
296
|
});
|
|
@@ -303,8 +303,8 @@ var create_release_note_default = createReleaseNote;
|
|
|
303
303
|
|
|
304
304
|
//#endregion
|
|
305
305
|
//#region src/commands/edit-env.ts
|
|
306
|
-
function editEnv(program
|
|
307
|
-
program
|
|
306
|
+
function editEnv(program) {
|
|
307
|
+
program.command("edit-env <key> [value]").description("Edit property in .env file (leave value blank to delete property)").option("--file <file>", "The file to edit", ".env").action(async (key, value, { file }) => {
|
|
308
308
|
let newValue = value;
|
|
309
309
|
if (typeof newValue === "string" && newValue.startsWith("--")) newValue = void 0;
|
|
310
310
|
let currentEnvFileContents;
|
|
@@ -323,12 +323,12 @@ var edit_env_default = editEnv;
|
|
|
323
323
|
|
|
324
324
|
//#endregion
|
|
325
325
|
//#region src/commands/encrypt-with-key.ts
|
|
326
|
-
function encryptWithKey$1(program
|
|
327
|
-
program
|
|
326
|
+
function encryptWithKey$1(program) {
|
|
327
|
+
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) => {
|
|
328
328
|
try {
|
|
329
329
|
console.info(await encryptWithKey(publicKey, plaintextValue));
|
|
330
330
|
} catch {
|
|
331
|
-
program
|
|
331
|
+
program.error("Encryption failed. Please double-check that the given key is a valid base 64 string.", {
|
|
332
332
|
exitCode: 1,
|
|
333
333
|
code: "ENCRYPTION_FAILED"
|
|
334
334
|
});
|
|
@@ -339,17 +339,19 @@ var encrypt_with_key_default = encryptWithKey$1;
|
|
|
339
339
|
|
|
340
340
|
//#endregion
|
|
341
341
|
//#region src/commands/get-version-type.ts
|
|
342
|
-
function getVersionType(program
|
|
343
|
-
program
|
|
344
|
-
|
|
342
|
+
function getVersionType(program) {
|
|
343
|
+
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) => {
|
|
344
|
+
return new VersionNumber(rawVersion);
|
|
345
|
+
}).action((version$1) => {
|
|
346
|
+
console.info(version$1.type);
|
|
345
347
|
});
|
|
346
348
|
}
|
|
347
349
|
var get_version_type_default = getVersionType;
|
|
348
350
|
|
|
349
351
|
//#endregion
|
|
350
352
|
//#region src/commands/git-post-merge-cleanup.ts
|
|
351
|
-
function gitPostMergeCleanup(program
|
|
352
|
-
program
|
|
353
|
+
function gitPostMergeCleanup(program) {
|
|
354
|
+
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 }) => {
|
|
353
355
|
let alexCLineConfigJSON;
|
|
354
356
|
try {
|
|
355
357
|
alexCLineConfigJSON = await readFile(path.join(process.env.HOME ?? os.homedir(), "alex-c-line-config.json"), "utf-8");
|
|
@@ -358,7 +360,7 @@ function gitPostMergeCleanup(program$1) {
|
|
|
358
360
|
const rebase = JSON.parse(alexCLineConfigJSON)["git-post-merge-cleanup"]?.rebase ?? rebaseOption;
|
|
359
361
|
console.info(`Running git-post-merge-cleanup in ${rebase ? "rebase" : "merge"} mode...`);
|
|
360
362
|
const { stdout: currentBranch } = await execa`git branch --show-current`;
|
|
361
|
-
if (currentBranch === branch) program
|
|
363
|
+
if (currentBranch === branch) program.error(`❌ ERROR: Cannot run cleanup on ${branch} branch!`, {
|
|
362
364
|
exitCode: 1,
|
|
363
365
|
code: "INVALID_BRANCH"
|
|
364
366
|
});
|
|
@@ -386,7 +388,7 @@ function gitPostMergeCleanup(program$1) {
|
|
|
386
388
|
const { stdout: changes } = await execa`git diff ${branch}..${currentBranch}`;
|
|
387
389
|
if (changes) {
|
|
388
390
|
await execa`git checkout ${currentBranch}`;
|
|
389
|
-
program
|
|
391
|
+
program.error("❌ ERROR: Changes on branch not fully merged!", {
|
|
390
392
|
exitCode: 1,
|
|
391
393
|
code: "CHANGES_NOT_MERGED"
|
|
392
394
|
});
|
|
@@ -402,7 +404,7 @@ function gitPostMergeCleanup(program$1) {
|
|
|
402
404
|
} catch (error) {
|
|
403
405
|
if (error instanceof ExecaError) {
|
|
404
406
|
await execa`git checkout ${currentBranch}`;
|
|
405
|
-
program
|
|
407
|
+
program.error("❌ ERROR: Changes on branch not fully merged!", {
|
|
406
408
|
exitCode: 1,
|
|
407
409
|
code: "CHANGES_NOT_MERGED"
|
|
408
410
|
});
|
|
@@ -414,15 +416,17 @@ var git_post_merge_cleanup_default = gitPostMergeCleanup;
|
|
|
414
416
|
|
|
415
417
|
//#endregion
|
|
416
418
|
//#region src/commands/increment-version.ts
|
|
417
|
-
function incrementVersion(program
|
|
418
|
-
program
|
|
419
|
+
function incrementVersion(program) {
|
|
420
|
+
program.command("increment-version").description("Increments the given input version depending on the given increment type.").argument("<version>", "The version to increment", (rawVersion) => {
|
|
421
|
+
return new VersionNumber(rawVersion);
|
|
422
|
+
}).argument("<incrementType>", normaliseIndents`
|
|
419
423
|
The type of increment. Can be one of the following:
|
|
420
424
|
|
|
421
425
|
- "major": Change the major version v1.2.3 → v2.0.0
|
|
422
426
|
- "minor": Change the minor version v1.2.3 → v1.3.0
|
|
423
427
|
- "patch": Change the patch version v1.2.3 → v1.2.4
|
|
424
|
-
|
|
425
|
-
console.info(
|
|
428
|
+
`, parseVersionType).option("--no-prefix").option("--prefix", "Whether to add the `v` prefix from the output version or not (defaults to true).").action((version$1, incrementType, { prefix }) => {
|
|
429
|
+
console.info(version$1.increment(incrementType).toString({ omitPrefix: !prefix }));
|
|
426
430
|
});
|
|
427
431
|
}
|
|
428
432
|
var increment_version_default = incrementVersion;
|
|
@@ -430,8 +434,8 @@ var increment_version_default = incrementVersion;
|
|
|
430
434
|
//#endregion
|
|
431
435
|
//#region src/commands/pre-commit.ts
|
|
432
436
|
const deprecationMessage = "[DEPRECATED]: This command does not support the new alex-c-line config system. Please use `pre-commit-2` instead.";
|
|
433
|
-
function preCommit(program
|
|
434
|
-
program
|
|
437
|
+
function preCommit(program) {
|
|
438
|
+
program.command("pre-commit").description(normaliseIndents`
|
|
435
439
|
${deprecationMessage}
|
|
436
440
|
Run the standard pre-commits used across all my repositories.`).option("--no-build", "Skip the build").option("--no-tests", "Skip the tests").option("--allow-unstaged", "Run even if nothing is staged").option("--repository-manager <repositoryManager>", "The repository manager if it is a monorepo (Only Turborepo is supported as of now)").action(async ({ build: shouldIncludeBuild, tests: shouldIncludeTests, allowUnstaged, repositoryManager: rawRepositoryManager }) => {
|
|
437
441
|
console.warn(deprecationMessage);
|
|
@@ -442,7 +446,7 @@ function preCommit(program$1) {
|
|
|
442
446
|
"--quiet"
|
|
443
447
|
]);
|
|
444
448
|
switch (diffExitCode) {
|
|
445
|
-
case 128: program
|
|
449
|
+
case 128: program.error("Not currently in a Git repository", {
|
|
446
450
|
exitCode: 1,
|
|
447
451
|
code: "GIT_DIFF_FAILED"
|
|
448
452
|
});
|
|
@@ -455,7 +459,7 @@ function preCommit(program$1) {
|
|
|
455
459
|
const newArguments = [...args ?? []];
|
|
456
460
|
if (repositoryManager === "turborepo") newArguments.push("--ui=stream");
|
|
457
461
|
const result = await execaNoFail(command, newArguments, { stdio: "inherit" });
|
|
458
|
-
if (result.exitCode !== 0) program
|
|
462
|
+
if (result.exitCode !== 0) program.error(`Command failed: ${command}${newArguments.length ? ` ${newArguments.join(" ")}` : ""}`, {
|
|
459
463
|
exitCode: result.exitCode ?? 1,
|
|
460
464
|
code: "PRE_COMMIT_FAILED"
|
|
461
465
|
});
|
|
@@ -550,15 +554,15 @@ var findAlexCLineConfig_default = findAlexCLineConfig;
|
|
|
550
554
|
|
|
551
555
|
//#endregion
|
|
552
556
|
//#region src/commands/pre-commit-2.ts
|
|
553
|
-
function preCommit2(program
|
|
554
|
-
program
|
|
557
|
+
function preCommit2(program) {
|
|
558
|
+
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").action(async ({ allowNoStagedChanges }) => {
|
|
555
559
|
const configPath = await findAlexCLineConfig_default(process.cwd());
|
|
556
|
-
if (!configPath) program
|
|
560
|
+
if (!configPath) program.error("Could not find the path to the alex-c-line config file. Does it exist?", {
|
|
557
561
|
exitCode: 1,
|
|
558
562
|
code: "ALEX_C_LINE_CONFIG_NOT_FOUND"
|
|
559
563
|
});
|
|
560
564
|
const { preCommit: preCommitConfig } = await loadAlexCLineConfig_default(configPath);
|
|
561
|
-
if (!preCommitConfig) program
|
|
565
|
+
if (!preCommitConfig) program.error("Could not find the pre-commit config in alex-c-line config.", {
|
|
562
566
|
exitCode: 1,
|
|
563
567
|
code: "PRE_COMMIT_CONFIG_NOT_FOUND"
|
|
564
568
|
});
|
|
@@ -568,7 +572,7 @@ function preCommit2(program$1) {
|
|
|
568
572
|
"--quiet"
|
|
569
573
|
]);
|
|
570
574
|
switch (diffExitCode) {
|
|
571
|
-
case 128: program
|
|
575
|
+
case 128: program.error("Not currently in a Git repository", {
|
|
572
576
|
exitCode: 1,
|
|
573
577
|
code: "GIT_DIFF_FAILED"
|
|
574
578
|
});
|
|
@@ -579,7 +583,7 @@ function preCommit2(program$1) {
|
|
|
579
583
|
}
|
|
580
584
|
async function runCommandAndLogToConsole(command, args) {
|
|
581
585
|
const result = await execaNoFail(command, args, { stdio: "inherit" });
|
|
582
|
-
if (result.exitCode !== 0) program
|
|
586
|
+
if (result.exitCode !== 0) program.error(`Command failed: ${command}${args?.length ? ` ${args.join(" ")}` : ""}`, {
|
|
583
587
|
exitCode: result.exitCode ?? 1,
|
|
584
588
|
code: "PRE_COMMIT_FAILED"
|
|
585
589
|
});
|
|
@@ -589,7 +593,7 @@ function preCommit2(program$1) {
|
|
|
589
593
|
const rawPackageManager = preCommitConfig.packageManager ?? (typeof packagePackageManager === "string" ? packagePackageManager.split("@")[0] : void 0);
|
|
590
594
|
const packageManager$1 = parseZodSchema(z.enum(PackageManager), rawPackageManager, new DataError(rawPackageManager, "UNSUPPORTED_PACKAGE_MANAGER", `This repository manager is not currently supported. Only the following are supported: ${Object.values(PackageManager).join(", ")}`));
|
|
591
595
|
function getCommandArguments(script, args) {
|
|
592
|
-
if (!(script in (scripts$1 ?? {}))) program
|
|
596
|
+
if (!(script in (scripts$1 ?? {}))) program.error(`Could not find script \`${script}\` in package.json.`, {
|
|
593
597
|
exitCode: 1,
|
|
594
598
|
code: "SCRIPT_NOT_FOUND"
|
|
595
599
|
});
|
|
@@ -609,8 +613,8 @@ var pre_commit_2_default = preCommit2;
|
|
|
609
613
|
|
|
610
614
|
//#endregion
|
|
611
615
|
//#region src/commands/say-hello.ts
|
|
612
|
-
function sayHello(program
|
|
613
|
-
program
|
|
616
|
+
function sayHello(program) {
|
|
617
|
+
program.command("say-hello").description("Quick test command").action(() => {
|
|
614
618
|
console.info("Hello!");
|
|
615
619
|
});
|
|
616
620
|
}
|
|
@@ -629,10 +633,10 @@ var isValidReleaseDocument_default = isValidReleaseDocument;
|
|
|
629
633
|
|
|
630
634
|
//#endregion
|
|
631
635
|
//#region src/commands/set-release-status.ts
|
|
632
|
-
function setReleaseStatus(program
|
|
633
|
-
program
|
|
636
|
+
function setReleaseStatus(program) {
|
|
637
|
+
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) => {
|
|
634
638
|
const { name: packageName } = JSON.parse(await readFile(path.join(process.cwd(), "package.json"), "utf-8"));
|
|
635
|
-
if (!documentPath.endsWith("md")) program
|
|
639
|
+
if (!documentPath.endsWith("md")) program.error("❌ ERROR: Invalid file path. Path must lead to a .md file.", {
|
|
636
640
|
exitCode: 1,
|
|
637
641
|
code: "INVALID_FILE_PATH"
|
|
638
642
|
});
|
|
@@ -642,7 +646,7 @@ function setReleaseStatus(program$1) {
|
|
|
642
646
|
}).join("."));
|
|
643
647
|
const fullDocumentPath = path.join(process.cwd(), documentPath);
|
|
644
648
|
const initialDocument = await readFile(fullDocumentPath, "utf-8");
|
|
645
|
-
if (!isValidReleaseDocument_default(packageName, versionNumber, initialDocument)) program
|
|
649
|
+
if (!isValidReleaseDocument_default(packageName, versionNumber, initialDocument)) program.error("❌ ERROR: Document does not match a valid release note template.", {
|
|
646
650
|
exitCode: 1,
|
|
647
651
|
code: "INVALID_RELEASE_NOTE"
|
|
648
652
|
});
|
|
@@ -654,15 +658,15 @@ var set_release_status_default = setReleaseStatus;
|
|
|
654
658
|
|
|
655
659
|
//#endregion
|
|
656
660
|
//#region src/utility/loadCommands.ts
|
|
657
|
-
function loadCommands(program
|
|
658
|
-
for (const loader of Object.values(commandMap)) loader(program
|
|
661
|
+
function loadCommands(program, commandMap) {
|
|
662
|
+
for (const loader of Object.values(commandMap)) loader(program);
|
|
659
663
|
}
|
|
660
664
|
var loadCommands_default = loadCommands;
|
|
661
665
|
|
|
662
666
|
//#endregion
|
|
663
667
|
//#region src/commands/index.ts
|
|
664
|
-
function createCommands(program
|
|
665
|
-
loadCommands_default(program
|
|
668
|
+
function createCommands(program) {
|
|
669
|
+
loadCommands_default(program, {
|
|
666
670
|
checkForFileDependencies: check_for_file_dependencies_default,
|
|
667
671
|
checkLockfileVersionDiscrepancy: check_lockfile_version_discrepancy_default,
|
|
668
672
|
checkVersionNumberChange: check_version_number_change_default,
|
|
@@ -683,7 +687,7 @@ var commands_default = createCommands;
|
|
|
683
687
|
|
|
684
688
|
//#endregion
|
|
685
689
|
//#region package.json
|
|
686
|
-
var version = "1.17.
|
|
690
|
+
var version = "1.17.3";
|
|
687
691
|
var package_default = {
|
|
688
692
|
name: "alex-c-line",
|
|
689
693
|
version,
|
|
@@ -759,6 +763,7 @@ var package_default = {
|
|
|
759
763
|
},
|
|
760
764
|
devDependencies: {
|
|
761
765
|
"@alextheman/eslint-plugin": "^5.4.2",
|
|
766
|
+
"@commander-js/extra-typings": "^14.0.0",
|
|
762
767
|
"@types/eslint": "^9.6.1",
|
|
763
768
|
"@types/libsodium-wrappers": "^0.7.14",
|
|
764
769
|
"@types/node": "^25.0.3",
|
|
@@ -784,11 +789,13 @@ var package_default = {
|
|
|
784
789
|
|
|
785
790
|
//#endregion
|
|
786
791
|
//#region src/index.ts
|
|
787
|
-
|
|
788
|
-
program
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
program
|
|
792
|
+
(async () => {
|
|
793
|
+
const program = new Command();
|
|
794
|
+
program.name("alex-c-line").description("CLI tool built by Alex").version(version);
|
|
795
|
+
updateNotifier({ pkg: package_default }).notify();
|
|
796
|
+
commands_default(program);
|
|
797
|
+
await program.parseAsync(process.argv);
|
|
798
|
+
})();
|
|
792
799
|
|
|
793
800
|
//#endregion
|
|
794
801
|
export { };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alex-c-line",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.3",
|
|
4
4
|
"description": "Command-line tool with commands to streamline the developer workflow.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@alextheman/eslint-plugin": "^5.4.2",
|
|
47
|
+
"@commander-js/extra-typings": "^14.0.0",
|
|
47
48
|
"@types/eslint": "^9.6.1",
|
|
48
49
|
"@types/libsodium-wrappers": "^0.7.14",
|
|
49
50
|
"@types/node": "^25.0.3",
|