How to use the @codechecks/client.codechecks.context function in @codechecks/client

To help you get started, we’ve selected a few @codechecks/client 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 codechecks / monorepo / checks / semaphore.ts View on Github external
export default async function() {
  await codechecks.success({
    name: "Semaphore",
    shortDescription: "works!",
    longDescription: "```\n" + JSON.stringify(codechecks.context, null, 2) + "\n```\n",
  });
}
github codechecks / build-size-watcher / src / index.ts View on Github external
export async function buildSizeWatcher(_options: BuildSizeWatcherOptions): Promise {
  const options = normalizeOptions(_options);
  const cwd = codechecks.context.workspaceRoot;

  const fullArtifact: FullArtifact = {};

  for (const file of options.files) {
    const matches = glob.sync(file.path, { cwd });

    const sizes = await Promise.all(matches.map(match => getSize(join(cwd, match), options.gzip)));
    const overallSize = sizes.reduce((a, b) => a + b, 0);

    const artifact: FileArtifact = {
      path: file.path,
      files: matches.length,
      overallSize,
    };

    fullArtifact[file.path] = artifact;