@vitus-labs/tools-favicon 0.46.0 → 1.0.1-alpha.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.
@@ -1,65 +1,37 @@
1
- import fs from 'fs';
2
- import favicons from 'favicons';
3
- import { loadVLToolsConfig } from '@vitus-labs/tools-core';
4
-
5
- const configuration = {
6
- dir: 'auto',
7
- lang: 'en-US',
8
- background: '#fff',
9
- theme_color: '#fff',
10
- appleStatusBarStyle: 'black-translucent',
11
- display: 'standalone',
12
- orientation: 'any',
13
- scope: '/',
14
- start_url: '/?homescreen=1',
15
- version: '1.0',
16
- logging: false,
17
- pixel_art: false,
18
- loadManifestWithCredentials: false,
19
- icons: {
20
- // Platform Options:
21
- // - offset - offset in percentage
22
- // - background:
23
- // * false - use default
24
- // * true - force use default, e.g. set background for Android icons
25
- // * color - set background for the specified icons
26
- // * mask - apply mask in order to create circle icon (applied by default for firefox). `boolean`
27
- // * overlayGlow - apply glow effect after mask has been applied (applied by default for firefox). `boolean`
28
- // * overlayShadow - apply drop shadow after mask has been applied .`boolean`
29
- //
30
- android: true,
31
- appleIcon: true,
32
- appleStartup: true,
33
- coast: true,
34
- favicons: true,
35
- firefox: true,
36
- windows: true,
37
- yandex: true, // Create Yandex browser icon. `boolean` or `{ offset, background, mask, overlayGlow, overlayShadow }` or an array of sources
38
- },
1
+ const configuration = {
2
+ dir: 'auto',
3
+ lang: 'en-US',
4
+ background: '#fff',
5
+ theme_color: '#fff',
6
+ appleStatusBarStyle: 'black-translucent',
7
+ display: 'standalone',
8
+ orientation: 'any',
9
+ scope: '/',
10
+ start_url: '/?homescreen=1',
11
+ version: '1.0',
12
+ logging: false,
13
+ pixel_art: false,
14
+ loadManifestWithCredentials: false,
15
+ icons: {
16
+ // Platform Options:
17
+ // - offset - offset in percentage
18
+ // - background:
19
+ // * false - use default
20
+ // * true - force use default, e.g. set background for Android icons
21
+ // * color - set background for the specified icons
22
+ // * mask - apply mask in order to create circle icon (applied by default for firefox). `boolean`
23
+ // * overlayGlow - apply glow effect after mask has been applied (applied by default for firefox). `boolean`
24
+ // * overlayShadow - apply drop shadow after mask has been applied .`boolean`
25
+ //
26
+ android: true,
27
+ appleIcon: true,
28
+ appleStartup: true,
29
+ coast: true,
30
+ favicons: true,
31
+ firefox: true,
32
+ windows: true,
33
+ yandex: true, // Create Yandex browser icon. `boolean` or `{ offset, background, mask, overlayGlow, overlayShadow }` or an array of sources
34
+ },
39
35
  };
40
-
41
- const VL_CONFIG = loadVLToolsConfig('favicon');
42
- const { icons, path, ...restConfig } = VL_CONFIG.merge(configuration).config;
43
- const callback = (outputPath) => (error, response) => {
44
- if (error) {
45
- console.log(error.message); // Error description e.g. "An unknown error has occurred"
46
- return;
47
- }
48
- console.log('Creating images...');
49
- response.images.forEach((item) => {
50
- fs.writeFileSync(`${outputPath}${item.name}`, item.contents);
51
- });
52
- console.log('Creating manifests...');
53
- response.files.forEach((item) => {
54
- fs.writeFileSync(`${outputPath}${item.name}`, item.contents);
55
- });
56
- };
57
- const generateFavicons = () => icons.forEach((item) => {
58
- const inputPath = `${process.cwd()}/${item.input}`;
59
- const outputPath = `${process.cwd()}/${item.output}/`;
60
- // favicons(source, configuration, callback)
61
- favicons(inputPath, { ...restConfig, path: `${path}/${item.path}` }, callback(outputPath));
62
- });
63
-
64
- export { configuration, generateFavicons };
65
- //# sourceMappingURL=vitus-tools-favicon.module.js.map
36
+ export { configuration };
37
+ //# sourceMappingURL=baseConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseConfig.js","sourceRoot":"","sources":["../src/baseConfig.ts"],"names":[],"mappings":"AAAA,MAAM,aAAa,GAAG;IACpB,GAAG,EAAE,MAAM;IACX,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,MAAM;IAClB,WAAW,EAAE,MAAM;IACnB,mBAAmB,EAAE,mBAAmB;IACxC,OAAO,EAAE,YAAY;IACrB,WAAW,EAAE,KAAK;IAClB,KAAK,EAAE,GAAG;IACV,SAAS,EAAE,gBAAgB;IAC3B,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,KAAK;IAChB,2BAA2B,EAAE,KAAK;IAClC,KAAK,EAAE;QACL,oBAAoB;QACpB,kCAAkC;QAClC,gBAAgB;QAChB,0BAA0B;QAC1B,sEAAsE;QACtE,qDAAqD;QACrD,mGAAmG;QACnG,8GAA8G;QAC9G,+EAA+E;QAC/E,EAAE;QACF,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,IAAI;QACf,YAAY,EAAE,IAAI;QAClB,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,IAAI,EAAE,6HAA6H;KAC5I;CACF,CAAA;AAID,OAAO,EAAE,aAAa,EAAE,CAAA"}
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { generateFavicons } from '../generateFavicon.js';
3
+ await generateFavicons();
4
+ //# sourceMappingURL=run-favicon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-favicon.js","sourceRoot":"","sources":["../../src/bin/run-favicon.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD,MAAM,gBAAgB,EAAE,CAAA"}
@@ -0,0 +1,27 @@
1
+ import fs from 'node:fs';
2
+ import favicons from 'favicons';
3
+ import { loadVLToolsConfig } from '@vitus-labs/tools-core';
4
+ import { configuration } from './baseConfig.js';
5
+ const VL_CONFIG = await loadVLToolsConfig('favicon');
6
+ const { icons, path, ...restConfig } = VL_CONFIG.merge(configuration).config;
7
+ const handleSuccess = (outputPath, response) => {
8
+ console.log('Creating images...');
9
+ response.images.forEach((item) => {
10
+ fs.writeFileSync(`${outputPath}${item.name}`, item.contents);
11
+ });
12
+ console.log('Creating manifests...');
13
+ response.files.forEach((item) => {
14
+ fs.writeFileSync(`${outputPath}${item.name}`, item.contents);
15
+ });
16
+ };
17
+ const handleError = (error) => {
18
+ console.log(error.message); // Error description e.g. "An unknown error has occurred"
19
+ };
20
+ const generateFavicons = () => icons.forEach((item) => {
21
+ const inputPath = `${process.cwd()}/${item.input}`;
22
+ const outputPath = `${process.cwd()}/${item.output}/`;
23
+ // favicons(source, configuration, callback)
24
+ favicons(inputPath, { ...restConfig, path: `${path}/${item.path}` }).then((res) => handleSuccess(outputPath, res), (err) => handleError(err));
25
+ });
26
+ export { generateFavicons };
27
+ //# sourceMappingURL=generateFavicon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateFavicon.js","sourceRoot":"","sources":["../src/generateFavicon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,MAAM,SAAS,GAAG,MAAM,iBAAiB,CAAC,SAAS,CAAC,CAAA;AAEpD,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,UAAU,EAAE,GAAG,SAAS,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,MAAM,CAAA;AAE5E,MAAM,aAAa,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,EAAE;IAC7C,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;IACjC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC/B,EAAE,CAAC,aAAa,CAAC,GAAG,UAAU,GAAG,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC9D,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;IACpC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC9B,EAAE,CAAC,aAAa,CAAC,GAAG,UAAU,GAAG,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC9D,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,EAAE;IAC5B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA,CAAC,yDAAyD;AACtF,CAAC,CAAA;AAED,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAC5B,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;IACrB,MAAM,SAAS,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,KAAK,EAAE,CAAA;IAClD,MAAM,UAAU,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,GAAG,CAAA;IAErD,4CAA4C;IAC5C,QAAQ,CAAC,SAAS,EAAE,EAAE,GAAG,UAAU,EAAE,IAAI,EAAE,GAAG,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CACvE,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,GAAG,CAAC,EACvC,CAAC,GAAG,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAC1B,CAAA;AACH,CAAC,CAAC,CAAA;AAEJ,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
package/lib/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import { generateFavicons } from './generateFavicon.js';
2
+ import { configuration } from './baseConfig.js';
3
+ export { generateFavicons, configuration };
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,aAAa,EAAiB,MAAM,iBAAiB,CAAA;AAI9D,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,CAAA"}
@@ -1,28 +1,27 @@
1
- declare const configuration: {
2
- dir: string;
3
- lang: string;
4
- background: string;
5
- theme_color: string;
6
- appleStatusBarStyle: string;
7
- display: string;
8
- orientation: string;
9
- scope: string;
10
- start_url: string;
11
- version: string;
12
- logging: boolean;
13
- pixel_art: boolean;
14
- loadManifestWithCredentials: boolean;
15
- icons: {
16
- android: boolean;
17
- appleIcon: boolean;
18
- appleStartup: boolean;
19
- coast: boolean;
20
- favicons: boolean;
21
- firefox: boolean;
22
- windows: boolean;
23
- yandex: boolean;
24
- };
25
- };
26
- export type Configuration = typeof configuration;
27
- export default configuration;
28
- //# sourceMappingURL=baseConfig.d.ts.map
1
+ declare const configuration: {
2
+ dir: string;
3
+ lang: string;
4
+ background: string;
5
+ theme_color: string;
6
+ appleStatusBarStyle: string;
7
+ display: string;
8
+ orientation: string;
9
+ scope: string;
10
+ start_url: string;
11
+ version: string;
12
+ logging: boolean;
13
+ pixel_art: boolean;
14
+ loadManifestWithCredentials: boolean;
15
+ icons: {
16
+ android: boolean;
17
+ appleIcon: boolean;
18
+ appleStartup: boolean;
19
+ coast: boolean;
20
+ favicons: boolean;
21
+ firefox: boolean;
22
+ windows: boolean;
23
+ yandex: boolean;
24
+ };
25
+ };
26
+ export type Configuration = typeof configuration;
27
+ export { configuration };
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -1,3 +1,2 @@
1
- declare const generateFavicons: () => any;
2
- export default generateFavicons;
3
- //# sourceMappingURL=generateFavicon.d.ts.map
1
+ declare const generateFavicons: () => any;
2
+ export { generateFavicons };
@@ -1,5 +1,4 @@
1
- import generateFavicons from "./generateFavicon";
2
- import configuration, { Configuration } from "./baseConfig";
3
- export type { Configuration };
4
- export { generateFavicons, configuration };
5
- //# sourceMappingURL=index.d.ts.map
1
+ import { generateFavicons } from './generateFavicon.js';
2
+ import { configuration, Configuration } from './baseConfig.js';
3
+ export type { Configuration };
4
+ export { generateFavicons, configuration };
package/package.json CHANGED
@@ -1,41 +1,34 @@
1
1
  {
2
2
  "name": "@vitus-labs/tools-favicon",
3
- "version": "0.46.0",
3
+ "version": "1.0.1-alpha.1",
4
4
  "license": "MIT",
5
5
  "author": "Vit Bokisch <vit@bokisch.com>",
6
6
  "maintainers": [
7
7
  "Vit Bokisch <vit@bokisch.com>"
8
8
  ],
9
- "main": "lib/vitus-tools-favicon.js",
10
- "module": "lib/vitus-tools-favicon.module.js",
11
- "types": "lib/index.d.ts",
12
- "files": [
13
- "lib/",
14
- "bin/"
15
- ],
9
+ "type": "module",
10
+ "exports": "./lib/index.js",
11
+ "types": "./lib/index.d.ts",
16
12
  "engines": {
17
- "node": ">= 14"
13
+ "node": ">= 16"
18
14
  },
19
15
  "publishConfig": {
20
16
  "access": "public"
21
17
  },
22
18
  "bin": {
23
- "vl_favicon": "bin/run-favicon.js"
19
+ "vl_favicon": "./lib/bin/run-favicon.js"
24
20
  },
25
21
  "scripts": {
26
22
  "prepublish": "yarn build",
27
- "build": "yarn vl_build",
28
- "build:watch": "yarn vl_build-watch",
29
- "lint:css": "stylelint src/*.ts src/*.tsx",
30
- "lint:ts": "eslint src/*",
31
- "lint": "yarn lint:css && yarn lint:ts"
23
+ "build": "tsc"
32
24
  },
33
25
  "dependencies": {
34
- "@vitus-labs/tools-babel": "0.46.0",
35
- "@vitus-labs/tools-core": "0.46.0",
36
- "@vitus-labs/tools-rollup": "0.46.0",
37
- "@vitus-labs/tools-typescript": "0.46.0",
38
- "favicons": "^6.2.2"
26
+ "@vitus-labs/tools-core": "1.0.1-alpha.1",
27
+ "favicons": "^7.1.3"
28
+ },
29
+ "devDependencies": {
30
+ "@vitus-labs/tools-typescript": "1.0.1-alpha.1",
31
+ "typescript": "^5.1.6"
39
32
  },
40
- "gitHead": "81660f866ad89ae42fcca35ad103fac72305467b"
33
+ "gitHead": "52d479556ae2a3e6047e251526e80cb08d77ecdd"
41
34
  }
@@ -0,0 +1,39 @@
1
+ const configuration = {
2
+ dir: 'auto', // Primary text direction for name, short_name, and description
3
+ lang: 'en-US', // Primary language for name and short_name
4
+ background: '#fff', // Background colour for flattened icons. `string`
5
+ theme_color: '#fff', // Theme color user for example in Android's task switcher. `string`
6
+ appleStatusBarStyle: 'black-translucent', // Style for Apple status bar: "black-translucent", "default", "black". `string`
7
+ display: 'standalone', // Preferred display mode: "fullscreen", "standalone", "minimal-ui" or "browser". `string`
8
+ orientation: 'any', // Default orientation: "any", "natural", "portrait" or "landscape". `string`
9
+ scope: '/', // set of URLs that the browser considers within your app
10
+ start_url: '/?homescreen=1', // Start URL when launching the application from a device. `string`
11
+ version: '1.0', // Your application's version string. `string`
12
+ logging: false, // Print logs to console? `boolean`
13
+ pixel_art: false, // Keeps pixels "sharp" when scaling up, for pixel art. Only supported in offline mode.
14
+ loadManifestWithCredentials: false, // Browsers don't send cookies when fetching a manifest, enable this to fix that. `boolean`
15
+ icons: {
16
+ // Platform Options:
17
+ // - offset - offset in percentage
18
+ // - background:
19
+ // * false - use default
20
+ // * true - force use default, e.g. set background for Android icons
21
+ // * color - set background for the specified icons
22
+ // * mask - apply mask in order to create circle icon (applied by default for firefox). `boolean`
23
+ // * overlayGlow - apply glow effect after mask has been applied (applied by default for firefox). `boolean`
24
+ // * overlayShadow - apply drop shadow after mask has been applied .`boolean`
25
+ //
26
+ android: true, // Create Android homescreen icon. `boolean` or `{ offset, background, mask, overlayGlow, overlayShadow }` or an array of sources
27
+ appleIcon: true, // Create Apple touch icons. `boolean` or `{ offset, background, mask, overlayGlow, overlayShadow }` or an array of sources
28
+ appleStartup: true, // Create Apple startup images. `boolean` or `{ offset, background, mask, overlayGlow, overlayShadow }` or an array of sources
29
+ coast: true, // Create Opera Coast icon. `boolean` or `{ offset, background, mask, overlayGlow, overlayShadow }` or an array of sources
30
+ favicons: true, // Create regular favicons. `boolean` or `{ offset, background, mask, overlayGlow, overlayShadow }` or an array of sources
31
+ firefox: true, // Create Firefox OS icons. `boolean` or `{ offset, background, mask, overlayGlow, overlayShadow }` or an array of sources
32
+ windows: true, // Create Windows 8 tile icons. `boolean` or `{ offset, background, mask, overlayGlow, overlayShadow }` or an array of sources
33
+ yandex: true, // Create Yandex browser icon. `boolean` or `{ offset, background, mask, overlayGlow, overlayShadow }` or an array of sources
34
+ },
35
+ }
36
+
37
+ export type Configuration = typeof configuration
38
+
39
+ export { configuration }
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { generateFavicons } from '../generateFavicon.js'
3
+
4
+ await generateFavicons()
@@ -0,0 +1,38 @@
1
+ import fs from 'node:fs'
2
+ import favicons from 'favicons'
3
+ import { loadVLToolsConfig } from '@vitus-labs/tools-core'
4
+ import { configuration } from './baseConfig.js'
5
+
6
+ const VL_CONFIG = await loadVLToolsConfig('favicon')
7
+
8
+ const { icons, path, ...restConfig } = VL_CONFIG.merge(configuration).config
9
+
10
+ const handleSuccess = (outputPath, response) => {
11
+ console.log('Creating images...')
12
+ response.images.forEach((item) => {
13
+ fs.writeFileSync(`${outputPath}${item.name}`, item.contents)
14
+ })
15
+
16
+ console.log('Creating manifests...')
17
+ response.files.forEach((item) => {
18
+ fs.writeFileSync(`${outputPath}${item.name}`, item.contents)
19
+ })
20
+ }
21
+
22
+ const handleError = (error) => {
23
+ console.log(error.message) // Error description e.g. "An unknown error has occurred"
24
+ }
25
+
26
+ const generateFavicons = () =>
27
+ icons.forEach((item) => {
28
+ const inputPath = `${process.cwd()}/${item.input}`
29
+ const outputPath = `${process.cwd()}/${item.output}/`
30
+
31
+ // favicons(source, configuration, callback)
32
+ favicons(inputPath, { ...restConfig, path: `${path}/${item.path}` }).then(
33
+ (res) => handleSuccess(outputPath, res),
34
+ (err) => handleError(err)
35
+ )
36
+ })
37
+
38
+ export { generateFavicons }
package/src/index.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { generateFavicons } from './generateFavicon.js'
2
+ import { configuration, Configuration } from './baseConfig.js'
3
+
4
+ export type { Configuration }
5
+
6
+ export { generateFavicons, configuration }
package/tsconfig.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "extends": "@vitus-labs/tools-typescript/lib",
3
+ "compilerOptions": {
4
+ "target": "ESNext",
5
+ "module": "ESNext",
6
+ "moduleResolution": "Bundler",
7
+ "outDir": "lib",
8
+ "rootDir": "src",
9
+ "baseUrl": ".",
10
+ "declarationDir": "./lib/types",
11
+ "paths": {
12
+ "~/*": [
13
+ "src/*"
14
+ ]
15
+ },
16
+ "plugins": []
17
+ },
18
+ "include": [
19
+ "typings",
20
+ "src",
21
+ ],
22
+ "exclude": [
23
+ "node_modules",
24
+ "__stories__",
25
+ "lib"
26
+ ]
27
+ }