@massimo-cassandro/create-favicons 1.3.6 → 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 +3 -3
- package/package.json +4 -5
- package/readme.md +1 -0
- package/src/create-favicons.mjs +3 -3
- package/src/create-snippet.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';
|
|
@@ -58,7 +58,7 @@ try {
|
|
|
58
58
|
|
|
59
59
|
} else {
|
|
60
60
|
|
|
61
|
-
throw new Error( `'${config_filename}' e '${
|
|
61
|
+
throw new Error( `'${config_filename}' e '${default_params.src_img}' non presenti`);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
}
|
|
@@ -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.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
|
-
"
|
|
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
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/create-snippet.mjs
CHANGED
|
@@ -11,9 +11,9 @@ export async function createSnippet(params) {
|
|
|
11
11
|
.replace('%_cache_buster_%', cache_buster);
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
let snippet_content = `<link rel="icon" href="${create_href('favicon.ico')}" sizes="32x32"
|
|
15
|
-
`<link rel="icon" href="${create_href('favicon.svg')}" type="image/svg+xml"
|
|
16
|
-
`<link rel="apple-touch-icon" href="${create_href('apple-touch-icon.png')}"
|
|
14
|
+
let snippet_content = `<link rel="icon" href="${create_href('favicon.ico')}" sizes="32x32"/>\n` +
|
|
15
|
+
`<link rel="icon" href="${create_href('favicon.svg')}" type="image/svg+xml"/>\n` +
|
|
16
|
+
`<link rel="apple-touch-icon" href="${create_href('apple-touch-icon.png')}"/>\n` +
|
|
17
17
|
`<link rel="manifest" href="${create_href('manifest.webmanifest')}"/>`;
|
|
18
18
|
|
|
19
19
|
if (params.snippet_language === 'pug') {
|
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
|
}
|