'How to run NX angular applicationGenerator synchronously

I'm trying to replace an old angular-devkit schematic with a new nx generator using nx-devkit.

I'm following the guide here: https://nx.dev/generators/composing-generators

We should be able to await the nx generators, however when I do, the generator does not complete before await finishes.

Expected:

this should happen before
...application is created
this should happen after

Actual:

this should happen before
this should happen after
...application is created
export default async function(tree: Tree, schema: SchemaOptions) {
  logger.info('this should happen before');
  await applicationGenerator(tree, {...}); // this returns before the files are created
  logger.info('this should happen after');
}


Solution 1:[1]

Isn't that simple as just puting await before calling applicationGenerator?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jarek Krzemie?ski