X Tutup
Skip to content

Commit 198074f

Browse files
committed
Documentation around the env var token matching in ci-rush.
1 parent 834b701 commit 198074f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

apps/rush-lib/src/scripts/ci-rush.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,12 @@ if (!installedVersionValid || installedVersion !== expectedVersion) {
131131
const resultLines: string[] = [];
132132
// Trim out lines that reference environment variables that aren't defined
133133
for (const line of npmrcFileLines) {
134-
const environmentVariables: string[] | null = line.match(/\$\{([^\}]+)\}/g);
134+
const regex: RegExp = /\$\{([^\}]+)\}/g; // This finds environment varible tokens that look like "${VAR_NAME}"
135+
const environmentVariables: string[] | null = line.match(regex);
135136
let lineShouldBeTrimmed: boolean = false;
136137
if (environmentVariables) {
137138
for (const token of environmentVariables) {
139+
// Remove the leading "${" and the trailing "}" from the token
138140
const environmentVariableName: string = token.substring(2, token.length - 1);
139141
if (!process.env[environmentVariableName]) {
140142
lineShouldBeTrimmed = true;

common/scripts/ci-rush.js

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
X Tutup