File tree Expand file tree Collapse file tree 2 files changed +14
-31
lines changed
Expand file tree Collapse file tree 2 files changed +14
-31
lines changed Original file line number Diff line number Diff line change 1+ const { execSync } = require ( 'child_process' ) ;
12const 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 ( ) ;
616
717module . exports = ( { context, onGetWebpackConfig } ) => {
818 onGetWebpackConfig ( ( config ) => {
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments