mirror of
https://gitee.com/eolink_admin/postcat.git
synced 2024-12-05 05:08:30 +08:00
26 lines
752 B
JavaScript
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);
|
||
|
}
|
||
|
});
|
||
|
});
|