From 653cc758e2c509d4ccc928853a874282f954b5c4 Mon Sep 17 00:00:00 2001 From: shpwe <146758400+shpwe@users.noreply.github.com> Date: Mon, 14 Oct 2024 12:34:30 -0400 Subject: [PATCH] fix config string replacement (#2054) * fix config string replacement * set featureFlagNavToggle to true --- .jenkins/projectBuilder.Jenkinsfile | 4 ++++ frontend/package.json | 3 ++- .../projects/upgrade/src/environments/environment.prod.ts | 2 +- .../upgrade/src/environments/environment.staging.ts | 2 +- frontend/set_build_variables.js | 8 +++----- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.jenkins/projectBuilder.Jenkinsfile b/.jenkins/projectBuilder.Jenkinsfile index d833ab7753..656e6b0909 100644 --- a/.jenkins/projectBuilder.Jenkinsfile +++ b/.jenkins/projectBuilder.Jenkinsfile @@ -42,6 +42,10 @@ projectBuilderV5 ( githubCheck: '${projectName} npm ci --no-audit', log: '${projectName}-npm-ci.log' ], + [ + script: 'npm run prebuild:project', + log: 'env-pre-build.log', + ], [ script: 'npm run build:project', log: '${projectName}-build.log', diff --git a/frontend/package.json b/frontend/package.json index 5866beb980..9431fe3cfe 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,7 +12,8 @@ "prebuild": "npm run test", "build": "ng build", "prebuild:prod": "npm run test", - "build:project": "node set_build_variables.js && ng build --configuration ${ENV:-develop} --base-href /upgrade/", + "prebuild:project": "node set_build_variables.js", + "build:project": "ng build --configuration ${ENV:-develop} --base-href /upgrade/", "build:prod": "ng build --configuration beanstalk", "build:demo": "ng build --configuration demo --base-href /upgrade/", "build:dev": "ng build -c=development", diff --git a/frontend/projects/upgrade/src/environments/environment.prod.ts b/frontend/projects/upgrade/src/environments/environment.prod.ts index 0583ef364b..1cee609963 100755 --- a/frontend/projects/upgrade/src/environments/environment.prod.ts +++ b/frontend/projects/upgrade/src/environments/environment.prod.ts @@ -11,7 +11,7 @@ export const environment = { pollingEnabled: true, pollingInterval: 10 * 1000, pollingLimit: 600, - featureFlagNavToggle: false, + featureFlagNavToggle: true, withinSubjectExperimentSupportToggle: false, errorLogsToggle: false, metricAnalyticsExperimentDisplayToggle: false, diff --git a/frontend/projects/upgrade/src/environments/environment.staging.ts b/frontend/projects/upgrade/src/environments/environment.staging.ts index 0b87b2c52f..8f1ea164be 100644 --- a/frontend/projects/upgrade/src/environments/environment.staging.ts +++ b/frontend/projects/upgrade/src/environments/environment.staging.ts @@ -11,7 +11,7 @@ export const environment = { pollingEnabled: true, pollingInterval: 10 * 1000, pollingLimit: 600, - featureFlagNavToggle: false, + featureFlagNavToggle: true, withinSubjectExperimentSupportToggle: false, errorLogsToggle: false, metricAnalyticsExperimentDisplayToggle: false, diff --git a/frontend/set_build_variables.js b/frontend/set_build_variables.js index fd532b664a..5915e3086e 100644 --- a/frontend/set_build_variables.js +++ b/frontend/set_build_variables.js @@ -3,7 +3,7 @@ replace = require("replace-in-file"); var replacements = []; var envKeys = Object.keys(envVars); - +var environment = process.env.ENV || 'qa'; for (var i in envKeys) { var replacement = {}; replacement["search"] = new RegExp("%" + envKeys[i] + "%", "g"); @@ -13,15 +13,13 @@ for (var i in envKeys) { } console.log( - "Beginning pre build environment string replacements in environments.*.ts files" + `Beginning pre build environment string replacements in environments.${environment}.ts files` ); for (var i in replacements) { try { const changedFiles = replace.sync({ files: [ - 'projects/upgrade/src/environments/environment.prod.ts', - 'projects/upgrade/src/environments/environment.qa.ts', - 'projects/upgrade/src/environments/environment.staging.ts', + `projects/upgrade/src/environments/environment.${environment}.ts`, ], from: replacements[i].search, to: replacements[i].replace,