How to use the @storybook/node-logger.logger.info 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-static.js View on Github external
function prepareFilesStructure(outputDir, defaultFavIcon) {
  // clear the output dir
  logger.info('clean outputDir..');
  shelljs.rm('-rf', outputDir);

  // create output directory if not exists
  shelljs.mkdir('-p', outputDir);
  shelljs.mkdir('-p', path.join(outputDir, 'sb_dll'));

  shelljs.cp(defaultFavIcon, outputDir);
}
github storybookjs / storybook / lib / core / src / server / preview / custom-webpack-preset.js View on Github external
// Check whether user has a custom webpack config file and
  // return the (extended) base configuration if it's not available.
  const customConfig = loadCustomWebpackConfig(configDir);

  if (customConfig === null) {
    logger.info('=> Using default Webpack setup.');
    return createFinalDefaultConfig(presets, config, options);
  }

  if (typeof customConfig === 'function') {
    logger.info('=> Loading custom Webpack config (full-control mode).');
    const finalDefaultConfig = await createFinalDefaultConfig(presets, config, options);
    return customConfig({ config: finalDefaultConfig, mode: configType });
  }

  logger.info('=> Loading custom webpack config (extending mode).');

  // Restore 4.x behavior, but deprecate this mode of extending webpack
  const finalConfig = await presets.apply('webpackFinal', config, options);
  return deprecate(
    () => mergeConfigs(finalConfig, customConfig),
    stripIndents`
      Extend-mode configuration is deprecated, please use full-control mode instead.
      
      See https://storybook.js.org/docs/configurations/custom-webpack-config/#full-control-mode
    `
  )();
}
github storybookjs / storybook / lib / core / src / server / utils / load-custom-addons-file.js View on Github external
function loadCustomAddons({ configDir }) {
  const storybookCustomAddonsPath = getInterpretedFile(path.resolve(configDir, 'addons'));
  const storybookCustomManagerPath = getInterpretedFile(path.resolve(configDir, 'manager'));

  if (storybookCustomAddonsPath || storybookCustomManagerPath) {
    logger.info('=> Loading custom manager config.');
  }

  if (storybookCustomAddonsPath && storybookCustomManagerPath) {
    throw new Error(dedent`
      You have both a "addons.js" and a "manager.js", remove the "addons.js" file from your configDir (${path.resolve(
        configDir,
        'addons'
      )})`);
  }

  return [...(toArray(storybookCustomManagerPath) || toArray(storybookCustomAddonsPath) || [])];
}
github storybookjs / storybook / app / angular / src / server / ts_config.js View on Github external
function resolveTsConfig(tsConfigPath) {
  if (!fs.existsSync(tsConfigPath)) {
    return null;
  }

  logger.info('=> Found custom tsconfig.json');

  return tsConfigPath;
}
github storybookjs / storybook / app / angular / src / server / framework-preset-angular-cli.ts View on Github external
export function webpackFinal(config: Configuration) {
  const cwd = process.cwd();
  const cliWebpackConfigOptions = getAngularCliWebpackConfigOptions(cwd as Path);

  if (cliWebpackConfigOptions) {
    logger.info('=> Loading angular-cli config.');
  }

  return applyAngularCliWebpackConfig(config, cliWebpackConfigOptions);
}
github storybookjs / storybook / lib / core / src / server / build-static.js View on Github external
async function buildManager(configType, outputDir, configDir, options) {
  logger.info('=> Building manager..');
  const managerStartTime = process.hrtime();

  logger.info('=> Loading manager config..');
  const managerConfig = await loadManagerConfig({
    configType,
    outputDir,
    configDir,
    corePresets: [require.resolve('./manager/manager-preset.js')],
    frameworkPresets: options.frameworkPresets,
    docsMode: options.docsMode,
    previewUrl: options.previewUrl,
  });

  if (options.debugWebpack) {
    logConfig('Manager webpack config', managerConfig);
  }

  return compileManager(managerConfig, managerStartTime);
}
github storybookjs / storybook / lib / core / src / server / build-dev.js View on Github external
async function outputStats(previewStats, managerStats) {
  if (previewStats) {
    await writeStats('preview', previewStats);
  }
  await writeStats('manager', managerStats);
  logger.info(`stats written to => ${chalk.cyan(path.join(cacheDir, '[name].json'))}`);
}
github storybookjs / storybook / lib / core / src / server / build-static.js View on Github external
async function compileManager(managerConfig, managerStartTime) {
  logger.info('=> Compiling manager..');

  return new Promise((resolve, reject) => {
    webpack(managerConfig).run((error, stats) => {
      if (error || !stats || stats.hasErrors()) {
        logger.error('=> Failed to build the manager');

        if (error) {
          logger.error(error.message);
        }

        if (stats && (stats.hasErrors() || stats.hasWarnings())) {
          const { warnings, errors } = stats.toJson(managerConfig.stats);

          errors.forEach(e => logger.error(e));
          warnings.forEach(e => logger.error(e));
        }
github storybookjs / storybook / app / react / src / server / framework-preset-cra.js View on Github external
export function webpackFinal(config, { configDir }) {
  if (!isReactScriptsInstalled()) {
    logger.info('=> Using base config because react-scripts is not installed.');
    return config;
  }

  logger.info('=> Loading create-react-app config.');

  return applyCRAWebpackConfig(config, configDir);
}