@enigmax/icons 0.1.0 → 0.1.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.
package/LICENSE CHANGED
@@ -19,12 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
-
23
- ---
24
-
25
- The icon artwork is the Solar Icon Set by 480 Design, licensed under
26
- Creative Commons Attribution 4.0 International (CC BY 4.0):
27
- https://creativecommons.org/licenses/by/4.0/
28
-
29
- Attribution is required by that licence. Keep this notice, and surface the
30
- credit somewhere in any application that ships these icons.
package/README.md CHANGED
@@ -1,7 +1,10 @@
1
1
  # @enigmax/icons
2
2
 
3
- Filled duotone icons for React. 391 icons in 36 categories, each in its own
4
- module, so a bundle carries only the ones it renders.
3
+ Icons for React. 391 icons in 36 categories, each in its own module, so a
4
+ bundle carries only the ones it renders.
5
+
6
+ Bold duotone is the weight that ships today. The package is built to hold more
7
+ than one, so nothing in its name, its exports or its API is tied to that weight.
5
8
 
6
9
  ```tsx
7
10
  import { IconMapPin } from "@enigmax/icons";
@@ -47,7 +50,7 @@ one. Install `@tabler/icons-react` only if you import a brand mark.
47
50
  ## Regenerating
48
51
 
49
52
  ```sh
50
- node generate.mjs --solar <path/to/set.json>
53
+ node generate.mjs --set <path/to/set.json>
51
54
  ```
52
55
 
53
56
  Edit `icon-map.json` to add, remove or re-point an icon, then regenerate. A
@@ -56,9 +59,4 @@ forever.
56
59
 
57
60
  ## Licence
58
61
 
59
- The icon artwork is the Solar Icon Set by 480 Design, used under
60
- [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). That licence
61
- requires attribution: keep this notice, and surface it somewhere in any app
62
- that ships these icons (an About or Credits screen is the usual place).
63
-
64
- The package code is MIT.
62
+ MIT.
package/generate.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // Generate the icon package's source from icon-map.json and the Solar set.
2
+ // Generate the icon package's source from icon-map.json and a set of drawings.
3
3
  //
4
4
  // One module per icon, one barrel per category, and a root index that re-exports
5
5
  // everything. That shape is what lets a bundler drop what an app never renders:
@@ -8,15 +8,11 @@
8
8
  // fetched at install time - the bodies are written here as plain strings.
9
9
  //
10
10
  // Usage:
11
- // node generate.mjs --solar <path/to/solar-icons.json> [--out src]
11
+ // node generate.mjs --set <path/to/icons.json> [--out src]
12
12
  //
13
- // The Solar set is a build-time input, not a dependency of the published
14
- // package: it is read here and the ~400 bodies the map names are copied out.
15
- // The full set is 7,759 icons, of which this keeps about five percent.
16
- //
17
- // Solar Icon Set by 480 Design, CC BY 4.0
18
- // (https://creativecommons.org/licenses/by/4.0/). The attribution the licence
19
- // requires ships in the package README and must not be stripped.
13
+ // The set is a build-time input, not a dependency of the published package: it
14
+ // is read here and the ~400 bodies the map names are copied out. The full set
15
+ // is several thousand icons, of which this keeps about five percent.
20
16
  import { fileURLToPath } from "node:url";
21
17
  import { resolve, dirname } from "node:path";
22
18
  import { readFileSync, writeFileSync, mkdirSync, rmSync, existsSync } from "node:fs";
@@ -30,9 +26,9 @@ const arg = (flag, fallback) => {
30
26
  };
31
27
 
32
28
  const OUT = resolve(HERE, arg("--out", "src"));
33
- const SOLAR = arg("--solar", null);
34
- if (!SOLAR || !existsSync(SOLAR)) {
35
- console.error("usage: node generate.mjs --solar <path/to/solar-icons.json> [--out src]");
29
+ const SET = arg("--set", null);
30
+ if (!SET || !existsSync(SET)) {
31
+ console.error("usage: node generate.mjs --set <path/to/icons.json> [--out src]");
36
32
  process.exit(1);
37
33
  }
38
34
 
@@ -95,14 +91,14 @@ export function icon(name: string, body: string): Icon {
95
91
  `;
96
92
 
97
93
  const { icons, brands } = JSON.parse(readFileSync(MAP, "utf8"));
98
- const solar = JSON.parse(readFileSync(SOLAR, "utf8")).icons;
94
+ const drawings = JSON.parse(readFileSync(SET, "utf8")).icons;
99
95
 
100
96
  // A name that is not in the set does not throw at runtime - it renders an empty
101
97
  // square forever - so it has to fail here instead.
102
- const missing = Object.entries(icons).filter(([, spec]) => !solar[spec.solar]);
98
+ const missing = Object.entries(icons).filter(([, spec]) => !drawings[spec.glyph]);
103
99
  if (missing.length > 0) {
104
100
  console.error("Names not present in the icon set:");
105
- for (const [name, spec] of missing.slice(0, 10)) console.error(` ${name} -> ${spec.solar}`);
101
+ for (const [name, spec] of missing.slice(0, 10)) console.error(` ${name} -> ${spec.glyph}`);
106
102
  process.exit(1);
107
103
  }
108
104
 
@@ -117,10 +113,10 @@ const byCategory = new Map();
117
113
  let bytes = 0;
118
114
 
119
115
  for (const name of names) {
120
- const { solar: solarName, category } = icons[name];
121
- const body = solar[solarName].body;
116
+ const { glyph, category } = icons[name];
117
+ const body = drawings[glyph].body;
122
118
  bytes += body.length;
123
- const file = `// ${name} - ${solarName}. GENERATED, do not hand-edit.
119
+ const file = `// ${name} - ${glyph}. GENERATED, do not hand-edit.
124
120
  import { icon } from "../icon";
125
121
 
126
122
  export const ${name} = icon(${JSON.stringify(name)}, ${JSON.stringify(body)});
@@ -139,7 +135,7 @@ for (const category of categories) {
139
135
  }
140
136
 
141
137
  const index = [
142
- "// GENERATED, do not hand-edit. Run: node generate.mjs --solar <set.json>",
138
+ "// GENERATED, do not hand-edit. Run: node generate.mjs --set <set.json>",
143
139
  "//",
144
140
  "// Import from the root for a single icon (the bundler keeps only that module),",
145
141
  "// or from a category when you want the group:",