mirror of
https://github.com/sveltejs/svelte.git
synced 2024-11-29 16:36:44 +01:00
convert update_template.sh to js for windows support
This commit is contained in:
parent
8e9f37a7d4
commit
2b1be6f8ae
@ -5,7 +5,7 @@
|
||||
"scripts": {
|
||||
"dev": "sapper dev",
|
||||
"sapper": "sapper build --legacy",
|
||||
"update": "sh scripts/update_template.sh && node scripts/get-contributors.js",
|
||||
"update": "node scripts/update_template.js && node scripts/get-contributors.js",
|
||||
"start": "node __sapper__/build",
|
||||
"cy:run": "cypress run",
|
||||
"cy:open": "cypress open",
|
||||
@ -29,6 +29,7 @@
|
||||
"passport-github": "^1.1.0",
|
||||
"prismjs": "^1.15.0",
|
||||
"session-file-store": "^1.2.0",
|
||||
"shelljs": "^0.8.3",
|
||||
"sirv": "^0.2.0",
|
||||
"yootils": "0.0.14"
|
||||
},
|
||||
|
26
site/scripts/update_template.js
Normal file
26
site/scripts/update_template.js
Normal file
@ -0,0 +1,26 @@
|
||||
const sh = require('shelljs');
|
||||
const fs = require('fs')
|
||||
|
||||
sh.cd(__dirname+'/../')
|
||||
|
||||
// fetch svelte app
|
||||
sh.rm('-rf','scripts/svelte-app')
|
||||
sh.exec('npx degit sveltejs/template scripts/svelte-app')
|
||||
|
||||
// update repl-viewer.css based on template
|
||||
sh.cp('scripts/svelte-app/public/global.css', 'static/repl-viewer.css')
|
||||
|
||||
// remove src (will be recreated client-side) and node_modules
|
||||
sh.rm('-rf', 'scripts/svelte-app/src')
|
||||
sh.rm('-rf', 'scripts/svelte-app/node_modules')
|
||||
|
||||
// build svelte-app.json
|
||||
const appPath = 'scripts/svelte-app'
|
||||
let files = []
|
||||
|
||||
for (const path of sh.find(appPath).filter(p => fs.lstatSync(p).isFile()) ) {
|
||||
files.push({ path: path.slice(appPath.length + 1), data: fs.readFileSync(path).toString() });
|
||||
}
|
||||
|
||||
fs.writeFileSync('static/svelte-app.json', JSON.stringify(files));
|
||||
|
Loading…
Reference in New Issue
Block a user