How to use the @codechecks/client.codechecks.saveValue 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 cgewecke / eth-gas-reporter / codechecks.js View on Github external
console.log(message);
    return;
  }

  // Lets monorepo subcomponents individuate themselves
  output.namespace = options.name
    ? `${output.namespace}:${options.name}`
    : output.namespace;

  // Save new data on the merge commit / push build
  if (!codechecks.isPr()) {
    const report = new CodeChecksReport(output.config);
    report.generate(output.info);

    try {
      await codechecks.saveValue(output.namespace, report.newData);
      console.log(`Successful save: output.namespace was: ${output.namespace}`);
    } catch (err) {
      console.log(
        `If you have a chance, report this incident to the eth-gas-reporter github issues.`
      );
      console.log(`Codechecks errored running 'saveValue'...\n${err}\n`);
      console.log(`output.namespace was: ${output.namespace}`);
      console.log(`Saved gas-reporter data was: ${report.newData}`);
    }

    return;
  }

  // Get historical data for each pr commit
  try {
    output.config.previousData = await codechecks.getValue(output.namespace);
github nestjs / nest / tools / benchmarks / check-benchmarks.ts View on Github external
export default async function checkBenchmarks() {
  const currentBenchmarks = await getBenchmarks();
  await codechecks.saveValue(benchmarksKey, currentBenchmarks);

  if (!codechecks.isPr()) {
    return;
  }
  const baselineBenchmarks = await codechecks.getValue(
    benchmarksKey,
  );
  const report = getCodechecksReport(currentBenchmarks, baselineBenchmarks);
  await codechecks.report(report);
}
github codechecks / build-size-watcher / src / index.ts View on Github external
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;
  }

  await codechecks.saveValue(options.artifactName, fullArtifact);

  if (!codechecks.isPr()) {
    return;
  }

  const baseArtifact = await codechecks.getValue(options.artifactName);

  const diff = getArtifactDiff(fullArtifact, baseArtifact);

  const report = getReportFromDiff(diff, options.files, options);
  await codechecks.report(report);
}