|
1 | 1 | #!/bin/bash |
2 | 2 |
|
3 | | -SOURCE_DIR=../src; |
4 | | -TO_SOURCE_DIR=src; |
5 | | -PACK_DIR=package; |
6 | | -ROOT_DIR=..; |
7 | | -PUBLISH=--publish |
8 | | - |
9 | | -install(){ |
10 | | - npm i |
11 | | -} |
12 | | - |
13 | | -pack() { |
14 | | - echo 'Clearing /src and /package...' |
15 | | - node_modules/.bin/rimraf "$TO_SOURCE_DIR" |
16 | | - node_modules/.bin/rimraf "$PACK_DIR" |
17 | | - |
18 | | - echo 'Copying src...' |
19 | | - node_modules/.bin/ncp "$SOURCE_DIR" "$TO_SOURCE_DIR" |
20 | | - |
21 | | - echo 'Copying README and LICENSE to /src...' |
22 | | - node_modules/.bin/ncp "$ROOT_DIR"/LICENSE "$TO_SOURCE_DIR"/LICENSE |
23 | | - node_modules/.bin/ncp "$ROOT_DIR"/README.md "$TO_SOURCE_DIR"/README.md |
24 | | - |
25 | | - echo 'Building /src...' |
26 | | - cd "$TO_SOURCE_DIR" |
27 | | - npm run compile |
28 | | - cd .. |
29 | | - |
30 | | - echo 'Creating package...' |
31 | | - mkdir "$PACK_DIR" |
32 | | - cd "$PACK_DIR" |
33 | | - npm pack ../"$TO_SOURCE_DIR" |
34 | | - |
35 | | - cd .. |
36 | | - node_modules/.bin/rimraf "$TO_SOURCE_DIR" |
37 | | -} |
38 | | - |
39 | | -install && pack |
| 3 | +CURRENT_DIR=`dirname $0` |
| 4 | +SOURCE_DIR="$CURRENT_DIR"/../src |
| 5 | +TO_SOURCE_DIR="$CURRENT_DIR"/src |
| 6 | +PACK_DIR="$CURRENT_DIR"/package |
| 7 | +ROOT_DIR="$CURRENT_DIR"/.. |
| 8 | + |
| 9 | +echo 'Installing npm dependencies...' |
| 10 | +npm i |
| 11 | + |
| 12 | +echo 'Clearing /src and /package...' |
| 13 | +node_modules/.bin/rimraf "$TO_SOURCE_DIR" |
| 14 | +node_modules/.bin/rimraf "$PACK_DIR" |
| 15 | + |
| 16 | +echo 'Copying src...' |
| 17 | +node_modules/.bin/ncp "$SOURCE_DIR" "$TO_SOURCE_DIR" |
| 18 | + |
| 19 | +echo 'Copying README and LICENSE to /src...' |
| 20 | +node_modules/.bin/ncp "$ROOT_DIR"/LICENSE "$TO_SOURCE_DIR"/LICENSE |
| 21 | +node_modules/.bin/ncp "$ROOT_DIR"/README.md "$TO_SOURCE_DIR"/README.md |
| 22 | + |
| 23 | +echo 'Building /src...' |
| 24 | +cd "$TO_SOURCE_DIR" |
| 25 | +npm run compile |
| 26 | +cd .. |
| 27 | + |
| 28 | +echo 'Creating package...' |
| 29 | +mkdir "$PACK_DIR" |
| 30 | +cd "$PACK_DIR" |
| 31 | +npm pack ../"$TO_SOURCE_DIR" |
| 32 | + |
| 33 | +echo 'Cleaning...' |
| 34 | +cd .. |
| 35 | +node_modules/.bin/rimraf "$TO_SOURCE_DIR" |
0 commit comments