Scoped name, publishConfig.registry, secret-free .npmrc (token from NPM_AUTH_TOKEN env), changelog (1.0.0 tagged but never published), install docs without public-CDN claims, consumer smoke uses the package name. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: sonnet Assistant-Process: 299063@bnt-lap001 Assistant-Session: 53eb1e1c-c13a-4277-9ce2-3702960d93f7
26 lines
1.6 KiB
Bash
Executable file
26 lines
1.6 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Pack the package, install the tarball into an empty project, and check the
|
|
# published entry points (ESM import, CJS require, CSS) load. Guards the
|
|
# exports map and bundle globals, which Jest (source-only) cannot see.
|
|
set -euo pipefail
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
TMP="$(mktemp -d)"
|
|
trap 'rm -rf "$TMP"' EXIT
|
|
cd "$ROOT" && npm run build:prod >/dev/null
|
|
TARBALL="$(npm pack --pack-destination "$TMP" 2>/dev/null | tail -1)"
|
|
cd "$TMP" && npm init -y >/dev/null
|
|
PKG="$(node -p "require('$ROOT/package.json').name")"
|
|
npm i --no-audit --no-fund marked@13 jsdom "./$TARBALL" >/dev/null 2>&1
|
|
SETUP="const {JSDOM}=require('jsdom');const d=new JSDOM('<!doctype html><body></body>',{url:'http://localhost/'});
|
|
globalThis.window=globalThis;globalThis.document=d.window.document;globalThis.location=d.window.location;
|
|
globalThis.localStorage=d.window.localStorage;globalThis.navigator=d.window.navigator;"
|
|
# The library is browser-only; unhandled indexedDB rejections after load are expected, so check markers, not exit codes.
|
|
check() { # check <marker> <label> <node args...>
|
|
local marker="$1" label="$2"; shift 2
|
|
local out; out="$(node "$@" 2>&1 || true)"
|
|
grep -q "^$marker" <<<"$out" || { echo "FAIL: $label"; exit 1; }
|
|
}
|
|
check 'CJS ok' "CJS require" -e "$SETUP const m=require('$PKG');console.log('CJS ok',typeof m)"
|
|
check 'ESM ok' "ESM import" -e "$SETUP import('$PKG').then(m=>console.log('ESM ok',typeof m.default))"
|
|
check 'CSS ok' "style.css" -e "console.log('CSS ok',require.resolve('$PKG/style.css'))"
|
|
echo "consumer smoke: ESM, CJS, CSS ok"
|