@preact-mvc/cli 0.1.0 → 0.1.1
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 +54 -0
- package/package.json +1 -1
- package/src/templates.mjs +10 -0
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# @preact-mvc/cli
|
|
2
|
+
|
|
3
|
+
[](https://github.com/jwhenry3/preact-mvc/actions/workflows/ci.yml)
|
|
4
|
+
[](https://codecov.io/gh/jwhenry3/preact-mvc)
|
|
5
|
+
[](https://badge.socket.dev/npm/package/@preact-mvc/cli)
|
|
6
|
+
|
|
7
|
+
The `pmvc` binary — scaffolding, generators, dev/build/test delegation,
|
|
8
|
+
and dependency maintenance for preact-mvc projects.
|
|
9
|
+
|
|
10
|
+
**[preact-mvc — CLI documentation](https://jwhenry3.github.io/preact-mvc/docs/cli/)**
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install -g @preact-mvc/cli
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Create an app
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pmvc new my-app # scaffold + npm install
|
|
22
|
+
pmvc new my-app --islands # + worker-island demo (contract + worker + route)
|
|
23
|
+
pmvc new my-app --tailwind # + Tailwind v4 wiring
|
|
24
|
+
cd my-app && pmvc serve # vite dev server
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The generated app is a runnable `@Module`-/`@Component`-structured Preact
|
|
28
|
+
project with router, DI tokens, a sample view test, and (with `--islands`)
|
|
29
|
+
a shared island contract + worker entry.
|
|
30
|
+
|
|
31
|
+
## Generators — run inside a project
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pmvc g view my-page # src/app/my-page/my-page.view.tsx (+ test)
|
|
35
|
+
pmvc g controller orders # <name>.controller.ts — @Controller view logic
|
|
36
|
+
pmvc g service auth # <name>.service.ts — @Injectable service
|
|
37
|
+
pmvc g module admin # feature module
|
|
38
|
+
pmvc g island ticker # contract + worker entry pair
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Build, dev, test
|
|
42
|
+
|
|
43
|
+
`pmvc serve|dev`, `pmvc build` (`tsc --noEmit` + `vite build`), and
|
|
44
|
+
`pmvc test` (`vitest run`) delegate to the project's own toolchain —
|
|
45
|
+
vite args pass through (`--watch`, `--no-typecheck`).
|
|
46
|
+
|
|
47
|
+
## Maintenance
|
|
48
|
+
|
|
49
|
+
- `pmvc add tailwind | islands` — install + wire an integration into an
|
|
50
|
+
existing project.
|
|
51
|
+
- `pmvc update` — bump `@preact-mvc/*` deps (`--to <ver>`,
|
|
52
|
+
`--include-atoll` for `@atolljs/*`).
|
|
53
|
+
|
|
54
|
+
The package is plain `.mjs` — no build step, ships `src/` directly.
|
package/package.json
CHANGED
package/src/templates.mjs
CHANGED
|
@@ -38,6 +38,16 @@ import preact from '@preact/preset-vite';
|
|
|
38
38
|
resolve: {
|
|
39
39
|
alias: [{ find: '@', replacement: fileURLToPath(new URL('./src', import.meta.url)) }],
|
|
40
40
|
},
|
|
41
|
+
// Keep @preact-mvc/* out of dep prebundling: releases >= 0.1.1 ship
|
|
42
|
+
// compiled dist/, but 0.1.0 ships .ts/.tsx sources which esbuild's
|
|
43
|
+
// optimizer compiles with the classic React pragma ("React is not
|
|
44
|
+
// defined"). Excluded deps go through vite's transform instead —
|
|
45
|
+
// correct JSX either way — and stay in one module realm with the
|
|
46
|
+
// view interceptor's patched options object (same reason the vitest
|
|
47
|
+
// inline list exists below).
|
|
48
|
+
optimizeDeps: {
|
|
49
|
+
exclude: ['@preact-mvc/core', '@preact-mvc/atoll', '@preact-mvc/atoll-island'],
|
|
50
|
+
},
|
|
41
51
|
test: {
|
|
42
52
|
environment: 'jsdom',
|
|
43
53
|
globals: true,
|