@massimo-cassandro/create-favicons 1.3.1 → 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
@@ -1,14 +1,13 @@
1
1
  {
2
2
  "name": "@massimo-cassandro/create-favicons",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "Favicon files builder",
5
5
  "bin": {
6
6
  "create-favicons": "./index.mjs"
7
7
  },
8
8
  "type": "module",
9
9
  "scripts": {
10
- "update-version": "node ./src/update-version/index.mjs",
11
- "upd@m": "node ./src/upd@m/index.mjs",
10
+ "update-version": "npx update-version",
12
11
  "npm-publish": "npm publish"
13
12
  },
14
13
  "publishConfig": {
@@ -24,14 +23,6 @@
24
23
  "url": "https://github.com/massimo-cassandro/create-favicons/issues"
25
24
  },
26
25
  "homepage": "https://github.com/massimo-cassandro/create-favicons/tree/main#readme",
27
- "eslintConfig": {
28
- "extends": [
29
- "./node_modules/@massimo-cassandro/linters-config/eslintrc.js"
30
- ]
31
- },
32
- "stylelint": {
33
- "extends": "@massimo-cassandro/linters-config/stylelintrc.js"
34
- },
35
26
  "files": [
36
27
  "src/**/*",
37
28
  "index.mjs"
@@ -45,5 +36,8 @@
45
36
  "sharp": "^0.33.2",
46
37
  "sharp-ico": "^0.1.5",
47
38
  "svgo": "^3.2.0"
39
+ },
40
+ "devDependencies": {
41
+ "@massimo-cassandro/dev-updater": "^1.0.0"
48
42
  }
49
- }
43
+ }
package/readme.md CHANGED
@@ -26,7 +26,7 @@ Il formato migliore per i file sorgenti è SVG, o in alternativa PNG.
26
26
 
27
27
  In assenza di entrambi i file viene restituito un errore.
28
28
 
29
- I parametri di default sono elencati in dettaglio nel file `src/create-favicons/src/defaults.mjs`,
29
+ I parametri di default sono elencati in dettaglio nel file `src/create-favicons/src/default-params.mjs`,
30
30
  e possono essere personalizzati nel file di configurazione, che deve avere questa forma:
31
31
 
32
32
  ```javascript
@@ -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]
@@ -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
  );
@@ -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
 
package/src/init.mjs CHANGED
@@ -18,7 +18,7 @@ export function init() {
18
18
  }
19
19
 
20
20
 
21
- let default_params = fs.readFileSync(src_dir + './defaults.mjs', 'UTF8');
21
+ let default_params = fs.readFileSync(src_dir + './default-params.mjs', 'UTF8');
22
22
 
23
23
  const start_string = '/*** INIT START ***/',
24
24
  end_string = '/*** INIT END ***/',