File tree Expand file tree Collapse file tree
libraries/rush-lib/src/utilities Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ const NPM_INCOMPATIBLE_PROPERTIES: Set<string> = new Set([
9696 * @param env The environment variables object
9797 * @param supportEnvVarFallbackSyntax Whether to support fallback values in the form of `${VAR_NAME:-fallback}`
9898 * @param filterNpmIncompatibleProperties Whether to filter out properties that npm doesn't understand
99- * @returns
99+ * @returns An array of processed npmrc file lines with undefined environment variables and npm-incompatible properties commented out
100100 */
101101export function trimNpmrcFileLines (
102102 npmrcFileLines : string [ ] ,
@@ -127,14 +127,14 @@ export function trimNpmrcFileLines(
127127 // Check if this is a property that npm doesn't understand
128128 if ( filterNpmIncompatibleProperties ) {
129129 // Extract the property name (everything before the '=' or '[')
130- const match : RegExpMatchArray | null = line . match ( / ^ ( [ ^ = \[ ] + ) / ) ;
130+ const match : RegExpMatchArray | null = line . match ( / ^ ( [ ^ = \[ \s ] + ) / ) ;
131131 if ( match ) {
132- const propertyName : string = match [ 1 ] . trim ( ) ;
133-
132+ const propertyName : string = match [ 1 ] ;
133+
134134 // Never filter registry-scoped properties (auth tokens, etc.)
135135 // These start with "//" like "//registry.npmjs.org/:_authToken"
136136 const isRegistryScoped : boolean = propertyName . startsWith ( '//' ) ;
137-
137+
138138 if ( ! isRegistryScoped && NPM_INCOMPATIBLE_PROPERTIES . has ( propertyName ) ) {
139139 lineShouldBeTrimmed = true ;
140140 }
You can’t perform that action at this time.
0 commit comments