1 |
|
2 |
|
3 | function msg() {
|
4 | echo "$Pkg: $*"
|
5 | }
|
6 |
|
7 |
|
8 |
|
9 | function err() {
|
10 | msg "$*" 1>&2
|
11 | }
|
12 |
|
13 |
|
14 |
|
15 | function npm-publish () {
|
16 |
|
17 | if [ -d "build/src" ]; then
|
18 | if ! cp -r build/src/* .; then
|
19 | err "packaging module failed"
|
20 | return 1
|
21 | fi
|
22 | fi
|
23 |
|
24 |
|
25 | rm -f .gitignore
|
26 |
|
27 | if ! npm publish "$@"; then
|
28 | err "failed to publish node package"
|
29 | cat "$(ls -t "$HOME"/.npm/_logs/*-debug.log | head -n 1)"
|
30 | return 1
|
31 | fi
|
32 |
|
33 | if ! git checkout -- .gitignore; then
|
34 | err "removed .gitignore and was unable to check out original"
|
35 | return 1
|
36 | fi
|
37 |
|
38 | if [ -d "build/src" ]; then
|
39 | local pub_file pub_base
|
40 | for pub_file in build/src/*; do
|
41 | pub_base=${pub_file#build/src/}
|
42 | rm -rf "$pub_base"
|
43 | done
|
44 | fi
|
45 | }
|
46 |
|
47 | npm-publish "$@" |
\ | No newline at end of file |