@canva/cli 0.0.1-beta.3 → 0.0.1-beta.4

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/README.md CHANGED
@@ -7,155 +7,246 @@ CLI for creating and managing Canva Apps.
7
7
  ## Table of contents
8
8
 
9
9
  - [Introduction](#introduction)
10
- - [Features](#features)
11
- - [Usage](#usage)
10
+ - [Requirements](#requirements)
11
+ - [Quickstart](#quickstart)
12
+ - [Use the Canva CLI](#use-the-canva-cli)
13
+ - [Step 1: Install and log in](#step-1-install-and-log-in)
14
+ - [Step 2: Create your app](#step-2-create-your-app)
15
+ - [Step 3: Preview your app](#step-3-preview-your-app)
16
+ - [Log out, auth token storage, and removal](#token-storage-and-removal)
12
17
  - [CLI reference](#cli-reference)
13
18
  - [Flags](#flags)
14
19
  - [Commands](#commands)
15
20
  - [Next steps](#next-steps)
16
21
  - [Limitations](#limitations)
17
- - [Updating](#updating)
18
- - [Contributing](#contributing)
22
+ - [Updates](#updating)
23
+ - [Contributions](#contributing)
19
24
  - [License](#license)
20
25
 
21
26
  ## Introduction
22
27
 
23
- `@canva/cli` is a command line tool designed for creating and managing Canva Apps. To learn more about app development, visit [the official documentation](https://www.canva.dev/docs/apps).
28
+ `@canva/cli` is a command line tool designed for creating and managing Canva Apps. Use `@canva/cli` to get started creating and testing your app. The Canva CLI allows you to create apps from the command line, and to use Canva's recommended development tools and templates.
24
29
 
25
- ## Features
30
+ To learn more about app development, visit [the official documentation](https://www.canva.dev/docs/apps).
26
31
 
27
- - Log in to your Canva account.
28
- - Create and manage apps directly from the command line.
29
- - Utilize Canva's recommended development tools and templates.
32
+ ## Requirements
30
33
 
31
- ## Prerequisites
34
+ Before using the CLI, make sure that you have the following:
32
35
 
33
- Before using the CLI, ensure that you have the following installed:
36
+ - Node.js `v18.20.4` or `v20.17.0`.
37
+ - npm `v9` or `v10`.
38
+ - A [Canva account](https://www.canva.com/developers).
34
39
 
35
- - Node.js `v18.20.4` or `v20.17.0`
36
- - npm `v9` or `v10`
40
+ **Note**: If you are using a version manager such as nvm, run the `nvm install 20.17.0` command to make sure you have the correct Node.js version.
37
41
 
38
- ## Usage
42
+ ## Quickstart
39
43
 
40
- To start using the CLI, first install it globally:
44
+ The following commands create a new Canva app using the Canva CLI.
41
45
 
42
- ```bash
43
- npm install -g @canva/cli
46
+ ```shell
47
+ npm install -g @canva/cli@latest
48
+ canva login
49
+ canva apps create "My New App" --template="hello_world" --distribution="public" --git --installDependencies
50
+ cd my-new-app
51
+ npm start
44
52
  ```
45
53
 
46
- After installation, you can use the CLI by running:
54
+ ## Use the Canva CLI
47
55
 
48
- ```bash
49
- canva <command>
50
- ```
56
+ ### Step 1: Install and log in
57
+
58
+ Installing the Canva CLI allows you to create new apps from the command line.
59
+
60
+ To get started:
61
+
62
+ 1. Install the Canva CLI globally.
63
+
64
+ ```shell
65
+ npm install -g @canva/cli@latest
66
+ ```
67
+
68
+ 2. Log in to the Canva CLI. The Canva CLI then opens an access request page in your browser.
69
+
70
+ ```shell
71
+ canva login
72
+ ```
73
+
74
+ 3. In your browser, click **Allow** to grant the Canva CLI access to create and edit apps on your behalf. When you grant access, the Canva CLI generates an auth token and stores it locally. For more information on the auth token, read the following section on [auth token storage and removal](#log-out-auth-token-storage-and-removal).
75
+ 4. Copy the confirmation code shown in your browser, and paste it into the Canva CLI input.
76
+
77
+ ### Step 2: Create your app
78
+
79
+ After you log in to the Canva CLI and authorize it, you can create your app.
80
+
81
+ To create a new app:
82
+
83
+ 1. Run the `canva apps create` command. The flags in the following code snippet are optional, and you can instead configure these settings during the apps creation process. See the [CLI Reference](#cli-reference) for more information on each flag.
84
+
85
+ ```shell
86
+ canva apps create "My New App" --template="hello_world" --distribution="public" --git --installDependencies
87
+ ```
88
+
89
+ **Note**: You can't change the distribution type after creating an app.
90
+
91
+ ### Step 3: Preview your app
92
+
93
+ When your new app is ready, the Canva CLI automatically opens the [Developer Portal](https://www.canva.com/developers/apps) to your new app's Configuration page in your browser. You can then continue to preview and manage your new app.
94
+
95
+ To preview your app:
96
+
97
+ 1. Change into your new app's folder.
98
+
99
+ ```shell
100
+ cd my-new-app
101
+ ```
102
+
103
+ 2. Run the following command to start your app.
104
+
105
+ ```shell
106
+ npm start
107
+ ```
108
+
109
+ 3. In the Developer Portal, click **Preview** to open the Canva Editor preview.
110
+ 4. If this the first time previewing your app, click **Open** to preview your new app.
111
+
112
+ ## Log out, auth token storage, and removal
113
+
114
+ When you log in to the Canva CLI using the `canva login` command, and then grant the Canva CLI access to manage apps in your Canva account, an auth token is encrypted and stored locally on your machine. The token provides authentication for future requests so you don't need to grant the Canva CLI access each time it sends a request.
115
+
116
+ When you log out of the Canva CLI with the `canva logout` command, the auth token is revoked, and deleted.
117
+
118
+ ### Token Location
119
+
120
+ The auth token is located in your home directory under the `.canva-cli` folder.
121
+
122
+ ### Removing the Token
123
+
124
+ To delete the token, there are two options. However only the `canva logout` command revokes and deletes the token. If there's a copy of the token, it's possible to reconnect the Canva CLI to your account's apps using the token.
125
+
126
+ #### Log out
127
+
128
+ 1. Use the `canva logout` command to revoke access and delete the stored token.
129
+
130
+ ```shell
131
+ canva logout
132
+ ```
133
+
134
+ #### Delete the file manually
135
+
136
+ 1. Locate the `credentials` file, which is stored in the following locations:
137
+
138
+ - **macOS and Linux**: The token is stored in `~/.canva-cli/credentials`.
139
+ - **Windows**: The token is stored in `%USERPROFILE%\.canva-cli\credentials`.
140
+
141
+ 2. Delete the file.
51
142
 
52
143
  ## CLI Reference
53
144
 
145
+ After installation, you can use the Canva CLI by running:
146
+
147
+ ```shell
148
+ canva <command-name>
149
+ ```
150
+
54
151
  ### Flags
55
152
 
56
- Top-level flags applicable across commands:
153
+ Top-level flags applicable to commands:
57
154
 
58
- - `--help`: Display help information about commands and flags.
155
+ - `--help`: Show help information about commands and flags.
59
156
  - `--lite`: Enable a simplified CLI interface for enhanced accessibility.
60
- - `--version`: Show the version number of the CLI.
157
+ - `--version`: Show the CLI version number.
61
158
 
62
159
  ### Commands
63
160
 
64
161
  #### welcome
65
162
 
66
- Display the welcome page and general information.
163
+ Show the welcome page and general information.
67
164
 
68
- - **Usage**:
69
-
70
- ```bash
71
- canva welcome
72
- ```
165
+ ```shell
166
+ canva welcome
167
+ ```
73
168
 
74
169
  #### tip
75
170
 
76
- Get a random development tip for working with the Apps SDK.
171
+ Print a random development tip for working with the Apps SDK.
77
172
 
78
- - **Usage**:
79
-
80
- ```bash
81
- canva tip
82
- ```
173
+ ```shell
174
+ canva tip
175
+ ```
83
176
 
84
- - **Aliases**: `tips`
177
+ - **Aliases**:
178
+ - `tips`: Also prints a random development tip.
85
179
 
86
180
  #### login
87
181
 
88
182
  Log in to the Canva CLI.
89
183
 
90
- - **Usage**:
91
-
92
- ```bash
93
- canva login
94
- ```
184
+ ```shell
185
+ canva login
186
+ ```
95
187
 
96
- #### apps
188
+ #### logout
97
189
 
98
- Manage your Canva apps.
190
+ Log out of the Canva CLI, and delete the saved auth token:
99
191
 
100
- - **Usage**:
192
+ ```shell
193
+ canva logout
194
+ ```
101
195
 
102
- ```bash
103
- canva apps
104
- ```
196
+ #### apps
105
197
 
106
- - **Sub-Commands**:
198
+ Manage your Canva apps.
107
199
 
108
- - `create [name]`: Create a new Canva app.
200
+ ```shell
201
+ canva apps
202
+ ```
109
203
 
110
- - **Usage**:
204
+ #### apps sub-commands
111
205
 
112
- ```bash
113
- canva apps create "My New App" --template="hello_world" --distribution="public" --git --installDependencies
114
- ```
206
+ - `create "app-name"`: Create a new Canva app.
115
207
 
116
- - **Arguments**:
117
- - `[name]`: Sets the app's name. Provide the desired name of the app when using this command.
118
- - **Flags**:
208
+ ```shell
209
+ canva apps create "My New App" --template="hello_world" --distribution="public" --git --installDependencies
210
+ ```
119
211
 
120
- - `--template`: Specifies the starting template for the app.
212
+ - **Arguments**:
213
+ - `--name`: Sets the app's name. Provide the name you want for the app.
214
+ - **Flags**:
121
215
 
122
- Available templates:
216
+ - `--template`: Specifies the starting template for the app.
123
217
 
124
- - `"hello_world"`: Basic starting point.
125
- - `"dam"`: Digital asset management integration.
126
- - `"gen_ai"`: Generative AI app creation.
218
+ Available templates:
127
219
 
128
- - `--distribution`: Sets the app's distribution type.
220
+ - `"hello_world"`: Basic starting point.
221
+ - `"dam"`: Digital asset management integration.
222
+ - `"gen_ai"`: Generative AI app creation.
129
223
 
130
- Options:
224
+ - `--distribution`: Sets the app's distribution type.
131
225
 
132
- - `"public"`: Available to all Canva users, subject to Canva review.
133
- - `"private"`: Only available to your team, requires team admin approval.
226
+ Available types:
134
227
 
135
- > [!Note]
136
- > This setting cannot be changed after the app is created.
228
+ - `"public"`: Available to all Canva users, subject to Canva review.
229
+ - `"private"`: Only available to your team, and requires team admin approval.
137
230
 
138
- - `--git`: Initializes a Git repository in the project directory.
231
+ **Note**: You can't change the distribution setting after creating a new app with the `canva apps create` command.
139
232
 
140
- - `--installDependencies`: Automatically installs necessary npm dependencies.
233
+ - `--git`: Initializes a Git repository in the project directory.
141
234
 
142
- - `list`: List all Canva apps.
235
+ - `--installDependencies`: Automatically installs necessary npm dependencies during the app creation process.
143
236
 
144
- - **Usage**:
237
+ - `list`: List all Canva apps.
145
238
 
146
- ```bash
239
+ ```shell
147
240
  canva apps list
148
241
  ```
149
242
 
150
243
  #### logout
151
244
 
152
- Log out and revoke access from the CLI.
153
-
154
- - **Usage**:
245
+ Log out and revoke Canva CLI access.
155
246
 
156
- ```bash
157
- canva logout
158
- ```
247
+ ```shell
248
+ canva logout
249
+ ```
159
250
 
160
251
  ## Next Steps
161
252
 
@@ -164,43 +255,20 @@ Log out and revoke access from the CLI.
164
255
 
165
256
  ## Limitations
166
257
 
167
- Once an app is created, it must be managed through Canva's [Developer Portal](https://www.canva.com/developers/apps) and cannot be fully managed via the CLI.
258
+ You must manage your new app created through the Canva CLI through the [Developer Portal](https://www.canva.com/developers/apps). You can't manage apps completely through the Canva CLI.
168
259
 
169
- ## Updating
260
+ ## Updates
170
261
 
171
262
  To update the CLI to the latest version, run:
172
263
 
173
- ```bash
174
- npm update -g @canva/cli
264
+ ```shell
265
+ npm update -g @canva/cli@latest
175
266
  ```
176
267
 
177
- ## Token Storage and Removal
178
-
179
- When you log in using the `canva login` command, the Auth token is encrypted and stored locally on your machine. This token is used to authenticate future requests made by the CLI, so you don’t have to log in repeatedly.
180
-
181
- ### Token Location
182
-
183
- The token is stored in a credentials file located in your home directory under the `.canva-cli` folder:
184
-
185
- ### Removing the Token
186
-
187
- To remove the token and log out of the CLI, you can either:
188
-
189
- 1. Use the `canva logout` command to revoke access and delete the stored token:
190
-
191
- ```bash
192
- canva logout
193
- ```
194
-
195
- 2. Manually delete the credentials file:
196
-
197
- - **macOS/Linux**: The token is stored in `~/.canva-cli/credentials`.
198
- - **Windows**: The token is stored in `%USERPROFILE%\.canva-cli\credentials`.
199
-
200
- ## Contributing
268
+ ## Contributions
201
269
 
202
- We're in active development and currently do not accept third-party contributions. Please submit any feature requests through the [Canva Developers Community](https://community.canva.dev/).
270
+ Currently the Canva CLI doesn't accept third-party contributions. Please submit any feature requests through the [Canva Developers Community](https://community.canva.dev/).
203
271
 
204
272
  ## License
205
273
 
206
- Refer to the `LICENSE.md` file for licensing details.
274
+ Refer to the `LICENSE.md` file for more information.