postcat/scripts/beforeNSISBuild.js
Scarqin 3956948f93
feat/optimization extension (#226)
* chore: update patcheds

* chore: electron-build remove after pack hook

* chore: update electron build config

* chore: update electron build config

* chore: update npm scripts

* chore: update .gitattributes

* chore: update .gitattributes

* chore: update .gitattributes

* chore: update npm scripts

* chore: update electron builder config

* chore: update electron builder

* chore: update config

* chore: add build script

* chore: remove electron-build.json

* chore: update build script

* chore: update build script

* chore: update build script

* chore: update npm script

* chore: update npm script

* chore: update scripts

* chore: update npm script

* chore: update npm script

* chore: update npm script

* chore: update npm script

* chore: update npm script

* chore: update npm script

* chore: add build script

* chore: add build script

* chore: add build script

* chore: add build script

* chore: add build script

* chore: test relese

* chore: test relese

* chore: test relese

* chore: update config

* chore: update npm script

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* chore: update config

* Delete client.ovpn

* chore: remove electron-builder.json

* chore: merge code

* chore: merge code

* refactor: optimization extension ui

* feat: search extension

* fix: merge data struct

* chore: update build

* refactor: style

* wip: extenson-list

* chore: merge code

* fix: author

* style: update tag bgcolor

* fix: some css style issue

* fix: extension list update

* fix: suggest

* fix: extension tree select

* fix: settings index

* feat: params-import auto paste

---------

Co-authored-by: buqiyuan <1743369777@qq.com>
2023-02-09 14:11:43 +08:00

31 lines
874 B
JavaScript

const fs = require('fs');
const path = require('path');
// 模板文件
const inputPath = path.join(__dirname, '../build/SetupScripts/nim/nim_setup.template.nsi');
// 输出文件
const outputPath = path.join(__dirname, '../build/SetupScripts/nim/nim_setup.nsi');
const version = process.env.npm_package_version;
fs.readFile(inputPath, 'utf8', (err, data) => {
if (err) {
return console.error('before NSIS build readFile', err);
}
let text = data.toString();
const versionArr = version.split('-');
versionArr[0] = versionArr[0] + '.0';
const _version = versionArr.join('-');
text = text.replace('#{PRODUCT_VERSION}', _version);
text = text.replace('#{INSTALL_OUTPUT_NAME}', version);
fs.writeFile(outputPath, text, { flag: 'w', encoding: 'utf8' }, err => {
if (err) {
console.error('before NSIS build writeFile', err);
}
});
});