Skip to content

Commit

Permalink
fix: broken build on windows (tauri-apps/tauri#2927) by tricking it
Browse files Browse the repository at this point in the history
  • Loading branch information
kimlimjustin committed Nov 21, 2021
1 parent c06d96c commit 78ba08b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
"prettier": "prettier --write src",
"grunt": "grunt",
"css:minify": "cleancss --batch --batch-suffix \"\" out/**/*.css ",
"prebuild": "yarn compile && yarn grunt && yarn css:minify",
"prebuild": "yarn compile && yarn grunt && yarn css:minify && node scripts/prepare_workflow.js",
"build": "tauri build",
"postbuild": "node scripts/after_workflow.js",
"postinstall": "husky install",
"fakefiles": "python scripts/generate-fake-files.py 1000"
},
Expand Down
14 changes: 14 additions & 0 deletions scripts/after_workflow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Check if the workflow is run on GitHub Actions
if (process.env.GITHUB_ACTIONS === 'true') {
const fs = require('fs');
const path = require('path');
const tauriConf = require('../src-tauri/tauri.conf.json');
const spawn = require('cross-spawn');

tauriConf.tauri.bundle.windows.wix = {
template: './installer.wxs',
license: '../LICENSE',
};
fs.writeFileSync(path.join(__dirname, '../src-tauri/tauri.conf.json'), JSON.stringify(tauriConf, null, 2));
spawn('tauri', ['build']);
}
8 changes: 8 additions & 0 deletions scripts/prepare_workflow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Check if the workflow is run on GitHub Actions
if (process.env.GITHUB_ACTIONS === 'true') {
const fs = require('fs');
const path = require('path');
const tauriConf = require('../src-tauri/tauri.conf.json');
delete tauriConf.tauri.bundle.windows['wix'];
fs.writeFileSync(path.join(__dirname, '../src-tauri/tauri.conf.json'), JSON.stringify(tauriConf, null, 2));
}

1 comment on commit 78ba08b

@vercel
Copy link

@vercel vercel bot commented on 78ba08b Nov 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.