diff --git a/scripts/utils/touch.ts b/scripts/utils/touch.ts new file mode 100644 index 000000000000..916981b52c27 --- /dev/null +++ b/scripts/utils/touch.ts @@ -0,0 +1,8 @@ +const isWin = process.platform === 'win32'; + +export default function touch(filePath: string) { + if (isWin) { + return `echo. > ${filePath}`; + } + return `touch ${filePath}`; +} diff --git a/scripts/utils/yarn.ts b/scripts/utils/yarn.ts index b5f4ab35274b..83a18d51399f 100644 --- a/scripts/utils/yarn.ts +++ b/scripts/utils/yarn.ts @@ -4,6 +4,7 @@ import path from 'path'; import { exec } from './exec'; // TODO -- should we generate this file a second time outside of CLI? import storybookVersions from '../../code/lib/cli/src/versions'; +import touch from './touch'; export type YarnOptions = { cwd: string; @@ -25,8 +26,8 @@ export const addPackageResolutions = async ({ cwd, dryRun }: YarnOptions) => { export const installYarn2 = async ({ cwd, dryRun, debug }: YarnOptions) => { const command = [ - `touch yarn.lock`, - `touch yarnrc.yml`, + touch('yarn.lock'), + touch('yarnrc.yml'), `yarn set version berry`, // Use the global cache so we aren't re-caching dependencies each time we run sandbox `yarn config set enableGlobalCache true`,