@massimo-cassandro/create-favicons 1.3.7 → 1.4.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/index.mjs CHANGED
@@ -7,7 +7,7 @@
7
7
  import * as fs from 'fs';
8
8
  import * as path from 'path';
9
9
 
10
- import chalk from 'chalk';
10
+ import { log } from './src/print-frame.mjs';
11
11
 
12
12
  import { parseParams } from './src/parse-params.mjs';
13
13
  import { default_params } from './src/default-params.mjs';
@@ -66,5 +66,5 @@ try {
66
66
 
67
67
 
68
68
  } catch(err) {
69
- console.error(chalk.bgRed(`\n ${err} \n`));
69
+ log('bgRed', `\n ${err} \n`, 'error');
70
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massimo-cassandro/create-favicons",
3
- "version": "1.3.7",
3
+ "version": "1.4.0",
4
4
  "description": "Favicon files builder",
5
5
  "bin": {
6
6
  "create-favicons": "./index.mjs"
@@ -32,12 +32,11 @@
32
32
  "npm": ">= 9.0.0"
33
33
  },
34
34
  "dependencies": {
35
- "chalk": "^5.3.0",
36
- "sharp": "^0.33.2",
35
+ "sharp": "^0.33.5",
37
36
  "sharp-ico": "^0.1.5",
38
- "svgo": "^3.2.0"
37
+ "svgo": "^3.3.2"
39
38
  },
40
39
  "devDependencies": {
41
- "@massimo-cassandro/dev-updater": "^1.0.0"
40
+ "@massimo-cassandro/dev-updater": "^2.1.0"
42
41
  }
43
42
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  // import * as fs from 'fs';
4
4
  // import * as path from 'path';
5
- import chalk from 'chalk';
5
+ import { log } from './print-frame.mjs';
6
6
 
7
7
  import { createIco } from './create-ico.mjs';
8
8
  import { createPng } from './create-png.mjs';
@@ -16,7 +16,7 @@ export async function createFavicons(params) {
16
16
 
17
17
  try {
18
18
 
19
- console.error(chalk.green('Creating favicons...'));
19
+ log('green', 'Creating favicons...');
20
20
 
21
21
  await Promise.all([
22
22
  createSvg(params),
@@ -31,7 +31,7 @@ export async function createFavicons(params) {
31
31
  })
32
32
 
33
33
  } catch(err) {
34
- console.error(chalk.bgRed(` ${err} `));
34
+ log('bgRed', ` ${err} `, 'error');
35
35
  }
36
36
 
37
37
  }
@@ -1,7 +1,12 @@
1
1
  /* eslint-disable no-console */
2
- import chalk from 'chalk';
3
2
 
4
- // https://github.com/chalk/chalk
3
+ // https://nodejs.org/api/util.html#utilstyletextformat-text-options
4
+ import { styleText } from 'node:util';
5
+
6
+ export function log(color, string, mode='log') {
7
+ console[mode]( styleText(color, string) );
8
+ }
9
+
5
10
  export function printFrame(options) {
6
11
 
7
12
  /*
@@ -37,15 +42,15 @@ export function printFrame(options) {
37
42
 
38
43
  const total_length = Math.max( ...(options.strings.map(item => item.string.length)) ) + 2;
39
44
 
40
- console.log( chalk[options.frameColor]( `\n${frames_elements[0]}` + frames_elements[4].repeat(total_length) + frames_elements[1]) );
45
+ log( options.frameColor, `\n${frames_elements[0]}` + frames_elements[4].repeat(total_length) + frames_elements[1] );
41
46
 
42
47
  options.strings.forEach(item => {
43
48
  console.log(
44
- chalk[options.frameColor](`${frames_elements[5]} `) +
45
- chalk[item.color](item.string) + ' '.repeat(total_length - item.string.length - 2) +
46
- chalk[options.frameColor](` ${frames_elements[5]}`)
49
+ styleText(options.frameColor, `${frames_elements[5]} `) +
50
+ styleText(item.color, item.string) + ' '.repeat(total_length - item.string.length - 2) +
51
+ styleText(options.frameColor, ` ${frames_elements[5]}`)
47
52
  );
48
53
  });
49
54
 
50
- console.log( chalk[options.frameColor]( frames_elements[2] + frames_elements[4].repeat(total_length) + `${frames_elements[3]}\n` ) );
55
+ log(options.frameColor, frames_elements[2] + frames_elements[4].repeat(total_length) + `${frames_elements[3]}\n` );
51
56
  }
@@ -3,7 +3,6 @@ import { remove_homedir_string } from './remove-homedir-string.mjs';
3
3
  import * as fs from 'fs';
4
4
 
5
5
 
6
- // https://github.com/chalk/chalk
7
6
  export function printResult(params) {
8
7
 
9
8
  function printSize(size) {