@ngcorex/cli 0.1.4 → 0.1.5
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 +31 -2
- package/dist/commands/init.js +2 -2
- package/dist/watch/watch-config.js +14 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -103,8 +103,27 @@ export default defineNgCorexConfig({
|
|
|
103
103
|
|
|
104
104
|
---
|
|
105
105
|
|
|
106
|
+
## Command Overview
|
|
107
|
+
|
|
108
|
+
The ngCorex CLI supports the following commands:
|
|
109
|
+
|
|
110
|
+
- `ngcorex init` – create starter config and tokens
|
|
111
|
+
- `ngcorex build` – generate CSS from tokens
|
|
112
|
+
- `ngcorex build --watch` – rebuild on file changes
|
|
113
|
+
- `ngcorex build --dry-run` – validate without writing files
|
|
114
|
+
- `ngcorex version` / `--version` / `-v` – print CLI version
|
|
115
|
+
- `ngcorex --help` / `-h` – show help information
|
|
116
|
+
|
|
106
117
|
## Commands
|
|
107
118
|
|
|
119
|
+
### Initialize
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
npx ngcorex init
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
108
127
|
### Build CSS
|
|
109
128
|
|
|
110
129
|
```bash
|
|
@@ -124,8 +143,8 @@ npx ngcorex build --watch
|
|
|
124
143
|
```
|
|
125
144
|
|
|
126
145
|
- Watches `ngcorex.config.ts`
|
|
127
|
-
-
|
|
128
|
-
-
|
|
146
|
+
- Watches `tokens.json` (if present)
|
|
147
|
+
- Rebuilds CSS when either file changes
|
|
129
148
|
|
|
130
149
|
---
|
|
131
150
|
|
|
@@ -151,6 +170,16 @@ Prints the CLI version.
|
|
|
151
170
|
|
|
152
171
|
---
|
|
153
172
|
|
|
173
|
+
### Help
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
npx ngcorex --help
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Prints available commands and usage information.
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
154
183
|
## Output
|
|
155
184
|
|
|
156
185
|
The CLI generates CSS variables based on your tokens and constraints.
|
package/dist/commands/init.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { watch } from 'node:fs';
|
|
1
|
+
import { watch, existsSync } from 'node:fs';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
2
3
|
import { resolveConfigPath } from '../config/resolve-path.js';
|
|
3
4
|
export function watchConfig(onChange) {
|
|
4
5
|
const configPath = resolveConfigPath();
|
|
6
|
+
const tokensPath = resolve(process.cwd(), 'tokens.json');
|
|
5
7
|
console.log(`✔ Watching ${configPath}`);
|
|
8
|
+
if (existsSync(tokensPath)) {
|
|
9
|
+
console.log(`✔ Watching ${tokensPath}`);
|
|
10
|
+
}
|
|
6
11
|
let timeout = null;
|
|
7
|
-
|
|
12
|
+
const triggerRebuild = () => {
|
|
8
13
|
if (timeout) {
|
|
9
14
|
clearTimeout(timeout);
|
|
10
15
|
}
|
|
@@ -12,5 +17,11 @@ export function watchConfig(onChange) {
|
|
|
12
17
|
console.log('\n↻ Rebuilding...\n');
|
|
13
18
|
onChange();
|
|
14
19
|
}, 100);
|
|
15
|
-
}
|
|
20
|
+
};
|
|
21
|
+
// Watch config
|
|
22
|
+
watch(configPath, triggerRebuild);
|
|
23
|
+
// Watch tokens.json (if present)
|
|
24
|
+
if (existsSync(tokensPath)) {
|
|
25
|
+
watch(tokensPath, triggerRebuild);
|
|
26
|
+
}
|
|
16
27
|
}
|