Skip to content

Commit 810a95a

Browse files
committed
feat: deploy has FileResponses relative to projectDir if one exists on the CS and doesn't match cwd
1 parent 8c5b9fd commit 810a95a

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

src/client/deployMessages.ts

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,26 @@ export const createResponses =
8989
if (state === ComponentStatus.Failed) {
9090
return [{ ...base, state, ...parseDeployDiagnostic(component, message) } satisfies FileResponseFailure];
9191
} else {
92-
return [
93-
...(shouldWalkContent(component)
94-
? component.walkContent().map(
95-
(filePath): FileResponseSuccess => ({
96-
...base,
97-
state,
98-
// deployResults will produce filePaths relative to cwd, which might not be set in all environments
99-
filePath: process.cwd() === projectPath ? filePath : join(projectPath ?? '', filePath),
100-
})
101-
)
102-
: []),
103-
...(component.xml ? [{ ...base, state, filePath: component.xml } satisfies FileResponseSuccess] : []),
104-
];
92+
return (
93+
[
94+
...(shouldWalkContent(component)
95+
? component.walkContent().map((filePath): FileResponseSuccess => ({ ...base, state, filePath }))
96+
: []),
97+
...(component.xml ? [{ ...base, state, filePath: component.xml } satisfies FileResponseSuccess] : []),
98+
]
99+
// deployResults will produce filePaths relative to cwd, which might not be set in all environments
100+
// if our CS had a projectDir set, we'll make the results relative to that path
101+
.map((response) => ({
102+
...response,
103+
filePath:
104+
projectPath && process.cwd() === projectPath
105+
? response.filePath
106+
: join(projectPath ?? '', response.filePath),
107+
}))
108+
);
105109
}
106110
});
111+
107112
/**
108113
* Groups messages from the deploy result by component fullName and type
109114
*/

0 commit comments

Comments
 (0)