Skip to content
Browse files

A script for building a release

  • Loading branch information...
1 parent fc432c6 commit ccf2f4e8efe3ca96007818bc30ae4d48be278cf8 @isaacs isaacs committed
Showing with 52 additions and 3 deletions.
  1. +1 −0 .gitignore
  2. +11 −3 Makefile
  3. +40 −0 scripts/release.sh
View
1 .gitignore
@@ -13,3 +13,4 @@ html/doc/*.html
man/
doc/*/index.md
./npmrc
+release/
View
14 Makefile
@@ -108,18 +108,26 @@ version: link
git add package.json &&\
git ci -m v$(shell npm -v)
-publish: link
+publish: link doc
git tag -s -m v$(shell npm -v) v$(shell npm -v) &&\
git push origin --tags &&\
npm publish &&\
- make doc-publish
+ npm tag npm@$(shell npm -v) $(shell npm -v | awk -F. '{print $1 "." $2}') &&\
+ make doc-publish &&\
+ make zip-publish
docpublish: doc-publish
doc-publish: doc
rsync -vazu --stats --no-implied-dirs --delete html/doc/ npmjs.org:/var/www/npmjs.org/public/doc
rsync -vazu --stats --no-implied-dirs --delete html/api/ npmjs.org:/var/www/npmjs.org/public/api
+zip-publish: release
+ scp release/*.zip npmjs.org:/var/www/npmjs.org/public/dist/
+
+release:
+ @bash scripts/release.sh
+
sandwich:
@[ $$(whoami) = "root" ] && (echo "ok"; echo "ham" > sandwich) || echo "make it yourself"
-.PHONY: all latest install dev link doc clean uninstall test man doc-publish doc-clean docclean docpublish
+.PHONY: all latest install dev link doc clean uninstall test man doc-publish doc-clean docclean docpublish release zip-publish
View
40 scripts/release.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+# script for creating a zip and tarball for inclusion in node
+
+unset CDPATH
+
+set -e
+
+rm -rf release *.tgz || true
+mkdir release
+npm pack --loglevel error >/dev/null
+mv *.tgz release
+cd release
+tar xzf *.tgz
+
+# remove some unnecessary stuff.
+rm -rf package/node_modules/*/{test,bench,example}*
+rm -rf package/test/{disabled,output,bin,root}*
+
+mkdir node_modules
+mv package node_modules/npm
+
+# make the zip for windows users
+cp node_modules/npm/bin/*.cmd .
+zipname=npm-$(npm -v).zip
+zip -q -9 -r -X "$zipname" *.cmd node_modules
+
+# make the tar for node's deps
+cd node_modules
+tarname=npm-$(npm -v).tgz
+tar czf "$tarname" npm
+
+cd ..
+mv "node_modules/$tarname" .
+
+rm -rf *.cmd
+rm -rf node_modules
+
+echo "release/$tarname"
+echo "release/$zipname"

0 comments on commit ccf2f4e

Please sign in to comment.
Something went wrong with that request. Please try again.