Skip to content

Commit

Permalink
feat(sveltekit): upgrade versions and allow CLI overrides
Browse files Browse the repository at this point in the history
Upgrades sveltekit and svelte default versions and allows user to specify overrides via CLI options

ISSUES CLOSED: #1078
  • Loading branch information
kristianmandrup authored and DominikPieper committed Apr 16, 2024
1 parent f1c67f9 commit f867fb3
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 10 deletions.
2 changes: 1 addition & 1 deletion e2e/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function createTestProject() {
});

execSync(
`npx --yes create-nx-workspace@latest ${projectName} --preset empty --no-nxCloud --no-interactive`,
`npx --yes create-nx-workspace@latest ${projectName} --preset apps --nxCloud skip --interactive false`,
{
cwd: dirname(projectDirectory),
stdio: 'inherit',
Expand Down
2 changes: 1 addition & 1 deletion packages/sveltekit/src/generators/application/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export async function applicationGenerator(
}

if (!options.skipPackageJson) {
const installTask = installDependencies(host);
const installTask = installDependencies(host, options);
tasks.push(installTask);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@ import {
svelteKitVersion,
svelteVersion,
} from '../../utils/versions';
import { SveltekitGeneratorSchema } from '../schema';

export function installDependencies(host: Tree) {
export function installDependencies(
host: Tree,
options: SveltekitGeneratorSchema
) {
return addDependenciesToPackageJson(
host,
{},
{
'@sveltejs/adapter-auto': svelteKitAdapterVersion,
'@sveltejs/kit': svelteKitVersion,
svelte: svelteVersion,
'@sveltejs/adapter-auto':
options.adapterVersion || svelteKitAdapterVersion,
'@sveltejs/kit': options.svelteKitVersion || svelteKitVersion,
svelte: options.svelteVersion || svelteVersion,
}
);
}
3 changes: 3 additions & 0 deletions packages/sveltekit/src/generators/application/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export interface SveltekitGeneratorSchema {
skipFormat: boolean;
linter: Linter;
skipPackageJson?: boolean;
adapterVersion?: string;
svelteVersion?: string;
svelteKitVersion?: string;
}

export interface NormalizedSchema extends SveltekitGeneratorSchema {
Expand Down
12 changes: 12 additions & 0 deletions packages/sveltekit/src/generators/application/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@
"type": "boolean",
"default": false,
"x-priority": "internal"
},
"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"
}
},
"required": ["name"]
Expand Down
8 changes: 4 additions & 4 deletions packages/sveltekit/src/generators/utils/versions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const eslintPluginSvelteVersion = '^2.26.0';
export const svelteVersion = '^3.54.0';
export const svelteKitVersion = '^1.16.3';
export const svelteKitAdapterVersion = '^2.0.1';
export const eslintPluginSvelteVersion = '^2.35.0';
export const svelteVersion = '^4.2.0';
export const svelteKitVersion = '^2.5.0';
export const svelteKitAdapterVersion = '^3.2.0';

0 comments on commit f867fb3

Please sign in to comment.