Skip to content

Commit 55753d5

Browse files
feat: explicitly set projectDir on componentSet to prevent use of cwd
* feat: explicitly set projectDir on componentSet to prevent use of cwd * chore: auto-update metadata coverage in METADATA_SUPPORT.md * chore: set non-latest dist tag * test: record perf * chore: get dist tag right * chore(release): 7.14.0-beta.1 [skip ci] * chore(release): 7.14.0-beta.2 [skip ci] * fix: restore the projectDir pass-around * chore(release): 7.14.0-beta.3 [skip ci] * chore: set version for release --------- Co-authored-by: svc-cli-bot <[email protected]>
1 parent d7e58ff commit 55753d5

File tree

8 files changed

+255
-893
lines changed

8 files changed

+255
-893
lines changed

CHANGELOG.md

Lines changed: 230 additions & 875 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,4 +187,4 @@
187187
"output": []
188188
}
189189
}
190-
}
190+
}

src/collections/componentSet.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ export class ComponentSet extends LazyCollection<MetadataComponent> {
6464
* This is used as the value for the `version` field in the manifest.
6565
*/
6666
public sourceApiVersion: string;
67+
/**
68+
* Used to explicitly set the project directory for the component set.
69+
* When not present, sfdx-core's SfProject will use the current working directory.
70+
*/
71+
public projectDirectory?: string;
6772
public fullName?: string;
6873
public forceIgnoredPaths?: Set<string>;
6974
private logger: Logger;

src/convert/metadataConverter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export class MetadataConverter {
120120
const conversionPipeline = pipeline(
121121
Readable.from(components),
122122
!targetFormatIsSource && (process.env.SF_APPLY_REPLACEMENTS_ON_CONVERT === 'true' || output.type === 'zip')
123-
? (await getReplacementMarkingStream()) ?? new PassThrough({ objectMode: true })
123+
? (await getReplacementMarkingStream(cs.projectDirectory)) ?? new PassThrough({ objectMode: true })
124124
: new PassThrough({ objectMode: true }),
125125
new ComponentConverter(targetFormat, this.registry, mergeSet, defaultDirectory),
126126
writer

src/convert/replacements.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ export const replacementIterations = async (input: string, replacements: MarkedR
8181
/**
8282
* Reads the project, gets replacements, removes any that aren't applicable due to environment conditionals, and returns an instance of the ReplacementMarkingStream
8383
*/
84-
export const getReplacementMarkingStream = async (): Promise<ReplacementMarkingStream | undefined> => {
84+
export const getReplacementMarkingStream = async (
85+
projectDir?: string
86+
): Promise<ReplacementMarkingStream | undefined> => {
8587
// remove any that don't agree with current env
86-
const filteredReplacements = envFilter(await readReplacementsFromProject());
88+
const filteredReplacements = envFilter(await readReplacementsFromProject(projectDir));
8789
if (filteredReplacements.length) {
8890
return new ReplacementMarkingStream(filteredReplacements);
8991
}
@@ -207,8 +209,8 @@ const getEnvValue = (env: string): string => {
207209
/**
208210
* Read the `replacement` property from sfdx-project.json
209211
*/
210-
const readReplacementsFromProject = async (): Promise<ReplacementConfig[]> => {
211-
const proj = await SfProject.resolve();
212+
const readReplacementsFromProject = async (projectDir?: string): Promise<ReplacementConfig[]> => {
213+
const proj = await SfProject.resolve(projectDir);
212214
const projJson = (await proj.resolveProjectConfig()) as { replacements?: ReplacementConfig[] };
213215
return projJson.replacements;
214216
};
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
[
22
{
33
"name": "componentSetCreate",
4-
"duration": 201.25295900000492
4+
"duration": 207.436284000054
55
},
66
{
77
"name": "sourceToMdapi",
8-
"duration": 6621.193925000029
8+
"duration": 5423.031130000018
99
},
1010
{
1111
"name": "sourceToZip",
12-
"duration": 4725.25216600002
12+
"duration": 5202.063126999885
1313
},
1414
{
1515
"name": "mdapiToSource",
16-
"duration": 3624.5386980000185
16+
"duration": 3417.4116909999866
1717
}
1818
]
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
[
22
{
33
"name": "componentSetCreate",
4-
"duration": 406.26530899998033
4+
"duration": 444.3853680000175
55
},
66
{
77
"name": "sourceToMdapi",
8-
"duration": 8439.755018000025
8+
"duration": 8262.888810999924
99
},
1010
{
1111
"name": "sourceToZip",
12-
"duration": 6785.0722009999445
12+
"duration": 7476.526809000177
1313
},
1414
{
1515
"name": "mdapiToSource",
16-
"duration": 4213.607210000046
16+
"duration": 4032.80767800007
1717
}
1818
]
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
[
22
{
33
"name": "componentSetCreate",
4-
"duration": 725.7692759999773
4+
"duration": 707.5937909998465
55
},
66
{
77
"name": "sourceToMdapi",
8-
"duration": 11200.344226000016
8+
"duration": 10896.007658000104
99
},
1010
{
1111
"name": "sourceToZip",
12-
"duration": 9825.344100999995
12+
"duration": 9609.415148
1313
},
1414
{
1515
"name": "mdapiToSource",
16-
"duration": 7075.819200999918
16+
"duration": 6808.866952999961
1717
}
1818
]

0 commit comments

Comments
 (0)