@techninja/clearstack 0.2.5 → 0.2.7
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/docs/CONVENTIONS.md
CHANGED
|
@@ -213,6 +213,50 @@ function moveObj(o, dx, dy) { ... }
|
|
|
213
213
|
|
|
214
214
|
---
|
|
215
215
|
|
|
216
|
+
## npm Scripts: One Entry Point Per Domain
|
|
217
|
+
|
|
218
|
+
Every `package.json` script should be a single, discoverable entry point.
|
|
219
|
+
Avoid the `name:variant` colon pattern that fragments a domain across
|
|
220
|
+
multiple keys.
|
|
221
|
+
|
|
222
|
+
### Rules
|
|
223
|
+
|
|
224
|
+
- **One script per domain.** `test`, `spec`, `lint` — not `test:node`,
|
|
225
|
+
`test:browser`, `lint:fix`, `spec:code`, `spec:docs`.
|
|
226
|
+
- **Arguments over aliases.** `pnpm spec check code` instead of
|
|
227
|
+
`pnpm spec:code`. The CLI handles routing.
|
|
228
|
+
- **Interactive by default.** Running `pnpm spec` with no arguments shows
|
|
229
|
+
a menu of available actions. Users discover commands by using the tool.
|
|
230
|
+
- **Direct invocation for power users.** Once you know the subcommand,
|
|
231
|
+
skip the menu: `pnpm spec check`, `pnpm spec update`.
|
|
232
|
+
- **Self-documenting.** Each script's CLI should print usage when given
|
|
233
|
+
`help` or an unknown argument.
|
|
234
|
+
|
|
235
|
+
### Why
|
|
236
|
+
|
|
237
|
+
- Fewer script entries = less package.json bloat
|
|
238
|
+
- Discoverability through interactive menus beats memorizing key names
|
|
239
|
+
- Scripts grow via subcommands, not new `package.json` entries
|
|
240
|
+
- Consistent with how real CLIs work (`git`, `docker`, `npm` itself)
|
|
241
|
+
|
|
242
|
+
### Example
|
|
243
|
+
|
|
244
|
+
```json
|
|
245
|
+
{
|
|
246
|
+
"scripts": {
|
|
247
|
+
"start": "node src/server.js",
|
|
248
|
+
"dev": "node --watch --env-file=.env src/server.js",
|
|
249
|
+
"test": "node --test tests/*.test.js",
|
|
250
|
+
"spec": "clearstack"
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
`pnpm spec` → interactive menu. `pnpm spec check` → run checks.
|
|
256
|
+
`pnpm spec update` → sync docs. One entry, full access.
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
216
260
|
## Session Retrospective
|
|
217
261
|
|
|
218
262
|
At the end of each implementation session, ask:
|
package/lib/check.js
CHANGED
|
@@ -100,16 +100,22 @@ function findFiles(dir, extensions, ignoreDirs, root) {
|
|
|
100
100
|
return results;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
/** Run a shell command, report pass/fail. */
|
|
103
|
+
/** Run a shell command, report pass/fail. Filters node_modules errors. */
|
|
104
104
|
function runCmd(label, cmd, cwd) {
|
|
105
105
|
try {
|
|
106
106
|
execSync(cmd, { cwd, stdio: 'pipe' });
|
|
107
107
|
console.log(` ✅ ${label}`);
|
|
108
108
|
return true;
|
|
109
109
|
} catch (err) {
|
|
110
|
-
console.log(` ❌ ${label}`);
|
|
111
110
|
const out = (err.stdout || '') + (err.stderr || '');
|
|
112
|
-
|
|
111
|
+
const ownErrors = out.trim().split('\n')
|
|
112
|
+
.filter((l) => l.trim() && !l.includes('node_modules'));
|
|
113
|
+
if (ownErrors.length === 0) {
|
|
114
|
+
console.log(` ✅ ${label}`);
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
console.log(` ❌ ${label}`);
|
|
118
|
+
ownErrors.forEach((l) => console.log(` ${l}`));
|
|
113
119
|
return false;
|
|
114
120
|
}
|
|
115
121
|
}
|
package/lib/package-gen.js
CHANGED
|
@@ -22,17 +22,8 @@ export async function writePackageJson(dest, vars, existing) {
|
|
|
22
22
|
dev: 'node --watch --env-file=.env src/server.js',
|
|
23
23
|
} : {}),
|
|
24
24
|
postinstall: 'node scripts/vendor-deps.js && node scripts/build-icons.js',
|
|
25
|
-
test: '
|
|
26
|
-
|
|
27
|
-
'test:browser': 'web-test-runner --config .configs/web-test-runner.config.js',
|
|
28
|
-
spec: 'clearstack check',
|
|
29
|
-
'spec:code': 'clearstack check code',
|
|
30
|
-
'spec:docs': 'clearstack check docs',
|
|
31
|
-
'spec:update': 'clearstack update',
|
|
32
|
-
lint: 'eslint --config .configs/eslint.config.js .',
|
|
33
|
-
'lint:fix': 'eslint --config .configs/eslint.config.js . --fix',
|
|
34
|
-
format: 'prettier --config .configs/.prettierrc --write src scripts tests',
|
|
35
|
-
typecheck: 'tsc --project .configs/jsconfig.json',
|
|
25
|
+
test: 'node --test tests/*.test.js src/utils/*.test.js src/store/*.test.js',
|
|
26
|
+
spec: 'clearstack',
|
|
36
27
|
};
|
|
37
28
|
|
|
38
29
|
const specDeps = {
|
|
@@ -43,6 +34,7 @@ export async function writePackageJson(dest, vars, existing) {
|
|
|
43
34
|
|
|
44
35
|
const specDevDeps = {
|
|
45
36
|
'@techninja/clearstack': '^0.2.0',
|
|
37
|
+
'@types/node': '^22.0.0',
|
|
46
38
|
'@open-wc/testing': '^4.0.0',
|
|
47
39
|
'@web/test-runner': '^0.20.0',
|
|
48
40
|
'@web/test-runner-playwright': '^0.11.0',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@techninja/clearstack",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A no-build web component framework specification — scaffold, validate, and evolve spec-compliant projects",
|
|
6
6
|
"bin": {
|
|
@@ -20,22 +20,12 @@
|
|
|
20
20
|
"start": "node src/server.js",
|
|
21
21
|
"dev": "node --watch --env-file=.env src/server.js",
|
|
22
22
|
"setup": "node scripts/vendor-deps.js && node scripts/build-icons.js",
|
|
23
|
-
"test": "
|
|
24
|
-
"test:node": "node --test tests/*.test.js src/utils/*.test.js src/store/*.test.js",
|
|
25
|
-
"test:browser": "web-test-runner --config .configs/web-test-runner.config.js",
|
|
26
|
-
"test:watch": "web-test-runner --config .configs/web-test-runner.config.js --watch",
|
|
23
|
+
"test": "node --test tests/*.test.js src/utils/*.test.js src/store/*.test.js",
|
|
27
24
|
"spec": "node --env-file=.env scripts/spec.js",
|
|
28
|
-
"
|
|
29
|
-
"spec:docs": "node --env-file=.env scripts/spec.js docs",
|
|
30
|
-
"lint": "eslint --config .configs/eslint.config.js .",
|
|
31
|
-
"lint:fix": "eslint --config .configs/eslint.config.js . --fix",
|
|
25
|
+
"lint": "eslint --config .configs/eslint.config.js . --fix",
|
|
32
26
|
"format": "prettier --config .configs/.prettierrc --write src scripts tests",
|
|
33
|
-
"format:check": "prettier --config .configs/.prettierrc --check src scripts tests",
|
|
34
27
|
"typecheck": "tsc --project .configs/jsconfig.json",
|
|
35
|
-
"sync-docs": "node scripts/sync-docs.js",
|
|
36
28
|
"release": "node scripts/release.js",
|
|
37
|
-
"release:minor": "node scripts/release.js minor",
|
|
38
|
-
"release:major": "node scripts/release.js major",
|
|
39
29
|
"prepublishOnly": "node scripts/sync-docs.js"
|
|
40
30
|
},
|
|
41
31
|
"keywords": [
|
|
@@ -213,6 +213,50 @@ function moveObj(o, dx, dy) { ... }
|
|
|
213
213
|
|
|
214
214
|
---
|
|
215
215
|
|
|
216
|
+
## npm Scripts: One Entry Point Per Domain
|
|
217
|
+
|
|
218
|
+
Every `package.json` script should be a single, discoverable entry point.
|
|
219
|
+
Avoid the `name:variant` colon pattern that fragments a domain across
|
|
220
|
+
multiple keys.
|
|
221
|
+
|
|
222
|
+
### Rules
|
|
223
|
+
|
|
224
|
+
- **One script per domain.** `test`, `spec`, `lint` — not `test:node`,
|
|
225
|
+
`test:browser`, `lint:fix`, `spec:code`, `spec:docs`.
|
|
226
|
+
- **Arguments over aliases.** `pnpm spec check code` instead of
|
|
227
|
+
`pnpm spec:code`. The CLI handles routing.
|
|
228
|
+
- **Interactive by default.** Running `pnpm spec` with no arguments shows
|
|
229
|
+
a menu of available actions. Users discover commands by using the tool.
|
|
230
|
+
- **Direct invocation for power users.** Once you know the subcommand,
|
|
231
|
+
skip the menu: `pnpm spec check`, `pnpm spec update`.
|
|
232
|
+
- **Self-documenting.** Each script's CLI should print usage when given
|
|
233
|
+
`help` or an unknown argument.
|
|
234
|
+
|
|
235
|
+
### Why
|
|
236
|
+
|
|
237
|
+
- Fewer script entries = less package.json bloat
|
|
238
|
+
- Discoverability through interactive menus beats memorizing key names
|
|
239
|
+
- Scripts grow via subcommands, not new `package.json` entries
|
|
240
|
+
- Consistent with how real CLIs work (`git`, `docker`, `npm` itself)
|
|
241
|
+
|
|
242
|
+
### Example
|
|
243
|
+
|
|
244
|
+
```json
|
|
245
|
+
{
|
|
246
|
+
"scripts": {
|
|
247
|
+
"start": "node src/server.js",
|
|
248
|
+
"dev": "node --watch --env-file=.env src/server.js",
|
|
249
|
+
"test": "node --test tests/*.test.js",
|
|
250
|
+
"spec": "clearstack"
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
`pnpm spec` → interactive menu. `pnpm spec check` → run checks.
|
|
256
|
+
`pnpm spec update` → sync docs. One entry, full access.
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
216
260
|
## Session Retrospective
|
|
217
261
|
|
|
218
262
|
At the end of each implementation session, ask:
|
|
@@ -26,7 +26,8 @@ export default define({
|
|
|
26
26
|
<div class="home-view">
|
|
27
27
|
<h1>{{name}}</h1>
|
|
28
28
|
<p>Your Clearstack project is ready. Start building!</p>
|
|
29
|
-
${store.ready(state) &&
|
|
29
|
+
${store.ready(state) &&
|
|
30
|
+
html`
|
|
30
31
|
<p>Count: ${state.count}</p>
|
|
31
32
|
<button class="btn btn-primary" onclick="${increment}">Increment</button>
|
|
32
33
|
<p class="hint">State persists in localStorage — refresh to verify.</p>
|