1

Is it possible to output/log text at the very end the workspace generator output? I would like to notify the user of the next steps he/she should do, but my logs are kind of hidden above all the output generated by the tree updates.

export default async function (tree: Tree, schema: GeneratorOptions) {

  await applicationGenerator(tree, {
   // options go here
  });

  //format all the new files
  await formatFiles(tree);

  // log out next steps
  logger.info('next steps');
  logger.info('* Complete information in /src/environment files');
  logger.info('* Adjust example routes in /src/app/app.tsx');
}

The code above results in the following output, as you can see my logs are completely at the top (and nobody would ever see them)

output workspace generator

sjbuysse
  • 3,872
  • 7
  • 25
  • 37

1 Answers1

1

I was having the same problem and judging from this open issue it does not seem to be a way to do it.

What I ended up doing was wrapping the command to run the generator in a node script and then run that script instead:

import {execSync} from "child_process";
execSync('nx workspace-generator your-generator', {stdio: 'inherit'})
console.log('after')