@rokkit/icons 1.0.0-next.100 → 1.0.0-next.106

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": "@rokkit/icons",
3
- "version": "1.0.0-next.100",
3
+ "version": "1.0.0-next.106",
4
4
  "description": "A minimal icon set for use in applications.",
5
5
  "author": "Jerry Thomas <me@jerrythomas.name>",
6
6
  "license": "MIT",
@@ -8,6 +8,13 @@
8
8
  "main": "src/index.js",
9
9
  "module": "src/index.js",
10
10
  "type": "module",
11
+ "scripts": {
12
+ "format": "prettier --write .",
13
+ "lint": "eslint --fix .",
14
+ "build": "node src/index.js && pnpm format",
15
+ "latest": "pnpm upgrade --latest",
16
+ "release": "pnpm publish --access public"
17
+ },
11
18
  "publishConfig": {
12
19
  "access": "public"
13
20
  },
@@ -34,12 +41,5 @@
34
41
  "./auth.json": "./lib/auth.json",
35
42
  "./app.json": "./lib/app.json",
36
43
  ".": "./lib/base.json"
37
- },
38
- "scripts": {
39
- "format": "prettier --write .",
40
- "lint": "eslint --fix .",
41
- "build": "node src/index.js && pnpm format",
42
- "latest": "pnpm upgrade --latest",
43
- "release": "pnpm publish --access public"
44
44
  }
