pulp-image 0.1.3 → 0.1.4

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/package.json +1 -1
  2. package/src/banner.js +31 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pulp-image",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "A CLI tool for processing images with resize, format conversion, and optimization",
5
5
  "type": "module",
6
6
  "main": "bin/pulp.js",
package/src/banner.js CHANGED
@@ -1,10 +1,33 @@
1
- export const getBanner = (version) => `
2
- ╔════════════════════════════════════════╗
3
- ║ ║
4
- ║ 🍊 pulp-image v${version} ║
5
- ║ ║
6
- ║ Image processing made simple ║
7
- ║ ║
8
- ╚════════════════════════════════════════╝
1
+ export const getBanner = (version) => {
2
+ const title = `🍊 pulp-image v${version}`;
3
+ const subtitle = `Image processing made simple`;
4
+
5
+ // Calculate width: use the longest line + padding
6
+ const contentWidth = Math.max(title.length, subtitle.length);
7
+ const padding = 4; // 2 spaces on each side
8
+ const width = contentWidth + padding;
9
+
10
+ // Generate borders
11
+ const topBorder = `╔${'═'.repeat(width)}╗`;
12
+ const bottomBorder = `╚${'═'.repeat(width)}╝`;
13
+ const emptyLine = `║${' '.repeat(width)}║`;
14
+
15
+ // Center the text lines
16
+ const centerText = (text, totalWidth) => {
17
+ const spaces = totalWidth - text.length;
18
+ const leftPad = Math.floor(spaces / 2);
19
+ const rightPad = spaces - leftPad;
20
+ return `║${' '.repeat(leftPad)}${text}${' '.repeat(rightPad)}║`;
21
+ };
22
+
23
+ return `
24
+ ${topBorder}
25
+ ${emptyLine}
26
+ ${centerText(title, width)}
27
+ ${emptyLine}
28
+ ${centerText(subtitle, width)}
29
+ ${emptyLine}
30
+ ${bottomBorder}
9
31
  `;
32
+ };
10
33