-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
37 lines (26 loc) · 962 Bytes
/
build.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
#!/usr/bin/env bash
set -u -e -o pipefail
readonly currentDir=$(cd $(dirname $0); pwd)
readonly distFolder=${currentDir}/dist
export NODE_PATH=${NODE_PATH:-}:${currentDir}/node_modules
VERBOSE=false
TRACE=false
source ${currentDir}/scripts/ci/_ghactions-group.sh
source ${currentDir}/util-functions.sh
ghActionsGroupStart "clean dist" "no-xtrace"
rm -rf ${distFolder}
ghActionsGroupEnd "clean dist"
mkdir -p ${distFolder}
ghActionsGroupStart "build package" "no-xtrace"
logInfo "Copy essential files in dist"
syncOptions=(-a --include="README.md" --include="LICENSE" --include="package.json" --exclude="*" --exclude="**/*")
syncFiles ${currentDir} ${distFolder} "${syncOptions[@]}"
unset syncOptions
logInfo "Copy src content in dist"
syncOptions=(-a)
syncFiles "${currentDir}/src" ${distFolder} "${syncOptions[@]}"
unset syncOptions
logInfo "Generate npm package (tgz file)"
cd ${distFolder} > /dev/null
npm pack ./
ghActionsGroupEnd "build package"