@webflow/webflow-cli 1.19.0 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @webflow/webflow-cli
2
2
 
3
+ ## 1.20.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d77f3b7: Adds global session storage and new auth commands. Running `webflow auth login` now saves credentials to both `~/.config/webflow/auth.json` (macOS/Linux) or `%APPDATA%\webflow\auth.json` (Windows) **and** the project `.env` file (`WEBFLOW_API_TOKEN`), so existing 1.x workflows continue to work without changes. Two new commands: `webflow auth status` shows the currently logged-in user and active scopes; `webflow auth logout` removes the stored session. The `WEBFLOW_API_TOKEN` environment variable continues to work as a CI/CD override.
8
+
9
+ ### Patch Changes
10
+
11
+ - 067f4cf: Change version flag from `-V` to `-v` for convenience
12
+
3
13
  ## 1.19.0
4
14
 
5
15
  ### Minor Changes
package/README.md CHANGED
@@ -1,371 +1,219 @@
1
1
  # @webflow/webflow-cli
2
2
 
3
- The Webflow CLI is a command-line interface that allows you to interact with various Webflow developer products, including Devlink and Designer Extensions.
3
+ The Webflow CLI lets you manage Webflow sites, CMS content, assets, and code components from the command line.
4
4
 
5
5
  ## Installation
6
6
 
7
- You can install the Webflow CLI globally on your machine using npm:
8
-
9
7
  ```shell
10
- npm i @webflow/webflow-cli -g
8
+ npm install -g @webflow/webflow-cli
11
9
  ```
12
10
 
13
- ## Usage
11
+ ## Commands
14
12
 
