Skip to content

Commit

Permalink
Update release process to work around newer npm not packing node_modules
Browse files Browse the repository at this point in the history
  • Loading branch information
agrieve committed Nov 11, 2015
1 parent bc05fc6 commit c16404f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 18 deletions.
42 changes: 33 additions & 9 deletions dev-bin/prepfornpm.sh → dev-bin/create-tgz.sh
Expand Up @@ -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)
Expand All @@ -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

14 changes: 5 additions & 9 deletions dev-docs/release-instructions.md
Expand Up @@ -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 .
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c16404f

Please sign in to comment.