How to use the hygen/lib/logger function in hygen

To help you get started, we’ve selected a few hygen examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github beemojs / beemo / packages / core / src / routines / ScaffoldRoutine.ts View on Github external
async runGenerator(context: ScaffoldContext, moduleRoot: Path) {
    const { tool } = this;
    const args = [context.generator, context.action];

    try {
      return await engine(context.argv, {
        // @ts-ignore Broken upstream
        createPrompter: /* istanbul ignore next */ () => ({ prompt: this.handlePrompt }),
        cwd: tool.options.root,
        debug: tool.config.debug,
        exec: this.handleExec,
        logger: new Logger(this.handleLog),
        templates: moduleRoot.append('templates').path(),
      });
    } catch (error) {
      // Intercept hygen error to provide a better error message
      if (error.message.startsWith("I can't find action")) {
        throw new Error(this.tool.msg('errors:scaffoldNoTemplates', { path: args.join('/') }));
      }

      throw error;
    }
  }

hygen

The scalable code generator that saves you time.

MIT
Latest version published 3 months ago

Package Health Score

80 / 100
Full package analysis