idk stuff that should be defaults

materials
Valerie 2021-07-25 21:07:10 -04:00
parent 2e670c59fd
commit 730ba1af3f
2 changed files with 39 additions and 6 deletions

31
.vscode/tasks.json vendored
View File

@ -23,7 +23,10 @@
"problemMatcher": { "problemMatcher": {
"base": "$tsc-watch", "base": "$tsc-watch",
"applyTo": "allDocuments" "applyTo": "allDocuments"
} },
"dependsOn": [
"install deps"
]
}, },
{ {
"label": "dev", "label": "dev",
@ -41,6 +44,27 @@
"panel": "shared", "panel": "shared",
"group": "main" "group": "main"
}, },
"problemMatcher": [],
"dependsOn": [
"install deps"
]
},
{
"label": "install deps",
"type": "npm",
"script": "install",
"isBackground": true,
"group": "build",
"runOptions": {
"runOn": "folderOpen"
},
"presentation": {
"reveal": "never",
"echo": false,
"focus": false,
"panel": "shared",
"group": "main"
},
"problemMatcher": [] "problemMatcher": []
}, },
{ {
@ -59,7 +83,10 @@
"panel": "shared", "panel": "shared",
"group": "main" "group": "main"
}, },
"problemMatcher": [] "problemMatcher": [],
"dependsOn": [
"install deps"
]
} }
] ]
} }

View File

@ -11,7 +11,7 @@ import chalk from 'chalk';
ipc.config.silent = true; ipc.config.silent = true;
const exec = 'yarn'; const exec = 'yarn' + (process.platform === "win32" ? '.cmd' : '');
const args = [ const args = [
'start' 'start'
] ]
@ -31,7 +31,9 @@ let proc: ChildProcess = null;
function startProcess() { function startProcess() {
proc = spawn(exec, args, { proc = spawn(exec, args, {
stdio: 'inherit' stdio: 'inherit',
cwd: process.cwd(),
env: process.env
}); });
console.log(`[${proc.pid}] ${chalk.grey(`${exec} ${args.join(' ')}`)}`); console.log(`[${proc.pid}] ${chalk.grey(`${exec} ${args.join(' ')}`)}`);
proc.on('exit', () => { proc.on('exit', () => {
@ -55,8 +57,12 @@ async function killProcess() {
} }
async function restart() { async function restart() {
await killProcess(); if(proc) {
startProcess(); await killProcess();
startProcess();
} else {
startProcess();
}
} }
startProcess(); startProcess();