From 4f7ba0131327d1223bf7bb9cf9906b752a1fbf4e Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 26 Oct 2024 15:02:06 +0200 Subject: [PATCH] build: add `clean-publish` at npm package releasing MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .clean-publish | 4 ++++ package.json | 7 ++++++- pnpm-lock.yaml | 16 ++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 .clean-publish diff --git a/.clean-publish b/.clean-publish new file mode 100644 index 00000000..711387ff --- /dev/null +++ b/.clean-publish @@ -0,0 +1,4 @@ +{ + "withoutPublish": true, + "tempDir": "package" +} diff --git a/package.json b/package.json index dc30bb3e..440f1b26 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,9 @@ "import": "./lib/index.mjs" } }, + "publishConfig": { + "directory": "package" + }, "scripts": { "prepare": "node prepare.mjs", "build": "rollup --config --environment BUILD:development", @@ -33,7 +36,8 @@ "lint:fix": "eslint . --cache --fix", "lint:report": "eslint . --cache --format json --output-file reports/eslint.json", "typedoc": "node typedoc.mjs", - "prepublishOnly": "pnpm build:prod" + "prepublishOnly": "pnpm build:prod && rm -rf ./package && clean-publish", + "postpublish": "rm -rf ./package" }, "engines": { "node": ">=18.0.0", @@ -109,6 +113,7 @@ "@rollup/plugin-typescript": "^12.1.1", "@types/node": "^22.8.1", "c8": "^10.1.2", + "clean-publish": "^5.1.0", "cross-env": "^7.0.3", "eslint": "^9.13.0", "eslint-define-config": "^2.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 28f018f5..1c79ad48 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -38,6 +38,9 @@ importers: c8: specifier: ^10.1.2 version: 10.1.2 + clean-publish: + specifier: ^5.1.0 + version: 5.1.0 cross-env: specifier: ^7.0.3 version: 7.0.3 @@ -104,6 +107,7 @@ importers: typescript: specifier: ~5.6.3 version: 5.6.3 + publishDirectory: package packages: @@ -989,6 +993,11 @@ packages: resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} engines: {node: '>=8'} + clean-publish@5.1.0: + resolution: {integrity: sha512-Gbz8x7sL/sn0j+2B+yYEumD17WmPT6pHLN+A5nhcd0Sdh86EYblQleU+dUIICXVFalFMFBdW2aGynrVJ6k1u4Q==} + engines: {node: '>= 18.0.0'} + hasBin: true + clean-stack@2.2.0: resolution: {integrity: sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==} engines: {node: '>=6'} @@ -3725,6 +3734,13 @@ snapshots: ci-info@3.9.0: {} + clean-publish@5.1.0: + dependencies: + cross-spawn: 7.0.3 + fast-glob: 3.3.2 + lilconfig: 3.1.2 + micromatch: 4.0.8 + clean-stack@2.2.0: {} clear-module@4.1.2: -- 2.34.1