Skip to content
This repository was archived by the owner on Jul 17, 2022. It is now read-only.

Commit 9bec79b

Browse files
fix: More compiler stability
1 parent 2a5adfd commit 9bec79b

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

Firework.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,32 @@ export async function Start(path, com){
148148

149149
spinner2.success()
150150

151+
const spinner3 = createSpinner('Waiting for source JSON of ' + targetFileName + '...').start()
152+
153+
let sourceJson = null
154+
155+
let waits = 0
156+
157+
while(!sourceJson && waits < 100){
158+
try{
159+
sourceJson = JSON.parse(fs.readFileSync(sourceFilePath))
160+
}catch{}
161+
162+
waits++
163+
164+
await sleep(100)
165+
}
166+
167+
if(waits >= 100){
168+
spinner3.fail()
169+
170+
console.log(chalk.hex('#ffc825').bold('Warning:') + ' Failed to load ' + files[i])
171+
172+
continue
173+
}else{
174+
spinner3.success()
175+
}
176+
151177
const result = CompileFile(sourceFilePath, targetFilePath, com + '/development_behavior_packs/' + projectName + ' BP', JSON.parse(fs.readFileSync(path + '/.firework/config.json')))
152178

153179
if(result instanceof Backend.Error){

0 commit comments

Comments
 (0)