Skip to content

Commit 68e68f0

Browse files
Fix file not found
1 parent e792fdc commit 68e68f0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/comment.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,17 @@ async function printCDNTable(names) {
7575
if (!names.includes(name) || !file) continue;
7676
const version = newPlugins[name];
7777
const links = getVendors({ ...value, version, minified: file });
78+
const path = `./node_modules/${name}/${file}`;
79+
const fileExists = fs.existsSync(path);
80+
if (!fileExists) {
81+
console.log(`
82+
## ${name}
83+
84+
The file \`${file}\` does not exist.`);
85+
continue;
86+
}
7887
const integrity = await ssri
79-
.fromStream(fs.createReadStream(`./node_modules/${name}/${file}`), { algorithms: ['sha256'] });
88+
.fromStream(fs.createReadStream(path), { algorithms: ['sha256'] });
8089
await formatTable(key, links, integrity.toString());
8190
}
8291
}

0 commit comments

Comments
 (0)