@massimo-cassandro/create-favicons 1.3.7 → 1.4.1
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 +2 -2
- package/package.json +4 -5
- package/readme.md +6 -0
- package/src/create-favicons.mjs +3 -3
- package/src/print-frame.mjs +12 -7
- package/src/print-result.mjs +0 -1
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
|
|
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
|
-
|
|
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
|
+
"version": "1.4.1",
|
|
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
|
-
"
|
|
36
|
-
"sharp": "^0.33.2",
|
|
35
|
+
"sharp": "^0.33.5",
|
|
37
36
|
"sharp-ico": "^0.1.5",
|
|
38
|
-
"svgo": "^3.2
|
|
37
|
+
"svgo": "^3.3.2"
|
|
39
38
|
},
|
|
40
39
|
"devDependencies": {
|
|
41
|
-
"@massimo-cassandro/dev-updater": "^1.0
|
|
40
|
+
"@massimo-cassandro/dev-updater": "^2.1.0"
|
|
42
41
|
}
|
|
43
42
|
}
|
package/readme.md
CHANGED
|
@@ -6,6 +6,12 @@ I file da elaborare devono essere in formato SVG, mentre quelli generati sono in
|
|
|
6
6
|
|
|
7
7
|
Le immagini sono generate con [Sharp](https://sharp.pixelplumbing.com/), [SVGO](https://github.com/svg/svgo) e [sharp-ico](https://github.com/ssnangua/sharp-ico).
|
|
8
8
|
|
|
9
|
+
## Installazione
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm i -D @massimo-cassandro/create-favicons
|
|
13
|
+
```
|
|
14
|
+
|
|
9
15
|
|
|
10
16
|
## Creazione template file di config (vedi più avanti)
|
|
11
17
|
|
package/src/create-favicons.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// import * as fs from 'fs';
|
|
4
4
|
// import * as path from 'path';
|
|
5
|
-
import
|
|
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
|
-
|
|
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
|
-
|
|
34
|
+
log('bgRed', ` ${err} `, 'error');
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
}
|
package/src/print-frame.mjs
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import chalk from 'chalk';
|
|
3
2
|
|
|
4
|
-
// https://
|
|
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
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
55
|
+
log(options.frameColor, frames_elements[2] + frames_elements[4].repeat(total_length) + `${frames_elements[3]}\n` );
|
|
51
56
|
}
|