Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

Improved CLI wording based on user testing (#2300)

Oleg Isonen1d48b5ba61ac
diff --git a/packages/cli/Readme.md b/packages/cli/Readme.md
index 6bb0ac2f9a..5d9267b630 100644
--- a/packages/cli/Readme.md
+++ b/packages/cli/Readme.md
@@ -1,57 +1,117 @@
## Webstudio CLI
-The Webstudio CLI is designed to help you seamlessly link, sync, and build projects from your web development workspace. This README will guide you through the process of setting up linking, syncing, building, and running your projects using the Webstudio CLI commands.
+The Webstudio CLI helps you to `link`, `sync`, and `build` projects from your Webstudio Builder workspace. This README will guide you through the process of setting up a Webstudio project on your local machine and continually sync it with the cloud.
-## Linking a Project
+## Prerequisites: Installing Node.js
-Create a folder using
+You need Node.js to use the Webstudio CLI. If Node.js is already installed in your system, you can skip ahead to the section on installing the Webstudio CLI.
-```sh
-mkdir <project-name>
+To install Node.js using NVM, first install NVM by running:
+
+```bash
+curl -o- <https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh> | bash
```
-Now, `cd` into the folder that we just created.
+Once NVM is installed, you can install Node.js version 18 by running:
-```sh
-cd <project-name>
+```bash
+nvm install 18
```
-Run the following command to link the project from your workspace.
+Verify your Node.js installation by checking its version:
-```sh
-webstudio link
+```bash
+node --version
```
-This will prompt you to paste the link. You can create a link for your Webstudio project using the _share_ option. Make sure you provide _build_ access when you create the link.
+## Installing the Webstudio CLI
+
+To get started with the Webstudio CLI:
+
+1. Download and install the CLI using the following command:
+
+```bash
+npm install -g webstudio-cli
+```
-Now, you can sync your project with the following command. Make sure you publish the project in the workspace before the sync.
+1. Confirm the installation by checking the CLI version:
-```sh
-webstudio sync
+```bash
+webstudio-cli --version
```
-Let's build the project. In this step, the `cli` creates the routes, pages, and scaffolds the entire app using the default remix template. All the assets like images and fonts will also be downloaded into the `assets` folder under the `public` directory.
+1. To keep your CLI updated, use the same command used for installation whenever a new release is available.
+
+## Initiating a Webstudio Project
-```sh
-webstudio build
+Now, you can run a Webstudio project on your local machine using this command:
+
+```bash
+webstudio-cli
```
-The project is scaffolded now. You can run `npm install` and then `npm run dev` to run your app in development mode. If you want to build a production version of the app, you can run `npm run build`.
+This will initiate the flow to connect your Webstudio project and build it in your local computer. The default flow will guide you through the steps. You can also perform all the operations individually using independent commands.
## Commands
-- `help` shows you all the available commands.
-- `version` displays the current version of the CLI.
+Here is the list of independent commands:
+
+- version
+- help
+- link
+- sync
+- build
+
+### link
+
+The **`link`** command syncs your local Webstudio project with the project from the workspace. This means that any changes made in the workspace project can be synced to the local project, once they are published.
+
+You can link a project from your workspace with the following command:
+
+```bash
+webstudio-cli link
+```
+
+This command will prompt you to paste a link which you can create using the S*hare* option in your project.
+
+Make sure to provide B*uild* access when generating the link in Webstudio Cloud.
-## Development setup
+### sync
-- To use a local version of the `cli`, you need to clone the repository.
+Once the project is linked, use the **`sync`** command to sync it with the workspace project:
-```sh
-git clone https://github.com/webstudio-is/webstudio
+```bash
+webstudio-cli sync
```
-- Then run `pnpm install` to install all the dependencies.
-- Once the dependencies are installed, you can use `pnpm build` to build all the necessary packages and the CLI itself.
-- Now, change to the `app/cli` folder and run `yarn link` to create a global link for the package.
-- Upon the successful creation of the `symlink`, you can use the `webstudio` command to use the CLI.
+Make sure to publish the project in the workspace before running the **`sync`** command in your local Webstudio project.
+
+### build
+
+Now, you can build your project with the **`build`** command:
+
+```bash
+webstudio-cli build
+```
+
+During this phase, the CLI establishes the necessary routes and pages, scaffolding the entire application using the default Remix template. Additionally, all assets, such as images and fonts are downloaded to the **`assets`** folder inside the **`public`** directory.
+
+Once the project is scaffolded, you can run `npm install` and then `npm run dev` to run your app in development mode.
+
+If you want to build a production version of the app, you can run `npm run build`.
+
+## Deployment
+
+Once you've built the project locally, you can use the [Vercel CLI](https://vercel.com/docs/cli) to deploy your site directly to Vercel:
+
+```bash
+vercel deploy
+```
+
+Follow the instructions [here](https://vercel.com/docs/cli) to install the `vercel` CLI.
+
+## Important Notes
+
+If you use `vercel build` before `vercel deploy`, make sure to clean your `app` folder in the project afterward.
+
+Vercel injects a few [files](https://github.com/vercel/vercel/blob/a8ad176262ef822860ce338927e6f959961d2d32/packages/remix/src/build.ts#L63) to support and deploy Remix using their CLI, but these files are not necessary for your project when you use it locally.
diff --git a/packages/cli/src/commands/init-flow.ts b/packages/cli/src/commands/init-flow.ts
index d6f21b1318..0644f3a80b 100644
--- a/packages/cli/src/commands/init-flow.ts
+++ b/packages/cli/src/commands/init-flow.ts
@@ -27,7 +27,8 @@ export const initFlow = async (
const { shouldCreateFolder } = await prompt({
type: "confirm",
name: "shouldCreateFolder",
- message: "Would you like to create a folder?",
+ message:
+ "Would you like to create a project folder? (no to use current folder)",
initial: true,
});
@@ -61,7 +62,7 @@ export const initFlow = async (
const { installDeps } = await prompt({
type: "confirm",
name: "installDeps",
- message: "Would you like to install dependencies?",
+ message: "Would you like to install dependencies? (recommended)",
initial: true,
});
shouldInstallDeps = installDeps;