How to use the @carbon/icons/build-info.json.map function in @carbon/icons

To help you get started, we’ve selected a few @carbon/icons 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 carbon-design-system / carbon / packages / icons-vue / src / build.js View on Github external
const outputOptions = {
        format,
        file: entrypointPath.replace(/\/es\//, `/${directory}/`),
      };
      if (format === 'umd') {
        outputOptions.name = 'CarbonIconsVue';
      }
      await bundle.write(outputOptions);
    })
  );

  reporter.info('Generating Storybook stories...');
  await fs.remove(STORYBOOK_DIR);
  await fs.ensureDir(STORYBOOK_DIR);
  await Promise.all(
    meta.map(info => {
      const { moduleName } = info;
      const outputPath = path.join(STORYBOOK_DIR, `${moduleName}-story.js`);
      return fs.writeFile(outputPath, createIconStory(info));
    })
  );

  reporter.success('Done! 🎉');
}
github carbon-design-system / carbon / packages / icons-vue / tasks / build.js View on Github external
async function build() {
  const modules = meta.map(icon => {
    const { source } = createIconComponent(icon.moduleName, icon.descriptor);
    return {
      moduleName: icon.moduleName,
      filepath: icon.outputOptions.file.replace(/^es\//g, '').slice(0, -3),
      source,
    };
  });

  const entrypoint = `export const CarbonIconsVue = {
  install(Vue, options) {
    const { components } = options;
    Object.keys(components).forEach(key => {
      Vue.component(key, components[key]);
    });
  },
}`;