fixed watch mode
This commit is contained in:
56
src/main.ts
56
src/main.ts
@@ -85,36 +85,42 @@ readdirSync(AllPaths.base.dist).forEach(file =>
|
||||
)
|
||||
|
||||
//compile scripts
|
||||
let scripts = readdirSync(AllPaths.base.script)
|
||||
let scriptMeta: runBuildResult[] = []
|
||||
async function doCompile() {
|
||||
let scripts = readdirSync(AllPaths.base.script)
|
||||
let scriptMeta: runBuildResult[] = []
|
||||
|
||||
for (let name of scripts) {
|
||||
let path = AllPaths.script(name)
|
||||
for (let name of scripts) {
|
||||
let path = AllPaths.script(name)
|
||||
|
||||
if (
|
||||
!name.endsWith('_') &&
|
||||
existsSync(path.dir) &&
|
||||
lstatSync(path.dir).isDirectory() &&
|
||||
existsSync(path.main) &&
|
||||
lstatSync(path.main).isFile()
|
||||
) {
|
||||
let id = scriptMeta.length
|
||||
if (
|
||||
!name.endsWith('_') &&
|
||||
existsSync(path.dir) &&
|
||||
lstatSync(path.dir).isDirectory() &&
|
||||
existsSync(path.main) &&
|
||||
lstatSync(path.main).isFile()
|
||||
) {
|
||||
let id = scriptMeta.length
|
||||
|
||||
function update(result: runBuildResult) {
|
||||
console.log('WATCH', name, result.meta.version)
|
||||
scriptMeta[id] = result
|
||||
updateReadmeFile(scriptMeta)
|
||||
}
|
||||
|
||||
let result = await runBuild(name, update)
|
||||
console.log(name, result.meta.version)
|
||||
|
||||
function update(result: runBuildResult) {
|
||||
console.log('WATCH', name, result.meta.version)
|
||||
scriptMeta[id] = result
|
||||
updateReadmeFile(scriptMeta)
|
||||
}
|
||||
|
||||
let result = runBuild(name, update)
|
||||
console.log(name, result.meta.version)
|
||||
|
||||
scriptMeta[id] = result
|
||||
}
|
||||
return scriptMeta
|
||||
}
|
||||
doCompile().then(scriptMeta => {
|
||||
updateReadmeFile(scriptMeta)
|
||||
|
||||
updateReadmeFile(scriptMeta)
|
||||
|
||||
console.log(
|
||||
`\nFinished Compiling\n${CLIArgs.watch ? 'Listening for Changes\n' : ''}`
|
||||
)
|
||||
console.log(
|
||||
`\nFinished Compiling\n${
|
||||
CLIArgs.watch ? 'Listening for Changes\n' : ''
|
||||
}`
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user