From 7835607f4ecb53926ecbb3d528f525955aeaad66 Mon Sep 17 00:00:00 2001 From: Ivan Starkov Date: Tue, 12 Sep 2023 07:59:35 +0300 Subject: [PATCH] Add vercelignore to templates (#2299) ## Description This avoid uploading builds/caches etc onto vercel ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 5de6) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env.example` and the `builder/env-check.js` if mandatory --- fixtures/webstudio-remix-vercel/.vercelignore | 8 ++++++++ packages/cli/src/__generated__/templates.ts | 7 +++++++ packages/cli/src/commands/init-flow.ts | 6 ++++++ packages/cli/templates/defaults/.vercelignore | 8 ++++++++ 4 files changed, 29 insertions(+) create mode 100644 fixtures/webstudio-remix-vercel/.vercelignore create mode 100644 packages/cli/templates/defaults/.vercelignore diff --git a/fixtures/webstudio-remix-vercel/.vercelignore b/fixtures/webstudio-remix-vercel/.vercelignore new file mode 100644 index 0000000000..6a0e67a2fb --- /dev/null +++ b/fixtures/webstudio-remix-vercel/.vercelignore @@ -0,0 +1,8 @@ +node_modules + +.cache +.env +.vercel +.webstudio +build +public/build diff --git a/packages/cli/src/__generated__/templates.ts b/packages/cli/src/__generated__/templates.ts index 46b9b68be1..24f9ffacd6 100644 --- a/packages/cli/src/__generated__/templates.ts +++ b/packages/cli/src/__generated__/templates.ts @@ -11,6 +11,13 @@ export const templates: Record = { defaults: { name: "defaults", files: [ + { + name: ".vercelignore", + content: + "node_modules\n\n.cache\n.env\n.vercel\n.webstudio\nbuild\npublic/build\n", + encoding: "utf-8", + merge: false, + }, { name: "package.json", content: diff --git a/packages/cli/src/commands/init-flow.ts b/packages/cli/src/commands/init-flow.ts index fec02fdc5e..d6f21b1318 100644 --- a/packages/cli/src/commands/init-flow.ts +++ b/packages/cli/src/commands/init-flow.ts @@ -13,6 +13,12 @@ import pc from "picocolors"; export const initFlow = async ( options: StrictYargsOptionsToInterface ) => { + await prompt({ + type: "text", + name: "folderName", + message: "Please enter a project name", + }); + const isProjectConfigured = await isFileExists(".webstudio/config.json"); let shouldInstallDeps = false; let folderName; diff --git a/packages/cli/templates/defaults/.vercelignore b/packages/cli/templates/defaults/.vercelignore new file mode 100644 index 0000000000..6a0e67a2fb --- /dev/null +++ b/packages/cli/templates/defaults/.vercelignore @@ -0,0 +1,8 @@ +node_modules + +.cache +.env +.vercel +.webstudio +build +public/build