Skip to content

Commit

Permalink
Fail the NPM build if files are missing
Browse files Browse the repository at this point in the history
Summary: Neither yarn nor npm cares if declared files are missing from the package, which caused v0.2.0 to be broken. This adds a manual check to ensure the build fails when they're missing.

Reviewed By: jbower-fb

Differential Revision: D17330054

fbshipit-source-id: 770ecd6d0f3102cddef6269c83cb52d611bc4cba
  • Loading branch information
willholen authored and facebook-github-bot committed Sep 12, 2019
1 parent 91ee209 commit 66b8a6b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions npm/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,20 @@ async function unpackAll(files) {
var names = inputs.map(c => c.name).join(", ");
throw "No tarballs found. Please build or download at least one of: " + names;
}

verifyManifest();
}

function verifyManifest() {
if (options.dev) return;

// TODO: Handle globs
const files = npmjson.files.filter(s => s.indexOf("*") === -1);
for (const file of files) {
if (!fs.existsSync(file)) {
throw `File missing from manifest: ${file}`
}
}
}

var inputs = [
Expand Down

0 comments on commit 66b8a6b

Please sign in to comment.