【问题标题】:Output text at the very end of custom Nx workspace generator在自定义 Nx 工作区生成器的最后输出文本
【发布时间】:2022-03-27 17:25:29
【问题描述】:

是否可以在工作区生成器输出的最后输出/记录文本? 我想通知用户他/她应该执行的后续步骤,但我的日志有点隐藏在tree 更新生成的所有输出之上。

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');
}

上面的代码产生以下输出,你可以看到我的日志完全在顶部(没有人会看到它们)

【问题讨论】:

    标签: nrwl-nx nrwl angular-schematics


    【解决方案1】:

    我遇到了同样的问题,从 this open issue 来看,这似乎不是解决问题的方法。

    我最终做的是将运行生成器的命令包装在节点脚本中,然后改为运行该脚本:

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

    【讨论】:

      猜你喜欢
      • 2021-11-21
      • 2022-11-10
      • 2022-06-12
      • 2021-11-24
      • 2022-10-08
      • 2019-05-26
      • 1970-01-01
      • 1970-01-01
      • 2019-03-31
      相关资源
      最近更新 更多