Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix yarn task command on Windows machines #20431

Merged
merged 1 commit into from
Dec 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions scripts/utils/touch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const isWin = process.platform === 'win32';

export default function touch(filePath: string) {
if (isWin) {
return `echo. > ${filePath}`;
}
return `touch ${filePath}`;
}
5 changes: 3 additions & 2 deletions scripts/utils/yarn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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`,
Expand Down