@massimo-cassandro/create-favicons 1.3.2 → 1.3.4

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massimo-cassandro/create-favicons",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "Favicon files builder",
5
5
  "bin": {
6
6
  "create-favicons": "./index.mjs"
@@ -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),
@@ -5,7 +5,7 @@ import ico from 'sharp-ico';
5
5
 
6
6
  export async function createIco(params) {
7
7
 
8
- ico.sharpsToIco(
8
+ await ico.sharpsToIco(
9
9
  [sharp(params.small_src_img?? params.src_img)],
10
10
  `${params.output_dir}/favicon.ico`,
11
11
  {
@@ -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]
@@ -11,13 +11,13 @@ 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">\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
- `<link rel="manifest" href="${create_href('manifest.webmanifest')}">`;
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')}"/>` +
17
+ `<link rel="manifest" href="${create_href('manifest.webmanifest')}"/>`;
18
18
 
19
19
  if (params.snippet_language === 'pug') {
20
- snippet_content = snippet_content.replace(/<link (.*?)>/g, 'link($1)');
20
+ snippet_content = snippet_content.replace(/<link (.*?)\/?>/g, 'link($1)');
21
21
  }
22
22
 
23
23
  snippet_content = params.snippet_template.replace('%_link_tags_%', snippet_content);
@@ -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
  }
@@ -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