2
2
3
3
import { create } from 'create-svelte' // @latest
4
4
5
+ $ . verbose = false
6
+
5
7
export async function patchFiles ( filepaths , ...replacers ) {
6
8
for ( const file of [ filepaths ] . flat ( ) ) {
7
9
let contents = await fs . readFile ( file , 'utf8' )
@@ -12,6 +14,11 @@ export async function patchFiles(filepaths, ...replacers) {
12
14
}
13
15
}
14
16
17
+ export async function getVersion ( pkg ) {
18
+ const version = await $ `npm show ${ pkg } version`
19
+ return version . toString ( )
20
+ }
21
+
15
22
export async function addBaseTemplate ( { name, template } ) {
16
23
await fs . remove ( name )
17
24
await create ( name , {
@@ -23,10 +30,13 @@ export async function addBaseTemplate({ name, template }) {
23
30
playwright : true ,
24
31
vitest : false
25
32
} )
33
+ await fetch ( 'https://raw.githubusercontent.com/zerodevx/sveltekit-starter/main/favicon.png' ) . then (
34
+ ( r ) => r . body . pipe ( fs . createWriteStream ( path . join ( name , 'static' , 'favicon.png' ) ) )
35
+ )
26
36
}
27
37
28
38
export async function addTailwindcss ( { name } ) {
29
- await $ `cd ${ name } && npx svelte-add@latest tailwindcss` . quiet ( )
39
+ await $ `cd ${ name } && npx -y svelte-add@latest tailwindcss`
30
40
}
31
41
32
42
export async function addPrettier ( { name } ) {
@@ -87,5 +97,8 @@ void (async function () {
87
97
echo `- added adapter-static`
88
98
89
99
echo `\nAll done! Complete the setup with:\n`
90
- echo `$ cd ${ opts . name } && npm i && npm run format`
100
+ echo `$ cd ${ opts . name } `
101
+ echo `$ npx npm-check-updates -u`
102
+ echo `$ npm i`
103
+ echo `$ npm run format`
91
104
} ) ( )
0 commit comments