alex-c-line 2.4.0 → 2.5.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/index.cjs +7 -61
- package/dist/index.js +6 -60
- package/package.json +38 -39
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");
|
|
45
|
+
let _alextheman_utility_node = require("@alextheman/utility/node");
|
|
46
46
|
let gray_matter = require("gray-matter");
|
|
47
47
|
gray_matter = __toESM(gray_matter);
|
|
48
|
-
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");
|
|
@@ -774,7 +720,7 @@ function localPackage(program) {
|
|
|
774
720
|
function encryptWithKey(program) {
|
|
775
721
|
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
722
|
try {
|
|
777
|
-
console.info(await (0,
|
|
723
|
+
console.info(await (0, _alextheman_utility_node.encryptWithKey)(publicKey, plaintextValue));
|
|
778
724
|
} catch {
|
|
779
725
|
program.error(`${errorPrefix} Encryption failed. Please double-check that the given key is a valid base 64 string.`, {
|
|
780
726
|
exitCode: 1,
|
|
@@ -1235,7 +1181,7 @@ function template(program) {
|
|
|
1235
1181
|
//#endregion
|
|
1236
1182
|
//#region package.json
|
|
1237
1183
|
var name = "alex-c-line";
|
|
1238
|
-
var version$1 = "2.
|
|
1184
|
+
var version$1 = "2.5.0";
|
|
1239
1185
|
var description = "Command-line tool with commands to streamline the developer workflow.";
|
|
1240
1186
|
//#endregion
|
|
1241
1187
|
//#region src/utility/updates/checkUpdate.ts
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { Command } from "commander";
|
|
4
|
-
import { DataError, ONE_DAY_IN_MILLISECONDS, VersionNumber,
|
|
4
|
+
import { DataError, ONE_DAY_IN_MILLISECONDS, VersionNumber, fillArray, getStringsAndInterpolations, interpolate, isTemplateStringsArray, kebabToCamel, normaliseIndents, omitProperties, parseBoolean, parseVersionType, parseZodSchema, parseZodSchemaAsync, removeDuplicates, removeUndefinedFromObject, stringifyDotenv } from "@alextheman/utility";
|
|
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";
|
|
17
|
+
import { encryptWithKey, parseFilePath } from "@alextheman/utility/node";
|
|
18
18
|
import matter from "gray-matter";
|
|
19
|
-
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");
|
|
@@ -1204,7 +1150,7 @@ function template(program) {
|
|
|
1204
1150
|
//#endregion
|
|
1205
1151
|
//#region package.json
|
|
1206
1152
|
var name = "alex-c-line";
|
|
1207
|
-
var version$1 = "2.
|
|
1153
|
+
var version$1 = "2.5.0";
|
|
1208
1154
|
var description = "Command-line tool with commands to streamline the developer workflow.";
|
|
1209
1155
|
//#endregion
|
|
1210
1156
|
//#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.
|
|
3
|
+
"version": "2.5.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": "
|
|
38
|
-
"@inquirer/prompts": "
|
|
39
|
-
"axios": "
|
|
40
|
-
"boxen": "
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"dotenv": "
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"zod": "^4.3.6"
|
|
37
|
+
"@alextheman/utility": "5.9.0",
|
|
38
|
+
"@inquirer/prompts": "8.3.2",
|
|
39
|
+
"axios": "1.14.0",
|
|
40
|
+
"boxen": "8.0.1",
|
|
41
|
+
"chalk": "5.6.2",
|
|
42
|
+
"commander": "14.0.3",
|
|
43
|
+
"dotenv": "17.4.0",
|
|
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
|
+
"libsodium-wrappers": "0.8.2",
|
|
50
|
+
"semver": "7.7.4",
|
|
51
|
+
"supports-color": "10.2.2",
|
|
52
|
+
"zod": "4.3.6"
|
|
54
53
|
},
|
|
55
54
|
"devDependencies": {
|
|
56
|
-
"@alextheman/eslint-plugin": "
|
|
57
|
-
"@commander-js/extra-typings": "
|
|
58
|
-
"@types/eslint": "
|
|
59
|
-
"@types/node": "
|
|
60
|
-
"@types/semver": "
|
|
61
|
-
"@types/update-notifier": "
|
|
62
|
-
"cross-env": "
|
|
63
|
-
"dotenv-cli": "
|
|
64
|
-
"eslint": "
|
|
65
|
-
"husky": "
|
|
66
|
-
"prettier": "
|
|
67
|
-
"tempy": "
|
|
68
|
-
"ts-node": "
|
|
69
|
-
"tsdown": "
|
|
70
|
-
"typescript": "
|
|
71
|
-
"typescript-eslint": "
|
|
72
|
-
"vite-tsconfig-paths": "
|
|
73
|
-
"vitest": "
|
|
55
|
+
"@alextheman/eslint-plugin": "5.11.0",
|
|
56
|
+
"@commander-js/extra-typings": "14.0.0",
|
|
57
|
+
"@types/eslint": "9.6.1",
|
|
58
|
+
"@types/node": "25.5.2",
|
|
59
|
+
"@types/semver": "7.7.1",
|
|
60
|
+
"@types/update-notifier": "6.0.8",
|
|
61
|
+
"cross-env": "10.1.0",
|
|
62
|
+
"dotenv-cli": "11.0.0",
|
|
63
|
+
"eslint": "10.2.0",
|
|
64
|
+
"husky": "9.1.7",
|
|
65
|
+
"prettier": "3.8.1",
|
|
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.0",
|
|
71
|
+
"vite-tsconfig-paths": "6.1.1",
|
|
72
|
+
"vitest": "4.1.2"
|
|
74
73
|
},
|
|
75
74
|
"engines": {
|
|
76
75
|
"node": ">=22.0.0"
|
|
@@ -81,18 +80,18 @@
|
|
|
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
82
|
"format": "pnpm run format-prettier && pnpm run format-eslint",
|
|
84
|
-
"format-eslint": "eslint --fix --suppress-all \"package.json\" \"src
|
|
83
|
+
"format-eslint": "eslint --fix --suppress-all \"package.json\" \"{src,tests}/**/*.ts\" && rm -f eslint-suppressions.json",
|
|
85
84
|
"format-prettier": "pnpm run format-prettier-typescript && pnpm run format-prettier-javascript && pnpm run format-prettier-yml && pnpm run format-prettier-html",
|
|
86
85
|
"format-prettier-html": "prettier --write \"**/*.html\"",
|
|
87
86
|
"format-prettier-javascript": "prettier --write \"./**/*.js\"",
|
|
88
87
|
"format-prettier-typescript": "prettier --write --parser typescript \"./**/*.ts\"",
|
|
89
88
|
"format-prettier-yml": "prettier --write \"./**/*.{yml,yaml}\"",
|
|
90
89
|
"lint": "pnpm run lint-tsc && pnpm run lint-eslint && pnpm run lint-prettier && pnpm run lint-pre-release",
|
|
91
|
-
"lint-eslint": "eslint \"package.json\" \"src
|
|
90
|
+
"lint-eslint": "eslint \"package.json\" \"{src,tests}/**/*.ts\"",
|
|
92
91
|
"lint-pre-release": "node dist/index.js package-json check --rules no-pre-release-dependencies",
|
|
93
92
|
"lint-prettier": "pnpm run lint-prettier-typescript && pnpm run lint-prettier-javascript && pnpm run lint-prettier-yml && pnpm run lint-prettier-html",
|
|
94
93
|
"lint-prettier-html": "prettier --check \"**/*.html\"",
|
|
95
|
-
"lint-prettier-javascript": "prettier --check \"
|
|
94
|
+
"lint-prettier-javascript": "prettier --check \"./**/*.js\"",
|
|
96
95
|
"lint-prettier-typescript": "prettier --check --parser typescript \"./**/*.ts\"",
|
|
97
96
|
"lint-prettier-yml": "prettier --check \"./**/*.{yml,yaml}\"",
|
|
98
97
|
"lint-tsc": "tsc --noEmit",
|