Skip to content

Commit 30a022e

Browse files
brunnerhmanuel3108
andauthored
fix: resolve to task instead of run in addon instructions for deno (#599)
* fix: Resolve to `task` instead of `run` in addon instructions when using Deno. * Create silent-timers-carry.md --------- Co-authored-by: Manuel <30698007+manuel3108@users.noreply.github.com>
1 parent 441b089 commit 30a022e

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

.changeset/silent-timers-carry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@sveltejs/addons": patch
3+
---
4+
5+
fix: resolve to `task` instead of `run` in addon instructions for `deno`

packages/addons/drizzle/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import path from 'node:path';
33
import { common, exports, functions, imports, object, variables } from '@sveltejs/cli-core/js';
44
import { defineAddon, defineAddonOptions, dedent, type OptionValues } from '@sveltejs/cli-core';
55
import { parseJson, parseScript } from '@sveltejs/cli-core/parsers';
6+
import { resolveCommand } from 'package-manager-detector/commands';
67
import { getNodeTypesVersion } from '../common.ts';
78

89
const PORTS = {
@@ -357,16 +358,18 @@ export default defineAddon({
357358
`You will need to set ${highlighter.env('DATABASE_URL')} in your production environment`
358359
];
359360
if (options.docker) {
361+
const { command, args } = resolveCommand(packageManager, 'run', ['db:start'])!;
360362
steps.push(
361-
`Run ${highlighter.command(`${packageManager} run db:start`)} to start the docker container`
363+
`Run ${highlighter.command(`${command} ${args.join(' ')}`)} to start the docker container`
362364
);
363365
} else {
364366
steps.push(
365367
`Check ${highlighter.env('DATABASE_URL')} in ${highlighter.path('.env')} and adjust it to your needs`
366368
);
367369
}
370+
const { command, args } = resolveCommand(packageManager, 'run', ['db:push'])!;
368371
steps.push(
369-
`Run ${highlighter.command(`${packageManager} run db:push`)} to update your database schema`
372+
`Run ${highlighter.command(`${command} ${args.join(' ')}`)} to update your database schema`
370373
);
371374

372375
return steps;

packages/addons/lucia/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
import * as js from '@sveltejs/cli-core/js';
1212
import type { AstTypes } from '@sveltejs/cli-core/js';
1313
import { parseScript } from '@sveltejs/cli-core/parsers';
14+
import { resolveCommand } from 'package-manager-detector/commands';
1415
import { addToDemoPage } from '../common.ts';
1516

1617
const TABLE_TYPE = {
@@ -618,8 +619,9 @@ export default defineAddon({
618619
}
619620
},
620621
nextSteps: ({ highlighter, options, packageManager }) => {
622+
const { command, args } = resolveCommand(packageManager, 'run', ['db:push'])!;
621623
const steps = [
622-
`Run ${highlighter.command(`${packageManager} run db:push`)} to update your database schema`
624+
`Run ${highlighter.command(`${command} ${args.join(' ')}`)} to update your database schema`
623625
];
624626
if (options.demo) {
625627
steps.push(`Visit ${highlighter.route('/demo/lucia')} route to view the demo`);

packages/addons/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@
1313
"exports": "./index.ts",
1414
"dependencies": {
1515
"@sveltejs/cli-core": "workspace:*"
16+
},
17+
"devDependencies": {
18+
"package-manager-detector": "^0.2.11"
1619
}
1720
}

pnpm-lock.yaml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)