Skip to content

Commit 7b671c3

Browse files
authored
fix(cli): --from-playground option & node 20 (#720)
1 parent 431cddf commit 7b671c3

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

.changeset/three-trains-allow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'sv': patch
3+
---
4+
5+
fix(cli): `--from-playground` option now works correctly from node 20

packages/cli/commands/create.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ async function createProjectFromPlayground(url: string, cwd: string): Promise<vo
242242

243243
// Detect external dependencies and ask for confirmation
244244
const dependencies = detectPlaygroundDependencies(playground.files);
245-
const installDependencies = await confirmExternalDependencies(dependencies.keys().toArray());
245+
const installDependencies = await confirmExternalDependencies(Array.from(dependencies.keys()));
246246

247247
setupPlaygroundProject(playground, cwd, installDependencies);
248248
}

packages/create/test/playground.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ test('detect dependencies from playground files', () => {
142142
expect(dependencies).not.toContain(['$lib/utils', 'latest']);
143143
expect(dependencies).not.toContain(['node:fs', 'latest']);
144144
expect(dependencies).not.toContain(['@sveltejs/kit', 'latest']);
145+
146+
// should work with array
147+
expect(Array.from(dependencies.keys()).length).toBe(3);
145148
});
146149

147150
test('real world download and convert playground', async () => {

0 commit comments

Comments
 (0)