From 04f488e3498027971cbc6800b47986b15609aa47 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Mon, 23 Sep 2024 04:02:08 +0800 Subject: [PATCH] fix(cli): intermittent dependency installation failure (#207) --- cli/src/run.ts | 5 +++++ .../deploy/github/.github/workflows/deploy.yml.handlebars | 1 + 2 files changed, 6 insertions(+) diff --git a/cli/src/run.ts b/cli/src/run.ts index 51225423..1a293a01 100644 --- a/cli/src/run.ts +++ b/cli/src/run.ts @@ -2,6 +2,7 @@ import type { PromptResult, ResolvedData } from './types.js' import path from 'node:path' import process from 'node:process' import { intro, outro, spinner } from '@clack/prompts' +import { sleep } from '@pengzhanbo/utils' import { execaCommand } from 'execa' import colors from 'picocolors' import { Mode } from './constants.js' @@ -21,6 +22,10 @@ export async function run(mode: Mode, root?: string) { await generate(mode, data) + // Delay for some time, I/O may not be completed yet, + // executing subsequent tasks at this point may cause issues. + await sleep(200) + const cwd = path.join(process.cwd(), data.root) if (data.git) { progress.message(t('spinner.git')) diff --git a/cli/templates/deploy/github/.github/workflows/deploy.yml.handlebars b/cli/templates/deploy/github/.github/workflows/deploy.yml.handlebars index ede07401..83e34c58 100644 --- a/cli/templates/deploy/github/.github/workflows/deploy.yml.handlebars +++ b/cli/templates/deploy/github/.github/workflows/deploy.yml.handlebars @@ -23,6 +23,7 @@ jobs: {{#if (equal packageManager "pnpm")}} - name: Setup pnpm uses: pnpm/action-setup@v4 + {{/if}} - name: Setup Node.js uses: actions/setup-node@v4