How to use the @carbon/cli-reporter.reporter.success 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 / cli / src / commands / ci-check.js View on Github external
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
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 / bundler / src / commands / sassdoc.js View on Github external
if (json) {
    reporter.info(
      `Creating sassdoc json for pattern: '${pattern}', ignoring: '${ignore}'`
    );

    try {
      const jsonFile = await createJson(files);
      await fs.ensureDir(DOCS_DIR);
      await fs.writeFile(JSON_FILE, JSON.stringify(jsonFile, null, 2));
    } catch (error) {
      reporter.error(`Sassdoc error: ${error}`);
      process.exit(1);
    }

    reporter.success('Done! 🎉');
  } else {
    reporter.info(
      `Creating sassdoc markdown for pattern: '${pattern}', ignoring: '${ignore}'`
    );

    try {
      const markdownFile = await createMarkdown(files);
      await fs.ensureDir(DOCS_DIR);
      await fs.writeFile(MARKDOWN_FILE, markdownFile);
    } catch (error) {
      reporter.error(`Sassdoc error: ${error}`);
      process.exit(1);
    }

    reporter.success('Done! 🎉');
  }
github carbon-design-system / carbon / packages / themes / tasks / build.js View on Github external
themes,
          tokens,
          defaultTheme,
          defaultThemeMapName
        );
      },
    },
  ];

  await fs.ensureDir(SCSS_DIR);
  for (const { filepath, builder } of files) {
    const { code } = generate(builder());
    await fs.writeFile(filepath, code);
  }

  reporter.success('Done! 🎉');
}
github carbon-design-system / carbon / packages / icons-react / src / build.js View on Github external
);
    })
  );

  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 / colors / src / build.js View on Github external
}

    return acc + '\n' + `$${name}: ${value};`;
  }, '');

  const COLOR_IMPORT = `@import 'colors';`;

  await fs.writeFile(
    TOKEN_ENTRYPOINT,
    prettier.format(
      GENERATED_COMMENT + '\n' + COLOR_IMPORT + '\n' + tokenSource,
      prettierOptions
    )
  );

  reporter.success('Done! 🎉');
}
github carbon-design-system / carbon / packages / icons-vue / src / build.js View on Github external
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 / icon-build-helpers / src / builders / vanilla / optimize.js View on Github external
const optimized = await flatMapAsync(files, async file => {
    const { filepath } = file;
    const source = await fs.readFile(filepath);
    const optimized = await svgo.optimize(source, {
      path: filepath,
    });

    return {
      ...file,
      source,
      optimized,
    };
  });

  reporter.success(`Successfully optimized ${optimized.length} icons 🎉`);

  return optimized;
}
github carbon-design-system / carbon / tasks / examples.js View on Github external
if (relativePath.includes('node_modules')) {
                return false;
              }
              if (relativePath[0] === '.') {
                return false;
              }
              return true;
            },
          });
          reporter.success(
            `Built example \`${example.name}\` in package \`${pkg.name}\``
          );
        })
      );

      reporter.success(`Built examples in package \`${pkg.name}\``);
    })
  );

@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