Skip to content

Commit

Permalink
[tools] Build files if module is installed from github
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyganch committed Jan 23, 2016
1 parent eedc771 commit d8e4949
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 7 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
*.iml
.DS_Store
lib/
node_modules/
log/
node_modules/
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docs/
test/
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@
"build": "./scripts/build.sh",
"init": "./scripts/init.sh",
"log": "./scripts/log.sh",
"prepublish": "./scripts/prepublish.sh",
"postinstall": "./scripts/postinstall.sh",
"postpublish": "./scripts/postpublish.sh",
"test": "./scripts/build.sh && ./scripts/test.sh"
},
"bin": {
"gonzales": "./bin/gonzales.js"
},
"files": [
"bin",
"lib"
],
"dependencies": {
"minimist": "1.1.x"
},
Expand Down
6 changes: 6 additions & 0 deletions scripts/postinstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

if [[ ! -d 'lib' ]]; then
npm i [email protected] --save
./scripts/build.sh
fi
12 changes: 12 additions & 0 deletions scripts/postpublish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -e

print_npmignore() {
cat << EOIGNORE
docs/
test/
EOIGNORE
}

print_npmignore > .npmignore
16 changes: 16 additions & 0 deletions scripts/prepublish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -e

function print_npmignore() {
cat << EOIGNORE
docs/
log/
node_modules/
scripts/
src/
test/
EOIGNORE
}

print_npmignore > .npmignore

0 comments on commit d8e4949

Please sign in to comment.