Skip to content

Commit 40a6e39

Browse files
authored
breaking: goodbye create-svelte (#12850)
1 parent ed6b5cd commit 40a6e39

File tree

116 files changed

+15
-16512
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+15
-16512
lines changed

.changeset/breezy-cars-wink.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'create-svelte': major
3+
---
4+
5+
breaking: the `create-svelte` package has been replaced by the `sv` package

packages/create-svelte/README.md

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,11 @@
11
# create-svelte
22

3-
A CLI for creating new [SvelteKit](https://kit.svelte.dev) projects. Just run...
3+
This package has been deprecated. Please see [`sv`](https://npmjs.com/package/sv) instead:
44

55
```bash
6-
npm create svelte@latest
6+
npx sv create
77
```
88

9-
...and follow the prompts.
10-
11-
## API
12-
13-
You can also use `create-svelte` programmatically:
14-
15-
```js
16-
import { create } from 'create-svelte';
17-
18-
await create('my-new-app', {
19-
name: 'my-new-app',
20-
template: 'default', // or 'skeleton' or 'skeletonlib'
21-
types: 'checkjs', // or 'typescript' or null;
22-
prettier: false,
23-
eslint: false,
24-
playwright: false,
25-
vitest: false
26-
});
27-
```
28-
29-
`checkjs` means your project will use TypeScript to typecheck JavaScript via [JSDoc comments](https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html).
30-
319
## License
3210

33-
[MIT](../../LICENSE).
11+
[MIT](../../LICENSE)

packages/create-svelte/bin.js

Lines changed: 1 addition & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -1,150 +1,3 @@
11
#!/usr/bin/env node
2-
import fs from 'node:fs';
3-
import path from 'node:path';
4-
import process from 'node:process';
5-
import * as p from '@clack/prompts';
6-
import { bold, cyan, grey, yellow } from 'kleur/colors';
7-
import { create } from './index.js';
8-
import { dist, package_manager } from './utils.js';
92

10-
const { version } = JSON.parse(fs.readFileSync(new URL('package.json', import.meta.url), 'utf-8'));
11-
let cwd = process.argv[2] || '.';
12-
13-
console.log(`
14-
${grey(`create-svelte version ${version}`)}
15-
`);
16-
17-
p.intro('Welcome to SvelteKit!');
18-
19-
if (cwd === '.') {
20-
const dir = await p.text({
21-
message: 'Where should we create your project?',
22-
placeholder: ' (hit Enter to use current directory)'
23-
});
24-
25-
if (p.isCancel(dir)) process.exit(1);
26-
27-
if (dir) {
28-
cwd = /** @type {string} */ (dir);
29-
}
30-
}
31-
32-
if (fs.existsSync(cwd)) {
33-
if (fs.readdirSync(cwd).length > 0) {
34-
const force = await p.confirm({
35-
message: 'Directory not empty. Continue?',
36-
initialValue: false
37-
});
38-
39-
// bail if `force` is `false` or the user cancelled with Ctrl-C
40-
if (force !== true) {
41-
process.exit(1);
42-
}
43-
}
44-
}
45-
46-
const options = await p.group(
47-
{
48-
template: (_) =>
49-
p.select({
50-
message: 'Which Svelte app template?',
51-
options: fs.readdirSync(dist('templates')).map((dir) => {
52-
const meta_file = dist(`templates/${dir}/meta.json`);
53-
const { title, description } = JSON.parse(fs.readFileSync(meta_file, 'utf8'));
54-
55-
return {
56-
label: title,
57-
hint: description,
58-
value: dir
59-
};
60-
})
61-
}),
62-
63-
types: ({ results }) =>
64-
p.select({
65-
message: 'Add type checking with TypeScript?',
66-
initialValue: /** @type {'checkjs' | 'typescript' | null} */ (
67-
results.template === 'skeletonlib' ? 'checkjs' : 'typescript'
68-
),
69-
options: [
70-
{
71-
label: 'Yes, using TypeScript syntax',
72-
value: 'typescript'
73-
},
74-
{
75-
label: 'Yes, using JavaScript with JSDoc comments',
76-
value: 'checkjs'
77-
},
78-
{ label: 'No', value: null }
79-
]
80-
}),
81-
82-
features: () =>
83-
p.multiselect({
84-
message: 'Select additional options (use arrow keys/space bar)',
85-
required: false,
86-
options: [
87-
{
88-
value: 'eslint',
89-
label: 'Add ESLint for code linting'
90-
},
91-
{
92-
value: 'prettier',
93-
label: 'Add Prettier for code formatting'
94-
},
95-
{
96-
value: 'playwright',
97-
label: 'Add Playwright for browser testing'
98-
},
99-
{
100-
value: 'vitest',
101-
label: 'Add Vitest for unit testing'
102-
},
103-
{
104-
value: 'svelte5',
105-
label: 'Try the Svelte 5 preview (unstable!)'
106-
}
107-
]
108-
})
109-
},
110-
{ onCancel: () => process.exit(1) }
111-
);
112-
113-
await create(cwd, {
114-
name: path.basename(path.resolve(cwd)),
115-
template: /** @type {'default' | 'skeleton' | 'skeletonlib'} */ (options.template),
116-
types: /** @type {'checkjs' | 'typescript' | null} */ (options.types),
117-
prettier: options.features.includes('prettier'),
118-
eslint: options.features.includes('eslint'),
119-
playwright: options.features.includes('playwright'),
120-
vitest: options.features.includes('vitest'),
121-
svelte5: options.features.includes('svelte5')
122-
});
123-
124-
p.outro('Your project is ready!');
125-
126-
if (!options.types && options.template === 'skeletonlib') {
127-
const warning = yellow('▲');
128-
console.log(
129-
`${warning} You chose to not add type checking, but TypeScript will still be installed in order to generate type definitions when building the library\n`
130-
);
131-
}
132-
133-
console.log('Install more integrations with:');
134-
console.log(bold(cyan(' npx svelte-add')));
135-
136-
console.log('\nNext steps:');
137-
let i = 1;
138-
139-
const relative = path.relative(process.cwd(), cwd);
140-
if (relative !== '') {
141-
console.log(` ${i++}: ${bold(cyan(`cd ${relative}`))}`);
142-
}
143-
144-
console.log(` ${i++}: ${bold(cyan(`${package_manager} install`))}`);
145-
// prettier-ignore
146-
console.log(` ${i++}: ${bold(cyan('git init && git add -A && git commit -m "Initial commit"'))} (optional)`);
147-
console.log(` ${i++}: ${bold(cyan(`${package_manager} run dev -- --open`))}`);
148-
149-
console.log(`\nTo close the dev server, hit ${bold(cyan('Ctrl-C'))}`);
150-
console.log(`\nStuck? Visit us at ${cyan('https://svelte.dev/chat')}`);
3+
console.warn("'npm create svelte' has been replaced with 'npx sv create'");

packages/create-svelte/index.js

Lines changed: 0 additions & 162 deletions
This file was deleted.

0 commit comments

Comments
 (0)