linework-cli 0.1.0 → 0.2.0
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/README.md +68 -15
- package/package.json +6 -3
- package/src/cli.mjs +26 -18
package/README.md
CHANGED
|
@@ -1,29 +1,82 @@
|
|
|
1
1
|
# linework-cli
|
|
2
2
|
|
|
3
|
-
Official CLI for [Linework](https://linework.rdev.web.id) semantic
|
|
3
|
+
Official CLI for **[Linework](https://linework.rdev.web.id)** — semantic SVG icons and editorial illustrations engineered for React, Next.js, Vite, Astro, Remix, and React Router.
|
|
4
4
|
|
|
5
|
-
Initialize semantic `--
|
|
5
|
+
Initialize semantic `--linework-*` light/dark CSS tokens and pull live TSX components or full React packages straight into your project. Newly published icons and illustrations on Linework are available immediately through the CLI without waiting for CLI releases.
|
|
6
|
+
|
|
7
|
+
---
|
|
6
8
|
|
|
7
9
|
## Quick Start
|
|
8
10
|
|
|
11
|
+
Initialize `linework.json` and configure all 5 semantic CSS custom properties:
|
|
12
|
+
|
|
9
13
|
```bash
|
|
10
|
-
#
|
|
14
|
+
# pnpm
|
|
11
15
|
pnpm dlx linework-cli@latest init -t next
|
|
12
16
|
|
|
13
|
-
#
|
|
17
|
+
# npm
|
|
18
|
+
npx linework-cli@latest init -t next
|
|
19
|
+
|
|
20
|
+
# yarn
|
|
21
|
+
yarn dlx linework-cli@latest init -t next
|
|
22
|
+
|
|
23
|
+
# bun
|
|
24
|
+
bunx --bun linework-cli@latest init -t next
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Supported framework presets (`-t`): `next`, `vite`, `astro`, `remix`, `react-router`, `react`.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Add Icons & Illustrations (`add`)
|
|
32
|
+
|
|
33
|
+
Pull typed, zero-dependency TSX component files straight from the live Linework registry into `src/components/linework/` (or your custom `--dir`):
|
|
34
|
+
|
|
35
|
+
```bash
|
|
14
36
|
pnpm dlx linework-cli@latest add friendly-ghost shield-check
|
|
37
|
+
```
|
|
15
38
|
|
|
16
|
-
|
|
17
|
-
|
|
39
|
+
Options:
|
|
40
|
+
- `--size <px>` — Default SVG width/height (default `48`)
|
|
41
|
+
- `-o, --dir <path>` — Custom output directory
|
|
42
|
+
- `--overwrite` — Replace existing `.tsx` files
|
|
43
|
+
- `--all-illustrations` — Pull all free illustrations at once
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Search & Sync
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Search live icons & illustrations from the terminal
|
|
51
|
+
pnpm dlx linework-cli@latest search astronaut --type illustration
|
|
52
|
+
|
|
53
|
+
# Refresh installed @linework/icons-react & @linework/illustrations-react .tgz packages
|
|
54
|
+
pnpm dlx linework-cli@latest sync
|
|
18
55
|
```
|
|
19
56
|
|
|
20
|
-
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 5 Semantic Color Tokens
|
|
60
|
+
|
|
61
|
+
Every icon and illustration automatically maps paths to 5 theme tokens configured by `linework-cli init`:
|
|
62
|
+
|
|
63
|
+
| Token | CSS Variable | Role |
|
|
64
|
+
|---|---|---|
|
|
65
|
+
| `primary` | `--linework-primary` | Dominant fill / foreground subject |
|
|
66
|
+
| `secondary` | `--linework-secondary` | Supporting planes & depth |
|
|
67
|
+
| `accent` | `--linework-accent` | Warm highlights & badges |
|
|
68
|
+
| `outline` | `--linework-outline` | Structural ink contours |
|
|
69
|
+
| `highlight` | `--linework-highlight` | Specular paper/card shine |
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Documentation
|
|
74
|
+
|
|
75
|
+
- Introduction: https://linework.rdev.web.id/docs
|
|
76
|
+
- Installation Guide: https://linework.rdev.web.id/docs/installation
|
|
77
|
+
- CLI Reference: https://linework.rdev.web.id/docs/cli
|
|
78
|
+
- State Page Builder (404 / 500): https://linework.rdev.web.id/builder
|
|
79
|
+
|
|
80
|
+
## License
|
|
21
81
|
|
|
22
|
-
|
|
23
|
-
Creates `linework.json`, injects `--rdev-*` semantic light & dark tokens into your global CSS, and optionally installs `@rdev/icons-react` + `@rdev/illustrations-react`.
|
|
24
|
-
- `add <slug...> [-o <dir>] [--size <px>] [--overwrite] [--all-illustrations]`
|
|
25
|
-
Fetches ready-to-use PascalCase TSX component files directly from the live Linework registry.
|
|
26
|
-
- `search <query> [--type icon|illustration] [--limit <n>]`
|
|
27
|
-
Searches published assets from the terminal.
|
|
28
|
-
- `sync`
|
|
29
|
-
Updates `@rdev/icons-react` and `@rdev/illustrations-react` in `node_modules` with newly published assets.
|
|
82
|
+
MIT — Linework Studio
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "linework-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "CLI for initializing Linework semantic color tokens and adding live vector icons and illustrations to React projects.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"author": "
|
|
7
|
+
"author": "Linework Studio",
|
|
8
8
|
"homepage": "https://linework.rdev.web.id/docs/cli",
|
|
9
9
|
"keywords": [
|
|
10
10
|
"icons",
|
|
@@ -34,6 +34,9 @@
|
|
|
34
34
|
"node": ">=18.0.0"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
|
-
"test": "node --test tests/*.test.mjs"
|
|
37
|
+
"test": "node --test tests/*.test.mjs",
|
|
38
|
+
"prepublishOnly": "npm test",
|
|
39
|
+
"release:patch": "npm version patch && npm publish --access public",
|
|
40
|
+
"release:minor": "npm version minor && npm publish --access public"
|
|
38
41
|
}
|
|
39
42
|
}
|
package/src/cli.mjs
CHANGED
|
@@ -2,8 +2,12 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { spawnSync } from 'node:child_process';
|
|
4
4
|
|
|
5
|
+
const PKG_JSON = JSON.parse(
|
|
6
|
+
fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
|
|
7
|
+
);
|
|
8
|
+
|
|
5
9
|
export const DEFAULT_REGISTRY_URL = 'https://linework.rdev.web.id';
|
|
6
|
-
export const CLI_VERSION = '0.
|
|
10
|
+
export const CLI_VERSION = String(PKG_JSON.version || '0.0.0');
|
|
7
11
|
|
|
8
12
|
const TOKEN_BLOCK_START = '/* linework-tokens:start */';
|
|
9
13
|
const TOKEN_BLOCK_END = '/* linework-tokens:end */';
|
|
@@ -108,19 +112,19 @@ function buildTokenCssBlock(tokens = DEFAULT_TOKENS) {
|
|
|
108
112
|
return [
|
|
109
113
|
TOKEN_BLOCK_START,
|
|
110
114
|
':root {',
|
|
111
|
-
` --
|
|
112
|
-
` --
|
|
113
|
-
` --
|
|
114
|
-
` --
|
|
115
|
-
` --
|
|
115
|
+
` --linework-primary: ${tokens.primary};`,
|
|
116
|
+
` --linework-secondary: ${tokens.secondary};`,
|
|
117
|
+
` --linework-accent: ${tokens.accent};`,
|
|
118
|
+
` --linework-outline: ${tokens.outline};`,
|
|
119
|
+
` --linework-highlight: ${tokens.highlight};`,
|
|
116
120
|
'}',
|
|
117
121
|
'',
|
|
118
122
|
'.dark {',
|
|
119
|
-
' --
|
|
120
|
-
' --
|
|
121
|
-
' --
|
|
122
|
-
' --
|
|
123
|
-
' --
|
|
123
|
+
' --linework-primary: #52B788;',
|
|
124
|
+
' --linework-secondary: #74C69D;',
|
|
125
|
+
' --linework-accent: #F4A261;',
|
|
126
|
+
' --linework-outline: #E8E6DF;',
|
|
127
|
+
' --linework-highlight: #1B2622;',
|
|
124
128
|
'}',
|
|
125
129
|
TOKEN_BLOCK_END,
|
|
126
130
|
].join('\n');
|
|
@@ -139,7 +143,7 @@ export function upsertTokenCss(fullCssPath, tokens = DEFAULT_TOKENS) {
|
|
|
139
143
|
return 'updated';
|
|
140
144
|
}
|
|
141
145
|
|
|
142
|
-
if (existing.includes('--
|
|
146
|
+
if (existing.includes('--linework-primary')) {
|
|
143
147
|
return 'skipped';
|
|
144
148
|
}
|
|
145
149
|
|
|
@@ -236,8 +240,8 @@ export function formatHelp() {
|
|
|
236
240
|
'Options:',
|
|
237
241
|
' -t, --template <framework> Framework preset (next, vite, astro, remix, react-router, react)',
|
|
238
242
|
' -d, --dir <path> Target directory for added components (default: components/linework)',
|
|
239
|
-
' --install Install live @
|
|
240
|
-
' --no-css Skip writing --
|
|
243
|
+
' --install Install live @linework/icons-react & @linework/illustrations-react .tgz packages',
|
|
244
|
+
' --no-css Skip writing --linework-* CSS custom properties',
|
|
241
245
|
' --size <px> Default icon/illustration width/height for added TSX (default: 48)',
|
|
242
246
|
' --overwrite Overwrite existing local .tsx component files',
|
|
243
247
|
' -h, --help Show help',
|
|
@@ -299,7 +303,7 @@ export async function runCli(argv, deps = {}) {
|
|
|
299
303
|
const cssFullPath = path.resolve(cwd, cssRel);
|
|
300
304
|
const cssStatus = upsertTokenCss(cssFullPath, DEFAULT_TOKENS);
|
|
301
305
|
if (cssStatus === 'added') {
|
|
302
|
-
log(`✔ Added 5 semantic --
|
|
306
|
+
log(`✔ Added 5 semantic --linework-* tokens to ${cssRel}`);
|
|
303
307
|
} else if (cssStatus === 'updated') {
|
|
304
308
|
log(`✔ Updated Linework semantic tokens in ${cssRel}`);
|
|
305
309
|
} else {
|
|
@@ -313,7 +317,7 @@ export async function runCli(argv, deps = {}) {
|
|
|
313
317
|
`${registry}/api/packages/illustrations-react.tgz`,
|
|
314
318
|
];
|
|
315
319
|
const args = buildInstallArgs(pm, specs);
|
|
316
|
-
log(`Installing @
|
|
320
|
+
log(`Installing @linework/icons-react and @linework/illustrations-react via ${pm}...`);
|
|
317
321
|
const res = runCommand(pm, args, cwd);
|
|
318
322
|
if (res.status !== 0) {
|
|
319
323
|
errLog(`Package installation failed with exit code ${res.status}.`);
|
|
@@ -457,8 +461,12 @@ export async function runCli(argv, deps = {}) {
|
|
|
457
461
|
}
|
|
458
462
|
|
|
459
463
|
const targets = [];
|
|
460
|
-
if (deps['@
|
|
461
|
-
|
|
464
|
+
if (deps['@linework/icons-react'] || deps['@rdev/icons-react']) {
|
|
465
|
+
targets.push(`${registry}/api/packages/icons-react.tgz`);
|
|
466
|
+
}
|
|
467
|
+
if (deps['@linework/illustrations-react'] || deps['@rdev/illustrations-react']) {
|
|
468
|
+
targets.push(`${registry}/api/packages/illustrations-react.tgz`);
|
|
469
|
+
}
|
|
462
470
|
if (targets.length === 0) {
|
|
463
471
|
targets.push(
|
|
464
472
|
`${registry}/api/packages/icons-react.tgz`,
|