feat: Only generate manifest if update is specified (#8)

* Only generate manifest if update is specified

BREAKING CHANGE: packwatch will now exit with a non-zero code if run
without an existing manifest file and without the --update-manifest
flag. Now run packwatch --update-manifest to generate a manifest for the
first time.

* Fail but still generate manifest
This commit is contained in:
Michael Rose 2020-03-08 13:12:49 -04:00 committed by GitHub
parent a34e42a5e1
commit 16e0ea7ff0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -33,7 +33,9 @@ if (!existsSync(MANIFEST_FILENAME)) {
console.log( console.log(
`Package size (${currentStats.packageSize}) adopted as new limit.`, `Package size (${currentStats.packageSize}) adopted as new limit.`,
) )
process.exit(0) // If the update flag wasn't specified, exit with a non-zero code so we
// don't "accidentally" pass CI builds if the manifest didn't exist
process.exit(isUpdatingManifest ? 0 : 1)
} }
const previousStats = getPreviousPackageStats() const previousStats = getPreviousPackageStats()