mimeforge 0.1.1 → 0.1.2
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/CHANGELOG.md +7 -0
- package/README.md +39 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
All notable changes are listed here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the
|
|
4
4
|
project uses [Semantic Versioning](https://semver.org/).
|
|
5
5
|
|
|
6
|
+
## [0.1.2] - 2026-10-08
|
|
7
|
+
|
|
8
|
+
Documentation only.
|
|
9
|
+
|
|
10
|
+
- README: separate install paths (npx, global, project dependency, from source), a "use it in a project" example,
|
|
11
|
+
library install and ESM notes
|
|
12
|
+
|
|
6
13
|
## [0.1.1] - 2026-10-08
|
|
7
14
|
|
|
8
15
|
Maintenance release, the first one published through GitHub Actions (npm Trusted Publishing). No code changes.
|
package/README.md
CHANGED
|
@@ -35,28 +35,55 @@ And, frankly, why not? :)
|
|
|
35
35
|
|
|
36
36
|
Requires Node.js 20 or newer.
|
|
37
37
|
|
|
38
|
+
**Try it, nothing to install:**
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx mimeforge pdf docx webm -o icons
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
This writes `icons/pdf.svg`, `icons/docx.svg` and `icons/webm.svg`. Use them like any image:
|
|
45
|
+
|
|
46
|
+
```html
|
|
47
|
+
<img src="icons/pdf.svg" width="32" height="32" alt="PDF">
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Install:**
|
|
51
|
+
|
|
38
52
|
```bash
|
|
39
|
-
|
|
40
|
-
npm i mimeforge
|
|
53
|
+
npm i -g mimeforge # a global `mimeforge` command
|
|
54
|
+
npm i mimeforge # or as a dependency of your project (CLI via npx, plus the library API)
|
|
41
55
|
```
|
|
42
56
|
|
|
43
|
-
|
|
57
|
+
**From source** (to hack on it):
|
|
44
58
|
|
|
45
59
|
```bash
|
|
46
60
|
git clone https://github.com/reachdevel/mimeforge.git
|
|
47
61
|
cd mimeforge
|
|
48
|
-
npm install
|
|
62
|
+
npm install # also builds the project
|
|
49
63
|
node dist/cli.js pdf docx webm -o icons
|
|
50
64
|
```
|
|
51
65
|
|
|
52
|
-
|
|
66
|
+
The examples below use the `mimeforge` command. Without a global install, put `npx` in front of it
|
|
67
|
+
(`npx mimeforge --all`); from a source checkout use `node dist/cli.js` or run `npm link` once.
|
|
53
68
|
|
|
54
|
-
|
|
55
|
-
|
|
69
|
+
### Use it in a project
|
|
70
|
+
|
|
71
|
+
Generate the icons at build time, so your app only ships the SVGs it needs:
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"scripts": {
|
|
76
|
+
"icons": "mimeforge --all -o public/icons"
|
|
77
|
+
},
|
|
78
|
+
"devDependencies": {
|
|
79
|
+
"mimeforge": "^0.1.1"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
56
82
|
```
|
|
57
83
|
|
|
58
|
-
|
|
59
|
-
|
|
84
|
+
Then `npm run icons` and reference `/icons/<ext>.svg`. `public/icons/manifest.json` maps every extension to its
|
|
85
|
+
category, which is handy for lookups. If you only show a few types, list them instead of `--all`. To render icons at
|
|
86
|
+
runtime instead (a server, a build plugin), use the [library API](#library-api).
|
|
60
87
|
|
|
61
88
|
## Everyday use
|
|
62
89
|
|
|
@@ -199,6 +226,8 @@ how to change it.
|
|
|
199
226
|
|
|
200
227
|
## Library API
|
|
201
228
|
|
|
229
|
+
Install with `npm i mimeforge`. The package is ESM, so use `import` (from CommonJS: `const { renderIcon } = await import('mimeforge')`).
|
|
230
|
+
|
|
202
231
|
```ts
|
|
203
232
|
import { renderIcon, loadFont, loadBodies, createPalette } from 'mimeforge';
|
|
204
233
|
|
|
@@ -215,8 +244,7 @@ renderIcon('xyz', {
|
|
|
215
244
|
```
|
|
216
245
|
|
|
217
246
|
`renderIcon` returns `{ svg, ext, category, accent }`. Other exports: `categoryFor`, `allExtensions`, `CATEGORIES`,
|
|
218
|
-
`DEFAULT_PALETTE`, `validateBody`, `renderLabel`, `bitmapFont`, `outlineFont` (see `src/index.ts`).
|
|
219
|
-
The package is ESM only.
|
|
247
|
+
`DEFAULT_PALETTE`, `validateBody`, `renderLabel`, `bitmapFont`, `outlineFont` (see `src/index.ts`). Types are included.
|
|
220
248
|
|
|
221
249
|
## CLI reference
|
|
222
250
|
|
package/package.json
CHANGED