-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnpm-pack-testing.sh
executable file
·69 lines (57 loc) · 1.09 KB
/
npm-pack-testing.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash
set -e
VERSION=$(npx pkg-jq -r .version)
if npx --package @chatie/semver semver-is-prod "$VERSION"; then
NPM_TAG=latest
else
NPM_TAG=next
fi
npm run dist
npm pack
TMPDIR="/tmp/npm-pack-testing.$$"
mkdir "$TMPDIR"
mv ./*-*.*.*.tgz "$TMPDIR"
cp tests/fixtures/smoke-testing.ts "$TMPDIR"
cd $TMPDIR
npm init -y
npm install --production *-*.*.*.tgz \
@types/node \
@chatie/tsconfig@$NPM_TAG \
wechaty-plugin-contrib@$NPM_TAG \
pkg-jq \
"wechaty@$NPM_TAG" \
#
# CommonJS
#
./node_modules/.bin/tsc \
--target es6 \
--module CommonJS \
\
--moduleResolution node \
--esModuleInterop \
--lib esnext \
--noEmitOnError \
--noImplicitAny \
--skipLibCheck \
smoke-testing.ts
echo
echo "CommonJS: pack testing..."
node smoke-testing.js
#
# ES Modules
#
npx pkg-jq -i '.type="module"'
./node_modules/.bin/tsc \
--target es2020 \
--module es2020 \
\
--moduleResolution node \
--esModuleInterop \
--lib esnext \
--noEmitOnError \
--noImplicitAny \
--skipLibCheck \
smoke-testing.ts
echo
echo "ES Module: pack testing..."
node smoke-testing.js