create-innovator 0.4.0 → 1.0.0

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.
Files changed (3) hide show
  1. package/README.md +156 -0
  2. package/dist/cli.js +4 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1 +1,157 @@
1
+ # create-innovator
2
+
1
3
  [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
4
+
5
+ A CLI scaffolding tool that creates new projects from the Storm Reply [innovator-template](https://github.com/stormreply/innovator-template). It clones the template repository, replaces placeholder names with your project name, installs dependencies, and creates an initial commit — all in one command.
6
+
7
+ ## Prerequisites
8
+
9
+ - [Node.js](https://nodejs.org/) >= 24
10
+ - [pnpm](https://pnpm.io/) >= 10.29.2 (or corepack will enable it automatically)
11
+ - [GitHub CLI (`gh`)](https://cli.github.com/) installed and available on your `PATH`
12
+ - A **GitHub Personal Access Token** with `repo` and `read:packages` scopes and access to the `stormreply` organization
13
+
14
+ ## Usage
15
+
16
+ Run directly with pnpm:
17
+
18
+ ```bash
19
+ pnpm create innovator
20
+ ```
21
+
22
+ Or with npx:
23
+
24
+ ```bash
25
+ npx create-innovator
26
+ ```
27
+
28
+ ### Options
29
+
30
+ | Flag | Alias | Description |
31
+ | ---------------- | ----- | ----------------------------------------------------------- |
32
+ | `--name <name>` | `-n` | Project name (skips the interactive prompt) |
33
+ | `--experimental` | `-e` | Include pre-release template versions in the version picker |
34
+
35
+ ### Examples
36
+
37
+ Create a project interactively:
38
+
39
+ ```bash
40
+ pnpm create innovator
41
+ ```
42
+
43
+ Create a project with a specific name:
44
+
45
+ ```bash
46
+ pnpm create innovator --name my-project
47
+ ```
48
+
49
+ Include experimental template versions:
50
+
51
+ ```bash
52
+ pnpm create innovator --experimental
53
+ ```
54
+
55
+ ### What happens when you run it
56
+
57
+ 1. **GitHub authentication** — reads your token from `~/.npmrc` or prompts you to enter one. Validates required scopes (`repo`, `read:packages`) and access to the `stormreply` organization.
58
+ 2. **Version selection** — fetches available template tags and lets you pick a version.
59
+ 3. **Clone** — shallow-clones the template at the selected tag using `gh repo clone`, then re-initializes a fresh git repository.
60
+ 4. **Name replacement** — replaces `innovator-template` throughout the project with your chosen name in all case variants (kebab-case, camelCase, PascalCase, Title Case).
61
+ 5. **Template cleanup** — removes template-specific files that are not needed in the new project.
62
+ 6. **Setup** — installs dependencies via `pnpm install`, updates test snapshots, and creates an initial commit.
63
+
64
+ If the automatic setup fails, the CLI prints the commands to run manually.
65
+
66
+ ---
67
+
68
+ ## Development
69
+
70
+ ### Getting started
71
+
72
+ ```bash
73
+ git clone git@github.com:stormreply/create-innovator.git
74
+ cd create-innovator
75
+ pnpm install
76
+ ```
77
+
78
+ ### Scripts
79
+
80
+ ```bash
81
+ pnpm dev # Run the CLI locally via tsx
82
+ pnpm build # Build with tsup (outputs to dist/)
83
+ pnpm test # Run all tests (vitest)
84
+ pnpm test:watch # Run tests in watch mode
85
+ pnpm lint # ESLint
86
+ pnpm format # Prettier (write mode)
87
+ ```
88
+
89
+ Run a single test file:
90
+
91
+ ```bash
92
+ pnpm test -- src/scaffold/clone.test.ts
93
+ ```
94
+
95
+ ### Project structure
96
+
97
+ ```
98
+ src/
99
+ ├── cli.ts # Entry point — arg parsing (citty) and interactive UI (@clack/prompts)
100
+ ├── cli.test.ts
101
+ ├── auth/
102
+ │ ├── github.ts # Token validation, scope + org access checks
103
+ │ ├── github.test.ts
104
+ │ ├── prompts.ts # Interactive token input
105
+ │ ├── prompts.test.ts
106
+ │ ├── token-storage.ts # Read/write token from ~/.npmrc
107
+ │ └── token-storage.test.ts
108
+ ├── scaffold/
109
+ │ ├── clone.ts # gh CLI check, tag fetching, shallow clone + git init
110
+ │ ├── clone.test.ts
111
+ │ ├── template.ts # Name replacement engine + template file cleanup
112
+ │ ├── template.test.ts
113
+ │ ├── setup.ts # pnpm install, snapshot update, initial commit
114
+ │ └── setup.test.ts
115
+ └── utils/
116
+ ├── case.ts # PascalCase conversion (wraps Remeda)
117
+ ├── case.test.ts
118
+ └── constants.ts # GitHub org, repo, scopes, registry URL
119
+ ```
120
+
121
+ ### Code style
122
+
123
+ - **ESM** throughout (`"type": "module"`, `.js` extensions in imports)
124
+ - **TypeScript** with strict mode, target ES2022, NodeNext module resolution
125
+ - **Prettier**: single quotes, semicolons, trailing commas, 120 char line width
126
+ - **Dependencies** are pinned to exact versions (no `^` or `~` prefixes)
127
+
128
+ ### Testing
129
+
130
+ Tests use [Vitest](https://vitest.dev/) with `globals: true` — no imports needed for `describe`, `it`, `expect`, or `vi`.
131
+
132
+ Key patterns:
133
+
134
+ - Shell commands (`child_process.execFile`) are mocked via `vi.mock('node:child_process')` with callback-style mocks
135
+ - File system operations in template tests use [`memfs`](https://github.com/nicknisi/memfs) (in-memory filesystem)
136
+ - `@clack/prompts` is mocked in most test files to suppress UI output
137
+
138
+ ### Git hooks (Husky)
139
+
140
+ | Hook | Action |
141
+ | -------------------- | -------------------------------------------------------------------------------------------------------- |
142
+ | `pre-commit` | Runs lint-staged — ESLint + Prettier on staged `*.{js,json,md,ts}` files, vitest on related `*.ts` files |
143
+ | `prepare-commit-msg` | Launches Commitizen interactively to guide you through a conventional commit message |
144
+ | `commit-msg` | Enforces [Conventional Commits](https://www.conventionalcommits.org/) via commitlint |
145
+ | `pre-push` | Runs the full test suite (only if working tree is clean) |
146
+
147
+ ### Commits
148
+
149
+ This project follows [Conventional Commits](https://www.conventionalcommits.org/) and is [Commitizen](http://commitizen.github.io/cz-cli/) friendly. The `prepare-commit-msg` hook automatically launches Commitizen when you run `git commit`, guiding you through a structured commit message prompt — no extra commands needed.
150
+
151
+ ### Releasing
152
+
153
+ Releases are managed with [release-it](https://github.com/release-it/release-it):
154
+
155
+ ```bash
156
+ pnpm release
157
+ ```
package/dist/cli.js CHANGED
@@ -337,8 +337,9 @@ async function setupProject(projectName) {
337
337
  s.stop("Test snapshots updated");
338
338
  s.start("Creating initial commit");
339
339
  await execFile2("git", ["add", "."], { cwd: projectName });
340
- await execFile2("git", ["commit", "--no-verify", "-m", `feat(${projectName}): initial commit`], {
341
- cwd: projectName
340
+ await execFile2("git", ["commit", "-m", `feat(${projectName}): initial commit`], {
341
+ cwd: projectName,
342
+ env: { ...process.env, HUSKY: "0" }
342
343
  });
343
344
  s.stop("Initial commit created");
344
345
  } catch {
@@ -349,7 +350,7 @@ async function setupProject(projectName) {
349
350
  corepack enable
350
351
  pnpm install
351
352
  pnpm test -u
352
- git add . && git commit --no-verify -m "feat(${projectName}): initial commit"`
353
+ git add . && HUSKY=0 git commit -m "feat(${projectName}): initial commit"`
353
354
  );
354
355
  }
355
356
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-innovator",
3
- "version": "0.4.0",
3
+ "version": "1.0.0",
4
4
  "description": "Create Innovator App",
5
5
  "author": {
6
6
  "email": "storm@reply.de",