@m2s2/cli 0.1.20 → 0.1.23

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/CHANGELOG.md CHANGED
@@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.23] - 2026-06-12
11
+
12
+ ### Bug Fixes
13
+ - Sync template dependencies to latest @m2s2 releases
14
+
15
+
16
+ ## [0.1.22] - 2026-06-11
17
+
18
+ ### Bug Fixes
19
+ - Rename workflows
20
+
21
+
22
+ ## [0.1.21] - 2026-06-11
23
+
24
+ ### Bug Fixes
25
+ - Sync template dependencies to latest @m2s2 releases
26
+ - Add pre-commit hooks for clippy and fmt
27
+
28
+ ### Features
29
+ - Vue, react, angular page and service generation
30
+
31
+
10
32
  ## [0.1.20] - 2026-06-08
11
33
 
12
34
 
package/README.md CHANGED
@@ -10,6 +10,8 @@ The official CLI for scaffolding and working with [M²S²](https://github.com/M2
10
10
  - [Commands](#commands)
11
11
  - [new](#m2s2-new)
12
12
  - [generate component](#m2s2-generate-component)
13
+ - [generate page](#m2s2-generate-page)
14
+ - [generate service](#m2s2-generate-service)
13
15
  - [upgrade](#m2s2-upgrade)
14
16
  - [completions](#m2s2-completions)
15
17
  - [Building from Source](#building-from-source)
@@ -216,6 +218,107 @@ src/components/HeroSection/
216
218
 
217
219
  ---
218
220
 
221
+ ### `m2s2 generate page`
222
+
223
+ Scaffold a new route page inside an existing M²S² project.
224
+
225
+ ```bash
226
+ m2s2 generate page <name> [OPTIONS]
227
+ ```
228
+
229
+ Run this from your project root. Framework is auto-detected from `package.json` or `.m2s2.json`.
230
+
231
+ **Arguments**
232
+
233
+ | Argument | Description |
234
+ |----------|-------------|
235
+ | `<name>` | Page name. Accepts any casing — `UserProfile`, `user-profile`, and `userProfile` all produce the same output. |
236
+
237
+ **Options**
238
+
239
+ | Flag | Description |
240
+ |------|-------------|
241
+ | `--framework <react\|angular\|vue>` | Override framework detection. |
242
+ | `--path <dir>` | Override the output directory. |
243
+
244
+ **Examples**
245
+
246
+ ```bash
247
+ m2s2 generate page UserProfile
248
+ m2s2 generate page user-profile --framework angular
249
+ m2s2 generate page Dashboard --path src/views
250
+ ```
251
+
252
+ **What gets generated**
253
+
254
+ *React* — written to `src/pages/<Name>/`
255
+ ```
256
+ src/pages/UserProfile/
257
+ ├── UserProfilePage.tsx # Typed props, BEM className
258
+ ├── UserProfilePage.scss # Scoped class stub
259
+ └── index.ts # Barrel re-export
260
+ ```
261
+
262
+ *Angular* — written to `src/app/pages/<name>/`
263
+ ```
264
+ src/app/pages/user-profile/
265
+ ├── user-profile.component.ts # Standalone, OnPush, app-user-profile selector
266
+ ├── user-profile.component.html
267
+ └── user-profile.component.scss
268
+ ```
269
+
270
+ A lazy-load route snippet is printed to the terminal after generation:
271
+ ```typescript
272
+ { path: 'user-profile', loadComponent: () => import('./pages/user-profile/user-profile.component').then(m => m.UserProfilePageComponent) }
273
+ ```
274
+
275
+ *Vue* — written to `src/pages/<Name>/`
276
+ ```
277
+ src/pages/UserProfile/
278
+ ├── UserProfilePage.vue # <script setup> SFC with scoped SCSS
279
+ └── index.ts # Barrel re-export
280
+ ```
281
+
282
+ ---
283
+
284
+ ### `m2s2 generate service`
285
+
286
+ Scaffold an injectable Angular service inside an existing M²S² project.
287
+
288
+ ```bash
289
+ m2s2 generate service <name> [OPTIONS]
290
+ ```
291
+
292
+ > Only supported for Angular projects. React and Vue projects receive a helpful error message.
293
+
294
+ **Arguments**
295
+
296
+ | Argument | Description |
297
+ |----------|-------------|
298
+ | `<name>` | Service name (without the `Service` suffix). |
299
+
300
+ **Options**
301
+
302
+ | Flag | Description |
303
+ |------|-------------|
304
+ | `--path <dir>` | Override the output directory. Defaults to `src/app/services/`. |
305
+
306
+ **Examples**
307
+
308
+ ```bash
309
+ m2s2 generate service Auth
310
+ m2s2 generate service user-data
311
+ m2s2 generate service Analytics --path src/app/core/services
312
+ ```
313
+
314
+ **What gets generated** — written to `src/app/services/<name>/`
315
+ ```
316
+ src/app/services/auth/
317
+ └── auth.service.ts # @Injectable({ providedIn: 'root' }) AuthService
318
+ ```
319
+
320
+ ---
321
+
219
322
  ### `m2s2 completions`
220
323
 
221
324
  Install shell completions for `m2s2`. Auto-detects your shell from `$SHELL` and writes a completion script to your home directory, then patches your shell's rc file to source it automatically.
@@ -304,13 +407,13 @@ All scaffold and generate templates live under `templates/` and are embedded int
304
407
 
305
408
  ```
306
409
  templates/
307
- ├── react/ # m2s2 new --framework react
308
- ├── angular/ # m2s2 new --framework angular
309
- ├── vue/ # m2s2 new --framework vue
410
+ ├── react/ # m2s2 new --framework react
411
+ ├── angular/ # m2s2 new --framework angular
412
+ ├── vue/ # m2s2 new --framework vue
310
413
  └── generate/
311
- ├── react/ # m2s2 generate component (React)
312
- ├── angular/ # m2s2 generate component (Angular)
313
- └── vue/ # m2s2 generate component (Vue)
414
+ ├── react/ # m2s2 generate component/page (React)
415
+ ├── angular/ # m2s2 generate component/page/service (Angular)
416
+ └── vue/ # m2s2 generate component/page (Vue)
314
417
  ```
315
418
 
316
419
  ---
@@ -347,15 +450,19 @@ cd test-app
347
450
  ```
348
451
  src/
349
452
  ├── main.rs # CLI entry point, command routing
453
+ ├── utils.rs # Shared case conversion (to_pascal_case, to_kebab_case)
454
+ ├── config.rs # .m2s2.json read/write, framework detection/resolution
350
455
  ├── scaffold/
351
- │ └── mod.rs # Template engine (rust-embed + Handlebars)
456
+ │ └── mod.rs # Template engine (rust-embed + Handlebars), write_files helper
352
457
  └── commands/
353
458
  ├── mod.rs
354
459
  ├── new.rs # m2s2 new
355
460
  ├── upgrade.rs # m2s2 upgrade
356
461
  └── generate/
357
462
  ├── mod.rs # m2s2 generate (subcommand router)
358
- └── component.rs # m2s2 generate component
463
+ ├── component.rs # m2s2 generate component
464
+ ├── page.rs # m2s2 generate page
465
+ └── service.rs # m2s2 generate service
359
466
  ```
360
467
 
361
468
  ---
@@ -373,22 +480,23 @@ Runs on every push to `main` and every pull request.
373
480
  | `clippy` | Runs `cargo clippy -- -D warnings`. |
374
481
  | `fmt` | Runs `cargo fmt --check`. |
375
482
 
376
- ### Release (`release-plz.yml` + `release.yml`)
483
+ ### Release (`release-plz.yml` + `auto-merge-release.yml` + `release-tag.yml` + `release.yml`)
377
484
 
378
- Releases are fully automated from conventional commits — no PRs, no manual tagging required.
485
+ Releases are fully automated from conventional commits — no manual tagging or PR review required.
379
486
 
380
487
  1. **CI passes on `main`** — `release-plz.yml` triggers only after the `CI` workflow succeeds.
381
- 2. **Version bump** — `release-plz update` reads conventional commit history, bumps `Cargo.toml`, and updates `CHANGELOG.md`. Only `feat`, `fix`, and `perf` commits trigger a bump; `chore`, `docs`, `refactor`, and others are skipped.
382
- 3. **Tag pushed** — the bump is committed directly to `main` and a `vX.Y.Z` tag is pushed.
383
- 4. **`release.yml` (cargo-dist) triggers** builds platform binaries in parallel:
488
+ 2. **Release PR opened** — `release-plz release-pr` reads conventional commit history, bumps `Cargo.toml`, updates `CHANGELOG.md`, and opens a PR (e.g. `chore: release v0.1.5`). Only `feat`, `fix`, and `perf` commits trigger a bump.
489
+ 3. **PR auto-approved and merged** — `auto-merge-release.yml` detects the `release-plz-*` branch, approves the PR using the GitHub App token, and immediately squash-merges it.
490
+ 4. **Tag pushed** — `release-tag.yml` fires on the merge commit, reads the version from `Cargo.toml`, and pushes the `vX.Y.Z` tag if it doesn't already exist.
491
+ 5. **`release.yml` (cargo-dist) triggers** — builds platform binaries in parallel:
384
492
  - `aarch64-apple-darwin`
385
493
  - `x86_64-apple-darwin`
386
494
  - `aarch64-unknown-linux-gnu`
387
495
  - `x86_64-unknown-linux-gnu`
388
496
  - `x86_64-pc-windows-msvc`
389
- 5. **GitHub Release created** — all binaries, checksums, shell installer, and PowerShell installer are attached.
390
- 6. **`publish-npm.yml` triggers** — publishes `@m2s2/cli` to npm.
391
- 7. **`publish-crates.yml` triggers** — publishes `m2s2-cli` to crates.io.
497
+ 6. **GitHub Release created** — all binaries, checksums, shell installer, and PowerShell installer are attached.
498
+ 7. **`publish-npm.yml` triggers** — publishes `@m2s2/cli` to npm.
499
+ 8. **`publish-crates.yml` triggers** — publishes `m2s2-cli` to crates.io.
392
500
 
393
501
  ### Template Sync (`template-sync.yml`)
394
502
 
@@ -404,8 +512,8 @@ When a version change is detected, the workflow opens a pull request updating th
404
512
 
405
513
  | Secret | Used By | Description |
406
514
  |--------|---------|-------------|
407
- | `APP_ID` | `release-plz.yml` | GitHub App ID for bypassing branch protection on release commits. |
408
- | `APP_PRIVATE_KEY` | `release-plz.yml` | GitHub App private key. |
515
+ | `APP_ID` | `release-plz.yml`, `auto-merge-release.yml`, `release-tag.yml`, `release.yml` | GitHub App ID used to open, approve, merge release PRs, and push tags. |
516
+ | `APP_PRIVATE_KEY` | `release-plz.yml`, `auto-merge-release.yml`, `release-tag.yml`, `release.yml` | GitHub App private key. |
409
517
  | `NPM_TOKEN` | `publish-npm.yml` | npm access token with publish rights to the `@m2s2` scope. |
410
518
  | `CARGO_REGISTRY_TOKEN` | `publish-crates.yml` | crates.io API token for publishing `m2s2-cli`. |
411
519
 
@@ -23,7 +23,7 @@
23
23
  "hasInstallScript": true,
24
24
  "license": "MIT",
25
25
  "name": "@m2s2/cli",
26
- "version": "0.1.20"
26
+ "version": "0.1.23"
27
27
  },
28
28
  "node_modules/@isaacs/cliui": {
29
29
  "engines": {
@@ -542,5 +542,5 @@
542
542
  }
543
543
  },
544
544
  "requires": true,
545
- "version": "0.1.20"
545
+ "version": "0.1.23"
546
546
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "artifactDownloadUrls": [
3
- "https://github.com/M2S2-Engineering-Group/m2s2-cli/releases/download/v0.1.20"
3
+ "https://github.com/M2S2-Engineering-Group/m2s2-cli/releases/download/v0.1.23"
4
4
  ],
5
5
  "author": "M²S² Engineering Group <contact@m2s2.io>",
6
6
  "bin": {
@@ -95,7 +95,7 @@
95
95
  "zipExt": ".tar.xz"
96
96
  }
97
97
  },
98
- "version": "0.1.20",
98
+ "version": "0.1.23",
99
99
  "volta": {
100
100
  "node": "18.14.1",
101
101
  "npm": "9.5.0"