alex-c-line 1.30.0 → 1.30.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +23 -12
- package/dist/index.js +23 -12
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -61,12 +61,15 @@ supports_color = __toESM(supports_color);
|
|
|
61
61
|
|
|
62
62
|
//#region src/utility/miscellaneous/asciiToPng.ts
|
|
63
63
|
async function asciiToPng(ascii, options) {
|
|
64
|
-
const { fileName = "artwork/alex-c-line", width = 3e3, height = 3e3, backgroundColor = "#0b1020", titleColor = "#facc15", subtitleColor =
|
|
64
|
+
const { fileName = "artwork/alex-c-line", width = 3e3, height = 3e3, backgroundColor = "#0b1020", titleColor = "#facc15", subtitleColor = {
|
|
65
|
+
green: "#22c55e",
|
|
66
|
+
white: "#ffffff"
|
|
67
|
+
}[options?.subtitleColor ?? "green"], fontSize = 48, fontFamily = [
|
|
65
68
|
"Menlo",
|
|
66
69
|
"Monaco",
|
|
67
70
|
"Consolas",
|
|
68
71
|
"monospace"
|
|
69
|
-
], subtitleLineCount = 1 } = options ?? {};
|
|
72
|
+
], subtitleLineCount = options?.subtitleLineCount ?? 1 } = options ?? {};
|
|
70
73
|
const canvas$1 = (0, canvas.createCanvas)(width, height);
|
|
71
74
|
const context = canvas$1.getContext("2d");
|
|
72
75
|
context.fillStyle = backgroundColor;
|
|
@@ -100,12 +103,13 @@ function centerLine(text, width) {
|
|
|
100
103
|
//#endregion
|
|
101
104
|
//#region src/utility/miscellaneous/createAlexCLineArtwork.ts
|
|
102
105
|
async function createAlexCLineArtwork(options) {
|
|
103
|
-
const { includeColors = true, subtitleColor = chalk.default.green, subtitleText = "say my name and I'll assist ✓" } = options ?? {};
|
|
106
|
+
const { includeBox = true, includeColors = true, subtitleColor = chalk.default.green, subtitleText = "say my name and I'll assist ✓" } = options ?? {};
|
|
104
107
|
const title = await (0, figlet.default)("alex-c-line");
|
|
105
108
|
const subtitle = centerLine(subtitleText, Math.max(...title.split("\n").map((line) => {
|
|
106
109
|
return line.length;
|
|
107
110
|
})));
|
|
108
|
-
|
|
111
|
+
const output = includeColors ? [chalk.default.yellow(title), subtitleColor(subtitle)].join("\n") : [title, subtitle].join("\n");
|
|
112
|
+
return includeBox ? (0, boxen.default)(output, {
|
|
109
113
|
padding: {
|
|
110
114
|
top: 1,
|
|
111
115
|
bottom: 1,
|
|
@@ -114,26 +118,33 @@ async function createAlexCLineArtwork(options) {
|
|
|
114
118
|
},
|
|
115
119
|
borderStyle: "round",
|
|
116
120
|
borderColor: "cyanBright"
|
|
117
|
-
});
|
|
121
|
+
}) : output;
|
|
118
122
|
}
|
|
119
123
|
|
|
120
124
|
//#endregion
|
|
121
125
|
//#region src/commands/artwork.ts
|
|
122
126
|
function artwork(program) {
|
|
123
|
-
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) => {
|
|
124
|
-
|
|
127
|
+
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" }) => {
|
|
128
|
+
if (subtitleColor !== "green" && subtitleColor !== "white") throw new _alextheman_utility.DataError({ subtitleColor }, "INVALID_SUBTITLE_COLOR", "Subtitle color must either be green or white.");
|
|
129
|
+
const chalkColour = {
|
|
125
130
|
green: chalk.default.green,
|
|
126
131
|
white: chalk.default.white
|
|
127
132
|
}[subtitleColor];
|
|
128
|
-
}).option("--save-png [fileName]", "Save the artwork as a PNG file, optionally specifying the path").action(async ({ savePng: fileName, subtitleText, subtitleColor }) => {
|
|
129
133
|
console.info(await createAlexCLineArtwork({
|
|
134
|
+
includeBox: true,
|
|
130
135
|
includeColors: true,
|
|
131
136
|
subtitleText,
|
|
132
|
-
subtitleColor
|
|
137
|
+
subtitleColor: chalkColour
|
|
133
138
|
}));
|
|
134
|
-
if (fileName) await asciiToPng(await createAlexCLineArtwork({
|
|
139
|
+
if (fileName) await asciiToPng(await createAlexCLineArtwork({
|
|
140
|
+
includeBox: false,
|
|
141
|
+
includeColors: false,
|
|
142
|
+
subtitleText
|
|
143
|
+
}), {
|
|
135
144
|
fileName: typeof fileName === "string" ? fileName : void 0,
|
|
136
|
-
fontSize: 90
|
|
145
|
+
fontSize: 90,
|
|
146
|
+
subtitleColor,
|
|
147
|
+
subtitleLineCount: subtitleText?.split("\n").length
|
|
137
148
|
});
|
|
138
149
|
});
|
|
139
150
|
}
|
|
@@ -1304,7 +1315,7 @@ function parseZodSchemaForProgram(programError, schema, data) {
|
|
|
1304
1315
|
//#endregion
|
|
1305
1316
|
//#region package.json
|
|
1306
1317
|
var name = "alex-c-line";
|
|
1307
|
-
var version = "1.30.
|
|
1318
|
+
var version = "1.30.2";
|
|
1308
1319
|
var description = "Command-line tool with commands to streamline the developer workflow.";
|
|
1309
1320
|
|
|
1310
1321
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -23,12 +23,15 @@ import supportsColor from "supports-color";
|
|
|
23
23
|
|
|
24
24
|
//#region src/utility/miscellaneous/asciiToPng.ts
|
|
25
25
|
async function asciiToPng(ascii, options) {
|
|
26
|
-
const { fileName = "artwork/alex-c-line", width = 3e3, height = 3e3, backgroundColor = "#0b1020", titleColor = "#facc15", subtitleColor =
|
|
26
|
+
const { fileName = "artwork/alex-c-line", width = 3e3, height = 3e3, backgroundColor = "#0b1020", titleColor = "#facc15", subtitleColor = {
|
|
27
|
+
green: "#22c55e",
|
|
28
|
+
white: "#ffffff"
|
|
29
|
+
}[options?.subtitleColor ?? "green"], fontSize = 48, fontFamily = [
|
|
27
30
|
"Menlo",
|
|
28
31
|
"Monaco",
|
|
29
32
|
"Consolas",
|
|
30
33
|
"monospace"
|
|
31
|
-
], subtitleLineCount = 1 } = options ?? {};
|
|
34
|
+
], subtitleLineCount = options?.subtitleLineCount ?? 1 } = options ?? {};
|
|
32
35
|
const canvas = createCanvas(width, height);
|
|
33
36
|
const context = canvas.getContext("2d");
|
|
34
37
|
context.fillStyle = backgroundColor;
|
|
@@ -62,12 +65,13 @@ function centerLine(text, width) {
|
|
|
62
65
|
//#endregion
|
|
63
66
|
//#region src/utility/miscellaneous/createAlexCLineArtwork.ts
|
|
64
67
|
async function createAlexCLineArtwork(options) {
|
|
65
|
-
const { includeColors = true, subtitleColor = chalk.green, subtitleText = "say my name and I'll assist ✓" } = options ?? {};
|
|
68
|
+
const { includeBox = true, includeColors = true, subtitleColor = chalk.green, subtitleText = "say my name and I'll assist ✓" } = options ?? {};
|
|
66
69
|
const title = await figlet("alex-c-line");
|
|
67
70
|
const subtitle = centerLine(subtitleText, Math.max(...title.split("\n").map((line) => {
|
|
68
71
|
return line.length;
|
|
69
72
|
})));
|
|
70
|
-
|
|
73
|
+
const output = includeColors ? [chalk.yellow(title), subtitleColor(subtitle)].join("\n") : [title, subtitle].join("\n");
|
|
74
|
+
return includeBox ? boxen(output, {
|
|
71
75
|
padding: {
|
|
72
76
|
top: 1,
|
|
73
77
|
bottom: 1,
|
|
@@ -76,26 +80,33 @@ async function createAlexCLineArtwork(options) {
|
|
|
76
80
|
},
|
|
77
81
|
borderStyle: "round",
|
|
78
82
|
borderColor: "cyanBright"
|
|
79
|
-
});
|
|
83
|
+
}) : output;
|
|
80
84
|
}
|
|
81
85
|
|
|
82
86
|
//#endregion
|
|
83
87
|
//#region src/commands/artwork.ts
|
|
84
88
|
function artwork(program) {
|
|
85
|
-
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) => {
|
|
86
|
-
|
|
89
|
+
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" }) => {
|
|
90
|
+
if (subtitleColor !== "green" && subtitleColor !== "white") throw new DataError({ subtitleColor }, "INVALID_SUBTITLE_COLOR", "Subtitle color must either be green or white.");
|
|
91
|
+
const chalkColour = {
|
|
87
92
|
green: chalk.green,
|
|
88
93
|
white: chalk.white
|
|
89
94
|
}[subtitleColor];
|
|
90
|
-
}).option("--save-png [fileName]", "Save the artwork as a PNG file, optionally specifying the path").action(async ({ savePng: fileName, subtitleText, subtitleColor }) => {
|
|
91
95
|
console.info(await createAlexCLineArtwork({
|
|
96
|
+
includeBox: true,
|
|
92
97
|
includeColors: true,
|
|
93
98
|
subtitleText,
|
|
94
|
-
subtitleColor
|
|
99
|
+
subtitleColor: chalkColour
|
|
95
100
|
}));
|
|
96
|
-
if (fileName) await asciiToPng(await createAlexCLineArtwork({
|
|
101
|
+
if (fileName) await asciiToPng(await createAlexCLineArtwork({
|
|
102
|
+
includeBox: false,
|
|
103
|
+
includeColors: false,
|
|
104
|
+
subtitleText
|
|
105
|
+
}), {
|
|
97
106
|
fileName: typeof fileName === "string" ? fileName : void 0,
|
|
98
|
-
fontSize: 90
|
|
107
|
+
fontSize: 90,
|
|
108
|
+
subtitleColor,
|
|
109
|
+
subtitleLineCount: subtitleText?.split("\n").length
|
|
99
110
|
});
|
|
100
111
|
});
|
|
101
112
|
}
|
|
@@ -1266,7 +1277,7 @@ function parseZodSchemaForProgram(programError, schema, data) {
|
|
|
1266
1277
|
//#endregion
|
|
1267
1278
|
//#region package.json
|
|
1268
1279
|
var name = "alex-c-line";
|
|
1269
|
-
var version = "1.30.
|
|
1280
|
+
var version = "1.30.2";
|
|
1270
1281
|
var description = "Command-line tool with commands to streamline the developer workflow.";
|
|
1271
1282
|
|
|
1272
1283
|
//#endregion
|