1
0
mirror of https://gitlab.com/psono/psono-client synced 2025-04-19 03:22:16 +03:00
psono-client/webpack.environment.prod.electron.js
Sascha Pfeiffer 3b6dd519ce Added electron app
Signed-off-by: Sascha Pfeiffer <sascha.pfeiffer@esaqa.com>
2023-02-24 08:53:27 +01:00

44 lines
1.2 KiB
JavaScript

const webpack = require('webpack');
const { merge } = require('webpack-merge');
const prodConfig = require('./webpack.environment.prod.common');
const electron = require('./webpack.target.electron');
const ReplaceInFileWebpackPlugin = require('replace-in-file-webpack-plugin');
const commit_tag = process.env.CI_COMMIT_TAG;
const commit_sha = process.env.CI_COMMIT_SHA;
let version = '1.1.0';
let hash = 'abcd1234';
if (/^v\d*\.\d*\.\d*$/.test(commit_tag)) {
version = commit_tag.substring(1);
hash = commit_sha.substring(0,8);
}
module.exports = () => {
const config = merge(electron, prodConfig);
config['plugins'].push(
new ReplaceInFileWebpackPlugin([{
dir: 'build/electron',
files: ['VERSION.txt'],
rules: [{
search: '1.1.0',
replace: version
},{
search: 'abcd1234',
replace: hash
}]
}])
)
config['plugins'].push(
new ReplaceInFileWebpackPlugin([{
dir: 'src/electron',
files: ['package.json'],
rules: [{
search: '"version": "1.1.0"',
replace: '"version": "' + version + '"'
}]
}])
)
return config
};