Skip to content

Commit a693fb0

Browse files
authored
fix: mkdir output (#124)
1 parent 77208a7 commit a693fb0

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/core/src/main/ts/buildstamp.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ export const buildstamp = async (opts?: IBuildstampOptions): Promise<IBuildstamp
4040
Object.assign(stamp, getCIInfo(process.env))
4141
}
4242
if (output) {
43-
await fs.writeFile(path.resolve(cwd, output), JSON.stringify(stamp, null, 2))
43+
const file = path.resolve(cwd, output)
44+
await fs.mkdir(path.dirname(file), { recursive: true })
45+
await fs.writeFile(file, JSON.stringify(stamp, null, 2))
4446
}
4547

4648
return stamp

packages/core/src/test/ts/cli.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const run = async (...args: string[]) => spawn('node', [
1717

1818
describe('CLI', () => {
1919
it('returns a result corresponding the passed opts', async () => {
20-
const tmp = await fs.mkdir(path.resolve(await fs.realpath(os.tmpdir()), Math.random().toString(36).slice(2)), {recursive: true}) + ''
20+
const tmp = path.resolve(await fs.realpath(os.tmpdir()), Math.random().toString(36).slice(2))
2121
const output = path.resolve(tmp, 'out.json')
2222

2323
await run(`--output=${output}`)

0 commit comments

Comments
 (0)