Skip to content

Commit

Permalink
Fix file not found
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang committed Nov 3, 2024
1 parent e792fdc commit 68e68f0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,17 @@ async function printCDNTable(names) {
if (!names.includes(name) || !file) continue;
const version = newPlugins[name];
const links = getVendors({ ...value, version, minified: file });
const path = `./node_modules/${name}/${file}`;
const fileExists = fs.existsSync(path);
if (!fileExists) {
console.log(`
## ${name}
The file \`${file}\` does not exist.`);
continue;
}
const integrity = await ssri
.fromStream(fs.createReadStream(`./node_modules/${name}/${file}`), { algorithms: ['sha256'] });
.fromStream(fs.createReadStream(path), { algorithms: ['sha256'] });
await formatTable(key, links, integrity.toString());
}
}
Expand Down

0 comments on commit 68e68f0

Please sign in to comment.