From fedcc7970f4cfe4fdcd1bd3ee5383ea4f8d333a0 Mon Sep 17 00:00:00 2001 From: Andrew Jiang Date: Thu, 6 Jun 2024 17:02:12 -0400 Subject: [PATCH] check if out folder exists, if not, throw error (#988) --- .github/workflows/deploy-local-preview-bundle-dryrun.yml | 4 ++-- .github/workflows/deploy-local-preview-bundle.yml | 4 ++-- packages/cdk/src/docs-fe-stack.ts | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy-local-preview-bundle-dryrun.yml b/.github/workflows/deploy-local-preview-bundle-dryrun.yml index 51f23b4256..c838e16ff9 100644 --- a/.github/workflows/deploy-local-preview-bundle-dryrun.yml +++ b/.github/workflows/deploy-local-preview-bundle-dryrun.yml @@ -26,7 +26,7 @@ jobs: - name: Install uses: ./.github/actions/install - name: Build local preview bundle - run: pnpm turbo --filter=@fern-ui/local-preview-bundle build + run: pnpm --filter=@fern-ui/local-preview-bundle build - name: Synthesize local preview bundle run: pnpm --filter=@fern-ui/cdk run synth:dev2 @@ -44,6 +44,6 @@ jobs: - name: Install uses: ./.github/actions/install - name: Build local preview bundle - run: pnpm turbo --filter=@fern-ui/local-preview-bundle build + run: pnpm --filter=@fern-ui/local-preview-bundle build - name: Synthesize local preview bundle run: pnpm --filter=@fern-ui/cdk run synth:prod diff --git a/.github/workflows/deploy-local-preview-bundle.yml b/.github/workflows/deploy-local-preview-bundle.yml index a64a76b2bb..fef6ec98d6 100644 --- a/.github/workflows/deploy-local-preview-bundle.yml +++ b/.github/workflows/deploy-local-preview-bundle.yml @@ -28,7 +28,7 @@ jobs: - name: Install uses: ./.github/actions/install - name: Build local preview bundle - run: ENABLE_SOURCE_MAPS=true pnpm turbo --filter=@fern-ui/local-preview-bundle build + run: ENABLE_SOURCE_MAPS=true pnpm --filter=@fern-ui/local-preview-bundle build - name: Deploy local preview bundle run: pnpm --filter=@fern-ui/cdk run deploy:dev2 @@ -47,6 +47,6 @@ jobs: - name: Install uses: ./.github/actions/install - name: Build local preview bundle - run: pnpm turbo --filter=@fern-ui/local-preview-bundle build + run: pnpm --filter=@fern-ui/local-preview-bundle build - name: Deploy local preview bundle run: pnpm --filter=@fern-ui/cdk run deploy:prod diff --git a/packages/cdk/src/docs-fe-stack.ts b/packages/cdk/src/docs-fe-stack.ts index 8601b14e83..575c8186f8 100644 --- a/packages/cdk/src/docs-fe-stack.ts +++ b/packages/cdk/src/docs-fe-stack.ts @@ -41,6 +41,10 @@ export class DocsFeStack extends Stack { ); const local_preview_bundle_dist_zip = path.resolve(__dirname, "../../ui/local-preview-bundle/dist/out.zip"); + if (!fs.existsSync(LOCAL_PREVIEW_BUNDLE_OUT_DIR) || !fs.lstatSync(LOCAL_PREVIEW_BUNDLE_OUT_DIR).isDirectory()) { + throw new Error(`Local preview bundle not found at ${LOCAL_PREVIEW_BUNDLE_OUT_DIR}`); + } + void zipFolder(LOCAL_PREVIEW_BUNDLE_OUT_DIR, local_preview_bundle_dist_zip).then(() => { new BucketDeployment(this, "deploy-local-preview-bundle2", { sources: [Source.asset(local_preview_bundle_dist_zip)],