diff --git a/.gitignore b/.gitignore index f06235c..ab899ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ node_modules dist +coverage +*.log diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 789ce79..0000000 --- a/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -.github/ -tests/ -axe.png -example.ts diff --git a/package.json b/package.json index 0dad950..f56317b 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "lint": "biome check .", "postrelease": "git push --follow-tags && npm publish", "prebuild": "rm -rf dist", - "prepare": "npm run build", + "prepublishOnly": "npm run build", "prerelease": "git fetch --tags && npm test && npm run test:pack", "release": "npm version patch", "test": "npm run lint && npm run typecheck && npm run build && node --test --import=tsx test/*.test.ts", @@ -70,6 +70,7 @@ "test:watch": "node --test --watch --import=tsx test/*.test.ts", "typecheck": "tsc -p tsconfig.test.json" }, + "sideEffects": false, "type": "module", "types": "dist/index.d.ts" } diff --git a/scripts/test-pack.sh b/scripts/test-pack.sh index 179c7ee..9171e8f 100755 --- a/scripts/test-pack.sh +++ b/scripts/test-pack.sh @@ -8,6 +8,9 @@ tmp="$(mktemp -d)" trap 'rm -rf "$tmp"' EXIT cd "$root" +# Build first, the way `prepublishOnly` does at publish time, so the tarball +# carries a fresh dist (npm pack does not run prepublishOnly). +npm run build >/dev/null 2>&1 tarball="$tmp/$(npm pack --pack-destination "$tmp" 2>/dev/null | tail -1)" cd "$tmp"