Sveltekit: Upgrade default versions and allow user overrides via CLI options
kristianmandrup opened this issue · 0 comments
Is your feature request related to a problem? Please describe.
The versions listed in versions.ts are over 1 year old
F.ex sveltekit 1.16.3 is over 1 years old as show here.
The latest version is currently 2.5.x
For svelte, the current version is set to 3.x whereas the latest stable version is 4.x and 5.x is in beta and set to be released soon.
Currently the versions are taken from the versions file and fed into the installDependencies function in the lib folder
Describe the solution you'd like
Currently the installDependencies is called as follows
I propose enhancing the function to take in the options as well in order to allow the end user to override the default versions if needed
if (!options.skipPackageJson) {
const installTask = installDependencies(host, options);
tasks.push(installTask);
}
lib/install-dependencies.js
export function installDependencies(host: Tree, options: Record<string, string> = {}) {
return addDependenciesToPackageJson(
host,
{},
{
'@sveltejs/adapter-auto': options.adapterVersion || svelteKitAdapterVersion,
'@sveltejs/kit': options.svelteKitVersion || svelteKitVersion,
svelte: options.svelteVersion || svelteVersion,
}
);
}
This would then require adding additional optional options to the generator schema
export interface SveltekitGeneratorSchema {
name: string;
unitTestRunner: 'none' | 'vitest';
tags?: string;
directory?: string;
port?: number;
skipFormat: boolean;
linter: Linter;
skipPackageJson?: boolean;
directory?: string;
adapterVersion?: string
svelteVersion?: string;
svelteKitVersion?: string;
}
and to schema.json
"adapterVersion": {
"type": "string",
"description": "The version to use for sveltekit adapter-auto",
},
"svelteVersion": {
"type": "string",
"description": "The svelte version to use",
},
"svelteKitVersion": {
"type": "string",
"description": "The sveltekit version to use",
},
Update the default versions to the following:
export const eslintPluginSvelteVersion = '^2.35.0';
export const svelteVersion = '^4.2.0';
export const svelteKitVersion = '^2.5.0';
export const svelteKitAdapterVersion = '^3.2.0';
This would then allow the user to opt in to use alpha/beta versions such as Svelte 5.x or even use older versions if/as needed.
Describe alternatives you've considered
No alternatives
Additional context