Skip to content

Commit

Permalink
fix: npm install failure in dependencies due to unwanted post install…
Browse files Browse the repository at this point in the history
… script
  • Loading branch information
abose committed Sep 18, 2023
1 parent de1f2d0 commit 2afceff
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down
13 changes: 13 additions & 0 deletions src-build/remove-postinstall.js
Original file line number Diff line number Diff line change
@@ -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');

0 comments on commit 2afceff

Please sign in to comment.