Skip to content

Commit

Permalink
Build browser/AMD/gzip/etc
Browse files Browse the repository at this point in the history
It's annoying having that big closure around everything.

Just add it on ad-hoc and then uglify.

Also, make the src/re objects more compression-friendly,
with mungable names.
  • Loading branch information
isaacs committed Jun 17, 2013
1 parent 67b0b5f commit 4428702
Show file tree
Hide file tree
Showing 7 changed files with 803 additions and 748 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
semver.min.js
semver.min.js.gz
semver.browser.js
semver.browser.js.gz
11 changes: 11 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

( cat head.js
cat semver.js \
| egrep -v '^\/\* nomin \*\/' \
| perl -pi -e 's/debug\([^\)]+\)//g'
cat foot.js ) > semver.browser.js

uglifyjs -m <semver.browser.js >semver.min.js
gzip --stdout -9 <semver.browser.js >semver.browser.js.gz
gzip --stdout -9 <semver.min.js >semver.min.js.gz
6 changes: 6 additions & 0 deletions foot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

})(
typeof exports === 'object' ? exports :
typeof define === 'function' && define.amd ? {} :
semver = {}
);
2 changes: 2 additions & 0 deletions head.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;(function(exports) {

8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
"version": "2.0.0-alpha",
"description": "The semantic version parser used by npm.",
"main": "semver.js",
"browser": "semver.browser.js",
"min": "semver.min.js",
"scripts": {
"test": "tap test/*.js"
"test": "tap test/*.js",
"prepublish": "bash build.sh"
},
"devDependencies": {
"tap": "0.x >=0.0.4"
"tap": "0.x >=0.0.4",
"uglify-js": "~2.3.6"
},
"license": "BSD",
"repository": "git://github.com/isaacs/node-semver.git",
Expand Down
Loading

0 comments on commit 4428702

Please sign in to comment.