Commit 5468362
authored
fix(cli): restore Deno support for packaged CLI (#229)
## Summary
Restore Deno startup for the packaged Prisma CLI without copying or
changing credential-storage behavior.
- keep `@prisma/credentials-store` as the single auth-storage
implementation
- bundle it into both published CLI binaries, so Deno does not resolve
its broken transitive conditional export at runtime
- move it from a published runtime dependency to a build-time dependency
## The failure
With Deno 2.9.5, the current published RC fails before parsing any
command:
```console
$ deno run --minimum-dependency-age=0 -A npm:prisma@8.0.0-rc.9 --version
error: Cannot find module ".../xdg-app-paths/8.3.0/src/mod.deno.ts"
```
The same failure occurs through `npm:@prisma/cli@8.0.0-rc.9`.
The startup dependency chain is:
```text
prisma / @prisma/cli
-> FileTokenStorage
-> @prisma/credentials-store
-> xdg-app-paths
```
`xdg-app-paths@8.3.0` declares a Deno conditional export at
`./src/mod.deno.ts`, but that file and its imports are absent from the
npm tarball. Because auth storage is statically imported, every CLI
command fails, including `--version` and `orm init`.
Upgrading `@prisma/credentials-store` does not fix this: its latest
release still uses `xdg-app-paths@8.3.0`.
## Why bundle the store?
The CLI should not duplicate credential persistence.
`@prisma/credentials-store` remains the only implementation used by
`FileTokenStorage`; this PR changes packaging only.
Both published binaries already use bundled entry points. Adding the
store to `deps.alwaysBundle` makes the build resolve its Node-compatible
implementation once and include it in the shipped JavaScript. The
published package therefore does not ask Deno to resolve
`xdg-app-paths`, while Node and Deno execute the exact same auth code.
This avoids vendoring storage logic, patching an installed package,
lazy-importing auth, or adding a Deno-specific runtime branch. No
auth-file schema, path, locking behavior, command, flag, or output
changes.
## Verification
- `pnpm typecheck`
- `pnpm lint`
- `pnpm --filter @prisma/cli test` — 61 files, 958 passed, 1 skipped
- `pnpm --filter @repo/cli-conformance test` — 5 files, 66 passed
- `PUBLISH_CHANNEL=dev pnpm check:conformance` — 0 failing findings
- packed `prisma@8.0.0-rc.10`, installed it into a clean npm sandbox,
and ran under official Deno 2.9.5:
```console
prisma orm init --target postgres --authoring psl --skip-install --yes
--format json
```
It completed successfully and wrote the expected config, contract,
database client, TypeScript config, environment example, package
manifest, and Git metadata files.1 parent 6bd8606 commit 5468362
5 files changed
Lines changed: 24 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | 55 | | |
57 | 56 | | |
58 | 57 | | |
| |||
63 | 62 | | |
64 | 63 | | |
65 | 64 | | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | 55 | | |
57 | 56 | | |
58 | 57 | | |
| |||
63 | 62 | | |
64 | 63 | | |
65 | 64 | | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
19 | 26 | | |
20 | 27 | | |
21 | 28 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments