Skip to content

Commit 26a0e2d

Browse files
authored
fix: build output as nodejs to allow using it inside .js file (#415)
1 parent c4fbaf5 commit 26a0e2d

40 files changed

+235
-8463
lines changed

docs/API.md

+39-38
Original file line numberDiff line numberDiff line change
@@ -6,55 +6,56 @@ CLI for generating or manipulating icon fonts from SVG files.
66

77
Clean svgs for icon fonts to work
88

9-
> You can use `clean-icons.json` as a config file.
10-
> By default it tries to search for the configuration otherwise use a correct path by passing `--config=./clean-icons.json`.
9+
> You can use `clean-icons.json` as a config file.
10+
By default it tries to search for the configuration otherwise use a correct path by passing `--config=./clean-icons.json`.
1111

1212
| long | short | description | required | defaultValue |
1313
| :------------------ | :---: | :-------------------------------------------------------------------------------------------------- | :------: | :----------- |
14-
| `--src` | `-s` | Source folder with all svgs | `` | |
15-
| `--traceResolution` | `-r` | Change the default resolution of the trace | `` | `"600"` |
16-
| `--out` | `-o` | Relative path where the files should be written to. Empty string will overwrite the original files. | `` | |
17-
| `--dry` | `-d` | Do a dry run with this command - prints/returns output | `` | |
18-
| `--ignoreGlobs` | `-i` | Path icon glob to exclude from the fonts | `` | `[]` |
19-
| `--debug` | | Extra logging | `` | |
20-
| `--config` | `-c` | Path to configuration file | `` | |
14+
| `--src` | `-s` | Source folder with all svgs | `` | |
15+
| `--traceResolution` | `-r` | Change the default resolution of the trace | `` | `"600"` |
16+
| `--out` | `-o` | Relative path where the files should be written to. Empty string will overwrite the original files. | `` | |
17+
| `--dry` | `-d` | Do a dry run with this command - prints/returns output | `` | |
18+
| `--ignore` | `-i` | Glob or path like to exclude from files | `` | `[]` |
19+
| `--debug` | | Extra logging | `` | |
20+
| `--config` | `-c` | Path to configuration file | `` | |
2121

2222
## generate-icon-fonts
2323

2424
Generate icon fonts from SVG files
2525

26-
> You can use `generate-icon-fonts.json` as a config file.
27-
> By default it tries to search for the configuration otherwise use a correct path by passing `--config=./generate-icon-fonts.json`.
26+
> You can use `generate-icon-fonts.json` as a config file.
27+
By default it tries to search for the configuration otherwise use a correct path by passing `--config=./generate-icon-fonts.json`.
2828

2929
| long | short | description | required | defaultValue |
3030
| :------------------- | :---: | :------------------------------------------------------------------------------------ | :------: | :----------- |
31-
| `--fontName` | `-f` | The name of your font | `` | |
32-
| `--src` | `-s` | Source folder with all svgs | `` | |
33-
| `--variants` | `-v` | Font variants e.g. solid, inverted, etc. We always add a "default" variant for icons. | `` | `[]` |
34-
| `--withSizes` | `-w` | Splits the font into different sizes | `` | |
35-
| `--prefix` | `-p` | Prefix of icons to delete for icons | `` | |
36-
| `--overwriteSources` | `-o` | Overwrite all svgs inside src directory | `` | |
37-
| `--dry` | `-d` | Do a dry run with this command - prints/returns output | `` | |
38-
| `--ignoreGlobs` | `-i` | Path icon glob to exclude from the fonts | `` | `[]` |
39-
| `--debug` | | Extra logging | `` | |
40-
| `--config` | `-c` | Path to configuration file | `` | |
31+
| `--fontName` | `-f` | The name of your font | `` | |
32+
| `--src` | `-s` | Source folder with all svgs | `` | |
33+
| `--variants` | `-v` | Font variants e.g. solid, inverted, etc. We always add a "default" variant for icons. | `` | `[]` |
34+
| `--withSizes` | `-w` | Splits the font into different sizes | `` | |
35+
| `--prefix` | `-p` | Prefix of icons to delete for icons | `` | |
36+
| `--overwriteSources` | `-o` | Overwrite all svgs inside src directory | `` | |
37+
| `--dry` | `-d` | Do a dry run with this command - prints/returns output | `` | |
38+
| `--ignore` | `-i` | Glob or path like to exclude from files | `` | `[]` |
39+
| `--debug` | | Extra logging | `` | |
40+
| `--config` | `-c` | Path to configuration file | `` | |
4141

4242
## icon-subset
4343

44-
Creates new icon font (woff2) by passing a safelist/blocklist with icon literals. Requires <https://github.com/fonttools/fonttools> to be installed.
45-
46-
> You can use `icon-subset.json` as a config file.
47-
> By default it tries to search for the configuration otherwise use a correct path by passing `--config=./icon-subset.json`.
48-
49-
| long | short | description | required | defaultValue |
50-
| :-------------- | :---: | :----------------------------------------------------------------------------- | :------: | :----------- |
51-
| `--safeList` | `-l` | Includes only icons from provided list. Priority over 'blockList'. | `` | |
52-
| `--blockList` | `-b` | Excludes all icons from provided list. Can't be used together with 'safeList'. | `` | |
53-
| `--overwrite` | `-w` | If the source file should be overwritten. Disables 'out' option. | `` | `true` |
54-
| `--src` | `-s` | Source folder with all woff2 files | `` | |
55-
| `--filePaths` | `-f` | File paths to woff2 file which should be subsetted. | `` | |
56-
| `--out` | `-o` | Relative path where the file should be written | `` | `"."` |
57-
| `--dry` | `-d` | Do a dry run with this command - prints/returns output | `` | |
58-
| `--debug` | | Extra logging | `` | |
59-
| `--config` | `-c` | Path to configuration file | `` | |
60-
| `--ignoreGlobs` | `-i` | Path icon glob to exclude from the fonts | `` | `[]` |
44+
Creates new icon font (woff2) by passing a safelist/blocklist with icon literals. Requires https://github.com/fonttools/fonttools to be installed.
45+
46+
> You can use `icon-subset.json` as a config file.
47+
By default it tries to search for the configuration otherwise use a correct path by passing `--config=./icon-subset.json`.
48+
49+
| long | short | description | required | defaultValue |
50+
| :------------ | :---: | :----------------------------------------------------------------------------- | :------: | :----------- |
51+
| `--safeList` | `-l` | Includes only icons from provided list. Priority over 'blockList'. | `` | |
52+
| `--blockList` | `-b` | Excludes all icons from provided list. Can't be used together with 'safeList'. | `` | |
53+
| `--overwrite` | `-w` | If the source file should be overwritten. Disables 'out' option. | `` | `true` |
54+
| `--src` | `-s` | Source folder with all woff2 files | `` | |
55+
| `--filePaths` | `-f` | File paths to woff2 file which should be subsetted. | `` | |
56+
| `--out` | `-o` | Relative path where the file should be written | `` | `"."` |
57+
| `--dry` | `-d` | Do a dry run with this command - prints/returns output | `` | |
58+
| `--debug` | | Extra logging | `` | |
59+
| `--config` | `-c` | Path to configuration file | `` | |
60+
| `--ignore` | `-i` | Glob or path like to exclude from files | `` | `[]` |
61+

docs/GenerateIconFonts.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ Here is an example for a JS file `index.js`:
1010

1111
```js
1212
// index.js
13-
import { generateIconFonts } from "@db-ux/icon-font-tools/dist/commands/generate-icon-fonts";
13+
import { generateIconFonts } from "@db-ux/icon-font-tools";
1414

1515
void generateIconFonts({
1616
fontName,
1717
src: "./icons",
18-
ignoreGlobs: ["**/node_modules/**"],
18+
ignore: ["**/node_modules/**"],
1919
variants: ["filled"],
2020
withSizes: true,
2121
});

docs/IconSubset.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,14 @@ Here is an example for a JS file `index.(js|ts)`:
3131

3232
```js
3333
// index.(js|ts)
34-
import { iconSubset } from "@db-ux/icon-font-tools/dist/commands/icon-subset";
34+
import { iconSubset } from "@db-ux/icon-font-tools";
3535

3636
void iconSubset({
3737
src: "./my-path-to/icons",
3838
safeList: ["airplane", "bell"],
39+
ignore: {
40+
ignored: (p) => p.name.startsWith("NotoSans"),
41+
},
3942
});
4043
```
4144

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
force: true
3+
to: ../src/commands/<%= name %>/index.ts
4+
---
5+
import { <%= h.changeCase.pascal(name) %>ConfigType } from "./data";
6+
7+
export const <%= h.changeCase.camel(name) %> = async (config: <%= h.changeCase.pascal(name) %>ConfigType) => {
8+
const { debug, dry } = config;
9+
// TODO: Add you logic here
10+
11+
return false;
12+
}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
---
2-
force: true
3-
to: ../src/commands/<%= name %>/index.ts
2+
to: ../src/commands/index.ts
3+
inject: true
4+
append: true
45
---
5-
import { <%= h.changeCase.pascal(name) %>ConfigType } from "./data";
6-
7-
export const <%= h.changeCase.camel(name) %> = async (config: <%= h.changeCase.pascal(name) %>ConfigType) => {
8-
const { debug, dry } = config;
9-
// TODO: Add you logic here
10-
11-
return false;
12-
}
6+
export * from "./<%= name %>";

0 commit comments

Comments
 (0)