Skip to content

Commit

Permalink
await sample assets generators
Browse files Browse the repository at this point in the history
  • Loading branch information
HristoP96 authored and HristoP96 committed Jan 11, 2021
1 parent 6871e30 commit 856bb33
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
27 changes: 13 additions & 14 deletions src/LiveEditingManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) });
}
2 changes: 1 addition & 1 deletion src/generators/SampleAssetsGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]];

Expand Down

0 comments on commit 856bb33

Please sign in to comment.