Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default async function() {
await codechecks.success({
name: "Semaphore",
shortDescription: "works!",
longDescription: "```\n" + JSON.stringify(codechecks.context, null, 2) + "\n```\n",
});
}
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;