create-mohit-next 1.0.0 → 2.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.
- package/README.md +96 -65
- package/index.js +195 -195
- package/lib/features.js +358 -0
- package/lib/scaffold.js +471 -0
- package/package.json +10 -6
- package/templates/common/_editorconfig +12 -0
- package/templates/common/_gitattributes +5 -0
- package/templates/common/_github/dependabot.yml +14 -0
- package/templates/common/_github/workflows/ci.yml +66 -0
- package/templates/common/_husky/commit-msg +1 -0
- package/templates/common/_husky/pre-commit +1 -0
- package/templates/common/_nvmrc +1 -0
- package/{template → templates/common}/_prettierignore +4 -0
- package/templates/common/commitlint.config.mjs +10 -0
- package/templates/next/README.md +328 -0
- package/{template → templates/next}/_env.example +10 -1
- package/{template → templates/next}/_gitignore +8 -0
- package/templates/next/e2e/rbac.spec.ts +69 -0
- package/templates/next/e2e/server.mjs +35 -0
- package/{template → templates/next}/eslint.config.mjs +12 -0
- package/{template → templates/next}/next.config.ts +2 -0
- package/{template → templates/next}/package.json +18 -3
- package/templates/next/playwright.config.ts +30 -0
- package/templates/next/scripts/seed.ts +111 -0
- package/templates/next/src/app/(app)/admin/audit/page.tsx +99 -0
- package/templates/next/src/app/(app)/admin/page.tsx +92 -0
- package/{template → templates/next}/src/app/(app)/dashboard/page.tsx +22 -29
- package/{template → templates/next}/src/app/(app)/error.tsx +7 -7
- package/{template → templates/next}/src/app/(app)/layout.tsx +25 -2
- package/templates/next/src/app/(app)/reports/page.tsx +128 -0
- package/templates/next/src/app/(app)/settings/page.tsx +66 -0
- package/templates/next/src/app/(auth)/forgot-password/page.tsx +17 -0
- package/templates/next/src/app/(auth)/layout.tsx +18 -0
- package/{template → templates/next}/src/app/(auth)/register/page.tsx +2 -4
- package/templates/next/src/app/(auth)/reset-password/page.tsx +18 -0
- package/templates/next/src/app/api/account/password/route.ts +45 -0
- package/templates/next/src/app/api/account/route.ts +25 -0
- package/templates/next/src/app/api/account/sessions/route.ts +12 -0
- package/templates/next/src/app/api/admin/audit/route.ts +13 -0
- package/{template → templates/next}/src/app/api/admin/users/[id]/route.ts +25 -4
- package/templates/next/src/app/api/auth/forgot-password/route.ts +47 -0
- package/{template → templates/next}/src/app/api/auth/login/route.ts +19 -2
- package/{template → templates/next}/src/app/api/auth/me/route.ts +4 -2
- package/{template → templates/next}/src/app/api/auth/register/route.ts +38 -4
- package/templates/next/src/app/api/auth/resend-verification/route.ts +25 -0
- package/templates/next/src/app/api/auth/reset-password/route.ts +43 -0
- package/templates/next/src/app/api/auth/verify-email/route.ts +29 -0
- package/{template → templates/next}/src/app/forbidden/page.tsx +11 -13
- package/{template → templates/next}/src/app/layout.tsx +9 -6
- package/templates/next/src/app/not-found.tsx +20 -0
- package/templates/next/src/app/opengraph-image.tsx +49 -0
- package/templates/next/src/app/page.tsx +165 -0
- package/templates/next/src/app/robots.ts +15 -0
- package/templates/next/src/app/sitemap.ts +13 -0
- package/templates/next/src/app/verify-email/page.tsx +23 -0
- package/templates/next/src/components/admin/user-actions.tsx +124 -0
- package/templates/next/src/components/admin/users-data-table.tsx +221 -0
- package/templates/next/src/components/admin/users-table.tsx +67 -0
- package/{template → templates/next}/src/components/auth/auth-card.tsx +8 -8
- package/templates/next/src/components/auth/forgot-password-form.tsx +76 -0
- package/templates/next/src/components/auth/form-field.tsx +40 -0
- package/{template → templates/next}/src/components/auth/login-form.tsx +14 -9
- package/templates/next/src/components/auth/password-input.tsx +43 -0
- package/{template → templates/next}/src/components/auth/register-form.tsx +22 -19
- package/templates/next/src/components/auth/reset-password-form.tsx +80 -0
- package/{template → templates/next}/src/components/auth/session-refresher.tsx +1 -1
- package/templates/next/src/components/auth/verify-email-banner.tsx +43 -0
- package/templates/next/src/components/auth/verify-email-status.tsx +44 -0
- package/templates/next/src/components/layout/nav-links.tsx +37 -0
- package/templates/next/src/components/layout/navbar.tsx +27 -0
- package/templates/next/src/components/layout/page-header.tsx +21 -0
- package/templates/next/src/components/layout/sidebar.tsx +83 -0
- package/templates/next/src/components/layout/skeletons.tsx +57 -0
- package/templates/next/src/components/layout/user-menu.tsx +118 -0
- package/{template → templates/next}/src/components/logo.tsx +3 -6
- package/{template → templates/next}/src/components/reports/animated-bar.tsx +1 -5
- package/templates/next/src/components/reports/role-chart.tsx +61 -0
- package/templates/next/src/components/reports/signups-chart.tsx +64 -0
- package/templates/next/src/components/role-badge.tsx +11 -0
- package/templates/next/src/components/settings/password-form.tsx +80 -0
- package/templates/next/src/components/settings/profile-form.tsx +63 -0
- package/templates/next/src/components/settings/sessions-card.tsx +70 -0
- package/templates/next/src/components/theme-toggle.tsx +61 -0
- package/templates/next/src/config/rbac.test.ts +89 -0
- package/{template → templates/next}/src/config/rbac.ts +35 -5
- package/{template → templates/next}/src/lib/api.ts +40 -4
- package/templates/next/src/lib/audit.ts +66 -0
- package/{template → templates/next}/src/lib/auth.ts +10 -2
- package/{template → templates/next}/src/lib/dal.ts +8 -5
- package/templates/next/src/lib/email-templates.ts +55 -0
- package/templates/next/src/lib/email.ts +53 -0
- package/templates/next/src/lib/env.ts +90 -0
- package/templates/next/src/lib/password-strength.test.ts +20 -0
- package/templates/next/src/lib/password-strength.ts +24 -0
- package/templates/next/src/lib/rate-limit.test.ts +47 -0
- package/templates/next/src/lib/rate-limit.ts +70 -0
- package/templates/next/src/lib/redirect.test.ts +23 -0
- package/{template → templates/next}/src/lib/session.ts +5 -1
- package/templates/next/src/lib/theme.ts +32 -0
- package/templates/next/src/lib/tokens.ts +63 -0
- package/{template → templates/next}/src/lib/users.ts +49 -12
- package/templates/next/src/lib/validations/account.ts +20 -0
- package/templates/next/src/lib/validations/auth.test.ts +39 -0
- package/{template → templates/next}/src/lib/validations/auth.ts +24 -2
- package/templates/next/src/models/audit-log.ts +33 -0
- package/templates/next/src/models/auth-token.ts +26 -0
- package/{template → templates/next}/src/models/user.ts +5 -0
- package/{template → templates/next}/src/proxy.ts +1 -1
- package/templates/next/src/styles/app.css +1092 -0
- package/{template → templates/next}/src/types/user.ts +3 -0
- package/templates/next/vitest.config.mts +13 -0
- package/templates/styles/css.css +580 -0
- package/templates/styles/tailwind.css +140 -0
- package/templates/ui/css/components/alert-dialog.tsx +172 -0
- package/templates/ui/css/components/avatar.tsx +17 -0
- package/templates/ui/css/components/badge.tsx +18 -0
- package/templates/ui/css/components/button.tsx +41 -0
- package/templates/ui/css/components/card.tsx +33 -0
- package/templates/ui/css/components/dropdown-menu.tsx +230 -0
- package/templates/ui/css/components/input.tsx +7 -0
- package/templates/ui/css/components/label.tsx +7 -0
- package/templates/ui/css/components/native-select.tsx +23 -0
- package/templates/ui/css/components/skeleton.tsx +7 -0
- package/templates/ui/css/components/slot.tsx +30 -0
- package/templates/ui/css/components/table.tsx +31 -0
- package/templates/ui/css/utils.ts +16 -0
- package/templates/ui/shadcn/components/alert-dialog.tsx +199 -0
- package/templates/ui/shadcn/components/avatar.tsx +111 -0
- package/templates/ui/shadcn/components/dropdown-menu.tsx +268 -0
- package/templates/ui/shadcn/components/table.tsx +115 -0
- package/templates/ui/tailwind/components/alert-dialog.tsx +177 -0
- package/templates/ui/tailwind/components/avatar.tsx +36 -0
- package/templates/ui/tailwind/components/badge.tsx +29 -0
- package/templates/ui/tailwind/components/button.tsx +65 -0
- package/templates/ui/tailwind/components/card.tsx +70 -0
- package/templates/ui/tailwind/components/dropdown-menu.tsx +236 -0
- package/templates/ui/tailwind/components/input.tsx +17 -0
- package/templates/ui/tailwind/components/label.tsx +16 -0
- package/templates/ui/tailwind/components/native-select.tsx +32 -0
- package/templates/ui/tailwind/components/skeleton.tsx +13 -0
- package/templates/ui/tailwind/components/slot.tsx +34 -0
- package/templates/ui/tailwind/components/table.tsx +56 -0
- package/templates/ui/tailwind/utils.ts +1 -0
- package/templates/vite/Dockerfile +29 -0
- package/templates/vite/README.md +142 -0
- package/templates/vite/_dockerignore +14 -0
- package/templates/vite/_env.example +8 -0
- package/templates/vite/_gitignore +37 -0
- package/templates/vite/e2e/app.spec.ts +41 -0
- package/templates/vite/index.html +32 -0
- package/templates/vite/nginx.conf +26 -0
- package/templates/vite/package.json +61 -0
- package/templates/vite/playwright.config.ts +27 -0
- package/templates/vite/public/favicon.svg +1 -0
- package/templates/vite/src/App.test.tsx +28 -0
- package/templates/vite/src/App.tsx +26 -0
- package/templates/vite/src/components/home.tsx +121 -0
- package/templates/vite/src/components/layout/root-layout.tsx +18 -0
- package/templates/vite/src/components/layout/site-footer.tsx +10 -0
- package/templates/vite/src/components/layout/site-header.tsx +49 -0
- package/templates/vite/src/components/theme-toggle.tsx +90 -0
- package/templates/vite/src/env.ts +36 -0
- package/templates/vite/src/lib/theme.ts +26 -0
- package/templates/vite/src/main.tsx +13 -0
- package/templates/vite/src/pages/about.tsx +52 -0
- package/templates/vite/src/pages/not-found.tsx +33 -0
- package/templates/vite/src/router.ts +24 -0
- package/templates/vite/src/styles/app.css +281 -0
- package/templates/vite/src/test/setup.ts +21 -0
- package/templates/vite/tsconfig.app.json +31 -0
- package/templates/vite/tsconfig.json +7 -0
- package/templates/vite/tsconfig.node.json +23 -0
- package/templates/vite/vite.config.ts +30 -0
- package/template/README.md +0 -262
- package/template/_prettierrc +0 -9
- package/template/components.json +0 -25
- package/template/src/app/(app)/admin/page.tsx +0 -53
- package/template/src/app/(app)/reports/page.tsx +0 -109
- package/template/src/app/(auth)/layout.tsx +0 -22
- package/template/src/app/not-found.tsx +0 -18
- package/template/src/app/page.tsx +0 -187
- package/template/src/components/admin/users-table.tsx +0 -162
- package/template/src/components/auth/form-field.tsx +0 -32
- package/template/src/components/layout/logout-button.tsx +0 -34
- package/template/src/components/layout/navbar.tsx +0 -67
- package/template/src/components/layout/page-header.tsx +0 -21
- package/template/src/components/layout/skeletons.tsx +0 -35
- package/template/src/components/role-badge.tsx +0 -17
- package/template/src/components/theme-toggle.tsx +0 -25
- package/template/src/lib/env.ts +0 -36
- package/template/src/lib/theme.ts +0 -8
- /package/{template → templates/next}/AGENTS.md +0 -0
- /package/{template → templates/next}/Dockerfile +0 -0
- /package/{template → templates/next}/_dockerignore +0 -0
- /package/{template → templates/next}/docker-compose.yml +0 -0
- /package/{template → templates/next}/public/robots.txt +0 -0
- /package/{template → templates/next}/src/app/(app)/loading.tsx +0 -0
- /package/{template → templates/next}/src/app/(auth)/login/page.tsx +0 -0
- /package/{template → templates/next}/src/app/api/admin/users/route.ts +0 -0
- /package/{template → templates/next}/src/app/api/auth/logout/route.ts +0 -0
- /package/{template → templates/next}/src/app/api/health/route.ts +0 -0
- /package/{template → templates/next}/src/app/favicon.ico +0 -0
- /package/{template → templates/next}/src/components/auth/can.tsx +0 -0
- /package/{template → templates/next}/src/components/motion/fade-in.tsx +0 -0
- /package/{template → templates/next}/src/components/providers/user-provider.tsx +0 -0
- /package/{template → templates/next}/src/config/site.ts +0 -0
- /package/{template → templates/next}/src/lib/db.ts +0 -0
- /package/{template → templates/next}/src/lib/http.ts +0 -0
- /package/{template → templates/next}/src/lib/redirect.ts +0 -0
- /package/{template → templates/next}/src/lib/validations/user.ts +0 -0
- /package/{template → templates/next}/tsconfig.json +0 -0
- /package/{template/src/app/globals.css → templates/styles/shadcn.css} +0 -0
- /package/{template/src/components/ui → templates/ui/shadcn/components}/badge.tsx +0 -0
- /package/{template/src/components/ui → templates/ui/shadcn/components}/button.tsx +0 -0
- /package/{template/src/components/ui → templates/ui/shadcn/components}/card.tsx +0 -0
- /package/{template/src/components/ui → templates/ui/shadcn/components}/input.tsx +0 -0
- /package/{template/src/components/ui → templates/ui/shadcn/components}/label.tsx +0 -0
- /package/{template/src/components/ui → templates/ui/shadcn/components}/native-select.tsx +0 -0
- /package/{template/src/components/ui → templates/ui/shadcn/components}/skeleton.tsx +0 -0
- /package/{template/src/lib → templates/ui/shadcn}/utils.ts +0 -0
package/README.md
CHANGED
|
@@ -1,74 +1,109 @@
|
|
|
1
1
|
# create-mohit-next
|
|
2
2
|
|
|
3
|
-
Scaffold a production-ready
|
|
3
|
+
Scaffold a production-ready React app in one command, choosing exactly what you need:
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
6
|
npm create mohit-next@latest my-app
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
- **
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
9
|
+
The CLI asks, in order:
|
|
10
|
+
|
|
11
|
+
1. **Project name**
|
|
12
|
+
2. **Language**: TypeScript or JavaScript
|
|
13
|
+
3. **Framework**:
|
|
14
|
+
- **Next.js** (full-stack): MongoDB + Mongoose, JWT auth (bcrypt + `jose`), role-based access
|
|
15
|
+
control (`user` < `manager` < `admin`, enforced in the proxy, the data layer and the API)
|
|
16
|
+
- **Vite + React** (single-page app)
|
|
17
|
+
4. **Styling**: Tailwind CSS + shadcn/ui, Tailwind CSS only, or none (plain CSS)
|
|
18
|
+
5. **Yes/no questions** for everything else:
|
|
19
|
+
|
|
20
|
+
| Group | Question | Next.js | Vite |
|
|
21
|
+
| ----- | -------- | :-----: | :--: |
|
|
22
|
+
| Core | React Router (pages + client-side routing) | (built in) | ✓ |
|
|
23
|
+
| Core | Basic UI components (Button, Input, Card, Badge, Table, Dialog...) | (always) | ✓ |
|
|
24
|
+
| Core | Environment variables with zod validation | ✓ | ✓ |
|
|
25
|
+
| Code quality | ESLint / Oxlint | ESLint | Oxlint |
|
|
26
|
+
| Code quality | Prettier | ✓ | ✓ |
|
|
27
|
+
| Code quality | Husky + lint-staged + commitlint | ✓ | ✓ |
|
|
28
|
+
| Frontend | Sidebar dashboard layout (or top navbar) | ✓ | |
|
|
29
|
+
| Frontend | Admin users table with search, sort & pagination | ✓ | |
|
|
30
|
+
| Frontend | Charts on the reports page (Recharts) | ✓ | |
|
|
31
|
+
| Frontend | SEO: sitemap, robots.txt, Open Graph image | ✓ | |
|
|
32
|
+
| Backend | Profile & settings (name, password, sign out other devices) | ✓ | |
|
|
33
|
+
| Backend | Forgot password + email verification (Resend) | ✓ | |
|
|
34
|
+
| Backend | Rate limiting on auth endpoints | ✓ | |
|
|
35
|
+
| Backend | Audit log of admin actions | ✓ | |
|
|
36
|
+
| Backend | Seed script with demo users | ✓ | |
|
|
37
|
+
| Testing | Vitest unit tests | ✓ | ✓ |
|
|
38
|
+
| Testing | Playwright end-to-end tests | ✓ | ✓ |
|
|
39
|
+
| DevOps | Docker | ✓ (app + MongoDB) | ✓ (nginx) |
|
|
40
|
+
| DevOps | GitHub Actions CI + Dependabot | ✓ | ✓ |
|
|
41
|
+
| DevOps | VS Code settings + EditorConfig | ✓ | ✓ |
|
|
42
|
+
|
|
43
|
+
Finally it asks **Install dependencies?** and **Initialize git?**, shows a summary, and creates the
|
|
44
|
+
project after you confirm.
|
|
45
|
+
|
|
46
|
+
Code for features you decline is left out entirely (files, imports, packages, scripts and README
|
|
47
|
+
sections), and the result is formatted with Prettier.
|
|
48
|
+
|
|
49
|
+
## Options
|
|
26
50
|
|
|
27
51
|
```bash
|
|
28
|
-
npm create mohit-next@latest [project-name]
|
|
29
|
-
# or
|
|
30
|
-
pnpm create mohit-next [project-name]
|
|
31
|
-
yarn create mohit-next [project-name]
|
|
32
|
-
bun create mohit-next [project-name]
|
|
52
|
+
npm create mohit-next@latest [project-name] -- [options]
|
|
33
53
|
```
|
|
34
54
|
|
|
35
|
-
| Option
|
|
36
|
-
|
|
|
37
|
-
| `
|
|
38
|
-
|
|
|
39
|
-
| `--
|
|
40
|
-
| `--no-
|
|
41
|
-
| `--
|
|
42
|
-
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
55
|
+
| Option | Description |
|
|
56
|
+
| ------ | ----------- |
|
|
57
|
+
| `--ts`, `--js` | Language (default: TypeScript) |
|
|
58
|
+
| `--next`, `--vite` | Framework (default: Next.js) |
|
|
59
|
+
| `--shadcn`, `--tailwind`, `--css` | Styling (default: Tailwind + shadcn/ui) |
|
|
60
|
+
| `--<feature>`, `--no-<feature>` | Turn one feature on/off: `router`, `ui`, `env`, `eslint`, `oxlint`, `prettier`, `git-hooks`, `sidebar`, `data-table`, `charts`, `seo`, `profile`, `email`, `rate-limit`, `audit-log`, `seed`, `vitest`, `playwright`, `docker`, `ci`, `editor` |
|
|
61
|
+
| `-y`, `--yes` | No prompts: defaults with every feature on |
|
|
62
|
+
| `--minimal` | No prompts: every optional feature off |
|
|
63
|
+
| `--no-install` | Don't install dependencies |
|
|
64
|
+
| `--no-git` | Don't initialize a git repository |
|
|
65
|
+
| `-h`, `--help` | Show help |
|
|
46
66
|
|
|
47
|
-
|
|
67
|
+
With `npm create`, put `--` before the options so npm forwards them:
|
|
48
68
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
4. creates `.env.local` from `.env.example` with a freshly generated random `JWT_SECRET`
|
|
54
|
-
5. installs dependencies with the package manager you ran it with (npm, pnpm, yarn or bun, detected
|
|
55
|
-
from `npm_config_user_agent`)
|
|
56
|
-
6. runs `git init` and makes an initial commit (skipped with a warning if git is missing)
|
|
69
|
+
```bash
|
|
70
|
+
npm create mohit-next@latest my-app -- --yes --vite --css --no-docker
|
|
71
|
+
pnpm create mohit-next my-app --js --minimal
|
|
72
|
+
```
|
|
57
73
|
|
|
58
|
-
|
|
74
|
+
The package manager you run it with (npm, pnpm, yarn or bun) is detected and used for installing,
|
|
75
|
+
in the README and in the CI workflow. Without a TTY (CI) prompts are skipped and defaults are used.
|
|
59
76
|
|
|
60
77
|
## Developing the CLI
|
|
61
78
|
|
|
62
|
-
```
|
|
79
|
+
```text
|
|
63
80
|
create-mohit-next/
|
|
64
|
-
├── index.js
|
|
65
|
-
├──
|
|
66
|
-
|
|
81
|
+
├── index.js # prompts + flow (@clack/prompts, picocolors)
|
|
82
|
+
├── lib/
|
|
83
|
+
│ ├── features.js # every question, and which files/packages/scripts depend on it
|
|
84
|
+
│ └── scaffold.js # copy, apply markers, TS->JS, package.json, format
|
|
85
|
+
└── templates/
|
|
86
|
+
├── next/ # Next.js app (TypeScript source)
|
|
87
|
+
├── vite/ # Vite app (TypeScript source)
|
|
88
|
+
├── common/ # files shared by both (CI, hooks, editor config)
|
|
89
|
+
├── ui/{shadcn,tailwind,css}/ # the UI kit for each styling option (same API)
|
|
90
|
+
└── styles/{shadcn,tailwind,css}.css # global CSS for each styling option
|
|
67
91
|
```
|
|
68
92
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
93
|
+
How a project is generated:
|
|
94
|
+
|
|
95
|
+
1. Copy `templates/<framework>` + `templates/common`, the UI kit and global CSS for the chosen style.
|
|
96
|
+
2. Restore dotfiles: npm strips them on publish, so templates store `_gitignore`, `_github/`, etc.
|
|
97
|
+
3. Delete files whose condition fails (`FILE_RULES` in `lib/features.js`).
|
|
98
|
+
4. Apply code markers. Lines between `// @feature key` and `// @end key` are kept only when `key`
|
|
99
|
+
is on (`!key` = off, `a|b` = either). The same works with `#`, `{/* */}`, `/* */` and `<!-- -->`.
|
|
100
|
+
Markers must be on their own line.
|
|
101
|
+
5. Prune `package.json` dependencies and scripts (`PACKAGE_RULES`, `SCRIPT_RULES`).
|
|
102
|
+
6. For JavaScript, strip the types with `sucrase` (`.tsx` -> `.jsx`, `.ts` -> `.js`), keeping JSX.
|
|
103
|
+
7. Format everything with Prettier, then create `.env.local`.
|
|
104
|
+
|
|
105
|
+
Built-in keys for markers: `ts`, `next`, `vite`, `shadcn`, `tailwind` (shadcn or Tailwind only),
|
|
106
|
+
`css`, `ui`, plus every question key.
|
|
72
107
|
|
|
73
108
|
### Test locally with `npm link`
|
|
74
109
|
|
|
@@ -77,33 +112,29 @@ cd create-mohit-next
|
|
|
77
112
|
npm install
|
|
78
113
|
npm link # puts `create-mohit-next` on your PATH
|
|
79
114
|
|
|
80
|
-
cd /some/
|
|
81
|
-
create-mohit-next my-app
|
|
82
|
-
create-mohit-next my-app2 --yes --no
|
|
115
|
+
cd /some/empty/folder
|
|
116
|
+
create-mohit-next my-app # interactive
|
|
117
|
+
create-mohit-next my-app2 --yes --vite --js # no prompts
|
|
83
118
|
```
|
|
84
119
|
|
|
85
|
-
`npm unlink -g create-mohit-next` removes the link.
|
|
86
|
-
`node /path/to/create-mohit-next/index.js my-app`.
|
|
87
|
-
|
|
88
|
-
Before publishing, check the generated app:
|
|
120
|
+
`npm unlink -g create-mohit-next` removes the link. Check a generated app before publishing:
|
|
89
121
|
|
|
90
122
|
```bash
|
|
91
123
|
cd my-app
|
|
92
|
-
npm run typecheck && npm run lint && npm run build
|
|
124
|
+
npm run typecheck && npm run lint && npm test && npm run build
|
|
93
125
|
```
|
|
94
126
|
|
|
95
127
|
### Publish to npm
|
|
96
128
|
|
|
129
|
+
Requires Node.js 22.12+ and two-factor authentication on your npm account.
|
|
130
|
+
|
|
97
131
|
```bash
|
|
98
132
|
npm login
|
|
99
|
-
npm pack --dry-run # check the tarball: index.js,
|
|
100
|
-
npm version
|
|
101
|
-
npm publish
|
|
133
|
+
npm pack --dry-run # check the tarball: index.js, lib/, templates/
|
|
134
|
+
npm version minor # or patch / major
|
|
135
|
+
npm publish
|
|
102
136
|
```
|
|
103
137
|
|
|
104
|
-
After publishing, `npm create mohit-next@latest my-app` runs your new version (npm maps
|
|
105
|
-
`npm create <x>` to the `create-<x>` package).
|
|
106
|
-
|
|
107
138
|
## License
|
|
108
139
|
|
|
109
140
|
MIT
|