Skip to content

Commit

Permalink
Build: Fix tempy usage during sandbox generation
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinpalkovic committed Jun 3, 2024
1 parent 9b12305 commit 6f9ff5e
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions scripts/sandbox/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,22 @@ if (!existsSync(REPROS_DIRECTORY)) {
throw Error("Couldn't find sandbox directory. Did you forget to run generate-sandboxes?");
}

const { temporaryDirectory } = await import('tempy');
const tmpFolder = temporaryDirectory();
logger.log(`⏱ Created tmp folder: ${tmpFolder}`);

const options = program.opts() as PublishOptions;

publish({ ...options, tmpFolder }).catch(async (e) => {
logger.error(e);
async function main() {
const { temporaryDirectory } = await import('tempy');
const tmpFolder = temporaryDirectory();
logger.log(`⏱ Created tmp folder: ${tmpFolder}`);

const options = program.opts() as PublishOptions;

publish({ ...options, tmpFolder }).catch(async (e) => {
logger.error(e);

if (existsSync(tmpFolder)) {
logger.log('🚮 Removing the temporary folder..');
await remove(tmpFolder);
}
process.exit(1);
});
}

if (existsSync(tmpFolder)) {
logger.log('🚮 Removing the temporary folder..');
await remove(tmpFolder);
}
process.exit(1);
});
main();

0 comments on commit 6f9ff5e

Please sign in to comment.