@preact-mvc/cli 0.1.0 → 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/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # @preact-mvc/cli
2
+
3
+ [![CI](https://github.com/jwhenry3/preact-mvc/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/jwhenry3/preact-mvc/actions/workflows/ci.yml)
4
+ [![codecov](https://codecov.io/gh/jwhenry3/preact-mvc/graph/badge.svg?branch=main)](https://codecov.io/gh/jwhenry3/preact-mvc)
5
+ [![Socket Badge](https://badge.socket.dev/npm/package/@preact-mvc/cli)](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 PreactMVC projects.
9
+
10
+ **[PreactMVC — 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@preact-mvc/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Project scaffolding and maintenance CLI for preact-mvc: new, generate, serve/build/test, add, update",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * pmvc — the preact-mvc CLI. Angular-CLI-shaped: new / generate /
3
+ * pmvc — the PreactMVC CLI. Angular-CLI-shaped: new / generate /
4
4
  * serve / build / test / add / update / version / docs.
5
5
  *
6
6
  * Dependency-free on purpose: the CLI must run before a project has
@@ -13,7 +13,7 @@ import { cmdNew } from './commands/new.mjs';
13
13
  import { cmdGenerate } from './commands/generate.mjs';
14
14
  import { cmdBuild, cmdServe, cmdTest } from './commands/run.mjs';
15
15
  import { cmdAdd, cmdUpdate } from './commands/update.mjs';
16
- const HELP = `pmvc — the preact-mvc CLI
16
+ const HELP = `pmvc — the PreactMVC CLI
17
17
 
18
18
  Usage: pmvc <command> [args] [flags]
19
19
 
@@ -97,7 +97,7 @@ export function cmdGenerate(a) {
97
97
  }
98
98
 
99
99
  const found = findProjectRoot();
100
- if (!found) fail('not inside a preact-mvc project (no @preact-mvc/core dependency found)');
100
+ if (!found) fail('not inside a PreactMVC project (no @preact-mvc/core dependency found)');
101
101
  const name = featureName(rawName);
102
102
 
103
103
  if (schematic === 'island') {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `pmvc new <dir>` — scaffold a preact-mvc application, the `ng new`
2
+ * `pmvc new <dir>` — scaffold a PreactMVC application, the `ng new`
3
3
  * equivalent. Flags: --islands, --tailwind, --skip-install,
4
4
  * --skip-tests, -d/--dry-run, --force (overwrite existing files).
5
5
  */
@@ -119,7 +119,7 @@ export function cmdNew(argv) {
119
119
  );
120
120
  }
121
121
 
122
- log(`\nScaffolding a preact-mvc app in ${root}\n`);
122
+ log(`\nScaffolding a PreactMVC app in ${root}\n`);
123
123
  for (const [rel, contents] of Object.entries(files)) {
124
124
  writeFile(root, rel, contents, opts);
125
125
  }
@@ -10,7 +10,7 @@ import { findProjectRoot, readJson, run, fail } from '../lib.mjs';
10
10
 
11
11
  function projectRoot() {
12
12
  const found = findProjectRoot();
13
- if (!found) fail('not inside a preact-mvc project (no @preact-mvc/core dependency found)');
13
+ if (!found) fail('not inside a PreactMVC project (no @preact-mvc/core dependency found)');
14
14
  return found.root;
15
15
  }
16
16
 
@@ -24,7 +24,7 @@ import * as T from '../templates.mjs';
24
24
 
25
25
  function project() {
26
26
  const found = findProjectRoot();
27
- if (!found) fail('not inside a preact-mvc project (no @preact-mvc/core dependency found)');
27
+ if (!found) fail('not inside a PreactMVC project (no @preact-mvc/core dependency found)');
28
28
  return found;
29
29
  }
30
30
 
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,
@@ -94,7 +104,7 @@ save-exact=true
94
104
 
95
105
  export const T_README = `# %%NAME%%
96
106
 
97
- A [preact-mvc](https://github.com/jwhenry3/preact-mvc) application —
107
+ A [PreactMVC](https://github.com/jwhenry3/preact-mvc) application —
98
108
  Angular-style modules, DI, and MVC on class-based JSX views rendered by
99
109
  Preact, with signal reactivity.
100
110