echo-banner 0.2.0 → 0.3.0

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
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * echo-banner v0.2.0
2
+ * echo-banner v0.3.0
3
3
  * Generate multiline build banners and ASCII CLI titles
4
4
  *
5
5
  * (c) 2026 Sriman
@@ -8,4 +8,4 @@
8
8
  * https://teneplaysofficial.github.io/echo-banner
9
9
  * https://github.com/teneplaysofficial/echo-banner
10
10
  */
11
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`node:os`),l=require(`figlet`);l=s(l);function u({pkg:e,shebang:t=!1,style:n=`js`,useDisplayName:r=!1,prefixVersion:i=`v`,fallback:a={name:`unknown`,version:`0.0.0`}}){if(!e||typeof e!=`object`)throw TypeError(`Expected valid metadata`);let o=``,s=[],l=new Date().getFullYear(),u=/^(git\+)|(\.git)$/g;t&&(o+=t+c.EOL.repeat(2)),s.push(`${(r?e.displayName:e.name)??a.name} ${i}${e.version??a.version}`),s.push(e.description??``),s.push(``),s.push(`(c) ${l} ${(typeof e.author==`object`?e.author.name:e.author)??``}`),e.license&&s.push(`Released under the ${e.license} License`),s.push(``);let d=e.homepage;d&&s.push(d);let f=typeof e.repository==`object`?e.repository.url?.replace(u,``):e.repository?.replace(u,``);switch(f&&s.push(f),n){case`js`:o+=[`/*!`,...s.slice(0,s.findLastIndex(e=>e!==``)+1).map(e=>` * ${e}`),` */`].join(c.EOL);break}return o}async function d({pkg:e,useVersion:t=!0,useDisplayName:n=!0,prefixVersion:r=`v`,font:i=`Slant`}){let a=n&&e.displayName||e.name;if(!a)return;let o=await l.default.text(a,{font:i});if(!t||!e.version){console.log(o);return}let s=o.split(c.EOL),u=`${r}${e.version}`,d=s.findLastIndex(e=>e.trim().length>0);if(d<0){console.log(o);return}let f=Math.max(...s.map(e=>e.trimEnd().length)),p=s[d].trimEnd(),m=f-p.length+2;s[d]=p+` `.repeat(m)+u,console.log(s.join(c.EOL))}exports.banner=u,exports.print=d;
11
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`node:os`),l=require(`figlet`);l=s(l);let u=require(`use-colors`);u=s(u);function d({pkg:e,shebang:t=!1,style:n=`js`,useDisplayName:r=!1,prefixVersion:i=`v`,fallback:a={name:`unknown`,version:`0.0.0`}}){if(!e||typeof e!=`object`)throw TypeError(`Expected valid metadata`);let o=``,s=[],l=new Date().getFullYear(),u=/^(git\+)|(\.git)$/g;t&&(o+=t+c.EOL.repeat(2)),s.push(`${(r?e.displayName:e.name)??a.name} ${i}${e.version??a.version}`),s.push(e.description??``),s.push(``),s.push(`(c) ${l} ${(typeof e.author==`object`?e.author.name:e.author)??``}`),e.license&&s.push(`Released under the ${e.license} License`),s.push(``);let d=e.homepage;d&&s.push(d);let f=typeof e.repository==`object`?e.repository.url?.replace(u,``):e.repository?.replace(u,``);switch(f&&s.push(f),n){case`js`:o+=[`/*!`,...s.slice(0,s.findLastIndex(e=>e!==``)+1).map(e=>` * ${e}`),` */`].join(c.EOL);break}return o}async function f({pkg:e,useVersion:t=!0,useDisplayName:n=!0,prefixVersion:r=`v`,font:i=`Slant`,color:a=!0}){let o=n&&e.displayName||e.name;if(!o)return;a||u.default.config({level:0});let s=await l.default.text(o,{font:i});if(!t||!e.version){console.log(u.default.cyanBright(s));return}let d=s.split(c.EOL),f=u.default.gray`${r}${e.version}`,p=d.findLastIndex(e=>e.trim().length>0);if(p<0){console.log(u.default.cyanBright(s));return}let m=Math.max(...d.map(e=>e.trimEnd().length)),h=d[p].trimEnd(),g=m-h.length+2;d[p]=u.default.cyanBright(h)+` `.repeat(g)+f,console.log(d.join(c.EOL))}exports.banner=d,exports.print=f;
package/dist/index.d.cts CHANGED
@@ -98,6 +98,7 @@ type FontName = '1Row' | '3-D' | '3D Diagonal' | '3D-ASCII' | '3x5' | '4Max' | '
98
98
  * - If `useVersion` is enabled and `pkg.version` exists, the version will be aligned to the
