How to use the @storybook/node-logger.progress.emit 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 / server / src / http / middleware.ts View on Github external
const hasCustomFavicon = await list.reduce(async (acc, [route, location]) => {
    const fullLocation = path.resolve(location);

    if (!(await fs.pathExists(fullLocation))) {
      logger.error(`Error: no such directory to load static files: "${fullLocation}"`);
    } else {
      // TODO should be part of server
      progress.emit('server', {
        message: `adding static files from: "${location}", routing at "${route}"`,
        details: [location, route],
      });
    }

    app.use(express.static(fullLocation, { index: false }));

    // if route is root and we haven't found a favicon before and this one contains a favicon
    if (route === '/' && !(await acc) && (await containsFavicon(fullLocation))) {
      app.use(favicon(faviconLocation(fullLocation)));
      return true;
    }
    return acc;
  }, Promise.resolve(false));