How to use the @carbon/cli-reporter.reporter.info function in @carbon/cli-reporter

To help you get started, we’ve selected a few @carbon/cli-reporter 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 / bundler / src / commands / check.js View on Github external
async function check(pattern, { ignore, cwd, list } = {}) {
  reporter.info(`Running in: ${cwd}`);
  reporter.info(`Checking pattern: '${pattern}', ignoring: '${ignore}'`);
  // Assume globs are for checking scss files for now
  const files = await glob(pattern, {
    cwd,
    ignore,
  });

  reporter.info(`Compiling ${files.length} files...`);

  const results = await Promise.all(
    compile(files.map(file => path.join(cwd, file)))
  );

  const errors = results.reduce((acc, result) => {
    if (result.error) {
      const error = result.error;
github carbon-design-system / carbon / tasks / examples.js View on Github external
async function main() {
  reporter.info('Building examples...');

  await fs.remove(BUILD_DIR);
  await fs.ensureDir(BUILD_DIR);

  const packageNames = await fs.readdir(PACKAGES_DIR);

  const packages = await Promise.all(
    packageNames
      .filter(name => PACKAGES_TO_BUILD.has(name))
      .map(async name => {
        // Verify that each file that we read from the packages directory is
        // actually a folder. Typically used to catch `.DS_store` files that
        // accidentally appear when opening with MacOS Finder
        const filepath = path.join(PACKAGES_DIR, name);
        const stat = await fs.lstat(filepath);
        const descriptor = {
github carbon-design-system / carbon / packages / icon-build-helpers / src / builders / vanilla / builder.js View on Github external
),
    ],
  });

  await Promise.all(
    BUNDLE_FORMATS.map(({ directory, format }) => {
      return bundle.write({
        dir: directory,
        format,
        // We already specify `.js` in the `filepath` used in `input` above
        entryFileNames: '[name]',
      });
    })
  );

  reporter.info('Building module entrypoints...');

  let entrypoint = `/**
 * Copyright IBM Corp. 2019, 2019
 *
 * This source code is licensed under the Apache-2.0 license found in the
 * LICENSE file in the root directory of this source tree.
 */
`;

  for (const file of files) {
    const { moduleName, descriptor } = file;
    const value = JSON.stringify(descriptor);
    entrypoint += `\nexport const ${moduleName} = ${value}`;
  }

  const entrypointBundle = await rollup({
github carbon-design-system / carbon / packages / cli / src / commands / ci-check.js View on Github external
stdio: 'inherit',
  };
  const tasks = [
    'yarn format:diff',
    'yarn lint --quiet',
    'yarn lint:docs',
    `yarn bundler check --ignore '**/@(node_modules|examples|components|react|fixtures)/**' 'packages/**/*.scss'`,
    `cross-env BABEL_ENV=test yarn test --ci --maxWorkers 2 --reporters=default --reporters=jest-junit`,
    `cross-env BABEL_ENV=test yarn test:e2e --ci --maxWorkers 2 --reporters=default --reporters=jest-junit`,
  ];

  try {
    for (const task of tasks) {
      const now = Date.now();

      reporter.info(`Running: ${task}`);
      await exec(task, options);
      reporter.success(`Done in: ${Date.now() - now}ms`);
    }
  } catch (error) {
    console.log(error.stdout);
    console.log(error.stderr);
    console.log(error);
    process.exit(1);
  }
}
github carbon-design-system / carbon / packages / bundler / src / commands / check.js View on Github external
}
    return acc;
  }, []);

  if (errors.length > 0) {
    errors.forEach(error => {
      const { formatted, file } = error;
      reporter.error(`Error compiling ${path.relative(cwd, file)}`);
      console.log(chalk.gray(formatted));
    });
    process.exit(1);
    return;
  }

  if (list) {
    reporter.info('Compiled the following files:');
    console.log(files);
  }
  reporter.success(`Successfully compiled ${files.length} files! 🎉`);
  process.exit(0);
}
github carbon-design-system / carbon / packages / icons-vue / src / build.js View on Github external
async function build({ cwd }) {
  reporter.info(`Building components for ${meta.length} icons...`);
  const ESM_DIR = path.join(cwd, 'es');
  const BUNDLE_FORMATS = [
    {
      format: 'cjs',
      directory: 'lib',
    },
    {
      format: 'umd',
      directory: 'umd',
    },
  ];

  reporter.info('Building ESM and bundle sources...');
  await Promise.all(
    meta.map(async info => {
      const source = createModuleFromInfo(info);
github carbon-design-system / carbon / packages / icons-react / src / build.js View on Github external
};
          if (format === 'umd') {
            outputOptions.name = info.moduleName;
            outputOptions.globals = {
              '@carbon/icon-helpers': 'CarbonIconHelpers',
              'prop-types': 'PropTypes',
              react: 'React',
            };
          }
          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 / themes / tasks / build.js View on Github external
async function build() {
  reporter.info('Building scss files for themes...');

  const METADATA_FILE = path.resolve(__dirname, '../metadata.yml');
  const metadata = transformMetadata(
    yaml.safeLoad(fs.readFileSync(METADATA_FILE, 'utf8'))
  );

  const SCSS_DIR = path.resolve(__dirname, '../scss/generated');
  const files = [
    {
      filepath: path.join(SCSS_DIR, '_tokens.scss'),
      builder() {
        return buildTokensFile(tokens, metadata, themes[defaultTheme]);
      },
    },
    {
      filepath: path.join(SCSS_DIR, '_themes.scss'),
github carbon-design-system / carbon / packages / icons-vue / src / build.js View on Github external
format,
            file: jsFilepath.replace(/\/es\//, `/${directory}/`),
          };
          if (format === 'umd') {
            outputOptions.name = info.moduleName;
            outputOptions.globals = {
              '@carbon/icon-helpers': 'CarbonIconHelpers',
            };
          }
          await bundle.write(outputOptions);
        })
      );
    })
  );

  reporter.info('Building ESM and bundle entrypoints...');
  const entrypoint = `export const CarbonIconsVue = {
  install(Vue, options) {
    const { components } = options;
    Object.keys(components).forEach(key => {
      Vue.component(key, components[key]);
    });
  },
}`;
  const entrypointPath = path.join(ESM_DIR, 'index.js');

  await fs.ensureDir(ESM_DIR);
  await fs.writeFile(entrypointPath, entrypoint);

  await Promise.all(
    BUNDLE_FORMATS.map(async ({ format, directory }) => {
      const bundle = await rollup({
github carbon-design-system / carbon / packages / icons-react / src / build.js View on Github external
const BUNDLE_FORMATS = [
    {
      format: 'esm',
      directory: 'es',
    },
    {
      format: 'cjs',
      directory: 'lib',
    },
    {
      format: 'umd',
      directory: 'umd',
    },
  ];

  reporter.info('Building ESM and bundle sources...');

  await Promise.all(
    meta.map(async info => {
      const source = createModuleFromInfo(info);
      const jsFilepath = path.join(cwd, info.outputOptions.file);
      const bundle = await rollup({
        input: '__entrypoint__',
        external: ['@carbon/icon-helpers', 'prop-types', 'react'],
        plugins: [
          virtual({
            __entrypoint__: source,
          }),
        ],
      });

      await Promise.all(

@carbon/cli-reporter

Reporter for CLI-based tools in the Carbon Design System

Apache-2.0
Latest version published 1 year ago

Package Health Score

76 / 100
Full package analysis