postcat/scripts/beforeNSISBuild.js
Scarqin a51feb0311
feat/ui-component (#188)
* feat: update extension UI
* fix(components): [manage-access] a tag rename to span
* feat: update e2e

Co-authored-by: buqiyuan <1743369777@qq.com>
Co-authored-by: 夜鹰 <17kungfuboy@gmail.com>
2022-12-30 23:46:51 +08:00

26 lines
752 B
JavaScript

const fs = require('fs');
const path = require('path');
// 模板文件
const inputPath = path.join(__dirname, '../build/SetupScripts/nim/nim_setup.temp.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();
text = text.replace('#{PRODUCT_VERSION}', `${version}.0`);
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);
}
});
});