How to use the @storybook/node-logger.logger.line function in @storybook/node-logger

To help you get started, we’ve selected a few @storybook/node-logger 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 storybookjs / storybook / lib / core / src / server / build-dev.js View on Github external
openInBrowser(address);
    }
  } catch (error) {
    // this is a weird bugfix, somehow 'node-pre-gyp' is polluting the npmLog header
    npmLog.heading = '';

    if (error instanceof Error) {
      if (error.error) {
        logger.error(error.error);
      } else if (error.stats && error.stats.compilation.errors) {
        error.stats.compilation.errors.forEach(e => logger.plain(e));
      } else {
        logger.error(error);
      }
    }
    logger.line();
    logger.warn(
      error.close
        ? dedent`
            FATAL broken build!, will close the process,
            Fix the error below and restart storybook.
          `
        : dedent`
            Broken build, fix the error above.
            You may need to refresh the browser.
          `
    );
    logger.line();

    if (options.smokeTest || (error && error.close)) {
      process.exit(1);
    }
github storybookjs / storybook / lib / server / src / builder / commands / watch.ts View on Github external
errorDetails: true,
      errors: true,
      warnings: true,
      entrypoints: false,
      modules: false,
      assets: false,
      reasons: false,
      source: false,
      chunks: false,
      children: false,
      // @ts-ignore
      chunkGroups: false,
      chunkModules: false,
    });

    logger.line();
    logger.info(JSON.stringify(displayStats));

    warnings.forEach(e => {
      logger.line();
      logger.warn(e);
    });
    errors.forEach(e => {
      logger.line();
      logger.error(e);
    });
    reportStats(stats);

    if (!err) {
      if (errors.length) {
        reportError(new Error('compilation ended with errors'));
      } else {
github storybookjs / storybook / lib / core / src / server / dev-server.js View on Github external
(err, stats) => {
          managerTotalTime = process.hrtime(startTime);
          if (!resolved && (err || stats.hasErrors())) {
            const error = new Error('Manager build is broken');
            error.error = err;
            error.close = true;
            error.stats = stats;
            logger.line();
            logger.line();
            try {
              previewReject(error);
              previewProcess.close();
              logger.warn('force closed preview build');
            } catch (e) {
              logger.warn('Unable to close preview build!');
            }
            logger.line();
            reject(error);
          } else {
            resolve(stats);
          }
        }
      );