Skip to content

Commit

Permalink
fix: mkdir output (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimonka83 authored Sep 11, 2023
1 parent 77208a7 commit a693fb0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/core/src/main/ts/buildstamp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export const buildstamp = async (opts?: IBuildstampOptions): Promise<IBuildstamp
Object.assign(stamp, getCIInfo(process.env))
}
if (output) {
await fs.writeFile(path.resolve(cwd, output), JSON.stringify(stamp, null, 2))
const file = path.resolve(cwd, output)
await fs.mkdir(path.dirname(file), { recursive: true })
await fs.writeFile(file, JSON.stringify(stamp, null, 2))
}

return stamp
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/test/ts/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const run = async (...args: string[]) => spawn('node', [

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

await run(`--output=${output}`)
Expand Down

0 comments on commit a693fb0

Please sign in to comment.