alex-c-line 1.30.1 → 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 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 = "#22c55e", fontSize = 48, fontFamily = [
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;
@@ -121,26 +124,27 @@ async function createAlexCLineArtwork(options) {
121
124
  //#endregion
122
125
  //#region src/commands/artwork.ts
123
126
  function artwork(program) {
124
- program.command("artwork").description("Create the artwork for alex-c-line").option("--subtitle-text <subtitleText>", "Customise the subtitle text").option("--subtitle-color <subtitleColor>", "Customise the subtitle color", (subtitleColor) => {
125
- return {
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 = {
126
130
  green: chalk.default.green,
127
131
  white: chalk.default.white
128
132
  }[subtitleColor];
129
- }).option("--save-png [fileName]", "Save the artwork as a PNG file, optionally specifying the path").action(async ({ savePng: fileName, subtitleText, subtitleColor }) => {
130
133
  console.info(await createAlexCLineArtwork({
131
134
  includeBox: true,
132
135
  includeColors: true,
133
136
  subtitleText,
134
- subtitleColor
137
+ subtitleColor: chalkColour
135
138
  }));
136
139
  if (fileName) await asciiToPng(await createAlexCLineArtwork({
137
140
  includeBox: false,
138
141
  includeColors: false,
139
- subtitleText,
140
- subtitleColor
142
+ subtitleText
141
143
  }), {
142
144
  fileName: typeof fileName === "string" ? fileName : void 0,
143
- fontSize: 90
145
+ fontSize: 90,
146
+ subtitleColor,
147
+ subtitleLineCount: subtitleText?.split("\n").length
144
148
  });
145
149
  });
146
150
  }
@@ -1311,7 +1315,7 @@ function parseZodSchemaForProgram(programError, schema, data) {
1311
1315
  //#endregion
1312
1316
  //#region package.json
1313
1317
  var name = "alex-c-line";
1314
- var version = "1.30.1";
1318
+ var version = "1.30.2";
1315
1319
  var description = "Command-line tool with commands to streamline the developer workflow.";
1316
1320
 
1317
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 = "#22c55e", fontSize = 48, fontFamily = [
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;
@@ -83,26 +86,27 @@ async function createAlexCLineArtwork(options) {
83
86
  //#endregion
84
87
  //#region src/commands/artwork.ts
85
88
  function artwork(program) {
86
- program.command("artwork").description("Create the artwork for alex-c-line").option("--subtitle-text <subtitleText>", "Customise the subtitle text").option("--subtitle-color <subtitleColor>", "Customise the subtitle color", (subtitleColor) => {
87
- return {
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 = {
88
92
  green: chalk.green,
89
93
  white: chalk.white
90
94
  }[subtitleColor];
91
- }).option("--save-png [fileName]", "Save the artwork as a PNG file, optionally specifying the path").action(async ({ savePng: fileName, subtitleText, subtitleColor }) => {
92
95
  console.info(await createAlexCLineArtwork({
93
96
  includeBox: true,
94
97
  includeColors: true,
95
98
  subtitleText,
96
- subtitleColor
99
+ subtitleColor: chalkColour
97
100
  }));
98
101
  if (fileName) await asciiToPng(await createAlexCLineArtwork({
99
102
  includeBox: false,
100
103
  includeColors: false,
101
- subtitleText,
102
- subtitleColor
104
+ subtitleText
103
105
  }), {
104
106
  fileName: typeof fileName === "string" ? fileName : void 0,
105
- fontSize: 90
107
+ fontSize: 90,
108
+ subtitleColor,
109
+ subtitleLineCount: subtitleText?.split("\n").length
106
110
  });
107
111
  });
108
112
  }
@@ -1273,7 +1277,7 @@ function parseZodSchemaForProgram(programError, schema, data) {
1273
1277
  //#endregion
1274
1278
  //#region package.json
1275
1279
  var name = "alex-c-line";
1276
- var version = "1.30.1";
1280
+ var version = "1.30.2";
1277
1281
  var description = "Command-line tool with commands to streamline the developer workflow.";
1278
1282
 
1279
1283
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alex-c-line",
3
- "version": "1.30.1",
3
+ "version": "1.30.2",
4
4
  "description": "Command-line tool with commands to streamline the developer workflow.",
5
5
  "repository": {
6
6
  "type": "git",