Skip to content

Commit

Permalink
Check npm-shrinkwrap.json before npm version
Browse files Browse the repository at this point in the history
  • Loading branch information
madarche committed Apr 1, 2016
1 parent 559f5a1 commit 765d93d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
12 changes: 0 additions & 12 deletions assert_release_quality → assert_changelog_ready
Expand Up @@ -10,17 +10,6 @@ rollbackPackage() {
git checkout package.json
}

# Checking that the npm-shrinkwrap.json file is up-to-date wrt to the
# package.json file.
if [ package.json -nt npm-shrinkwrap.json ]
then
echo "File package.json is newer than file npm-shrinkwrap.json"
printf "To fix this, run:\nnpm run safefreeze\n\n"

rollbackPackage
exit 1
fi

# Checking the ChangeLog contains an entry for each version
for entry in $(git tag|cut -c 2-) $new_version
do
Expand All @@ -34,4 +23,3 @@ do
exit 1
fi
done

19 changes: 19 additions & 0 deletions assert_shrinkwrap_ready
@@ -0,0 +1,19 @@
#!/bin/sh
#
# Asserts that the module is ready for release with the expected quality

# Rollback modified package.json file so it has the previous version
rollbackPackage() {
git checkout package.json
}

# Checking that the npm-shrinkwrap.json file is up-to-date wrt to the
# package.json file.
if [ package.json -nt npm-shrinkwrap.json ]
then
echo "File package.json is newer than file npm-shrinkwrap.json"
printf "To fix this, run:\nnpm run safefreeze\n\n"

rollbackPackage
exit 1
fi
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -31,7 +31,8 @@
"lint:fix": "eslint --fix .",
"clean": "rm -rf test/coverage",
"safefreeze": "rm -rf node_modules npm-shrinkwrap.json && npm install && npm dedupe && npm test && npm shrinkwrap && touch package.json npm-shrinkwrap.json",
"version": "./assert_release_quality $npm_package_version"
"preversion": "./assert_shrinkwrap_ready"
"version": "./assert_changelog_ready $npm_package_version"
},
"files": [
"lib"
Expand Down

0 comments on commit 765d93d

Please sign in to comment.