45
- }
45
+ }
package/src/convert.js CHANGED
@@ -9,33 +9,26 @@ import {
9
9
  import fs from 'fs'
10
10
 
11
11
  /**
12
- * Convert icons
12
+ * Clean up and optimise SVG icon
13
13
  *
14
- * @param {string} folder Folder with icons
15
- * @param {string} prefix Prefix for icon set
14
+ * @param {string} svg SVG code
16
15
  * @param {boolean} color True if color should be preserved
17
16
  */
18
- export async function convert(folder, prefix, color = false) {
19
- // Import icons
20
- const iconSet = await importDirectory(folder, { prefix })
17
+ export function cleanAndOptimizeIcon(svg, color) {
18
+ // Clean up icon code
19
+ cleanupSVG(svg)
21
20
 
22
- // Validate, clean up, fix palette and optimise
23
- processIcons(iconSet, color)
21
+ if (!color) {
22
+ parseColors(svg, {
23
+ defaultColor: 'currentColor',
24
+ callback: (_, colorStr, value) => {
25
+ return !value || isEmptyColor(value) ? colorStr : 'currentColor'
26
+ }
27
+ })
28
+ }
24
29
 
25
- // Export
26
- const collection = JSON.stringify(iconSet.export(), null, 2)
27
- fs.writeFileSync(`./lib/${prefix}.json`, collection, 'utf8')
28
- const target = `./lib/${iconSet.prefix}`
29
- await exportJSONPackage(iconSet, {
30
- target,
31
- package: {
32
- name: `@rokkit/${iconSet.prefix}`,
33
- version: '1.0.0',
34
- bugs: 'https://github.com/jerrythomas/rokkit/issues',
35
- homepage: 'https://github.com/jerrythomas/rokkit'
36
- },
37
- cleanup: true
38
- })
30
+ // Optimise
31
+ runSVGO(svg)
39
32
  }
40
33
 
41
34
  /**
@@ -44,25 +37,27 @@ export async function convert(folder, prefix, color = false) {
44
37
  * @param {IconifyTools} iconSet Icon set
45
38
  * @param {boolean} color True if color should be preserved
46
39
  */
47
- function processIcons(iconSet, color) {
48
- iconSet.forEach((name, type) => {
49
- if (type !== 'icon') {
50
- return
51
- }
40
+ export function processIcons(iconSet, color) {
41
+ iconSet.forEach((name) => {
42
+ // There should not be any type other than icon
43
+ // if (type !== 'icon') {
44
+ // return
45
+ // }
52
46
 
53
47
  const svg = iconSet.toSVG(name)
54
- if (!svg) {
55
- // Invalid icon
56
- iconSet.remove(name)
57
- return
58
- }
48
+ // Since we are processing from within the list, there is no need to check for invalid icons
49
+ // if (!svg) {
50
+ // // Invalid icon
51
+ // iconSet.remove(name)
52
+ // return
53
+ // }
59
54
 
60
55
  // Clean up and optimise icons
61
56
  try {
62
57
  cleanAndOptimizeIcon(svg, color)
63
58
  } catch (err) {
64
59
  // eslint-disable-next-line no-console
65
- console.error(`Error parsing ${name}:`, err)
60
+ console.error(`Error parsing ${name}: ${err.reason}`)
66
61
  iconSet.remove(name)
67
62
  return
68
63
  }
@@ -73,24 +68,31 @@ function processIcons(iconSet, color) {
73
68
  }
74
69
 
75
70
  /**
76
- * Clean up and optimise SVG icon
71
+ * Convert icons
77
72
  *
78
- * @param {string} svg SVG code
73
+ * @param {string} folder Folder with icons
74
+ * @param {string} prefix Prefix for icon set
79
75
  * @param {boolean} color True if color should be preserved
80
76
  */
81
- function cleanAndOptimizeIcon(svg, color) {
82
- // Clean up icon code
83
- cleanupSVG(svg)
77
+ export async function convert(folder, prefix, color = false) {
78
+ // Import icons
79
+ const iconSet = await importDirectory(folder, { prefix })
84
80
 
85
- if (!color) {
86
- parseColors(svg, {
87
- defaultColor: 'currentColor',
88
- callback: (_, colorStr, value) => {
89
- return !value || isEmptyColor(value) ? colorStr : 'currentColor'
90
- }
91
- })
92
- }
81
+ // Validate, clean up, fix palette and optimise
82
+ processIcons(iconSet, color)
93
83
 
94
- // Optimise
95
- runSVGO(svg)
84
+ // Export
85
+ const collection = JSON.stringify(iconSet.export(), null, 2)
86
+ fs.writeFileSync(`./lib/${prefix}.json`, collection, 'utf8')
87
+ const target = `./lib/${iconSet.prefix}`
88
+ await exportJSONPackage(iconSet, {
89
+ target,
90
+ package: {
91
+ name: `@rokkit/${iconSet.prefix}`,
92
+ version: '1.0.0',
93
+ bugs: 'https://github.com/jerrythomas/rokkit/issues',
94
+ homepage: 'https://github.com/jerrythomas/rokkit'
95
+ },
96
+ cleanup: true
97
+ })
96
98
  }
package/src/index.js CHANGED
@@ -1,8 +1,15 @@
1
1
  #!/usr/bin/env node
2
+ import sade from 'sade'
2
3
  import { convert } from './convert.js'
3
4
 
4
- const groups = ['auth', 'app', 'base', 'light', 'solid', 'twotone', 'components']
5
+ function main() {
6
+ const groups = ['auth', 'app', 'base', 'light', 'solid', 'twotone', 'components']
5
7
 
6
- for (const group of groups) {
7
- convert(`./src/${group}`, group, group === 'auth')
8
+ for (const group of groups) {
9
+ convert(`./src/${group}`, group, group === 'auth')
10
+ }
8
11
  }
12
+
13
+ const prog = sade(name, true)
14
+ prog.action(() => main())
15
+ prog.parse(process.argv)
package/LICENCE.md DELETED
@@ -1,22 +0,0 @@
1
- # Pictogrammers Free License
2
-
3
- This icon collection is released as free, open source, and GPL friendly by
4
- the [Pictogrammers](http://pictogrammers.com/) icon group. You may use it
5
- for commercial projects, open source projects, or anything really.
6
-
7
- ## Icons: [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
8
-
9
- Some of the icons are redistributed under the Apache 2.0 license. All other
10
- icons are either redistributed under their respective licenses or are
11
- distributed under the Apache 2.0 license.
12
-
13
- ## Fonts: [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
14
-
15
- All web and desktop fonts are distributed under the Apache 2.0 license. Web
16
- and desktop fonts contain some icons that are redistributed under the Apache
17
- 2.0 license. All other icons are either redistributed under their respective
18
- licenses or are distributed under the Apache 2.0 license.
19
-
20
- ## Code: [MIT](https://opensource.org/licenses/MIT)
21
-
22
- The MIT license applies to all non-font and non-icon files.