How to use @carbon/cli-reporter - 10 common examples

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 / toolkit / packages / toolkit / src / addCommandToProgram.js View on Github external
'use strict';

const { ConsoleReporter } = require('@carbon/cli-reporter');
const { logger } = require('@carbon/cli-tools');
const packageJson = require('../package.json');

// Initialize our reporter for the console. Used for logging messages
const reporter = new ConsoleReporter();

/**
 * @typedef Option
 * @param {string} flags - specify the flags for the option
 * @param {string} description - the description to show for the option
 * @param {any} defaults - the default value for the option
 */

/**
 * @typedef Command
 * @param {string} name - the name of the command
 * @param {string} description - the description to show for the command
 * @param {Option[]} options - available options for the command
 * @param {Function} action - the function to call when the command is run
 */
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 / icons-angular / src / build.js View on Github external
async function build() {
  reporter.log('Cleaning build dirs...');
  try {
    await clean();

    await Promise.all([fs.mkdir(paths.STORIES), fs.mkdir(paths.TS)]);
  } catch (err) {
    reporter.error(err);
  }
  reporter.log('Generating source components...');
  await generateComponents();
  reporter.log('Compiling and generating modules...');
  // run the angular compiler over everything
  ngc.main(['-p', './config/tsconfig-aot.json']);
  reporter.log('Bundling...');
  await buildUMD();
  // build the storybook examples
  reporter.log('Generating storybook examples...');
  buildExamples();
}
github carbon-design-system / carbon / packages / icons-angular / src / build.js View on Github external
.replace('es', 'ts')
      .replace('.js', '.ts');
    // try to write out the component
    try {
      await fs.ensureDir(dirname(outputPath));
      await fs.writeFile(
        outputPath,
        componentTemplate(
          selectorName,
          className,
          rawSvg,
          icon.descriptor.attrs
        )
      );
    } catch (err) {
      reporter.error(err);
    }
  }
}
github carbon-design-system / carbon / packages / icons-angular / src / build.js View on Github external
async function build() {
  reporter.log('Cleaning build dirs...');
  try {
    await clean();

    await Promise.all([fs.mkdir(paths.STORIES), fs.mkdir(paths.TS)]);
  } catch (err) {
    reporter.error(err);
  }
  reporter.log('Generating source components...');
  await generateComponents();
  reporter.log('Compiling and generating modules...');
  // run the angular compiler over everything
  ngc.main(['-p', './config/tsconfig-aot.json']);
  reporter.log('Bundling...');
  await buildUMD();
  // build the storybook examples
  reporter.log('Generating storybook examples...');
  buildExamples();
}
github carbon-design-system / carbon / packages / icons-angular / src / build.js View on Github external
try {
    await clean();

    await Promise.all([fs.mkdir(paths.STORIES), fs.mkdir(paths.TS)]);
  } catch (err) {
    reporter.error(err);
  }
  reporter.log('Generating source components...');
  await generateComponents();
  reporter.log('Compiling and generating modules...');
  // run the angular compiler over everything
  ngc.main(['-p', './config/tsconfig-aot.json']);
  reporter.log('Bundling...');
  await buildUMD();
  // build the storybook examples
  reporter.log('Generating storybook examples...');
  buildExamples();
}
github carbon-design-system / carbon / packages / icons-angular / src / build.js View on Github external
async function build() {
  reporter.log('Cleaning build dirs...');
  try {
    await clean();

    await Promise.all([fs.mkdir(paths.STORIES), fs.mkdir(paths.TS)]);
  } catch (err) {
    reporter.error(err);
  }
  reporter.log('Generating source components...');
  await generateComponents();
  reporter.log('Compiling and generating modules...');
  // run the angular compiler over everything
  ngc.main(['-p', './config/tsconfig-aot.json']);
  reporter.log('Bundling...');
  await buildUMD();
  // build the storybook examples
  reporter.log('Generating storybook examples...');
  buildExamples();
}
github carbon-design-system / carbon / packages / icons-angular / src / build.js View on Github external
async function build() {
  reporter.log('Cleaning build dirs...');
  try {
    await clean();

    await Promise.all([fs.mkdir(paths.STORIES), fs.mkdir(paths.TS)]);
  } catch (err) {
    reporter.error(err);
  }
  reporter.log('Generating source components...');
  await generateComponents();
  reporter.log('Compiling and generating modules...');
  // run the angular compiler over everything
  ngc.main(['-p', './config/tsconfig-aot.json']);
  reporter.log('Bundling...');
  await buildUMD();
  // build the storybook examples
  reporter.log('Generating storybook examples...');
  buildExamples();
}

@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