Skip to content

Commit e7b1ff5

Browse files
OttoAllmendingerllm-git
andcommitted
feat(scripts): add root directory override for prepare-release
Add environment variable to allow customization of root directory during prepare-release script execution. Issue: DX-1201 Co-authored-by: llm-git <[email protected]>
1 parent 3ae6c72 commit e7b1ff5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scripts/prepare-release.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ let lernaModules: string[] = [];
1414
let lernaModuleLocations: string[] = [];
1515
let TARGET_SCOPE = '@bitgo-beta';
1616
let filesChanged = 0;
17+
// Default to __dirname/.. but allow override via environment variable
18+
const ROOT_DIR = process.env.BITGO_PREPARE_RELEASE_ROOT_DIR || path.join(__dirname, '..');
1719

1820
async function setLernaModules(): Promise<void> {
1921
const modules = await getLernaModules();
@@ -23,7 +25,7 @@ async function setLernaModules(): Promise<void> {
2325

2426
function replacePackageScopes() {
2527
// replace all @bitgo packages & source code with alternate SCOPE
26-
const filePaths = [...walk(path.join(__dirname, '../', 'modules')), ...walk(path.join(__dirname, '../', 'webpack'))];
28+
const filePaths = [...walk(path.join(ROOT_DIR, 'modules')), ...walk(path.join(ROOT_DIR, 'webpack'))];
2729
filePaths.forEach((file) => {
2830
filesChanged += changeScopeInFile(file, lernaModules, TARGET_SCOPE);
2931
});
@@ -128,6 +130,7 @@ function getArgs() {
128130
TARGET_SCOPE = split[1] || TARGET_SCOPE;
129131
}
130132
console.log(`Preparing to re-target to ${TARGET_SCOPE}`);
133+
console.log(`Using root directory: ${ROOT_DIR}`);
131134
}
132135

133136
async function main(preid?: string) {

0 commit comments

Comments
 (0)