alex-c-line 2.4.1 → 2.6.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.
@@ -67,6 +67,7 @@ declare let scripts: {
67
67
  "create-release-note": string;
68
68
  format: string;
69
69
  "format-eslint": string;
70
+ "format-markdownlint": string;
70
71
  "format-prettier": string;
71
72
  "format-prettier-html": string;
72
73
  "format-prettier-javascript": string;
@@ -74,6 +75,7 @@ declare let scripts: {
74
75
  "format-prettier-yml": string;
75
76
  lint: string;
76
77
  "lint-eslint": string;
78
+ "lint-markdownlint": string;
77
79
  "lint-pre-release": string;
78
80
  "lint-prettier": string;
79
81
  "lint-prettier-html": string;
@@ -67,6 +67,7 @@ declare let scripts: {
67
67
  "create-release-note": string;
68
68
  format: string;
69
69
  "format-eslint": string;
70
+ "format-markdownlint": string;
70
71
  "format-prettier": string;
71
72
  "format-prettier-html": string;
72
73
  "format-prettier-javascript": string;
@@ -74,6 +75,7 @@ declare let scripts: {
74
75
  "format-prettier-yml": string;
75
76
  lint: string;
76
77
  "lint-eslint": string;
78
+ "lint-markdownlint": string;
77
79
  "lint-pre-release": string;
78
80
  "lint-prettier": string;
79
81
  "lint-prettier-html": string;
package/dist/index.cjs CHANGED
@@ -29,13 +29,12 @@ let boxen = require("boxen");
29
29
  boxen = __toESM(boxen);
30
30
  let figlet = require("figlet");
31
31
  figlet = __toESM(figlet);
32
- let node_path = require("node:path");
33
- node_path = __toESM(node_path);
34
- let canvas = require("canvas");
35
- let node_fs_promises = require("node:fs/promises");
36
32
  let env_paths = require("env-paths");
37
33
  env_paths = __toESM(env_paths);
34
+ let node_path = require("node:path");
35
+ node_path = __toESM(node_path);
38
36
  let _inquirer_prompts = require("@inquirer/prompts");
37
+ let node_fs_promises = require("node:fs/promises");
39
38
  let dotenv = require("dotenv");
40
39
  let execa = require("execa");
41
40
  let node_url = require("node:url");
@@ -43,9 +42,9 @@ let _alextheman_utility_internal = require("@alextheman/utility/internal");
43
42
  let zod = require("zod");
44
43
  zod = __toESM(zod);
45
44
  let node_module = require("node:module");
46
- let _alextheman_utility_node = require("@alextheman/utility/node");
47
45
  let gray_matter = require("gray-matter");
48
46
  gray_matter = __toESM(gray_matter);
47
+ let _alextheman_utility_node = require("@alextheman/utility/node");
49
48
  let axios = require("axios");
50
49
  axios = __toESM(axios);
51
50
  let supports_color = require("supports-color");
@@ -97,56 +96,6 @@ function artworkLog(program) {
97
96
  });
98
97
  }
99
98
  //#endregion
100
- //#region src/utility/miscellaneous/asciiToPng.ts
101
- async function asciiToPng(ascii, options) {
102
- const { filePath = "media/alex-c-line", width = 3e3, height = 3e3, backgroundColor = "#0b1020", titleColor = "#facc15", subtitleColor = {
103
- green: "#22c55e",
104
- white: "#ffffff"
105
- }[options?.subtitleColor ?? "green"], fontSize = 48, fontFamily = [
106
- "Menlo",
107
- "Monaco",
108
- "Consolas",
109
- "monospace"
110
- ], subtitleLineCount = options?.subtitleLineCount ?? 1 } = options ?? {};
111
- const canvas$1 = (0, canvas.createCanvas)(width, height);
112
- const context = canvas$1.getContext("2d");
113
- context.fillStyle = backgroundColor;
114
- context.fillRect(0, 0, width, height);
115
- context.font = `${fontSize}px ${fontFamily.join(", ")}`;
116
- context.textBaseline = "top";
117
- const lines = ascii.split("\n");
118
- const lineHeight = fontSize * 1.4;
119
- const startY = (height - lines.length * lineHeight) / 2;
120
- const subtitleStartIndex = Math.max(0, lines.length - subtitleLineCount);
121
- lines.forEach((line, index) => {
122
- context.fillStyle = index >= subtitleStartIndex ? subtitleColor : titleColor;
123
- const x = (width - context.measureText(line).width) / 2;
124
- const y = startY + index * lineHeight;
125
- context.fillText(line, x, y);
126
- });
127
- const outputPath = node_path.default.resolve(filePath.endsWith(".png") ? filePath : `${filePath}.png`);
128
- await (0, node_fs_promises.mkdir)(node_path.default.dirname(outputPath), { recursive: true });
129
- await (0, node_fs_promises.writeFile)(outputPath, canvas$1.toBuffer("image/png"));
130
- }
131
- //#endregion
132
- //#region src/cli/commands/artwork/save.ts
133
- function artworkSave(program) {
134
- program.command("save").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("--file-path <filePath>", "Save the artwork as a PNG file, optionally specifying the path", "media/alex-c-line.png").action(async ({ filePath, subtitleText, subtitleColor = "green" }) => {
135
- if (subtitleColor !== "green" && subtitleColor !== "white") throw new _alextheman_utility.DataError({ subtitleColor }, "INVALID_SUBTITLE_COLOR", "Subtitle color must either be green or white.");
136
- await asciiToPng(await createAlexCLineArtwork({
137
- includeBox: false,
138
- includeColors: false,
139
- subtitleText
140
- }), {
141
- filePath,
142
- fontSize: 90,
143
- subtitleColor,
144
- subtitleLineCount: subtitleText?.split("\n").length
145
- });
146
- console.info(`Artwork saved successfully to ${node_path.default.resolve(filePath.endsWith(".png") ? filePath : `${filePath}.png`)}`);
147
- });
148
- }
149
- //#endregion
150
99
  //#region src/utility/miscellaneous/loadCommands.ts
151
100
  function loadCommands(program, commandMap) {
152
101
  for (const loader of Object.values(commandMap)) loader(program);
@@ -154,10 +103,7 @@ function loadCommands(program, commandMap) {
154
103
  //#endregion
155
104
  //#region src/cli/commands/artwork/index.ts
156
105
  function artwork(program) {
157
- loadCommands(program.command("artwork").description("Interact with the artwork for alex-c-line"), {
158
- artworkLog,
159
- artworkSave
160
- });
106
+ loadCommands(program.command("artwork").description("Interact with the artwork for alex-c-line"), { artworkLog });
161
107
  }
162
108
  const { cache: ALEX_C_LINE_GLOBAL_CACHE_DIRECTORY } = (0, env_paths.default)("alex-c-line");
163
109
  const ALEX_C_LINE_GLOBAL_CACHE_PATH = node_path.default.join(ALEX_C_LINE_GLOBAL_CACHE_DIRECTORY, "cache.json");
@@ -770,20 +716,6 @@ function localPackage(program) {
770
716
  loadCommands(program.command("local-package").description("Manage the use of local packages in your JavaScript project."), { localPackageUse });
771
717
  }
772
718
  //#endregion
773
- //#region src/cli/commands/root/encrypt-with-key.ts
774
- function encryptWithKey(program) {
775
- 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) => {
776
- try {
777
- console.info(await (0, _alextheman_utility_node.encryptWithKey)(publicKey, plaintextValue));
778
- } catch {
779
- program.error(`${errorPrefix} Encryption failed. Please double-check that the given key is a valid base 64 string.`, {
780
- exitCode: 1,
781
- code: "ENCRYPTION_FAILED"
782
- });
783
- }
784
- });
785
- }
786
- //#endregion
787
719
  //#region src/cli/commands/root/pre-commit/createStepRunner.ts
788
720
  const runCommandAndLogToConsole = (0, execa.execa)({
789
721
  stdio: "inherit",
@@ -887,7 +819,6 @@ function sayHello(program) {
887
819
  //#region src/cli/commands/root/index.ts
888
820
  function root(program) {
889
821
  loadCommands(program, {
890
- encryptWithKey,
891
822
  preCommit,
892
823
  sayHello
893
824
  });
@@ -1235,7 +1166,7 @@ function template(program) {
1235
1166
  //#endregion
1236
1167
  //#region package.json
1237
1168
  var name = "alex-c-line";
1238
- var version$1 = "2.4.1";
1169
+ var version$1 = "2.6.0";
1239
1170
  var description = "Command-line tool with commands to streamline the developer workflow.";
1240
1171
  //#endregion
1241
1172
  //#region src/utility/updates/checkUpdate.ts
package/dist/index.js CHANGED
@@ -5,18 +5,17 @@ import { DataError, ONE_DAY_IN_MILLISECONDS, VersionNumber, fillArray, getString
5
5
  import chalk from "chalk";
6
6
  import boxen from "boxen";
7
7
  import figlet from "figlet";
8
- import path from "node:path";
9
- import { createCanvas } from "canvas";
10
- import { access, mkdir, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
11
8
  import envPaths from "env-paths";
9
+ import path from "node:path";
12
10
  import { confirm, input, password, select } from "@inquirer/prompts";
11
+ import { access, mkdir, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
13
12
  import { parse } from "dotenv";
14
13
  import { ExecaError, execa } from "execa";
15
14
  import { fileURLToPath, pathToFileURL } from "node:url";
16
15
  import { DependencyGroup, PackageManager, getDependenciesFromGroup, getExpectedTgzName, getPackageJsonContents, packageJsonNotFoundError } from "@alextheman/utility/internal";
17
16
  import z from "zod";
18
- import { encryptWithKey, parseFilePath } from "@alextheman/utility/node";
19
17
  import matter from "gray-matter";
18
+ import { parseFilePath } from "@alextheman/utility/node";
20
19
  import axios from "axios";
21
20
  import supportsColor from "supports-color";
22
21
  import { randomUUID } from "node:crypto";
@@ -66,56 +65,6 @@ function artworkLog(program) {
66
65
  });
67
66
  }
68
67
  //#endregion
69
- //#region src/utility/miscellaneous/asciiToPng.ts
70
- async function asciiToPng(ascii, options) {
71
- const { filePath = "media/alex-c-line", width = 3e3, height = 3e3, backgroundColor = "#0b1020", titleColor = "#facc15", subtitleColor = {
72
- green: "#22c55e",
73
- white: "#ffffff"
74
- }[options?.subtitleColor ?? "green"], fontSize = 48, fontFamily = [
75
- "Menlo",
76
- "Monaco",
77
- "Consolas",
78
- "monospace"
79
- ], subtitleLineCount = options?.subtitleLineCount ?? 1 } = options ?? {};
80
- const canvas = createCanvas(width, height);
81
- const context = canvas.getContext("2d");
82
- context.fillStyle = backgroundColor;
83
- context.fillRect(0, 0, width, height);
84
- context.font = `${fontSize}px ${fontFamily.join(", ")}`;
85
- context.textBaseline = "top";
86
- const lines = ascii.split("\n");
87
- const lineHeight = fontSize * 1.4;
88
- const startY = (height - lines.length * lineHeight) / 2;
89
- const subtitleStartIndex = Math.max(0, lines.length - subtitleLineCount);
90
- lines.forEach((line, index) => {
91
- context.fillStyle = index >= subtitleStartIndex ? subtitleColor : titleColor;
92
- const x = (width - context.measureText(line).width) / 2;
93
- const y = startY + index * lineHeight;
94
- context.fillText(line, x, y);
95
- });
96
- const outputPath = path.resolve(filePath.endsWith(".png") ? filePath : `${filePath}.png`);
97
- await mkdir(path.dirname(outputPath), { recursive: true });
98
- await writeFile(outputPath, canvas.toBuffer("image/png"));
99
- }
100
- //#endregion
101
- //#region src/cli/commands/artwork/save.ts
102
- function artworkSave(program) {
103
- program.command("save").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("--file-path <filePath>", "Save the artwork as a PNG file, optionally specifying the path", "media/alex-c-line.png").action(async ({ filePath, subtitleText, subtitleColor = "green" }) => {
104
- if (subtitleColor !== "green" && subtitleColor !== "white") throw new DataError({ subtitleColor }, "INVALID_SUBTITLE_COLOR", "Subtitle color must either be green or white.");
105
- await asciiToPng(await createAlexCLineArtwork({
106
- includeBox: false,
107
- includeColors: false,
108
- subtitleText
109
- }), {
110
- filePath,
111
- fontSize: 90,
112
- subtitleColor,
113
- subtitleLineCount: subtitleText?.split("\n").length
114
- });
115
- console.info(`Artwork saved successfully to ${path.resolve(filePath.endsWith(".png") ? filePath : `${filePath}.png`)}`);
116
- });
117
- }
118
- //#endregion
119
68
  //#region src/utility/miscellaneous/loadCommands.ts
120
69
  function loadCommands(program, commandMap) {
121
70
  for (const loader of Object.values(commandMap)) loader(program);
@@ -123,10 +72,7 @@ function loadCommands(program, commandMap) {
123
72
  //#endregion
124
73
  //#region src/cli/commands/artwork/index.ts
125
74
  function artwork(program) {
126
- loadCommands(program.command("artwork").description("Interact with the artwork for alex-c-line"), {
127
- artworkLog,
128
- artworkSave
129
- });
75
+ loadCommands(program.command("artwork").description("Interact with the artwork for alex-c-line"), { artworkLog });
130
76
  }
131
77
  const { cache: ALEX_C_LINE_GLOBAL_CACHE_DIRECTORY } = envPaths("alex-c-line");
132
78
  const ALEX_C_LINE_GLOBAL_CACHE_PATH = path.join(ALEX_C_LINE_GLOBAL_CACHE_DIRECTORY, "cache.json");
@@ -739,20 +685,6 @@ function localPackage(program) {
739
685
  loadCommands(program.command("local-package").description("Manage the use of local packages in your JavaScript project."), { localPackageUse });
740
686
  }
741
687
  //#endregion
742
- //#region src/cli/commands/root/encrypt-with-key.ts
743
- function encryptWithKey$1(program) {
744
- 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) => {
745
- try {
746
- console.info(await encryptWithKey(publicKey, plaintextValue));
747
- } catch {
748
- program.error(`${errorPrefix} Encryption failed. Please double-check that the given key is a valid base 64 string.`, {
749
- exitCode: 1,
750
- code: "ENCRYPTION_FAILED"
751
- });
752
- }
753
- });
754
- }
755
- //#endregion
756
688
  //#region src/cli/commands/root/pre-commit/createStepRunner.ts
757
689
  const runCommandAndLogToConsole = execa({
758
690
  stdio: "inherit",
@@ -856,7 +788,6 @@ function sayHello(program) {
856
788
  //#region src/cli/commands/root/index.ts
857
789
  function root(program) {
858
790
  loadCommands(program, {
859
- encryptWithKey: encryptWithKey$1,
860
791
  preCommit,
861
792
  sayHello
862
793
  });
@@ -1204,7 +1135,7 @@ function template(program) {
1204
1135
  //#endregion
1205
1136
  //#region package.json
1206
1137
  var name = "alex-c-line";
1207
- var version$1 = "2.4.1";
1138
+ var version$1 = "2.6.0";
1208
1139
  var description = "Command-line tool with commands to streamline the developer workflow.";
1209
1140
  //#endregion
1210
1141
  //#region src/utility/updates/checkUpdate.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alex-c-line",
3
- "version": "2.4.1",
3
+ "version": "2.6.0",
4
4
  "description": "Command-line tool with commands to streamline the developer workflow.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,43 +34,42 @@
34
34
  "templates"
35
35
  ],
36
36
  "dependencies": {
37
- "@alextheman/utility": "^5.9.0",
38
- "@inquirer/prompts": "^8.3.2",
39
- "axios": "^1.14.0",
40
- "boxen": "^8.0.1",
41
- "canvas": "^3.2.2",
42
- "chalk": "^5.6.2",
43
- "commander": "^14.0.3",
44
- "dotenv": "^17.3.1",
45
- "dotenv-stringify": "^3.0.1",
46
- "env-paths": "^4.0.0",
47
- "execa": "^9.6.1",
48
- "figlet": "^1.11.0",
49
- "gray-matter": "^4.0.3",
50
- "libsodium-wrappers": "^0.8.2",
51
- "semver": "^7.7.4",
52
- "supports-color": "^10.2.2",
53
- "zod": "^4.3.6"
37
+ "@alextheman/utility": "5.10.1",
38
+ "@inquirer/prompts": "8.4.1",
39
+ "axios": "1.15.0",
40
+ "boxen": "8.0.1",
41
+ "chalk": "5.6.2",
42
+ "commander": "14.0.3",
43
+ "dotenv": "17.4.1",
44
+ "dotenv-stringify": "3.0.1",
45
+ "env-paths": "4.0.0",
46
+ "execa": "9.6.1",
47
+ "figlet": "1.11.0",
48
+ "gray-matter": "4.0.3",
49
+ "semver": "7.7.4",
50
+ "supports-color": "10.2.2",
51
+ "zod": "4.3.6"
54
52
  },
55
53
  "devDependencies": {
56
- "@alextheman/eslint-plugin": "^5.10.4",
57
- "@commander-js/extra-typings": "^14.0.0",
58
- "@types/eslint": "^9.6.1",
59
- "@types/node": "^25.5.0",
60
- "@types/semver": "^7.7.1",
61
- "@types/update-notifier": "^6.0.8",
62
- "cross-env": "^10.1.0",
63
- "dotenv-cli": "^11.0.0",
64
- "eslint": "^10.1.0",
65
- "husky": "^9.1.7",
66
- "prettier": "^3.8.1",
67
- "tempy": "^3.2.0",
68
- "ts-node": "^10.9.2",
69
- "tsdown": "^0.21.7",
70
- "typescript": "^6.0.2",
71
- "typescript-eslint": "^8.58.0",
72
- "vite-tsconfig-paths": "^6.1.1",
73
- "vitest": "^4.1.2"
54
+ "@alextheman/eslint-plugin": "5.12.0",
55
+ "@commander-js/extra-typings": "14.0.0",
56
+ "@types/eslint": "9.6.1",
57
+ "@types/node": "25.6.0",
58
+ "@types/semver": "7.7.1",
59
+ "@types/update-notifier": "6.0.8",
60
+ "cross-env": "10.1.0",
61
+ "dotenv-cli": "11.0.0",
62
+ "eslint": "10.2.0",
63
+ "husky": "9.1.7",
64
+ "markdownlint-cli2": "0.22.0",
65
+ "prettier": "3.8.2",
66
+ "tempy": "3.2.0",
67
+ "ts-node": "10.9.2",
68
+ "tsdown": "0.21.7",
69
+ "typescript": "6.0.2",
70
+ "typescript-eslint": "8.58.1",
71
+ "vite-tsconfig-paths": "6.1.1",
72
+ "vitest": "4.1.4"
74
73
  },
75
74
  "engines": {
76
75
  "node": ">=22.0.0"
@@ -80,15 +79,17 @@
80
79
  "command": "bash -c 'pnpm run build && echo && echo \"Command output:\" && node dist/index.js \"$@\"' --",
81
80
  "create-local-package": "pnpm run build && rm -f alex-c-line-*.tgz && pnpm pack",
82
81
  "create-release-note": "bash -c 'git pull origin main && pnpm run command template release-note create $@' --",
83
- "format": "pnpm run format-prettier && pnpm run format-eslint",
82
+ "format": "pnpm run format-prettier && pnpm run format-eslint && pnpm run format-markdownlint",
84
83
  "format-eslint": "eslint --fix --suppress-all \"package.json\" \"{src,tests}/**/*.ts\" && rm -f eslint-suppressions.json",
84
+ "format-markdownlint": "pnpm exec markdownlint-cli2 --fix \"**/*.md\" \"!{node_modules,dist}/**\" | grep -v \"^Finding:\"",
85
85
  "format-prettier": "pnpm run format-prettier-typescript && pnpm run format-prettier-javascript && pnpm run format-prettier-yml && pnpm run format-prettier-html",
86
86
  "format-prettier-html": "prettier --write \"**/*.html\"",
87
87
  "format-prettier-javascript": "prettier --write \"./**/*.js\"",
88
88
  "format-prettier-typescript": "prettier --write --parser typescript \"./**/*.ts\"",
89
89
  "format-prettier-yml": "prettier --write \"./**/*.{yml,yaml}\"",
90
- "lint": "pnpm run lint-tsc && pnpm run lint-eslint && pnpm run lint-prettier && pnpm run lint-pre-release",
90
+ "lint": "pnpm run lint-tsc && pnpm run lint-eslint && pnpm run lint-markdownlint && pnpm run lint-prettier && pnpm run lint-markdownlint && pnpm run lint-pre-release",
91
91
  "lint-eslint": "eslint \"package.json\" \"{src,tests}/**/*.ts\"",
92
+ "lint-markdownlint": "bash -o pipefail -c 'pnpm exec markdownlint-cli2 \"**/*.md\" \"!{node_modules,dist}/**\"| grep -v \"^Finding:\"'",
92
93
  "lint-pre-release": "node dist/index.js package-json check --rules no-pre-release-dependencies",
93
94
  "lint-prettier": "pnpm run lint-prettier-typescript && pnpm run lint-prettier-javascript && pnpm run lint-prettier-yml && pnpm run lint-prettier-html",
94
95
  "lint-prettier-html": "prettier --check \"**/*.html\"",