File tree Expand file tree Collapse file tree 2 files changed +12
-10
lines changed
Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -5,15 +5,17 @@ import * as os from 'os';
55import * as path from 'path' ;
66import * as child_process from 'child_process' ;
77import * as colors from 'colors' ;
8- import * as lodash from 'lodash' ;
98
109import inquirer = require( 'inquirer' ) ;
1110
1211import {
1312 CommandLineFlagParameter ,
1413 CommandLineStringParameter
1514} from '@microsoft/ts-command-line' ;
16- import { FileSystem } from '@microsoft/node-core-library' ;
15+ import {
16+ FileSystem ,
17+ Path
18+ } from '@microsoft/node-core-library' ;
1719
1820import { RushConfigurationProject } from '../../api/RushConfigurationProject' ;
1921import {
@@ -211,9 +213,8 @@ export class ChangeAction extends BaseRushAction {
211213 normalizedFolder = normalizedFolder + '/' ;
212214 }
213215
214- const pathRegex : RegExp = new RegExp ( `^${ lodash . escapeRegExp ( normalizedFolder ) } ` , 'i' ) ;
215216 for ( const folder of changedFolders ) {
216- if ( folder && folder . match ( pathRegex ) ) {
217+ if ( folder && Path . isUnderOrEqual ( folder , normalizedFolder ) ) {
217218 return true ;
218219 }
219220 }
Original file line number Diff line number Diff line change 33
44import * as child_process from 'child_process' ;
55import * as colors from 'colors' ;
6- import * as lodash from 'lodash' ;
7- import { Executable } from '@microsoft/node-core-library' ;
6+ import {
7+ Executable ,
8+ Path
9+ } from '@microsoft/node-core-library' ;
810
911const DEFAULT_BRANCH : string = 'master' ;
1012const DEFAULT_REMOTE : string = 'origin' ;
@@ -60,16 +62,15 @@ export class VersionControl {
6062 const output : string = child_process . execSync (
6163 `git diff ${ targetBranch } ... --name-only --no-renames --diff-filter=A`
6264 ) . toString ( ) ;
63- const regex : RegExp | undefined = pathPrefix ? new RegExp ( `^${ lodash . escapeRegExp ( pathPrefix ) } ` , 'i' ) : undefined ;
6465 return output . split ( '\n' ) . map ( ( line ) => {
6566 if ( line ) {
6667 const trimmedLine : string = line . trim ( ) ;
67- if ( regex && trimmedLine . match ( regex ) ) {
68+ if ( ! pathPrefix || Path . isUnderOrEqual ( trimmedLine , pathPrefix ) ) {
6869 return trimmedLine ;
6970 }
71+ } else {
72+ return undefined ;
7073 }
71-
72- return undefined ;
7374 } ) . filter ( ( line ) => {
7475 return line && line . length > 0 ;
7576 } ) as string [ ] ;
You can’t perform that action at this time.
0 commit comments