diff --git a/dev-bin/prepfornpm.sh b/dev-bin/create-tgz.sh similarity index 54% rename from dev-bin/prepfornpm.sh rename to dev-bin/create-tgz.sh index 55c222894..722ec30f2 100755 --- a/dev-bin/prepfornpm.sh +++ b/dev-bin/create-tgz.sh @@ -16,7 +16,13 @@ # specific language governing permissions and limitations # under the License. -if [[ -e npm_deleted_git_ignores ]]; then +function delete_git_ignores() { + GIT_IGNORES=$(echo $(find . -name ".gitignore" | grep -v "node_modules")) + echo $GIT_IGNORES > npm_deleted_git_ignores + rm $GIT_IGNORES +} + +function restore_git_ignores() { for f in $(cat npm_deleted_git_ignores); do ( cd $(dirname $f) @@ -25,13 +31,31 @@ if [[ -e npm_deleted_git_ignores ]]; then ) || exit $? done rm npm_deleted_git_ignores - echo Restored files. - exit 0 -fi +} set -e -GIT_IGNORES=$(echo $(find . -name ".gitignore" | grep -v "node_modules")) -echo $GIT_IGNORES > npm_deleted_git_ignores -rm $GIT_IGNORES -echo Prepped for npm pack / npm publish. Deleted: -for f in $GIT_IGNORES; do echo $f; done +set -x +cd $(dirname $0)/.. +if [[ -n "$(git status --porcelain)" ]]; then + echo "********** Changes exist. aborting. ************" + git status + exit 1 +fi +delete_git_ignores +npm pack +TMP_DIR=tmp-$RANDOM +mkdir $TMP_DIR +cd $TMP_DIR +tar xzf ../*.tgz +# This is the main reason for this script. +if [[ ! -e ../cordova/cordova-android/node_modules ]]; then + cp -r ../cordova/cordova-android/node_modules package/cordova/cordova-android + cp -r ../cordova/cordova-ios/bin/node_modules package/cordova/cordova-ios/bin +fi +tar czf foo.tgz package +mv foo.tgz ../*.tgz +cd .. +rm -r $TMP_DIR +restore_git_ignores +echo DONE + diff --git a/dev-docs/release-instructions.md b/dev-docs/release-instructions.md index b9bc655ec..041b2b49d 100644 --- a/dev-docs/release-instructions.md +++ b/dev-docs/release-instructions.md @@ -17,9 +17,7 @@ npm update -g npm ## How to See What is Packaged: - dev-bin/prepfornpm.sh - npm pack - dev-bin/prepfornpm.sh # It's a toggle... yeah, i know... + dev-bin/create-tgz.sh tar xzf *.tgz cd package find . @@ -135,9 +133,8 @@ Next, add in notable RELEASENOTE.md entries from `cordova-plugman` and `cordova- git commit -am "Set version to $(grep '"version"' package.json | cut -d'"' -f4)" # Publish rc to npm - dev-bin/prepfornpm.sh - npm publish --tag=rc # If this fails, try again with node v0.12 - dev-bin/prepfornpm.sh # It's a toggle... yeah, i know... + dev-bin/create-tgz.sh + npm publish *.tgz --tag=rc # Double check things are still good git status @@ -184,9 +181,8 @@ The following is the full set of tests. Vary accordingly depending on the magnit git tag v$CCA_VERSION # Publish to npm - dev-bin/prepfornpm.sh - npm publish - dev-bin/prepfornpm.sh # It's a toggle... yeah, i know... + dev-bin/create-tgz.sh + npm publish *.tgz # Double check that the tags point to the right things: npm info cca