build: add `clean-publish` at npm package releasing
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 26 Oct 2024 13:02:06 +0000 (15:02 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 26 Oct 2024 13:02:06 +0000 (15:02 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
.clean-publish [new file with mode: 0644]
package.json
pnpm-lock.yaml

diff --git a/.clean-publish b/.clean-publish
new file mode 100644 (file)
index 0000000..711387f
--- /dev/null
@@ -0,0 +1,4 @@
+{
+  "withoutPublish": true,
+  "tempDir": "package"
+}
index dc30bb3e180d167173fd0cc1fe9b1e71e91c9060..440f1b260fc209c9b6fb5652cecd83336f79dc3a 100644 (file)
@@ -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",
     "@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",
index 28f018f50a2781e611f42b841bb6b05592bf26b4..1c79ad48f9c7ec082b741f4bde0c5c1e4a503db5 100644 (file)
@@ -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: