-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathpackage.sh
executable file
·37 lines (27 loc) · 1.09 KB
/
package.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
#!/bin/bash -e
# Setup environment for building inside Dockerized toolchain
export NVM_DIR="${HOME}/.nvm"
[ -s "${NVM_DIR}/nvm.sh" ] && source "${NVM_DIR}/nvm.sh"
[ $(id -u) = 0 ] && umask 0
rm -rf node_modules
if [ -z "${ADDON_ARCH}" ]; then
TARFILE_SUFFIX=
else
NODE_VERSION="$(node --version)"
TARFILE_SUFFIX="-${ADDON_ARCH}-${NODE_VERSION/\.*/}"
fi
npm ci --production
shasum --algorithm 256 manifest.json package.json index.js LICENSE.md README.md > SHA256SUMS
find classes \( -type f -o -type l \) -exec shasum --algorithm 256 {} \; >> SHA256SUMS
find lib \( -type f -o -type l \) -exec shasum --algorithm 256 {} \; >> SHA256SUMS
find static \( -type f -o -type l \) -exec shasum --algorithm 256 {} \; >> SHA256SUMS
rm -rf node_modules/.bin
find node_modules \( -type f -o -type l \) -exec shasum --algorithm 256 {} \; >> SHA256SUMS
TARFILE=`npm pack`
tar xzf ${TARFILE}
rm ${TARFILE}
TARFILE_ARCH="${TARFILE/.tgz/${TARFILE_SUFFIX}.tgz}"
cp -r node_modules ./package
tar czf ${TARFILE_ARCH} package
shasum --algorithm 256 ${TARFILE_ARCH} > ${TARFILE_ARCH}.sha256sum
rm -rf SHA256SUMS package