-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: absolute paths for string replacements for out-of-project (#1239)
* feat: absolute paths for string replacements for out-of-project * test: refactor zip extraction * feat: componentSetBuilder sets projectDirectory * fix: tests use relative paths for file replacements, tighter customLabels exception * fix: registry bug for affinityScoreDefinition * refactor: variable rename for readability * test: more ut for whenEnv and absolute files
- Loading branch information
Showing
9 changed files
with
1,266 additions
and
2,135 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (c) 2023, salesforce.com, inc. | ||
* All rights reserved. | ||
* Licensed under the BSD 3-Clause license. | ||
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
|
||
import * as fs from 'node:fs'; | ||
import * as path from 'node:path'; | ||
import * as JSZip from 'jszip'; | ||
|
||
export const extractZip = async (zipBuffer: Buffer, extractPath: string) => { | ||
fs.mkdirSync(extractPath); | ||
const zip = await JSZip.loadAsync(zipBuffer); | ||
for (const filePath of Object.keys(zip.files)) { | ||
const zipObj = zip.file(filePath); | ||
if (!zipObj || zipObj?.dir) { | ||
fs.mkdirSync(path.join(extractPath, filePath)); | ||
} else { | ||
// eslint-disable-next-line no-await-in-loop | ||
const content = await zipObj?.async('nodebuffer'); | ||
if (content) { | ||
fs.writeFileSync(path.join(extractPath, filePath), content); | ||
} | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.