File tree 2 files changed +27
-1
lines changed
2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change 11
11
"clean" : " rimraf packages/*/dist packages/*/build" ,
12
12
"lint" : " eslint ." ,
13
13
"prepare" : " husky install" ,
14
- "prerelease" : " npm run lint && npm run test:force && npm run build:force" ,
14
+ "prerelease" : " ./scripts/checkReleaseBranch.mjs && npm run lint && npm run test:force && npm run build:force" ,
15
15
"release" : " lerna publish --no-private" ,
16
16
"test" : " nx run-many --target=test --all --parallel" ,
17
17
"test:force" : " nx run-many --target=test --all --parallel --skip-nx-cache" ,
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env node
2
+ import process from 'node:process' ;
3
+ import { execSync } from 'child_process' ;
4
+
5
+ const RELEASE_BRANCH = 'master' ;
6
+ const CONSOLE_COLOR_RED = '\x1b[31m' ;
7
+ const CONSOLE_COLOR_RESET = '\x1b[0m' ;
8
+
9
+ const status = execSync ( 'git status' , { encoding : 'utf-8' } ) ;
10
+
11
+ const res = status . match ( / o n b r a n c h ( .+ ) \n / i) ;
12
+ const currentBranch = res ?. [ 1 ] ;
13
+
14
+ if ( currentBranch !== RELEASE_BRANCH )
15
+ {
16
+ const messageParts = [
17
+ CONSOLE_COLOR_RED ,
18
+ `You are on the "${ currentBranch } " branch and not the release branch: "${ RELEASE_BRANCH } "!` ,
19
+ CONSOLE_COLOR_RESET ,
20
+ ] ;
21
+
22
+ console . error ( messageParts . join ( '' ) ) ;
23
+ process . exit ( 1 ) ;
24
+ }
25
+
26
+ process . exit ( 0 ) ;
You can’t perform that action at this time.
0 commit comments