99
99
  * right side of the banner's last visible line.
100
100
  * - If the banner contains no printable lines, the raw FIGlet output is printed.
101
+ * - If `color` is disabled, all ANSI styling is turned off.
101
102
  *
102
103
  * @example
103
104
  * ```ts
@@ -133,13 +134,22 @@ type FontName = '1Row' | '3-D' | '3D Diagonal' | '3D-ASCII' | '3x5' | '4Max' | '
133
134
  * useDisplayName: false
134
135
  * });
135
136
  * ```
137
+ *
138
+ * @example Disable colors
139
+ * ```ts
140
+ * await print({
141
+ * pkg,
142
+ * color: false
143
+ * });
144
+ * ```
136
145
  */
137
146
  declare function print({
138
147
  pkg,
139
148
  useVersion,
140
149
  useDisplayName,
141
150
  prefixVersion,
142
- font
151
+ font,
152
+ color
143
153
  }: {
144
154
  /** Package metadata containing the name, optional display name, and version. */pkg: Pick<PackageMeta, 'name' | 'displayName' | 'version'>;
145
155
  /**
@@ -168,6 +178,12 @@ declare function print({
168
178
  * @default "Slant"
169
179
  */
170
180
  font?: FontName;
181
+ /**
182
+ * Enable or disable colored output.
183
+ *
184
+ * @default true
185
+ */
186
+ color?: boolean;
171
187
  }): Promise<void>;
172
188
  //#endregion
173
189
  export { banner, print };
package/dist/index.d.mts CHANGED
@@ -98,6 +98,7 @@ type FontName = '1Row' | '3-D' | '3D Diagonal' | '3D-ASCII' | '3x5' | '4Max' | '
98
98
  * - If `useVersion` is enabled and `pkg.version` exists, the version will be aligned to the
99
99
  * right side of the banner's last visible line.
100
100
  * - If the banner contains no printable lines, the raw FIGlet output is printed.
101
+ * - If `color` is disabled, all ANSI styling is turned off.
101
102
  *
102
103
  * @example
103
104
  * ```ts
@@ -133,13 +134,22 @@ type FontName = '1Row' | '3-D' | '3D Diagonal' | '3D-ASCII' | '3x5' | '4Max' | '
133
134
  * useDisplayName: false
134
135
  * });
135
136
  * ```
137
+ *
138
+ * @example Disable colors
139
+ * ```ts
140
+ * await print({
141
+ * pkg,
142
+ * color: false
143
+ * });
144
+ * ```
136
145
  */
137
146
  declare function print({
138
147
  pkg,
139
148
  useVersion,
140
149
  useDisplayName,
141
150
  prefixVersion,
142
- font
151
+ font,
152
+ color
143
153
  }: {
144
154
  /** Package metadata containing the name, optional display name, and version. */pkg: Pick<PackageMeta, 'name' | 'displayName' | 'version'>;
145
155
  /**
@@ -168,6 +178,12 @@ declare function print({
168
178
  * @default "Slant"
169
179
  */
170
180
  font?: FontName;
181
+ /**
182
+ * Enable or disable colored output.
183
+ *
184
+ * @default true
185
+ */
186
+ color?: boolean;
171
187
  }): Promise<void>;
172
188
  //#endregion
173
189
  export { banner, print };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * echo-banner v0.2.0
2
+ * echo-banner v0.3.0
3
3
  * Generate multiline build banners and ASCII CLI titles
4
4
  *
5
5
  * (c) 2026 Sriman
@@ -8,4 +8,4 @@
8
8
  * https://teneplaysofficial.github.io/echo-banner
9
9
  * https://github.com/teneplaysofficial/echo-banner
10
10
  */
11
- import{EOL as e}from"node:os";import t from"figlet";function n({pkg:t,shebang:n=!1,style:r=`js`,useDisplayName:i=!1,prefixVersion:a=`v`,fallback:o={name:`unknown`,version:`0.0.0`}}){if(!t||typeof t!=`object`)throw TypeError(`Expected valid metadata`);let s=``,c=[],l=new Date().getFullYear(),u=/^(git\+)|(\.git)$/g;n&&(s+=n+e.repeat(2)),c.push(`${(i?t.displayName:t.name)??o.name} ${a}${t.version??o.version}`),c.push(t.description??``),c.push(``),c.push(`(c) ${l} ${(typeof t.author==`object`?t.author.name:t.author)??``}`),t.license&&c.push(`Released under the ${t.license} License`),c.push(``);let d=t.homepage;d&&c.push(d);let f=typeof t.repository==`object`?t.repository.url?.replace(u,``):t.repository?.replace(u,``);switch(f&&c.push(f),r){case`js`:s+=[`/*!`,...c.slice(0,c.findLastIndex(e=>e!==``)+1).map(e=>` * ${e}`),` */`].join(e);break}return s}async function r({pkg:n,useVersion:r=!0,useDisplayName:i=!0,prefixVersion:a=`v`,font:o=`Slant`}){let s=i&&n.displayName||n.name;if(!s)return;let c=await t.text(s,{font:o});if(!r||!n.version){console.log(c);return}let l=c.split(e),u=`${a}${n.version}`,d=l.findLastIndex(e=>e.trim().length>0);if(d<0){console.log(c);return}let f=Math.max(...l.map(e=>e.trimEnd().length)),p=l[d].trimEnd(),m=f-p.length+2;l[d]=p+` `.repeat(m)+u,console.log(l.join(e))}export{n as banner,r as print};
11
+ import{EOL as e}from"node:os";import t from"figlet";import n from"use-colors";function r({pkg:t,shebang:n=!1,style:r=`js`,useDisplayName:i=!1,prefixVersion:a=`v`,fallback:o={name:`unknown`,version:`0.0.0`}}){if(!t||typeof t!=`object`)throw TypeError(`Expected valid metadata`);let s=``,c=[],l=new Date().getFullYear(),u=/^(git\+)|(\.git)$/g;n&&(s+=n+e.repeat(2)),c.push(`${(i?t.displayName:t.name)??o.name} ${a}${t.version??o.version}`),c.push(t.description??``),c.push(``),c.push(`(c) ${l} ${(typeof t.author==`object`?t.author.name:t.author)??``}`),t.license&&c.push(`Released under the ${t.license} License`),c.push(``);let d=t.homepage;d&&c.push(d);let f=typeof t.repository==`object`?t.repository.url?.replace(u,``):t.repository?.replace(u,``);switch(f&&c.push(f),r){case`js`:s+=[`/*!`,...c.slice(0,c.findLastIndex(e=>e!==``)+1).map(e=>` * ${e}`),` */`].join(e);break}return s}async function i({pkg:r,useVersion:i=!0,useDisplayName:a=!0,prefixVersion:o=`v`,font:s=`Slant`,color:c=!0}){let l=a&&r.displayName||r.name;if(!l)return;c||n.config({level:0});let u=await t.text(l,{font:s});if(!i||!r.version){console.log(n.cyanBright(u));return}let d=u.split(e),f=n.gray`${o}${r.version}`,p=d.findLastIndex(e=>e.trim().length>0);if(p<0){console.log(n.cyanBright(u));return}let m=Math.max(...d.map(e=>e.trimEnd().length)),h=d[p].trimEnd(),g=m-h.length+2;d[p]=n.cyanBright(h)+` `.repeat(g)+f,console.log(d.join(e))}export{r as banner,i as print};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "echo-banner",
3
3
  "displayName": "Echo Banner",
4
- "version": "0.2.0",
4
+ "version": "0.3.0",
5
5
  "description": "Generate multiline build banners and ASCII CLI titles",
6
6
  "keywords": [
7
7
  "cli",
@@ -53,7 +53,8 @@
53
53
  },
54
54
  "dependencies": {
55
55
  "figlet": "^1.10.0",
56
- "js-utils-kit": "^2.1.0"
56
+ "js-utils-kit": "^2.1.0",
57
+ "use-colors": "^0.1.0"
57
58
  },
58
59
  "devDependencies": {
59
60
  "@biomejs/biome": "^2.4.5",