Files
wehub-resource-sync d5f55b5f9c
Coverage / build (push) Waiting to run
Docker / Build (push) Waiting to run
Docker / Publish (push) Blocked by required conditions
Node.js CI / build (16, macos-latest) (push) Waiting to run
Node.js CI / build (16, ubuntu-latest) (push) Waiting to run
Node.js CI / build (16, windows-latest) (push) Waiting to run
NPM / Build (22) (push) Waiting to run
NPM / Pack (push) Blocked by required conditions
NPM / Publish (push) Blocked by required conditions
chore: import upstream snapshot with attribution
2026-07-13 12:40:42 +08:00

73 lines
1.2 KiB
Bash
Executable File

#!/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"
# trap "rm -fr $TMPDIR" EXIT
mv ./*-*.*.*.tgz "$TMPDIR"
cp tests/fixtures/smoke-testing.ts "$TMPDIR"
cd $TMPDIR
npm init -y
npm install --production ./*-*.*.*.tgz \
@types/node \
typescript@latest \
pkg-jq \
file-box@"$NPM_TAG" \
wechaty-puppet-mock@"$NPM_TAG" \
wechaty-puppet-padlocal@"$NPM_TAG" \
wechaty-puppet-service@"$NPM_TAG" \
#
# CommonJS
#
npx tsc \
--target esnext \
--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"'
npx tsc \
--target esnext \
--module esnext \
\
--moduleResolution node \
--esModuleInterop \
--lib esnext \
--noEmitOnError \
--noImplicitAny \
--skipLibCheck \
smoke-testing.ts
echo
echo "ES Module: pack testing..."
node smoke-testing.js