From 856bb33dbac9d49d41bc82fd4d161545c6fbeb5e Mon Sep 17 00:00:00 2001 From: HristoP96 Date: Mon, 11 Jan 2021 15:20:52 +0200 Subject: [PATCH] await sample assets generators --- src/LiveEditingManager.ts | 27 ++++++++++++------------- src/generators/SampleAssetsGenerator.ts | 2 +- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/LiveEditingManager.ts b/src/LiveEditingManager.ts index dddc5b0..25e0411 100644 --- a/src/LiveEditingManager.ts +++ b/src/LiveEditingManager.ts @@ -15,26 +15,25 @@ export async function generateLiveEditing(options: ILiveEditingOptions, baseDir options.samplesDir = path.join(baseDir, options.samplesDir + "/samples/"); - if(fs.existsSync(options.samplesDir)) fsExtra.removeSync(options.samplesDir); + if (fs.existsSync(options.samplesDir)) fsExtra.removeSync(options.samplesDir); fs.mkdirSync(options.samplesDir); routingPathService.generateRouting(); console.log("-----------------------------------------------------"); console.log("Starting Live-Editing Generation - for " + baseDir); - - - new SampleAssetsGenerator(options).generateSamplesAssets() - .then(console.log) - .then(() => { - let metadata = new MetaData(); - fs.writeFileSync(options.samplesDir + "/meta.json", JSON.stringify(metadata)); - }) - .then(() => { - console.log("-----------------------------------------------------"); - console.log("Live-Editing - output folder: " + options.samplesDir); - }) - .catch(e => { throw new Error(e)}); new SharedAssetsGenerator(options.samplesDir).generateSharedAssets(); + + await new SampleAssetsGenerator(options).generateSamplesAssets() + .then(console.log) + .then(() => { + let metadata = new MetaData(); + fs.writeFileSync(options.samplesDir + "/meta.json", JSON.stringify(metadata)); + }) + .then(() => { + console.log("-----------------------------------------------------"); + console.log("Live-Editing - output folder: " + options.samplesDir); + }) + .catch(e => { throw new Error(e) }); } \ No newline at end of file diff --git a/src/generators/SampleAssetsGenerator.ts b/src/generators/SampleAssetsGenerator.ts index 528df95..2df74c6 100644 --- a/src/generators/SampleAssetsGenerator.ts +++ b/src/generators/SampleAssetsGenerator.ts @@ -47,7 +47,7 @@ export class SampleAssetsGenerator { console.log("Live-Editing - generating component samples..."); - import(path.join(process.cwd(), this.options.configGeneratorPath)). + await import(path.join(process.cwd(), this.options.configGeneratorPath)). then(m => { const GENERATORS = m[Object.keys(m)[0]];