alex-c-line 2.2.3 → 2.2.5

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
@@ -377,26 +377,62 @@ function gitPostMergeCleanup(program) {
377
377
  });
378
378
  }
379
379
  //#endregion
380
+ //#region src/utility/constants/warningPrefix.ts
381
+ const warningPrefix = "WARNING:";
382
+ //#endregion
383
+ //#region src/utility/fileSystem/readdirSafe.ts
384
+ async function readdirSafe(path) {
385
+ try {
386
+ return await (0, node_fs_promises.readdir)(path, { withFileTypes: true });
387
+ } catch (error) {
388
+ if (error instanceof Error && "code" in error && error.code === "ENOTDIR") return;
389
+ throw error;
390
+ }
391
+ }
392
+ //#endregion
380
393
  //#region src/cli/commands/internal/media/generate.ts
381
394
  function internalMediaGenerate(program) {
382
- program.command("generate").argument("[directory]", "The directory to generate from", process.cwd()).action(async (directory) => {
395
+ program.command("generate").argument("[target]", "The directory to generate from", process.cwd()).option("--ignore <ignore>", "Extra directories to ignore as comma-separated list").action(async (target, { ignore }) => {
396
+ const ignored = new Set([
397
+ ".git",
398
+ "node_modules",
399
+ "__pycache__",
400
+ ".venv",
401
+ "helpers",
402
+ ...ignore ? ignore.split(",") : []
403
+ ]);
404
+ async function renderFile(file) {
405
+ const relativePath = node_path.default.relative(process.cwd(), file);
406
+ console.info(`Rendering ${relativePath}...`);
407
+ try {
408
+ return await (0, execa.execa)({
409
+ stdio: "inherit",
410
+ env: {
411
+ ...process.env,
412
+ PYTHONPATH: node_path.default.resolve("src")
413
+ }
414
+ })`manim -qh ${file}`;
415
+ } catch (error) {
416
+ if (error instanceof execa.ExecaError) program.error(`${errorPrefix} An error has occurred with Manim while rendering ${relativePath}.`, {
417
+ exitCode: error.exitCode ?? 1,
418
+ code: "MANIM_ERROR"
419
+ });
420
+ else throw error;
421
+ }
422
+ }
383
423
  async function readDirectory(directory) {
384
- const directoryContents = await (0, node_fs_promises.readdir)(directory, { withFileTypes: true });
385
- for (const entry of directoryContents) {
424
+ const entries = await readdirSafe(directory);
425
+ if (entries === void 0) return;
426
+ for (const entry of entries) {
386
427
  const fullPath = node_path.default.join(directory, entry.name);
387
- if (entry.isDirectory() && ![
388
- ".git",
389
- "node_modules",
390
- "__pycache__",
391
- ".venv"
392
- ].includes(entry.name)) await readDirectory(fullPath);
393
- if (entry.isFile() && entry.name.endsWith(".py")) {
394
- console.info(`Rendering ${node_path.default.relative(process.cwd(), fullPath)}...`);
395
- await (0, execa.execa)({ stdio: "inherit" })`manim -qh ${fullPath}`;
396
- }
428
+ if (entry.isDirectory() && !ignored.has(entry.name)) await readDirectory(fullPath);
429
+ else if (entry.isFile() && entry.name.endsWith(".py")) await renderFile(fullPath);
397
430
  }
398
431
  }
399
- await readDirectory(directory);
432
+ const statResult = await (0, node_fs_promises.stat)(target);
433
+ if (statResult.isFile()) await renderFile(target);
434
+ else if (statResult.isDirectory()) await readDirectory(target);
435
+ else console.warn(`${warningPrefix} Not a file or directory.`);
400
436
  });
401
437
  }
402
438
  //#endregion
@@ -1199,7 +1235,7 @@ function template(program) {
1199
1235
  //#endregion
1200
1236
  //#region package.json
1201
1237
  var name = "alex-c-line";
1202
- var version$1 = "2.2.3";
1238
+ var version$1 = "2.2.5";
1203
1239
  var description = "Command-line tool with commands to streamline the developer workflow.";
1204
1240
  //#endregion
1205
1241
  //#region src/utility/updates/checkUpdate.ts
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import boxen from "boxen";
7
7
  import figlet from "figlet";
8
8
  import path from "node:path";
9
9
  import { createCanvas } from "canvas";
10
- import { access, mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises";
10
+ import { access, mkdir, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
11
11
  import envPaths from "env-paths";
12
12
  import { confirm, input, password, select } from "@inquirer/prompts";
13
13
  import { parse } from "dotenv";
@@ -346,26 +346,62 @@ function gitPostMergeCleanup(program) {
346
346
  });
347
347
  }
348
348
  //#endregion
349
+ //#region src/utility/constants/warningPrefix.ts
350
+ const warningPrefix = "WARNING:";
351
+ //#endregion
352
+ //#region src/utility/fileSystem/readdirSafe.ts
353
+ async function readdirSafe(path) {
354
+ try {
355
+ return await readdir(path, { withFileTypes: true });
356
+ } catch (error) {
357
+ if (error instanceof Error && "code" in error && error.code === "ENOTDIR") return;
358
+ throw error;
359
+ }
360
+ }
361
+ //#endregion
349
362
  //#region src/cli/commands/internal/media/generate.ts
350
363
  function internalMediaGenerate(program) {
351
- program.command("generate").argument("[directory]", "The directory to generate from", process.cwd()).action(async (directory) => {
364
+ program.command("generate").argument("[target]", "The directory to generate from", process.cwd()).option("--ignore <ignore>", "Extra directories to ignore as comma-separated list").action(async (target, { ignore }) => {
365
+ const ignored = new Set([
366
+ ".git",
367
+ "node_modules",
368
+ "__pycache__",
369
+ ".venv",
370
+ "helpers",
371
+ ...ignore ? ignore.split(",") : []
372
+ ]);
373
+ async function renderFile(file) {
374
+ const relativePath = path.relative(process.cwd(), file);
375
+ console.info(`Rendering ${relativePath}...`);
376
+ try {
377
+ return await execa({
378
+ stdio: "inherit",
379
+ env: {
380
+ ...process.env,
381
+ PYTHONPATH: path.resolve("src")
382
+ }
383
+ })`manim -qh ${file}`;
384
+ } catch (error) {
385
+ if (error instanceof ExecaError) program.error(`${errorPrefix} An error has occurred with Manim while rendering ${relativePath}.`, {
386
+ exitCode: error.exitCode ?? 1,
387
+ code: "MANIM_ERROR"
388
+ });
389
+ else throw error;
390
+ }
391
+ }
352
392
  async function readDirectory(directory) {
353
- const directoryContents = await readdir(directory, { withFileTypes: true });
354
- for (const entry of directoryContents) {
393
+ const entries = await readdirSafe(directory);
394
+ if (entries === void 0) return;
395
+ for (const entry of entries) {
355
396
  const fullPath = path.join(directory, entry.name);
356
- if (entry.isDirectory() && ![
357
- ".git",
358
- "node_modules",
359
- "__pycache__",
360
- ".venv"
361
- ].includes(entry.name)) await readDirectory(fullPath);
362
- if (entry.isFile() && entry.name.endsWith(".py")) {
363
- console.info(`Rendering ${path.relative(process.cwd(), fullPath)}...`);
364
- await execa({ stdio: "inherit" })`manim -qh ${fullPath}`;
365
- }
397
+ if (entry.isDirectory() && !ignored.has(entry.name)) await readDirectory(fullPath);
398
+ else if (entry.isFile() && entry.name.endsWith(".py")) await renderFile(fullPath);
366
399
  }
367
400
  }
368
- await readDirectory(directory);
401
+ const statResult = await stat(target);
402
+ if (statResult.isFile()) await renderFile(target);
403
+ else if (statResult.isDirectory()) await readDirectory(target);
404
+ else console.warn(`${warningPrefix} Not a file or directory.`);
369
405
  });
370
406
  }
371
407
  //#endregion
@@ -1168,7 +1204,7 @@ function template(program) {
1168
1204
  //#endregion
1169
1205
  //#region package.json
1170
1206
  var name = "alex-c-line";
1171
- var version$1 = "2.2.3";
1207
+ var version$1 = "2.2.5";
1172
1208
  var description = "Command-line tool with commands to streamline the developer workflow.";
1173
1209
  //#endregion
1174
1210
  //#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.2.3",
3
+ "version": "2.2.5",
4
4
  "description": "Command-line tool with commands to streamline the developer workflow.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -45,7 +45,7 @@
45
45
  "dotenv-stringify": "^3.0.1",
46
46
  "env-paths": "^4.0.0",
47
47
  "execa": "^9.6.1",
48
- "figlet": "^1.10.0",
48
+ "figlet": "^1.11.0",
49
49
  "gray-matter": "^4.0.3",
50
50
  "libsodium-wrappers": "^0.8.2",
51
51
  "semver": "^7.7.4",
@@ -53,10 +53,10 @@
53
53
  "zod": "^4.3.6"
54
54
  },
55
55
  "devDependencies": {
56
- "@alextheman/eslint-plugin": "^5.10.0",
56
+ "@alextheman/eslint-plugin": "^5.10.1",
57
57
  "@commander-js/extra-typings": "^14.0.0",
58
58
  "@types/eslint": "^9.6.1",
59
- "@types/node": "^25.3.5",
59
+ "@types/node": "^25.5.0",
60
60
  "@types/semver": "^7.7.1",
61
61
  "@types/update-notifier": "^6.0.8",
62
62
  "cross-env": "^10.1.0",
@@ -66,11 +66,11 @@
66
66
  "prettier": "^3.8.1",
67
67
  "tempy": "^3.2.0",
68
68
  "ts-node": "^10.9.2",
69
- "tsdown": "^0.21.0",
69
+ "tsdown": "^0.21.2",
70
70
  "typescript": "^5.9.3",
71
- "typescript-eslint": "^8.56.1",
71
+ "typescript-eslint": "^8.57.0",
72
72
  "vite-tsconfig-paths": "^6.1.1",
73
- "vitest": "^4.0.18"
73
+ "vitest": "^4.1.0"
74
74
  },
75
75
  "engines": {
76
76
  "node": ">=22.0.0"