15
- - [Code Components Libraries](#code-components-libraries)
16
- - [Webflow Designer APIs & Extensions](#webflow-designer-apis-and-extensions)
17
- - [Devlink](#devlink)
13
+ - [Authentication](#authentication)
14
+ - [Sites](#sites)
15
+ - [CMS](#cms)
16
+ - [Assets](#assets)
17
+ - [DevLink Import (Code Components)](#devlink-import-code-components)
18
+ - [DevLink Export](#devlink-export)
19
+ - [Designer Extensions](#designer-extensions)
20
+ - [Global Options](#global-options)
18
21
 
19
- ### Global Options
22
+ ---
20
23
 
21
- The following options are available for all commands:
24
+ ## Authentication
22
25
 
23
- - **`--no-input`** - Avoid prompting or doing anything interactive. Use this for CI/CD pipelines.
24
- - **`--manifest <path>`** - Path to a manifest .json file or directory containing webflow.json. Default: `./webflow.json`
25
- - **`--skip-update-check`** - Skip checking for `@webflow` packages updates
26
+ Authenticate with Webflow and save credentials locally.
26
27
 
27
- ### Code Components Libraries
28
+ ```shell
29
+ webflow auth login # OAuth login — saves token to .env
30
+ webflow auth login --force # Re-authenticate even if credentials exist
31
+ ```
28
32
 
29
- [Code Components](https://developers.webflow.com/code-components/introduction) allow you to build custom React components and share them to your Webflow workspace. The Webflow CLI provides commands to manage and share your component libraries.
33
+ ---
30
34
 
31
- #### Prerequisites
35
+ ## Sites
32
36
 
33
- Before using the library commands, you need to create a `webflow.json` configuration file in your project root. Here's an example:
37
+ Manage Webflow sites from the CLI.
34
38
 
35
- ```json
36
- {
37
- "library": {
38
- "name": "My Component Library",
39
- "description": "A collection of custom components",
40
- "components": ["src/components/**/*.webflow.tsx"]
41
- }
42
- }
39
+ ```shell
40
+ webflow sites list # List all sites in your workspace
41
+ webflow sites get <siteId> # Get details for a specific site
42
+ webflow sites domains --site <siteId> # List custom domains for a site
43
+ webflow sites publish --site <siteId> # Publish a site
43
44
  ```
44
45
 
45
- **Configuration Options:**
46
-
47
- - **`name`** (required): The display name of your library
48
- - **`description`** (optional): A description of your library
49
- - **`components`** (required): Glob pattern(s) for your component files
50
- - **`id`** (optional): Library ID (auto-generated on first share)
51
- - **`renderer`** (optional): Custom renderer configuration
52
- - Can be a string path to a renderer module
53
- - Or an object with `client` and `server` paths
54
- - **`bundleConfig`** (optional): Path to a webpack configuration file for custom bundle overrides
46
+ ### `sites list` options
55
47
 
56
- #### Sharing a Library
48
+ | Flag | Description |
49
+ | ------------------- | ---------------------------------------------------------------------------------------------------------------- |
50
+ | `--fields <fields>` | Comma-separated columns to display (id, displayName, shortName, timeZone, createdOn, lastUpdated, lastPublished) |
51
+ | `--json` | Output as JSON |
57
52
 
58
- Share your component library to your Webflow workspace:
53
+ ### `sites publish` options
59
54
 
60
- ```shell
61
- webflow library share
62
- ```
55
+ | Flag | Description |
56
+ | --------------------- | ---------------------------------------------------------- |
57
+ | `--site <siteId>` | Site ID to publish |
58
+ | `--domain <domainId>` | Publish to a specific custom domain (repeatable) |
59
+ | `--page <pageId>` | Publish a single page instead of the full site |
60
+ | `--dry-run` | Preview what would be published without triggering a build |
63
61
 
64
- This command will:
62
+ ---
65
63
 
66
- 1. Collect metadata from your component files
67
- 2. Bundle your components for both client and server environments
68
- 3. Upload the bundles to Webflow's CDN
69
- 4. Register the library in your workspace
64
+ ## CMS
70
65
 
71
- ##### Authentication
66
+ Manage CMS collections and items.
72
67
 
73
- You need a Workspace API token to share libraries. On your first share, the CLI will guide you through an OAuth flow to authenticate and generate a token.
68
+ ```shell
69
+ # Collections
70
+ webflow cms collections list --site <siteId>
71
+ webflow cms collections get --site <siteId> --collection <collectionId>
72
+ webflow cms collections create --site <siteId> --name "Blog Posts" --slug "blog-posts"
74
73
 
75
- Alternatively, you can provide a token manually with an environment variable:
74
+ # Fields
75
+ webflow cms fields create --collection <collectionId> --name "Author" --type PlainText
76
76
 
77
- ```shell
78
- export WEBFLOW_WORKSPACE_API_TOKEN=your_token_here
79
- webflow library share
77
+ # Items
78
+ webflow cms items list --site <siteId> --collection <collectionId>
79
+ webflow cms items get --site <siteId> --collection <collectionId> --item <itemId>
80
+ webflow cms items create --site <siteId> --collection <collectionId> --data '{"name":"Hello"}'
81
+ webflow cms items update --site <siteId> --collection <collectionId> --item <itemId> --data '{"name":"Updated"}'
82
+ webflow cms items delete --site <siteId> --collection <collectionId> --item <itemId>
83
+ webflow cms items publish --site <siteId> --collection <collectionId> --item <itemId>
80
84
  ```
81
85
 
82
- You can generate a Workspace API token in your Webflow workspace settings.
86
+ ### `cms collections list` options
83
87
 
84
- ##### Options
88
+ | Flag | Description |
89
+ | ------------------- | ---------------------------------------------------------------------- |
90
+ | `--sort-by <field>` | Sort by: `displayName`, `slug`, `lastUpdated` (default: `displayName`) |
91
+ | `--order <dir>` | `asc` or `desc` (default: `asc`) |
92
+ | `--json` | Output as JSON |
85
93
 
86
- - **`--api-token <token>`** - Workspace API token (overrides environment variable)
87
- - **`--force`** - Force compilation even with warnings or type errors
88
- - **`--debug-bundler`** - Display final bundler configurations for debugging
89
- - **`--dev`** - Bundle in development mode for debugging
90
- - **`--verbose`** - Display more detailed information
94
+ ---
91
95
 
92
- #### Bundling for Local Development
96
+ ## Assets
93
97
 
94
- Bundle your library locally without sharing to Webflow:
98
+ Upload and manage site assets.
95
99
 
96
100
  ```shell
97
- webflow library bundle --public-path /public
101
+ webflow assets list --site <siteId> # List assets
102
+ webflow assets upload <file> --site <siteId> # Upload a file
103
+ webflow assets update <assetId> --display-name "New name" # Update asset metadata
104
+ webflow assets folders --site <siteId> # List asset folders
105
+ webflow assets folders create --site <siteId> --name "Images"
98
106
  ```
99
107
 
100
- This is useful for:
108
+ ### `assets list` options
101
109
 
102
- - Testing your components locally
103
- - Debugging bundle issues
110
+ | Flag | Description |
111
+ | --------------------- | --------------------------------------------------------------------------------------------------------- |
112
+ | `--folder <folderId>` | Filter by folder |
113
+ | `--sort-by <field>` | Sort by: `displayName`, `originalFileName`, `contentType`, `size`, `lastUpdated` (default: `displayName`) |
114
+ | `--order <dir>` | `asc` or `desc` (default: `asc`) |
115
+ | `--fields <fields>` | Comma-separated columns to display |
116
+ | `--limit <n>` | Max assets to return |
117
+ | `--offset <n>` | Skip N assets (for pagination) |
118
+ | `--json` | Output as JSON |
104
119
 
105
- ##### Options
120
+ ### `assets upload` options
106
121
 
107
- - **`--public-path <path>`** (required) - Public path for the bundle
108
- - **`--output-path <path>`** - Output directory (default: `./dist`)
109
- - **`--force`** - Force compilation even with warnings or type errors
110
- - **`--debug-bundler`** - Display final bundler configurations
111
- - **`--dev`** - Bundle in development mode
112
- - **`--verbose`** - Display more detailed information
122
+ | Flag | Description |
123
+ | ---------------------- | ----------------------------------- |
124
+ | `--name <displayName>` | Display name (defaults to filename) |
125
+ | `--folder <folderId>` | Upload into a folder |
126
+ | `--dry-run` | Preview without uploading |
113
127
 
114
- The bundled files will be written to the output directory with separate `client` and `server` subdirectories.
128
+ **Supported file types:** PNG, JPG, JPEG, GIF, SVG, WEBP, AVIF (≤ 4 MB); PDF, DOC, DOCX, XLS, XLSX, PPT, PPTX, TXT, CSV, ODT, ODS, ODP, JSON, Lottie (≤ 10 MB)
115
129
 
116
- #### Viewing Logs
130
+ ---
117
131
 
118
- Display the logs directory and path to the latest log file:
132
+ ## DevLink Import (Code Components)
133
+
134
+ Build and import React component libraries to your Webflow workspace.
119
135
 
120
136
  ```shell
121
- webflow library log
137
+ webflow devlink import # Build and share your component library
138
+ webflow devlink bundle # Build locally without sharing
122
139
  ```
123
140
 
124
- This is helpful for debugging issues with the `share` or `bundle` commands.
125
-
126
- #### Customizing Bundle Configuration
127
-
128
- You can customize the webpack configuration used to bundle your components by providing a `bundleConfig` option in your `webflow.json` file. This allows you to add custom loaders, plugins, or modify the build process.
141
+ Aliases: `webflow library share`, `webflow library bundle`
129
142
 
130
- ##### Configuration File
143
+ ### Prerequisites
131
144
 
132
- In your `webflow.json`, specify the path to your bundle config file:
145
+ Create a `webflow.json` in your project root:
133
146
 
134
147
  ```json
135
148
  {
136
149
  "library": {
137
150
  "name": "My Component Library",
138
- "components": ["src/components/**/*.webflow.tsx"],
139
- "bundleConfig": "./webpack.webflow.js"
151
+ "description": "A collection of custom components",
152
+ "components": ["src/components/**/*.webflow.tsx"]
140
153
  }
141
154
  }
142
155
  ```
143
156
 
144
- ##### Bundle Config Format
145
-
146
- Your bundle config file can export configurations in three ways:
147
-
148
- **1. Static Object**
149
-
150
- Export a static configuration object:
151
-
152
- ```js
153
- // webpack.webflow.js
154
- module.exports = {
155
- mode: "production",
156
- devtool: "source-map",
157
- module: {
158
- rules: (currentRules) => [
159
- ...currentRules,
160
- { test: /\.svg$/, use: ["@svgr/webpack"] },
161
- ],
162
- },
163
- };
164
- ```
165
-
166
- **2. Function (Environment-Specific)**
167
-
168
- Export a function that receives the environment (`Environment.Client` or `Environment.Server`) and returns a configuration:
169
-
170
- ```js
171
- // webpack.webflow.js
172
- const { Environment } = require("@webflow/data-types");
173
-
174
- module.exports = (env) => ({
175
- mode: env === Environment.Client ? "production" : "development",
176
- devtool: env === Environment.Client ? "source-map" : false,
177
- module: {
178
- rules: (currentRules) => [
179
- ...currentRules,
180
- {
181
- test: env === Environment.Client ? /\.client\.js$/ : /\.server\.js$/,
182
- use: "custom-loader",
183
- },
184
- ],
185
- },
186
- });
187
- ```
188
-
189
- **3. Array (Multiple Configs)**
190
-
191
- Export an array of objects and/or functions to merge multiple configurations:
192
-
193
- ```js
194
- // webpack.webflow.js
195
- const { Environment } = require("@webflow/data-types");
196
- const {
197
- styledComponentsBundleConfig,
198
- } = require("@webflow/styled-components-utils");
199
-
200
- module.exports = [
201
- // Include third-party config
202
- styledComponentsBundleConfig,
203
-
204
- // Add environment-specific settings
205
- (env) => ({
206
- mode: env === Environment.Client ? "production" : "development",
207
- }),
208
-
209
- // Add custom rules
210
- {
211
- module: {
212
- rules: (currentRules) => [
213
- ...currentRules,
214
- { test: /\.svg$/, use: ["@svgr/webpack"] },
215
- ],
216
- },
217
- },
218
- ];
219
- ```
220
-
221
- ##### Common Use Cases
222
-
223
- **Adding a Custom Loader**
224
-
225
- ```js
226
- module.exports = {
227
- module: {
228
- rules: (currentRules) => [
229
- ...currentRules,
230
- {
231
- test: /\.scss$/,
232
- use: ["style-loader", "css-loader", "sass-loader"],
233
- },
234
- ],
235
- },
236
- };
237
- ```
238
-
239
- **Modifying an Existing Loader**
240
-
241
- ```js
242
- module.exports = {
243
- module: {
244
- rules: (currentRules) =>
245
- currentRules.map((rule) => {
246
- // Extend the CSS loader configuration
247
- if (rule.test instanceof RegExp && rule.test.test("test.css")) {
248
- // Modify the rule...
249
- return modifiedRule;
250
- }
251
- return rule;
252
- }),
253
- },
254
- };
255
- ```
256
-
257
- **Using CSS-in-JS Library Configs**
258
-
259
- ```js
260
- const {
261
- styledComponentsBundleConfig,
262
- } = require("@webflow/styled-components-utils");
263
-
264
- // For styled-components
265
- module.exports = styledComponentsBundleConfig;
266
- ```
267
-
268
- ##### Merging Behavior
269
-
270
- When multiple configs are provided (via array), they are merged with the following behavior:
271
-
272
- - **Regular properties**: Later configs override earlier ones
273
- - **Module rules**: Rules transformation functions are chained together in order
274
- - **Plugins**: Plugin arrays are concatenated
275
- - **ModuleFederationPlugin shared**: Shared dependency configurations are merged
276
-
277
- ##### Blocked Properties
157
+ ### `devlink import` options
278
158
 
279
- For security and consistency, the following webpack properties cannot be overridden:
159
+ | Flag | Description |
160
+ | --------------------- | --------------------------------------------------- |
161
+ | `--api-token <token>` | Workspace API token (overrides `WEBFLOW_API_TOKEN`) |
162
+ | `--force` | Compile even with warnings or type errors |
163
+ | `--dev` | Bundle in development mode |
280
164
 
281
- - `entry`
282
- - `output`
283
- - `target`
165
+ ### `devlink bundle` options
284
166
 
285
- Attempting to override these properties will result in a warning and they will be ignored.
167
+ | Flag | Description |
168
+ | ---------------------- | ----------------------------------------------------- |
169
+ | `--public-path <path>` | Set the public path for the bundle |
170
+ | `--output-path <path>` | Set the output path for the bundle (default `./dist`) |
171
+ | `--force` | Compile even with warnings or type errors |
172
+ | `--dev` | Bundle in development mode |
286
173
 
287
- ### Webflow Designer Extensions and APIs
174
+ ---
288
175
 
289
- [Designer Extensions](https://docs.developers.webflow.com/v2.0.0/docs/apps-overview) are single-page web Apps that run inside of of the Webflow Designer, and manipulate elements on the canvas through [Webflow's Designer APIs.](https://docs.developers.webflow.com/v2.0.0/reference/introduction-1). You can use the Webflow CLI to develop and package your Designer Extensions.
176
+ ## DevLink Export
290
177
 
291
- #### Creating an Extension
292
-
293
- To create a new extension, use the `webflow extension init` command:
294
-
295
- ```shell
296
- webflow extension init my-extension
297
- ```
298
-
299
- This command creates a new directory named `my-extension` with a basic scaffold for your extension. See more details about the scaffolding on the [App structure reference](https://docs.developers.webflow.com/v2.0.0/reference/app-structure).
300
-
301
- #### Running your Extension Locally
302
-
303
- Navigate to the newly created folder for your extension. You can serve your extension locally using the following command. The default port is set to 1337.
178
+ Export Webflow Components from your Webflow Site
304
179
 
305
180
  ```shell
306
- npm run dev
181
+ webflow devlink export # Export Webflow Components
307
182
  ```
308
183
 
309
- This will run the `webflow extension serve` and command, allowing you test your App locally.
310
-
311
- ##### Options
184
+ ### `devlink export` options
312
185
 
313
- - `port` - Serve your extension at a specific port on localhost: `webflow extension serve 1234`
186
+ | Flag | Description |
187
+ | --------------------- | --------------------------------------------------- |
188
+ | `--api-token <token>` | Workspace API token (overrides `WEBFLOW_API_TOKEN`) |
189
+ | `--site <siteId>` | Site ID to export from |
314
190
 
315
- #### Building and Bundling your Extension
191
+ ---
316
192
 
317
- If you're using the scaffolding built out from the `webflow extension init` command, you can create a build of your extension, an bundle it for publishing using the` npm run build` command:
193
+ ## Designer Extensions
318
194
 
319
- ```shell
320
- npm run build
321
- ```
322
-
323
- This will run the `webflow extension bundle` CLI command, which will output a `bundle.zip` file in your extension’s directory. You can upload this extension to Webflow via the "Integrations" tab in your workspace settings. Note: The extension size limit is 5MB.
324
-
325
- ### Devlink
326
-
327
- DevLink allows you to visually design and build web components for React directly in Webflow. [Learn more in our DevLink overview,](https://webflow.com/devlink) and read the [DevLink documentation](https://docs.developers.webflow.com/docs/devlink-documentation-and-usage-guide).
195
+ Scaffold and serve Webflow Designer Extensions.
328
196
 
329
197
  ```shell
330
- npx webflow devlink -h
198
+ webflow extension init <name> # Create a new extension project
199
+ webflow extension serve [port] # Serve locally (default port: 1337)
200
+ webflow extension bundle # Build and package for upload (outputs bundle.zip)
331
201
  ```
332
202
 
333
- In order to use the DevLink CLI first you'll need to create a `.webflowrc` configuration file on your application's root directory.
203
+ ---
334
204
 
335
- The supported formats are JavaScript(.js) and JSON (.json).
205
+ ## Global Options
336
206
 
337
- It should look something like this:
207
+ Available on all commands:
338
208
 
339
- JSON:
209
+ | Flag | Description |
210
+ | --------------------- | -------------------------------------------------- |
211
+ | `--no-input` | Disable interactive prompts (for CI/CD) |
212
+ | `--manifest <path>` | Path to `webflow.json` (default: `./webflow.json`) |
213
+ | `--skip-update-check` | Skip checking for package updates |
214
+ | `--verbose` | Show detailed output |
340
215
 
341
- ```json
342
- {
343
- "host": "https://api.wfdev.io:8443",
344
- "rootDir": "./devlink",
345
- "siteId": "[YOUR SITE ID]",
346
- "authToken": "[API TOKEN]"
347
- }
348
- ```
349
-
350
- JavaScript:
351
-
352
- ```js
353
- module.exports = {
354
- host: "https://api.wfdev.io:8443",
355
- rootDir: "./devlink",
356
- siteId: "[YOUR SITE ID]",
357
- authToken: process.env.WF_TOKEN,
358
- };
359
- ```
360
-
361
- You'll have to generate an API token to your application. This can be done on your Webflow project
362
- by going to Site Settings > Integrations.
363
-
364
- #### Sync your design system
365
-
366
- ```shell
367
- npx webflow devlink sync
368
- ```
216
+ ---
369
217
 
370
218
  ## License
371
219