Skip to content

Commit 1f1076c

Browse files
committed
Ensure absolute persist.outputDir to handle nested scripts
1 parent a0f0c7e commit 1f1076c

6 files changed

Lines changed: 23 additions & 11 deletions

File tree

dist/index.js

Lines changed: 8 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cli/commands/collect.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ export async function collect({
1515
}: CommandContext): Promise<PersistedCliFiles> {
1616
await exec(
1717
bin,
18-
[...(config ? [`--config=${config}`] : []), ...persistCliOptions(project)],
18+
[
19+
...(config ? [`--config=${config}`] : []),
20+
...persistCliOptions({ directory, project })
21+
],
1922
{ cwd: directory, silent }
2023
)
2124

src/cli/commands/compare.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export async function compare(
2424
`--after=${after}`,
2525
...(label ? [`--label=${label}`] : []),
2626
...(config ? [`--config=${config}`] : []),
27-
...persistCliOptions(project)
27+
...persistCliOptions({ directory, project })
2828
],
2929
{ cwd: directory, silent }
3030
)

src/cli/commands/merge-diffs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export async function mergeDiffs(
1616
'merge-diffs',
1717
...files.map(file => `--files=${file}`),
1818
...(config ? [`--config=${config}`] : []),
19-
...persistCliOptions()
19+
...persistCliOptions({ directory })
2020
],
2121
{ cwd: directory, silent }
2222
)

src/cli/persist.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,15 @@ export type PersistedCliFiles<T extends PersistFormat = PersistFormat> = {
1515
}
1616
}
1717

18-
export function persistCliOptions(project?: string): string[] {
18+
export function persistCliOptions({
19+
directory,
20+
project
21+
}: {
22+
directory: string
23+
project?: string
24+
}): string[] {
1925
return [
20-
`--persist.outputDir=${PERSIST_OUTPUT_DIR}`,
26+
`--persist.outputDir=${path.join(directory, PERSIST_OUTPUT_DIR)}`,
2127
`--persist.filename=${createFilename(project)}`,
2228
...PERSIST_FORMAT.map(format => `--persist.format=${format}`)
2329
]

0 commit comments

Comments
 (0)