logo-soup 0.2.1 → 0.2.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.
Files changed (2) hide show
  1. package/dist/cli.mjs +24 -12
  2. package/package.json +3 -2
package/dist/cli.mjs CHANGED
@@ -2,15 +2,28 @@ import { c as DENSITY_FACTOR, d as SCALE_FACTOR, i as BASE_SIZE, o as DEFAULT_EX
2
2
  import * as fsp from "node:fs/promises";
3
3
  import * as path from "node:path";
4
4
  import process from "node:process";
5
+ import * as ansis from "ansis";
5
6
  import { defineCommand, runMain } from "citty";
6
- import { consola } from "consola";
7
- import { colors } from "consola/utils";
8
7
 
9
8
  //#region package.json
10
9
  var name = "logo-soup";
11
- var version = "0.2.1";
10
+ var version = "0.2.2";
12
11
  var description = "Normalize logo dimensions for visual balance";
13
12
 
13
+ //#endregion
14
+ //#region src/log.ts
15
+ const log = {
16
+ success(message) {
17
+ console.log(`${ansis.green("✔")} ${message}`);
18
+ },
19
+ error(message) {
20
+ console.error(`${ansis.red("✖")} ${message}`);
21
+ },
22
+ info(message) {
23
+ console.log(`${ansis.cyan("●")} ${message}`);
24
+ }
25
+ };
26
+
14
27
  //#endregion
15
28
  //#region src/cli.ts
16
29
  const command = defineCommand({
@@ -53,11 +66,11 @@ const command = defineCommand({
53
66
  const dirPath = path.resolve(args.dir);
54
67
  try {
55
68
  if (!(await fsp.stat(dirPath)).isDirectory()) {
56
- consola.error(`Not a directory: ${dirPath}`);
69
+ log.error(`Not a directory: ${dirPath}`);
57
70
  process.exit(1);
58
71
  }
59
72
  } catch {
60
- consola.error(`Directory not found: ${dirPath}`);
73
+ log.error(`Directory not found: ${dirPath}`);
61
74
  process.exit(1);
62
75
  }
63
76
  const baseSize = parseNumericArg(args["base-size"], "base-size", BASE_SIZE);
@@ -75,30 +88,29 @@ const command = defineCommand({
75
88
  results[file] = dimensions;
76
89
  entries.push([file, dimensions]);
77
90
  }
78
- console.log();
79
- console.log(`${colors.cyan("●")} ${colors.bold(name)} ${colors.dim(`v${version}`)}`);
91
+ log.info(`${ansis.bold(name)} ${ansis.dim(`v${version}`)}`);
80
92
  console.log();
81
93
  const maxEntryLength = Math.max(...entries.map(([entry]) => entry.length));
82
94
  const total = entries.length;
83
95
  for (const [i, [file, dimensions]] of entries.entries()) {
84
96
  const branch = i === total - 1 ? "└─" : "├─";
85
- const dimStr = `${dimensions.width}${colors.dim("×")}${dimensions.height}`;
97
+ const dimStr = `${dimensions.width}${ansis.dim("×")}${dimensions.height}`;
86
98
  const padding = " ".repeat(maxEntryLength - file.length + 2);
87
- console.log(` ${colors.dim(branch)} ${colors.cyan(file)}${padding}${dimStr}`);
99
+ console.log(` ${ansis.dim(branch)} ${ansis.cyan(file)}${padding}${dimStr}`);
88
100
  }
89
101
  const outputPath = path.resolve(args.output);
90
102
  await fsp.mkdir(path.dirname(outputPath), { recursive: true });
91
- await fsp.writeFile(outputPath, `${JSON.stringify(results, null, 2)}\n`);
103
+ await fsp.writeFile(outputPath, `${JSON.stringify(results, void 0, 2)}\n`);
92
104
  const relativeOutput = path.relative(process.cwd(), outputPath);
93
105
  console.log();
94
- consola.success(`Wrote ${colors.bold(String(total))} entries to ${colors.cyan(relativeOutput)}`);
106
+ log.success(`Wrote ${ansis.bold(String(total))} entries to ${ansis.cyan(relativeOutput)}`);
95
107
  }
96
108
  });
97
109
  function parseNumericArg(value, name, fallback) {
98
110
  if (value == null) return fallback;
99
111
  const parsedNumber = Number(value);
100
112
  if (Number.isNaN(parsedNumber)) {
101
- consola.error(`Invalid value for --${name}: "${value}" (expected a number)`);
113
+ log.error(`Invalid value for --${name}: "${value}" (expected a number)`);
102
114
  process.exit(1);
103
115
  }
104
116
  return parsedNumber;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "logo-soup",
3
3
  "type": "module",
4
- "version": "0.2.1",
4
+ "version": "0.2.2",
5
5
  "packageManager": "pnpm@10.30.0",
6
6
  "description": "Normalize logo dimensions for visual balance",
7
7
  "author": "Johann Schopplich <hello@johannschopplich.com>",
@@ -40,6 +40,7 @@
40
40
  "dist"
41
41
  ],
42
42
  "scripts": {
43
+ "dev": "node src/cli.ts",
43
44
  "build": "tsdown",
44
45
  "lint": "eslint .",
45
46
  "lint:fix": "eslint . --fix",
@@ -48,8 +49,8 @@
48
49
  "release": "bumpp"
49
50
  },
50
51
  "dependencies": {
52
+ "ansis": "^4.2.0",
51
53
  "citty": "^0.2.1",
52
- "consola": "^3.4.2",
53
54
  "sharp": "^0.34.5"
54
55
  },
55
56
  "devDependencies": {