diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index a6b14d6..4ea71c1 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -18,6 +18,7 @@ jobs: - name: building package run: | npm run build + npm run remove-postinstall - name: Publishing package to npm repository run: | npm publish --access public diff --git a/package.json b/package.json index 890d158..941675a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@phcode/fs", "description": "Phoenix virtual file system over filer/ browser fs access/ tauri / phoenix web socket APIs", - "version": "2.0.0", + "version": "2.0.1", "keywords": [ "phoenix", "browser", @@ -13,6 +13,8 @@ "license": "GNU-AGPL3.0", "scripts": { "postinstall": "cd ./src-tauri/node-src/ && npm install && cd ../../", + "prepublishOnly": "echo make sure to run `npm run remove-postinstall` before you run npm publish!!!", + "remove-postinstall": "node src-build/remove-postinstall.js", "tauri": "tauri", "eslint": "eslint src test", "eslint:fix": "eslint src test --fix", diff --git a/src-build/remove-postinstall.js b/src-build/remove-postinstall.js new file mode 100644 index 0000000..7d58df3 --- /dev/null +++ b/src-build/remove-postinstall.js @@ -0,0 +1,13 @@ +const fs = require('fs'); +const path = require('path'); + +const packageJsonPath = path.join(__dirname, '../package.json'); +const packageData = require(packageJsonPath); + +// Remove the postinstall script +if (packageData.scripts && packageData.scripts.postinstall) { + delete packageData.scripts.postinstall; +} + +// Rewrite the package.json without the postinstall script +fs.writeFileSync(packageJsonPath, JSON.stringify(packageData, null, 2) + '\n'); \ No newline at end of file