GeezerVison is showing github.com — chore: use the branch name as release version · BeckSun/lowcode-engine@27ce430
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/engine/build.plugin.js +14-4Lines changed: 14 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +const { execSync } = require('child_process'); |
1 | 2 | const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); |
2 | | -const fse = require('fs-extra'); |
3 | | -// read from lerna |
4 | | -const lernaConfig = JSON.parse(fse.readFileSync('../../lerna.json', 'utf8')); |
5 | | -const { version } = lernaConfig; |
| 3 | + |
| 4 | +function getReleaseVersion() { |
| 5 | + const gitBranchName = execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf-8' }); |
| 6 | + const reBranchVersion = /^(?:[\w-]+\/)(\d+\.\d+\.\d+)$/im; |
| 7 | + const match = reBranchVersion.exec(gitBranchName); |
| 8 | + if (!match) { |
| 9 | + throw new Error(`[engine] gitBranchName: ${gitBranchName} is not valid`); |
| 10 | + } |
| 11 | + |
| 12 | + return match[1]; |
| 13 | +} |
| 14 | + |
| 15 | +const version = getReleaseVersion(); |
6 | 16 |
|
7 | 17 | module.exports = ({ context, onGetWebpackConfig }) => { |
8 | 18 | onGetWebpackConfig((config) => { |
|
Collapse file
Copy file name to clipboardExpand all lines: packages/engine/scripts/version.js -27Lines changed: 0 additions & 27 deletions