File tree Expand file tree Collapse file tree 3 files changed +17
-7
lines changed
packages/migrate/migrations Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import semver from 'semver';
66import glob from 'tiny-glob/sync.js' ;
77import { bail , check_git , migration_succeeded , update_svelte_file } from '../../utils.js' ;
88import { transform_svelte_code , update_pkg_json } from './migrate.js' ;
9- import { detect } from 'package-manager-detector' ;
9+ import { detect , resolveCommand } from 'package-manager-detector' ;
1010
1111export async function migrate ( ) {
1212 if ( ! fs . existsSync ( 'package.json' ) ) {
@@ -97,8 +97,13 @@ export async function migrate() {
9797
9898 const detected = await detect ( { cwd : process . cwd ( ) } ) ;
9999 const pm = detected ?. name ?? 'npm' ;
100+ const cmd = /** @type {import('package-manager-detector').ResolvedCommand } */ (
101+ resolveCommand ( pm , 'install' , [ ] )
102+ ) ;
100103
101- const tasks = [ `Install the updated dependencies by running ${ cyan ( `${ pm } install` ) } ` ] ;
104+ const tasks = [
105+ `Install the updated dependencies by running ${ cyan ( `${ cmd . command } ${ cmd . args . join ( ' ' ) } ` ) } `
106+ ] ;
102107 if ( use_git ) {
103108 tasks . push ( cyan ( 'git commit -m "migration to $app/state"' ) ) ;
104109 tasks . push ( `Run ${ cyan ( 'git diff' ) } to review changes.` ) ;
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ import {
1818import { migrate as migrate_svelte_4 } from '../svelte-4/index.js' ;
1919import { migrate as migrate_sveltekit_2 } from '../sveltekit-2/index.js' ;
2020import { transform_module_code , transform_svelte_code , update_pkg_json } from './migrate.js' ;
21- import { detect } from 'package-manager-detector' ;
21+ import { detect , resolveCommand } from 'package-manager-detector' ;
2222
2323export async function migrate ( ) {
2424 if ( ! fs . existsSync ( 'package.json' ) ) {
@@ -212,9 +212,11 @@ export async function migrate() {
212212
213213 const detected = await detect ( { cwd : process . cwd ( ) } ) ;
214214 const pm = detected ?. name ?? 'npm' ;
215-
215+ const cmd = /** @type {import('package-manager-detector').ResolvedCommand } */ (
216+ resolveCommand ( pm , 'install' , [ ] )
217+ ) ;
216218 const tasks = [
217- `Install the updated dependencies by running ${ cyan ( `${ pm } install ` ) } ` +
219+ `Install the updated dependencies by running ${ cyan ( `${ cmd . command } ${ cmd . args . join ( ' ' ) } ` ) } ` +
218220 '(note that there may be peer dependency issues when not all your libraries officially support Svelte 5 yet. In this case try installing with the --force option)' ,
219221 use_git && cyan ( 'git commit -m "migration to Svelte 5"' ) ,
220222 'Review the migration guide at https://svelte.dev/docs/svelte/v5-migration-guide' ,
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import {
1919 update_svelte_config ,
2020 update_tsconfig_content
2121} from './migrate.js' ;
22- import { detect } from 'package-manager-detector' ;
22+ import { detect , resolveCommand } from 'package-manager-detector' ;
2323
2424export async function migrate ( ) {
2525 if ( ! fs . existsSync ( 'package.json' ) ) {
@@ -140,9 +140,12 @@ export async function migrate() {
140140
141141 const detected = await detect ( { cwd : process . cwd ( ) } ) ;
142142 const pm = detected ?. name ?? 'npm' ;
143+ const cmd = /** @type {import('package-manager-detector').ResolvedCommand } */ (
144+ resolveCommand ( pm , 'install' , [ ] )
145+ ) ;
143146
144147 const tasks = [
145- `Install the updated dependencies by running ${ cyan ( `${ pm } install ` ) } ` ,
148+ `Install the updated dependencies by running ${ cyan ( `${ cmd . command } ${ cmd . args . join ( ' ' ) } ` ) } ` ,
146149 use_git && cyan ( 'git commit -m "migration to SvelteKit 2"' ) ,
147150 'Review the migration guide at https://svelte.dev/docs/kit/migrating-to-sveltekit-2' ,
148151 'Read the updated docs at https://svelte.dev/docs/kit' ,
You can’t perform that action at this time.
0 commit comments