Skip to content

Commit 4c8f7fd

Browse files
authored
template: use pnpm instead of npm (#700)
1 parent e706ee5 commit 4c8f7fd

19 files changed

Lines changed: 3892 additions & 5971 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,20 @@
1212
- `UseViteDevelopmentServer` now exposes a `PackageManagerCommand` option (defaults to "npm") to configure which package manager runs the dev script. Improved error messages when the configured package manager is not installed.
1313
- Fix: `no-sort-in-computed` eslint rule false positive when sorting a locally-declared array variable inside `computed()`.
1414
- Fix: Handle the possibility that Audit logging's `AuditInterceptor` can end up singleton under specific EF usage patterns (e.g. `AddDbContextFactory` + not using `OnConfiguring`).
15+
- Re-exported `isAxiosError` from `coalesce-vue` to avoid phantom dependency on `axios`.
1516

1617
## Template Changes
1718
- Added Vuetify 4 CSS layer ordering to `index.html` to work around Vite 8/Rolldown CSS ordering bugs.
18-
- Replaced deprecated `typeface-roboto` with `@fontsource/roboto/latin.css` and `@fontsource/roboto/latin-italic.css`.
19+
- Replaced deprecated `typeface-roboto` package with `@fontsource/roboto/latin.css` and `@fontsource/roboto/latin-italic.css`.
20+
- The template now uses pnpm instead of npm for better DX. To migrate an existing project:
21+
1. Install pnpm: `npm install -g pnpm@11`
22+
2. Delete `package-lock.json`, and copy `pnpm-workspace.yaml` and the root `package.json` from the template into your solution root (next to your `.slnx`). Add your web project as a package in the workspace (`packages: - YourProject.Web`).
23+
3. Run `pnpm install`.
24+
4. In `Program.cs`, add `c.PackageManagerCommand = "pnpm";` to `UseViteDevelopmentServer` options.
25+
5. Add any phantom dependencies that pnpm's strict `node_modules` structure reveals (e.g. `date-fns`, `date-fns-tz`). Build errors or runtime import failures will indicate which ones are missing.
26+
6. Update CI/CD scripts to use `pnpm` instead of `npm`. Add a step to install pnpm. Run `pnpm install --frozen-lockfile` from the solution root. Replace other `npm` commands with `pnpm`.
1927
- The first-party password/passkey login flow is now two-stage: enter username first, then choose between password, passkey, or a one-time email code. When `Passkeys` is enabled, users who sign in with password or email code are then prompted to create a passkey.
20-
- `Role.Permissions` are no longer EF-mapped as enums. The EF property is now `List<string>`, with a `[NotMapped]` `PermissionEnums` wrapper that silently drops unrecognized values. This prevents `InvalidOperationException` when a `Permission` enum member is removed but old values remain in the database.
28+
- `Role.Permissions` are no longer EF-mapped as enums. The EF property is now `List<string>`, with a `[NotMapped] PermissionEnums` wrapper that drops unrecognized values. This prevents `InvalidOperationException` when a `Permission` enum member is removed but old values remain in the database.
2129
- Added rate limiting to authentication pages (sign-in, register, forgot password, reset password, email confirmation, external login) to mitigate brute-force abuse.
2230

2331
# 6.4.0

docs/stacks/vue/getting-started.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Before you begin, ensure that you have all the required tools installed:
88

99
- Recent version of the [.NET SDK](https://dotnet.microsoft.com/en-us/download).
1010
- A recent version of [Node.js](https://nodejs.org/) (an LTS version is recommended).
11+
- [pnpm](https://pnpm.io/) - install with `npm install -g pnpm@11`
1112
- An IDE: [VS Code](https://code.visualstudio.com/) with the [Vue - Official](https://marketplace.visualstudio.com/items?itemName=Vue.volar) extension is recommended. [JetBrains Rider](https://www.jetbrains.com/rider/) also works.
1213

1314
## Creating a Project
@@ -58,8 +59,8 @@ font-weight: 600;
5859
dotnet new install IntelliTect.Coalesce.Vue.Template
5960
dotnet new coalescevue -n {{effectiveNamespace}} -o {{effectiveFolder}} {{templateParams}}
6061
cd {{effectiveFolder}}/*.Web
61-
npm i --min-release-age=0
62-
npm run lint:fix
62+
pnpm install
63+
pnpm lint:fix
6364
dotnet restore
6465
dotnet coalesce
6566
@@ -104,7 +105,7 @@ The structure of the Web project follows the conventions of both ASP.NET Core an
104105
The frontend build system uses [Vite](https://vitejs.dev/). You are strongly encouraged to read through at least the first few pages of the [Vite Documentation](https://vitejs.dev/guide/) before getting started on any development.
105106
:::
106107

107-
During development, no special effort is required to build your frontend code. Coalesce's `UseViteDevelopmentServer` in ASP.NET Core will take care of that automatically when the application starts. Just make sure NPM packages have been installed (`npm ci`). For more details on how the Vite integration works, see [Vite Integration](/topics/vite-integration.md).
108+
During development, no special effort is required to build your frontend code. Coalesce's `UseViteDevelopmentServer` in ASP.NET Core will take care of that automatically when the application starts. Package install is automatic via the `dev` script in `package.json`. For more details on how the Vite integration works, see [Vite Integration](/topics/vite-integration.md).
108109
109110
@[import-md "after":"MARKER:data-modeling", "before":"MARKER:data-modeling-end"](../agnostic/getting-started-modeling.md)
110111

src/coalesce-mcp/src/tools/upgrade-prompt.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ Use \`read_template_file\` to compare these files against the user's versions an
287287
- **eslint.config.mjs** — New rules, plugin changes. Note if user is still on \`.eslintrc\`.
288288
- **tsconfig.json**, **tsconfig.node.json**
289289
- **pnpm-workspace.yaml** — overrides, allowBuilds, and other pnpm settings
290+
- **.npmrc**
290291
- **.editorconfig**
291292
- **.vscode/settings.json**
292293
- **.vscode/mcp.json**

templates/Coalesce.Vue.Template/TestLocal.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ Push-Location $outDir/*.Web
3737
try {
3838
dotnet restore
3939
dotnet coalesce
40-
npm i
40+
pnpm install
4141
npx tsc -p ./tsconfig.node.json
42-
npm run build
43-
npm run lint:fix # ensure all lint issues are auto-fixable
42+
pnpm build
43+
pnpm lint:fix # ensure all lint issues are auto-fixable
4444
# CS9113: Parameter '<param>' is unread. (too annoying to fix this for every possible combination of template params)
4545
dotnet build .. /nowarn:CS9113
4646

templates/Coalesce.Vue.Template/content/.github/workflows/build-test-and-deploy.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ jobs:
4949
with:
5050
node-version: 24.x
5151

52-
- name: npm ci
53-
run: npm ci
54-
working-directory: Coalesce.Starter.Vue.Web
52+
- name: Install pnpm
53+
run: npm install -g pnpm@11
54+
55+
- name: pnpm install
56+
run: pnpm install --frozen-lockfile
5557

5658
- name: Restore Nuget packages
5759
run: dotnet restore
@@ -60,12 +62,12 @@ jobs:
6062
run: dotnet coalesce --what-if --verify
6163
working-directory: Coalesce.Starter.Vue.Web
6264

63-
- name: npm run lint
64-
run: npm run lint
65+
- name: pnpm lint
66+
run: pnpm lint
6567
working-directory: Coalesce.Starter.Vue.Web
6668

67-
- name: npm run build
68-
run: npm run build
69+
- name: pnpm build
70+
run: pnpm build
6971
working-directory: Coalesce.Starter.Vue.Web
7072

7173
- name: dotnet build

templates/Coalesce.Vue.Template/content/.npmrc

Whitespace-only changes.

templates/Coalesce.Vue.Template/content/.template.config/template.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@
308308
"**/*.g.ts",
309309
"**/*.lock.json",
310310
"**/package-lock.json",
311+
"**/pnpm-lock.yaml",
311312
"**/DEVELOPMENT.md"
312313
]
313314
},

templates/Coalesce.Vue.Template/content/.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"xml.format.maxLineWidth": 0,
1313
"chat.tools.terminal.autoApprove": {
1414
"dotnet test": true,
15-
"npm test": true,
15+
"pnpm test": true,
1616
"dotnet tool restore": true,
1717
"dotnet restore": true,
1818
"dotnet build": true

templates/Coalesce.Vue.Template/content/AGENTS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ An `IntelliTect Coalesce`–based project. Projects:
1010
- Data: EF Core entity models, services, business logic, etc
1111
- Data.Test: TUnit automated tests for the Data project.
1212
- Migrations: EF Core Migrations assembly. Create and manage migrations here, e.g. `dotnet ef migrations add MigrationName`. Run `dotnet ef` in this project's working directory, don't pass extra args like startup-project to `dotnet ef` calls.
13-
- Web: ASP.NET Core server. Serves both API endpoints and frontend Vue assets. Automatically launches Vite dev server - don't do `npm run dev` manually.
13+
- Web: ASP.NET Core server. Serves both API endpoints and frontend Vue assets. Automatically launches Vite dev server - don't do `pnpm dev` manually.
1414
- Web/src: Vite, Vue 3, Vuetify 4, and Coalesce for data binding and API access.
1515

1616
- Coalesce generates DTOs, controllers, and TypeScript from your models. After making changes to your models, invoke code generation with the `coalesce_generate` tool. The `coalesce.json` file is in the workspace root.
17-
- If you run tests with `npm test`, pass `--run` to avoid running in interactive mode. E.g. `npm test -- --run`.
17+
- If you run tests with `pnpm test`, pass `--run` to avoid running in interactive mode. E.g. `pnpm test --run`.
1818
- In Vue files, you don't need to add import statements for components nor composables from `vue`, `vue-router`, or those defined by the project's source code - they will be auto-imported by Vite.
19-
- Do not run `npm run build` to validate changes unless the user asks because this ruins HMR if the app is running. Instead, validate frontend changes by checking for problems with `read/problems`.
19+
- Do not run `pnpm build` to validate changes unless the user asks because this ruins HMR if the app is running. Instead, validate frontend changes by checking for problems with `read/problems`.
2020
- Use SCSS for all styles - `lang="scss"` in .vue files.
2121
- Use `date-fns` for date manipulation and formatting, or `.$display(propName)` on Coalesce ViewModel instances, or `c-display` in Vue templates.
2222

templates/Coalesce.Vue.Template/content/Coalesce.Starter.Vue.Web/.npmrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)