forked from triniwiz/nativescript-sse
-
Notifications
You must be signed in to change notification settings - Fork 2
/
pack.sh
executable file
·47 lines (36 loc) · 1 KB
/
pack.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
SOURCE_DIR=../src;
TO_SOURCE_DIR=src;
PACK_DIR=package;
ROOT_DIR=..;
PUBLISH=--publish
install(){
npm i
}
pack() {
echo 'Clearing /src and /package...'
node_modules/.bin/rimraf "$TO_SOURCE_DIR"
node_modules/.bin/rimraf "$PACK_DIR"
# copy src
echo 'Copying src...'
node_modules/.bin/ncp "$SOURCE_DIR" "$TO_SOURCE_DIR"
# copy README & LICENSE to src
echo 'Copying README and LICENSE to /src...'
node_modules/.bin/ncp "$ROOT_DIR"/LICENSE "$TO_SOURCE_DIR"/LICENSE
node_modules/.bin/ncp "$ROOT_DIR"/README.md "$TO_SOURCE_DIR"/README.md
# compile package and copy files required by npm
echo 'Building /src...'
cd "$TO_SOURCE_DIR"
node_modules/.bin/tsc
cd ..
echo 'Creating package...'
# create package dir
mkdir "$PACK_DIR"
# create the package
cd "$PACK_DIR"
npm pack ../"$TO_SOURCE_DIR"
# delete source directory used to create the package
cd ..
node_modules/.bin/rimraf "$TO_SOURCE_DIR"
}
install && pack