From 66a588649c9bfec15fd813cf6bda8a630ae32f65 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 7 Aug 2024 12:40:31 +0200 Subject: [PATCH] remove more tempy references --- scripts/sandbox/generate.ts | 7 +++---- scripts/sandbox/publish.ts | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/sandbox/generate.ts b/scripts/sandbox/generate.ts index 8ada9832705b..711d5dfd4489 100755 --- a/scripts/sandbox/generate.ts +++ b/scripts/sandbox/generate.ts @@ -26,6 +26,7 @@ import { } from '../utils/constants'; import * as ghActions from '@actions/core'; import { dedent } from 'ts-dedent'; +import { temporaryDirectory } from '../../code/core/src/common/utils/cli'; const isCI = process.env.GITHUB_ACTIONS === 'true'; @@ -96,8 +97,7 @@ const addStorybook = async ({ const beforeDir = join(baseDir, BEFORE_DIR_NAME); const afterDir = join(baseDir, AFTER_DIR_NAME); - const { temporaryDirectory } = await import('tempy'); - const tmpDir = temporaryDirectory(); + const tmpDir = await temporaryDirectory(); try { await copy(beforeDir, tmpDir); @@ -173,7 +173,6 @@ const runGenerators = async ( console.log(`🤹‍♂️ Generating sandboxes with a concurrency of ${1}`); const limit = pLimit(1); - const { temporaryDirectory } = await import('tempy'); const generationResults = await Promise.allSettled( generators.map(({ dirName, name, script, expected, env }) => @@ -190,7 +189,7 @@ const runGenerators = async ( await emptyDir(baseDir); // We do the creation inside a temp dir to avoid yarn container problems - const createBaseDir = temporaryDirectory(); + const createBaseDir = await temporaryDirectory(); if (!script.includes('pnp')) { await setupYarn({ cwd: createBaseDir }); } diff --git a/scripts/sandbox/publish.ts b/scripts/sandbox/publish.ts index a9acadc85652..fc9f92614875 100755 --- a/scripts/sandbox/publish.ts +++ b/scripts/sandbox/publish.ts @@ -9,6 +9,7 @@ import { getTemplatesData, renderTemplate } from './utils/template'; import { commitAllToGit } from './utils/git'; import { REPROS_DIRECTORY } from '../utils/constants'; import { glob } from 'glob'; +import { temporaryDirectory } from '../../code/core/src/common/utils/cli'; export const logger = console; @@ -99,8 +100,7 @@ if (!existsSync(REPROS_DIRECTORY)) { } async function main() { - const { temporaryDirectory } = await import('tempy'); - const tmpFolder = temporaryDirectory(); + const tmpFolder = await temporaryDirectory(); logger.log(`⏱ Created tmp folder: ${tmpFolder}`); const options = program.opts() as PublishOptions;