build: throw an exception when a package is not found in monorepo

This commit is contained in:
Hans 2018-08-20 10:39:20 -07:00
parent 56a97c1fc2
commit c0f61dcb83

View File

@ -190,6 +190,12 @@ export const packages: PackageMap =
// Only build the entry if there's a package name. // Only build the entry if there's a package name.
return packages; return packages;
} }
if (!(name in monorepoPackages)) {
throw new Error(
`Package ${name} found in ${JSON.stringify(pkg.root)}, not found in .monorepo.json.`,
);
}
const bin: {[name: string]: string} = {}; const bin: {[name: string]: string} = {};
Object.keys(packageJson['bin'] || {}).forEach(binName => { Object.keys(packageJson['bin'] || {}).forEach(binName => {
let p = path.resolve(pkg.root, packageJson['bin'][binName]); let p = path.resolve(pkg.root, packageJson['bin'][binName]);