@massimo-cassandro/create-favicons 1.3.2 → 1.3.3
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/package.json
CHANGED
package/src/create-favicons.mjs
CHANGED
|
@@ -12,13 +12,13 @@ import { createSnippet } from './create-snippet.mjs';
|
|
|
12
12
|
import { printResult } from './print-result.mjs';
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
export function createFavicons(params) {
|
|
15
|
+
export async function createFavicons(params) {
|
|
16
16
|
|
|
17
17
|
try {
|
|
18
18
|
|
|
19
19
|
console.error(chalk.green('Creating favicons...'));
|
|
20
20
|
|
|
21
|
-
Promise.all([
|
|
21
|
+
await Promise.all([
|
|
22
22
|
createSvg(params),
|
|
23
23
|
createPng(params),
|
|
24
24
|
createIco(params),
|
package/src/create-ico.mjs
CHANGED
package/src/create-png.mjs
CHANGED
|
@@ -4,7 +4,7 @@ export async function createPng(params) {
|
|
|
4
4
|
|
|
5
5
|
// https://sharp.pixelplumbing.com/api-constructor
|
|
6
6
|
// https://sharp.pixelplumbing.com/api-output#png
|
|
7
|
-
Promise.all([
|
|
7
|
+
await Promise.all([
|
|
8
8
|
['apple-touch-icon.png', 180],
|
|
9
9
|
['icon-192.png', 192],
|
|
10
10
|
['icon-512.png', 512]
|
package/src/create-snippet.mjs
CHANGED
|
@@ -28,7 +28,7 @@ export async function createSnippet(params) {
|
|
|
28
28
|
const targetFileContent = fs.readFileSync(params.snippet_target_file, 'utf8'),
|
|
29
29
|
regexp = /<!-- ?favicon-snippet-start ?-->(.*?)<!-- ?favicon-snippet-end ?-->/mis;
|
|
30
30
|
|
|
31
|
-
fs.promises.writeFile(params.snippet_target_file,
|
|
31
|
+
await fs.promises.writeFile(params.snippet_target_file,
|
|
32
32
|
targetFileContent.replace(regexp,
|
|
33
33
|
`<!-- favicon-snippet-start -->\n${snippet_content}\n<!-- favicon-snippet-end -->`
|
|
34
34
|
)
|
|
@@ -40,7 +40,7 @@ export async function createSnippet(params) {
|
|
|
40
40
|
|
|
41
41
|
} else {
|
|
42
42
|
|
|
43
|
-
fs.promises.writeFile(
|
|
43
|
+
await fs.promises.writeFile(
|
|
44
44
|
`${params.snippet_path}/${params.snippet_name}`,
|
|
45
45
|
snippet_content
|
|
46
46
|
);
|
package/src/create-svg.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import * as fs from 'fs/promises';
|
|
|
4
4
|
export async function createSvg(params) {
|
|
5
5
|
|
|
6
6
|
// TODO add extra config ???
|
|
7
|
-
fs.readFile(params.small_src_img?? params.src_img, { encoding: 'utf8' })
|
|
7
|
+
await fs.readFile(params.small_src_img?? params.src_img, { encoding: 'utf8' })
|
|
8
8
|
.then(svgString => {
|
|
9
9
|
|
|
10
10
|
const svg_result = optimize(svgString, { multipass: true});
|
|
@@ -9,6 +9,6 @@ export async function createWebmanifest(params) {
|
|
|
9
9
|
...(params.webmanifest_extra?? {})
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
fs.writeFile(`${params.output_dir}/manifest.webmanifest`, JSON.stringify(manifest, null, ' '));
|
|
12
|
+
await fs.writeFile(`${params.output_dir}/manifest.webmanifest`, JSON.stringify(manifest, null, ' '));
|
|
13
13
|
|
|
14
14
|
}
|
package/src/init-start-text.txt
CHANGED
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
dalla directory che contiene questo file.
|
|
10
10
|
|
|
11
|
+
(o `npx create-favicons --dir=./path/to/config/dir` dalla root del progetto)
|
|
12
|
+
|
|
13
|
+
TUTTI I PERCORSI DALLA DIRECTORY CHE CONTIENE IL FILE DI CONFIGURAZIONE
|
|
14
|
+
|
|
11
15
|
Creazione favicons (senza installare il package nel progetto):
|
|
12
16
|
npx --package=@massimo-cassandro/create-favicons create-favicons (dalla dir corrente)
|
|
13
17
|
|