@google/clasp 2.4.2 → 3.0.0-alpha1

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.
Files changed (149) hide show
  1. package/README.md +253 -196
  2. package/build/src/auth/auth.js +176 -0
  3. package/build/src/auth/auth_code_flow.js +36 -0
  4. package/build/src/auth/credential_store.js +1 -0
  5. package/build/src/auth/file_credential_store.js +82 -0
  6. package/build/src/auth/localhost_auth_code_flow.js +62 -0
  7. package/build/src/auth/serverless_auth_code_flow.js +32 -0
  8. package/build/src/commands/clone-script.js +71 -0
  9. package/build/src/commands/create-deployment.js +33 -0
  10. package/build/src/commands/create-script.js +75 -0
  11. package/build/src/commands/create-version.js +31 -0
  12. package/build/src/commands/delete-deployment.js +71 -0
  13. package/build/src/commands/disable-api.js +19 -0
  14. package/build/src/commands/enable-api.js +31 -0
  15. package/build/src/commands/list-apis.js +23 -0
  16. package/build/src/commands/list-deployments.js +30 -0
  17. package/build/src/commands/list-scripts.js +28 -0
  18. package/build/src/commands/list-versions.js +29 -0
  19. package/build/src/commands/login.js +54 -53
  20. package/build/src/commands/logout.js +15 -15
  21. package/build/src/commands/open-apis.js +11 -0
  22. package/build/src/commands/open-container.js +15 -0
  23. package/build/src/commands/open-credentials.js +11 -0
  24. package/build/src/commands/open-logs.js +11 -0
  25. package/build/src/commands/open-script.js +18 -0
  26. package/build/src/commands/open-webapp.js +56 -0
  27. package/build/src/commands/program.js +108 -0
  28. package/build/src/commands/pull.js +19 -18
  29. package/build/src/commands/push.js +64 -74
  30. package/build/src/commands/run-function.js +61 -0
  31. package/build/src/commands/setup-logs.js +12 -0
  32. package/build/src/commands/show-authorized-user.js +18 -0
  33. package/build/src/commands/show-file-status.js +34 -0
  34. package/build/src/commands/tail-logs.js +92 -0
  35. package/build/src/commands/utils.js +82 -0
  36. package/build/src/constants.js +0 -3
  37. package/build/src/{apis.js → core/apis.js} +90 -92
  38. package/build/src/core/clasp.js +171 -0
  39. package/build/src/core/files.js +359 -0
  40. package/build/src/core/functions.js +51 -0
  41. package/build/src/core/logs.js +41 -0
  42. package/build/src/core/manifest.js +1 -0
  43. package/build/src/core/project.js +313 -0
  44. package/build/src/core/services.js +179 -0
  45. package/build/src/core/utils.js +121 -0
  46. package/build/src/index.js +16 -354
  47. package/build/src/intl.js +34 -0
  48. package/docs/README.md +1 -4
  49. package/docs/config-files.md +4 -5
  50. package/docs/run.md +26 -7
  51. package/package.json +87 -51
  52. package/CHANGELOG.md +0 -66
  53. package/build/src/apis.d.ts +0 -34
  54. package/build/src/apis.js.map +0 -1
  55. package/build/src/apiutils.d.ts +0 -16
  56. package/build/src/apiutils.js +0 -81
  57. package/build/src/apiutils.js.map +0 -1
  58. package/build/src/auth.d.ts +0 -34
  59. package/build/src/auth.js +0 -295
  60. package/build/src/auth.js.map +0 -1
  61. package/build/src/clasp-error.d.ts +0 -3
  62. package/build/src/clasp-error.js +0 -10
  63. package/build/src/clasp-error.js.map +0 -1
  64. package/build/src/commands/apis.d.ts +0 -10
  65. package/build/src/commands/apis.js +0 -91
  66. package/build/src/commands/apis.js.map +0 -1
  67. package/build/src/commands/clone.d.ts +0 -13
  68. package/build/src/commands/clone.js +0 -59
  69. package/build/src/commands/clone.js.map +0 -1
  70. package/build/src/commands/create.d.ts +0 -16
  71. package/build/src/commands/create.js +0 -81
  72. package/build/src/commands/create.js.map +0 -1
  73. package/build/src/commands/default.d.ts +0 -8
  74. package/build/src/commands/default.js +0 -10
  75. package/build/src/commands/default.js.map +0 -1
  76. package/build/src/commands/deploy.d.ts +0 -13
  77. package/build/src/commands/deploy.js +0 -51
  78. package/build/src/commands/deploy.js.map +0 -1
  79. package/build/src/commands/deployments.d.ts +0 -5
  80. package/build/src/commands/deployments.js +0 -29
  81. package/build/src/commands/deployments.js.map +0 -1
  82. package/build/src/commands/list.d.ts +0 -9
  83. package/build/src/commands/list.js +0 -34
  84. package/build/src/commands/list.js.map +0 -1
  85. package/build/src/commands/login.d.ts +0 -14
  86. package/build/src/commands/login.js.map +0 -1
  87. package/build/src/commands/logout.d.ts +0 -5
  88. package/build/src/commands/logout.js.map +0 -1
  89. package/build/src/commands/logs.d.ts +0 -17
  90. package/build/src/commands/logs.js +0 -181
  91. package/build/src/commands/logs.js.map +0 -1
  92. package/build/src/commands/open.d.ts +0 -15
  93. package/build/src/commands/open.js +0 -89
  94. package/build/src/commands/open.js.map +0 -1
  95. package/build/src/commands/pull.d.ts +0 -10
  96. package/build/src/commands/pull.js.map +0 -1
  97. package/build/src/commands/push.d.ts +0 -11
  98. package/build/src/commands/push.js.map +0 -1
  99. package/build/src/commands/run.d.ts +0 -14
  100. package/build/src/commands/run.js +0 -130
  101. package/build/src/commands/run.js.map +0 -1
  102. package/build/src/commands/setting.d.ts +0 -8
  103. package/build/src/commands/setting.js +0 -53
  104. package/build/src/commands/setting.js.map +0 -1
  105. package/build/src/commands/status.d.ts +0 -9
  106. package/build/src/commands/status.js +0 -25
  107. package/build/src/commands/status.js.map +0 -1
  108. package/build/src/commands/undeploy.d.ts +0 -9
  109. package/build/src/commands/undeploy.js +0 -55
  110. package/build/src/commands/undeploy.js.map +0 -1
  111. package/build/src/commands/version.d.ts +0 -5
  112. package/build/src/commands/version.js +0 -22
  113. package/build/src/commands/version.js.map +0 -1
  114. package/build/src/commands/versions.d.ts +0 -5
  115. package/build/src/commands/versions.js +0 -41
  116. package/build/src/commands/versions.js.map +0 -1
  117. package/build/src/conf.d.ts +0 -40
  118. package/build/src/conf.js +0 -100
  119. package/build/src/conf.js.map +0 -1
  120. package/build/src/constants.d.ts +0 -6
  121. package/build/src/constants.js.map +0 -1
  122. package/build/src/dotfile.d.ts +0 -50
  123. package/build/src/dotfile.js +0 -71
  124. package/build/src/dotfile.js.map +0 -1
  125. package/build/src/files.d.ts +0 -70
  126. package/build/src/files.js +0 -318
  127. package/build/src/files.js.map +0 -1
  128. package/build/src/index.d.ts +0 -18
  129. package/build/src/index.js.map +0 -1
  130. package/build/src/inquirer.d.ts +0 -82
  131. package/build/src/inquirer.js +0 -111
  132. package/build/src/inquirer.js.map +0 -1
  133. package/build/src/manifest.d.ts +0 -123
  134. package/build/src/manifest.js +0 -142
  135. package/build/src/manifest.js.map +0 -1
  136. package/build/src/messages.d.ts +0 -110
  137. package/build/src/messages.js +0 -161
  138. package/build/src/messages.js.map +0 -1
  139. package/build/src/urls.d.ts +0 -21
  140. package/build/src/urls.js +0 -33
  141. package/build/src/urls.js.map +0 -1
  142. package/build/src/utils.d.ts +0 -102
  143. package/build/src/utils.js +0 -232
  144. package/build/src/utils.js.map +0 -1
  145. package/docs/develop.md +0 -81
  146. package/docs/esmodules.md +0 -81
  147. package/docs/running-locally.md +0 -31
  148. package/docs/settings.md +0 -56
  149. package/docs/typescript.md +0 -354
package/README.md CHANGED
@@ -46,15 +46,6 @@ You can also try clasp in Gitpod, a one-click online IDE for GitHub:
46
46
  - `slides.js`
47
47
  - `sheets.js`
48
48
 
49
- **🔷 Write Apps Script in TypeScript:** Write your Apps Script projects using TypeScript features:
50
-
51
- - Arrow functions
52
- - Optional structural typing
53
- - Classes
54
- - Type inference
55
- - Interfaces
56
- - [And more…](docs/typescript.md)
57
-
58
49
  **➡️ Run Apps Script:** Execute your Apps Script from the command line. Features:
59
50
 
60
51
  - _Instant_ deployment.
@@ -62,12 +53,6 @@ You can also try clasp in Gitpod, a one-click online IDE for GitHub:
62
53
  - Easily add custom Google OAuth scopes
63
54
  - [And more…](docs/run.md)
64
55
 
65
- **- V8 support** take advantage of the performance boost of Chrome JavaScript engine:
66
-
67
- - Every ES2019 features (except ES modules)
68
- - Edit your `appsscript.json` manifest to choose between the **Rhino** and **V8** engines
69
- - Typescript users should update their `tsconfig.json` with the `"target": "ES2019"` compiler option
70
-
71
56
  ## Install
72
57
 
73
58
  First download `clasp`:
@@ -90,54 +75,230 @@ The following command provide basic Apps Script project management.
90
75
  clasp
91
76
  ```
92
77
 
93
- - [`clasp login [--no-localhost] [--creds <file>] [--status]`](#login)
78
+ - [`clasp login [--no-localhost] [--creds <file>] [--redirect-port]`](#login)
94
79
  - [`clasp logout`](#logout)
95
- - [`clasp create [--title <title>] [--type <type>] [--rootDir <dir>] [--parentId <id>]`](#create)
96
- - [`clasp clone <scriptId | scriptURL> [versionNumber] [--rootDir <dir>]`](#clone)
80
+ - [`clasp create-script [--title <title>] [--type <type>] [--rootDir <dir>] [--parentId <id>]`](#create)
81
+ - [`clasp clone-script <scriptId | scriptURL> [versionNumber] [--rootDir <dir>]`](#clone)
97
82
  - [`clasp pull [--versionNumber]`](#pull)
98
83
  - [`clasp push [--watch] [--force]`](#push)
99
84
  - [`clasp status [--json]`](#status)
100
- - [`clasp open [scriptId] [--webapp] [--creds] [--addon] [--deploymentId <id>]`](#open)
101
- - [`clasp deployments`](#deployments)
102
- - [`clasp deploy [--versionNumber <version>] [--description <description>] [--deploymentId <id>]`](#deploy)
103
- - [`clasp undeploy [deploymentId] [--all]`](#undeploy)
104
- - [`clasp version [description]`](#version)
105
- - [`clasp versions`](#versions)
106
- - [`clasp list`](#list)
85
+ - [`clasp open-script](#open)
86
+ - [`clasp list-deployments`](#deployments)
87
+ - [`clasp create-deployment [--versionNumber <version>] [--description <description>] [--deploymentId <id>]`](#deploy)
88
+ - [`clasp delete-deployment [deploymentId] [--all]`](#undeploy)
89
+ - [`clasp create-version [description]`](#version)
90
+ - [`clasp list-versions`](#versions)
91
+ - [`clasp list-scripts`](#list)
107
92
 
108
93
  ### Advanced Commands
109
94
 
110
95
  > **NOTE**: These commands require you to add your [Project ID](#projectid-optional).
111
96
 
112
- - [`clasp logs [--json] [--open] [--setup] [--watch] [--simplified]`](#logs)
113
- - [`clasp apis list`](#apis)
114
- - [`clasp apis enable <api>`](#apis)
115
- - [`clasp apis disable <api>`](#apis)
116
- - [`clasp setting <key> [value]`](#setting)
97
+ - [`clasp tail-logs [--json] [--open] [--setup] [--watch] [--simplified]`](#logs)
98
+ - [`clasp list-apis`](#apis)
99
+ - [`clasp enable-api<api>`](#apis)
100
+ - [`clasp disable-api <api>`](#apis)
101
+ - [`clasp run-function [function]`](#clas-run)
117
102
 
118
- #### Clasp Run
103
+ ## Guides
119
104
 
120
- > **NOTE**: This command requires you to [bring your own Google API credentials](/docs/run.md).
105
+ ### Migrating from 2.x to 3.x
106
+
107
+ #### Drop typescript support
108
+
109
+ Clasp no longer transpiles typescript code. For typescript projects, use typescript with a bundler like [Rollup](https://rollupjs.org/) to transform code prior to pushing with clasp. This has the advantage of offering more
110
+ robust support for Typescript features along with ESM module and NPM package support.
111
+
112
+ There are several template projects on GitHub that show how to transform Typescript code into Apps Script that are all excellent choices.
113
+
114
+ * https://github.com/sqrrrl/apps-script-typescript-rollup-starter
115
+ * https://github.com/WildH0g/apps-script-engine-template
116
+ * https://github.com/tomoyanakano/clasp-typescript-template
117
+
118
+
119
+ #### Command renames
120
+
121
+ Clasp 3.x introdces some breaking changes from 2.x. For common use cases these changes should not impact usage, but some lesser used commands have been restructured and renamed to improve consistency.
122
+
123
+ | 2.x | 3.x |
124
+ |----------------------------|----------------------------------------|
125
+ |open | open-script |
126
+ |open --web | open-web-app |
127
+ |open --addon | open-container |
128
+ |open --creds | open-credentials-setup |
129
+ |login --creds <file> | login -u <name> --creds <file> |
130
+ |logs --open | open-logs |
131
+ |logs --setup | N/A |
132
+ |apis --open | open-api-console |
133
+ |apis enable <api> | enable-api <api> |
134
+ |apis disable <api> | disable-api <api> |
135
+ |settings | N/A |
136
+ |----------------------------|----------------------------------------|
137
+
138
+ Other commands have also been renamed but retain aliases for compatibility.
139
+
140
+ ### Authorization
141
+
142
+ Most command require user authorization. Run `clasp login` to authorize access to manage your scripts.
143
+
144
+ #### Multiple user support
145
+
146
+ Use the global `--user` option to switch between accounts. THis support both running clasp as different users as well as when invoking the `clasp run-function` command.
147
+
148
+ Examples:
149
+
150
+ ```sh
151
+ clasp login # Saves as default credentials
152
+ clasp clone # User not specified, runs using default credentials
153
+ clasp login --user testaccount # Authorized new named credentials
154
+ claso run-function --user testaccount myFunction # Runs function as test account
155
+ ```
156
+
157
+ ### Bring your own project/credentials
158
+
159
+ While clasp includes a default OAuth client, using your own project is recommend and can improve security and compliance in environments that limit which third party applications users may authorize. To set up your own project:
160
+
161
+ 1. [Create a new project](https://cloud.google.com/resource-manager/docs/creating-managing-projects) in the Google Cloud Developer Console.
162
+ 1. [Create an OAuth client](https://support.google.com/cloud/answer/15549257?hl=en#:~:text=To%20create%20an%20OAuth%202.0,are%20yet%20to%20do%20so.). The client type must be `Desktop Application`. Download and save the generated client secrets file. This is required when authorizing using the`clasp login --creds <filename>` command.
163
+ 1. [Enable services](https://cloud.google.com/endpoints/docs/openapi/enable-api). For full functionaliy, clasp requires the following:
164
+ * Apps SCript API - `script.googleapis.com` (required)
165
+ * Service Usage API - `serviceusage.googleapis.com` (require to list/enable/disable APIs)
166
+ * Google Drive API - `drive.googleapis.com` (required to list scripts, create container-bound scripts)
167
+ - Cloud Logging API - `logging.googleapis.com` (required to read logs)
168
+
169
+
170
+ Note: If configuring the project for external use where OAuth scopes must be registered, include the following:
171
+
172
+ ```
173
+ https://www.googleapis.com/auth/script.deployments
174
+ https://www.googleapis.com/auth/script.projects
175
+ https://www.googleapis.com/auth/script.webapp.deploy
176
+ https://www.googleapis.com/auth/drive.metadata.readonly
177
+ https://www.googleapis.com/auth/drive.file
178
+ https://www.googleapis.com/auth/service.management
179
+ https://www.googleapis.com/auth/logging.read
180
+ https://www.googleapis.com/auth/userinfo.email
181
+ https://www.googleapis.com/auth/userinfo.profile
182
+ https://www.googleapis.com/auth/cloud-platform
183
+ ```
184
+
185
+ ### Service accounts
186
+
187
+ Use the `--adc` option on any command to read credentials from the environemtn using Google Cloud's [application default credentials](https://cloud.google.com/docs/authentication/application-default-credentials) mechanism.
188
+
189
+ Note that if using a service account, service accounts can not own scripts. To use a service account to push or pull files from Apps Script, the scripts must be shared with the service account with the appropriate role (e.g. `Editor` in able to push.)
190
+
191
+
192
+ ### Ignore File (`.claspignore`)
193
+
194
+ Like `.gitignore`, `.claspignore` allows you to ignore files that you do not wish to upload on `clasp push`. Steps:
195
+
196
+ 1. Create a file called `.claspignore` in your project's root directory.
197
+ 1. Add patterns to be excluded from `clasp push`. _Note_: The `.claspignore` patterns are applied by [multimatch](https://github.com/sindresorhus/multimatch), which is different from `.gitignore`, especially for directories. To ignore a directory, use syntax like `**/node_modules/**`.
198
+
199
+ A sample `.claspignore` ignoring everything except the manifest and `build/main.js`:
200
+
201
+ ```text
202
+ **/**
203
+ !build/main.js
204
+ !appsscript.json
205
+ ```
206
+
207
+ _Note_: The `.claspignore` patterns are applied relative from the `rootDir`.
208
+
209
+ If no `.claspignore` is specified, a default set of patterns is applied. This default set will only consider the `appsscript.json` manifest and any JavaScript, TypeScript and `.html` source files within the `rootDir` folder. Child folders other than `.git` and `node_modules` are processed.
210
+
211
+ ```text
212
+ # ignore all files…
213
+ **/**
214
+
215
+ # except the extensions…
216
+ !appsscript.json
217
+ !**/*.gs
218
+ !**/*.js
219
+ !**/*.ts
220
+ !**/*.html
221
+
222
+ # ignore even valid files if in…
223
+ .git/**
224
+ node_modules/**
225
+ ```
226
+
227
+ ## Project Settings File (`.clasp.json`)
228
+
229
+ When running `clone` or `create`, a file named `.clasp.json` is created in the current directory to describe `clasp`'s configuration for the current project. Example `.clasp.json`:
230
+
231
+ ```json
232
+ {
233
+ "scriptId": "",
234
+ "rootDir": "build/",
235
+ "projectId": "project-id-xxxxxxxxxxxxxxxxxxx",
236
+ "fileExtension": "ts",
237
+ "filePushOrder": ["file1.ts", "file2.ts"]
238
+ }
239
+ ```
240
+
241
+ The following configuration values can be used:
242
+
243
+ ### `scriptId` (required)
244
+
245
+ Specifies the id of the Google Script project that clasp will target.
246
+
247
+ 1. Open script url.
248
+ 1. File > Project properties > Script ID
249
+
250
+
251
+ ### `rootDir` (optional)
252
+
253
+ Specifies the **local** directory in which clasp will store your project files. If not specified, clasp will default to the current directory.
254
+
255
+ ### `projectId` (optional)
256
+
257
+ Specifies the id of the Google Cloud Platform project that clasp will target.
258
+ You must [associate Google Script project with Google Cloud Platform](https://github.com/google/clasp/blob/master/docs/run.md#setup-instructions) beforehand.
259
+
260
+ 1. Run `clasp open`.
261
+ 1. Click `Resources > Cloud Platform project...`.
262
+ 1. Specify the project ID `project-id-xxxxxxxxxxxxxxxxxxx`.
263
+
264
+ Even if you do not set this manually, clasp will ask this via a prompt to you at the required time.
265
+
266
+ ### `fileExtension` (optional)
267
+
268
+ Specifies the file extension for **local** script files in your Apps Script project.
269
+
270
+ ### `filePushOrder` (optional)
271
+
272
+ Specifies the files that should be pushed first, useful for scripts that rely on order of execution. All other files are pushed after this list of files.
121
273
 
122
- - [`clasp run [functionName] [--nondev] [--params <StringArray>]`](#run)
123
274
 
124
275
  ## Reference
125
276
 
277
+ ### Global options
278
+
279
+ - `--user <name>`: Uses credentials stored under the named key. When omitted, the `default` user is used.
280
+ - `--adc`: Uses application default credentials from the environment. Intended to support service accounts in CI workflows.
281
+ - `--project <file>`: Reads project settings from a file other than `.clasp.json`. Intended to support multiple deployment targets.
282
+ - `--auth <file>`: (**DEPRECATED**) Reads credentials from a file other than `.clasprc.json`. Use the `--user` option to maintain multiple authorized accounts.
283
+ - `--ignore <file>`: Reads ignore patterns from a file other than `.claspignore`.
284
+
126
285
  ### Login
127
286
 
128
- Logs the user in. Saves the client credentials to a `.clasprc.json` file.
287
+ Logs the user in. Saves the client credentials to a `.clasprc.json` file in the user's home directory
129
288
 
130
289
  #### Options
131
290
 
132
291
  - `--no-localhost`: Do not run a local server, manually enter code instead.
133
292
  - `--creds <file>`: Use custom credentials used for `clasp run`. Saves a `.clasprc.json` file to current working directory. This file should be private!
134
293
  - `--status`: Print who you are currently logged in as, if anyone.
294
+ - `--redirect-port <port>`: Specify a custom port for the local redirect server during the login process. Useful for environments where a specific port is required.
135
295
 
136
296
  #### Examples
137
297
 
298
+ - `clasp login`
138
299
  - `clasp login --no-localhost`
139
- - `clasp login --creds creds.json`
140
- - `clasp login --status`
300
+ - `clasp login --user test-user --creds client_secret.json`
301
+ - `clasp login --redirect-port 37473`
141
302
 
142
303
  ### Logout
143
304
 
@@ -162,21 +323,21 @@ Creates a new script project. Prompts the user for the script type if not specif
162
323
 
163
324
  #### Examples
164
325
 
165
- - `clasp create`
166
- - `clasp create --type standalone` (default)
167
- - `clasp create --type docs`
168
- - `clasp create --type sheets`
169
- - `clasp create --type slides`
170
- - `clasp create --type forms`
171
- - `clasp create --type webapp`
172
- - `clasp create --type api`
173
- - `clasp create --title "My Script"`
174
- - `clasp create --rootDir ./dist`
175
- - `clasp create --parentId "1D_Gxyv*****************************NXO7o"`
326
+ - `clasp create-script`
327
+ - `clasp create-script --type standalone` (default)
328
+ - `clasp create-script --type docs`
329
+ - `clasp create-script --type sheets`
330
+ - `clasp create-script --type slides`
331
+ - `clasp create-script --type forms`
332
+ - `clasp create-script --type webapp`
333
+ - `clasp create-script --type api`
334
+ - `clasp create-script --title "My Script"`
335
+ - `clasp create-script --rootDir ./dist`
336
+ - `clasp create-script --parentId "1D_Gxyv*****************************NXO7o"`
176
337
 
177
338
  These options can be combined like so:
178
339
 
179
- - `clasp create --title "My Script" --parentId "1D_Gxyv*****************************NXO7o" --rootDir ./dist`
340
+ - `clasp create-script --title "My Script" --parentId "1D_Gxyv*****************************NXO7o" --rootDir ./dist`
180
341
 
181
342
  ### Clone
182
343
 
@@ -190,9 +351,9 @@ Clones the script project from script.google.com.
190
351
 
191
352
  #### Examples
192
353
 
193
- - `clasp clone "15ImUCpyi1Jsd8yF8Z6wey_7cw793CymWTLxOqwMka3P1CzE5hQun6qiC"`
194
- - `clasp clone "https://script.google.com/d/15ImUCpyi1Jsd8yF8Z6wey_7cw793CymWTLxOqwMka3P1CzE5hQun6qiC/edit"`
195
- - `clasp clone "15ImUCpyi1Jsd8yF8Z6wey_7cw793CymWTLxOqwMka3P1CzE5hQun6qiC" --rootDir ./src`
354
+ - `clasp clone-script "15ImUCpyi1Jsd8yF8Z6wey_7cw793CymWTLxOqwMka3P1CzE5hQun6qiC"`
355
+ - `clasp clone-script "https://script.google.com/d/15ImUCpyi1Jsd8yF8Z6wey_7cw793CymWTLxOqwMka3P1CzE5hQun6qiC/edit"`
356
+ - `clasp clone-script "15ImUCpyi1Jsd8yF8Z6wey_7cw793CymWTLxOqwMka3P1CzE5hQun6qiC" --rootDir ./src`
196
357
 
197
358
  ### Pull
198
359
 
@@ -247,29 +408,20 @@ Ignores files:
247
408
 
248
409
  #### Examples
249
410
 
250
- - `clasp status`
251
- - `clasp status --json`
411
+ - `clasp show-file-status`
412
+ - `clasp show-file-status --json`
252
413
 
253
414
  ### Open
254
415
 
255
- Opens the current directory's `clasp` project on script.google.com. Provide a `scriptId` to open a different script. Can also open web apps.
256
-
257
- #### Options
416
+ Clasp offers several commands to opens the current directory's `clasp` project and related resources.
258
417
 
259
- - `[scriptId]`: The optional script project to open.
260
- - `--webapp`: Open web application in a browser.
261
- - `--creds`: Open the URL to create credentials.
262
- - `--addon`: List parent IDs and open the URL of the first one.
263
- - `--deploymentId <id>`: Use custom deployment ID with `--webapp`.
264
418
 
265
419
  #### Examples
266
420
 
267
- - `clasp open`
268
- - `clasp open "15ImUCpyi1Jsd8yF8Z6wey_7cw793CymWTLxOqwMka3P1CzE5hQun6qiC"`
269
- - `clasp open --webapp`
270
- - `clasp open --creds`
271
- - `clasp open --addon`
272
- - `clasp open --webapp --deploymentId abcd1234`
421
+ - `clasp open-script`
422
+ - `clasp open-web-app`
423
+ - `clasp open-container`
424
+ - `clasp open-credentials-setup`
273
425
 
274
426
  ### Deployments
275
427
 
@@ -277,7 +429,7 @@ List deployments of a script.
277
429
 
278
430
  #### Examples
279
431
 
280
- - `clasp deployments`
432
+ - `clasp list-deployments`
281
433
 
282
434
  ### Deploy
283
435
 
@@ -295,11 +447,11 @@ To update/redeploy an existing deployment, provide the deployment ID.
295
447
 
296
448
  #### Examples
297
449
 
298
- - `clasp deploy` (create new deployment and new version)
299
- - `clasp deploy --versionNumber 4` (create new deployment)
300
- - `clasp deploy --description "Updates sidebar logo."` (deploy with description)
301
- - `clasp deploy --deploymentId abcd1234` (redeploy and create new version)
302
- - `clasp deploy -V 7 -d "Updates sidebar logo." -i abdc1234`
450
+ - `clasp create-deployment` (create new deployment and new version)
451
+ - `clasp create-deployment --versionNumber 4` (create new deployment)
452
+ - `clasp create-deployment --description "Updates sidebar logo."` (deploy with description)
453
+ - `clasp create-deployment --deploymentId abcd1234` (redeploy and create new version)
454
+ - `clasp create-deployment -V 7 -d "Updates sidebar logo." -i abdc1234`
303
455
 
304
456
  ### Undeploy
305
457
 
@@ -312,9 +464,9 @@ Undeploys a deployment of a script.
312
464
 
313
465
  #### Examples
314
466
 
315
- - `clasp undeploy` (undeploy the last deployment.)
316
- - `clasp undeploy "123"`
317
- - `clasp undeploy --all`
467
+ - `clasp delete-deployment` (prompts for deployment or deletes if only one)
468
+ - `clasp delete-deployment "123"`
469
+ - `clasp delete-deployment --all`
318
470
 
319
471
  ### Version
320
472
 
@@ -326,8 +478,8 @@ Creates an immutable version of the script.
326
478
 
327
479
  #### Examples
328
480
 
329
- - `clasp version`
330
- - `clasp version "Bump the version."`
481
+ - `clasp create-version`
482
+ - `clasp create-version "Bump the version."`
331
483
 
332
484
  ### Versions
333
485
 
@@ -335,7 +487,7 @@ List versions of a script.
335
487
 
336
488
  #### Examples
337
489
 
338
- - `clasp versions`
490
+ - `clasp list-versions`
339
491
 
340
492
  ### List
341
493
 
@@ -343,7 +495,7 @@ Lists your most recent Apps Script projects.
343
495
 
344
496
  #### Examples
345
497
 
346
- - `clasp list`: Prints `helloworld1 – xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ...`
498
+ - `clasp list-scripts`: Prints `helloworld1 – xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ...`
347
499
 
348
500
  ## Advanced Commands
349
501
 
@@ -356,8 +508,6 @@ Prints out most recent the _StackDriver logs_. These are logs from `console.log`
356
508
  #### Options
357
509
 
358
510
  - `--json`: Output logs in json format.
359
- - `--open`: Open StackDriver logs in a browser.
360
- - `--setup`: Setup StackDriver logs.
361
511
  - `--watch`: Retrieves the newest logs every 5 seconds.
362
512
  - `--simplified`: Removes timestamps from the logs.
363
513
 
@@ -370,7 +520,6 @@ INFO Sat Apr 07 2019 10:58:31 GMT-0700 (PDT) myFunction info message
370
520
  ```
371
521
 
372
522
  - `clasp logs --json`
373
- - `clasp logs --open`
374
523
  - `clasp logs --watch`
375
524
  - `clasp logs --simplified`
376
525
 
@@ -400,8 +549,8 @@ Below is a short summary:
400
549
 
401
550
  #### Examples
402
551
 
403
- - `clasp run 'sendEmail'`
404
- - `clasp run 'addOptions' -p '["string", 123, {"test": "for"}, true]'`
552
+ - `clasp run-function 'sendEmail'`
553
+ - `clasp run-function 'addOptions' -p '["string", 123, {"test": "for"}, true]'`
405
554
 
406
555
  ### List/Enable/Disable Google APIs
407
556
 
@@ -411,8 +560,8 @@ List available APIs. Enables and disables Google APIs.
411
560
 
412
561
  Lists Google APIs that can be enabled as [Advanced Services](https://developers.google.com/apps-script/guides/services/advanced).
413
562
 
414
- - `clasp apis`
415
- - `clasp apis list`
563
+ - `clasp list-apis`
564
+ - `clasp list-apis`
416
565
 
417
566
  #### Enable/Disable APIs
418
567
 
@@ -420,14 +569,14 @@ Enables or disables APIs with the Google Cloud project. These APIs are used via
420
569
 
421
570
  The API name can be found using `clasp apis list`.
422
571
 
423
- - `clasp apis enable drive`
424
- - `clasp apis disable drive`
572
+ - `clasp enable-api drive`
573
+ - `clasp disable-api drive`
425
574
 
426
575
  #### Open APIs Console
427
576
 
428
577
  Open the Google Cloud Console where you can view and manage API access.
429
578
 
430
- - `clasp apis --open`
579
+ - `clasp open-api-console`
431
580
 
432
581
  ### Help
433
582
 
@@ -438,113 +587,17 @@ Displays the help function.
438
587
  - `clasp`
439
588
  - `clasp help`
440
589
 
441
- ### Setting
442
-
443
- Update `.clasp.json` settings file.
444
-
445
- If `settingKey` is omitted it prints the current settings.
446
- If `newValue` is omitted it returns the current setting value.
447
-
448
- #### Options
449
-
450
- - `settingKey`: settingKey They key in `.clasp.json` you want to change
451
- - `newValue`: newValue The new value for the setting
452
-
453
- #### Examples
454
-
455
- - `clasp setting`
456
- - `clasp setting scriptId`
457
- - `clasp setting scriptId new-id`
458
-
459
- ## Guides
460
-
461
- ### Ignore File (`.claspignore`)
462
-
463
- Like `.gitignore`, `.claspignore` allows you to ignore files that you do not wish to not upload on `clasp push`. Steps:
464
-
465
- 1. Create a file called `.claspignore` in your project's root directory.
466
- 1. Add patterns to be excluded from `clasp push`. _Note_: The `.claspignore` patterns are applied by [multimatch](https://github.com/sindresorhus/multimatch), which is different from `.gitignore`, especially for directories. To ignore a directory, use syntax like `**/node_modules/**`.
467
-
468
- A sample `.claspignore` ignoring everything except the manifest and `build/main.js`:
469
-
470
- ```text
471
- **/**
472
- !build/main.js
473
- !appsscript.json
474
- ```
475
-
476
- _Note_: The `.claspignore` patterns are applied relative from the `rootDir`.
477
-
478
- If no `.claspignore` is specified, a default set of patterns is applied. This default set will only consider the `appsscript.json` manifest and any JavaScript, TypeScript and `.html` source files within the `rootDir` folder. Child folders other than `.git` and `node_modules` are processed.
479
-
480
- ```text
481
- # ignore all files…
482
- **/**
483
-
484
- # except the extensions…
485
- !appsscript.json
486
- !**/*.gs
487
- !**/*.js
488
- !**/*.ts
489
- !**/*.html
490
-
491
- # ignore even valid files if in…
492
- .git/**
493
- node_modules/**
494
- ```
495
-
496
- ## Project Settings File (`.clasp.json`)
497
-
498
- When running `clone` or `create`, a file named `.clasp.json` is created in the current directory to describe `clasp`'s configuration for the current project. Example `.clasp.json`:
499
-
500
- ```json
501
- {
502
- "scriptId": "",
503
- "rootDir": "build/",
504
- "projectId": "project-id-xxxxxxxxxxxxxxxxxxx",
505
- "fileExtension": "ts",
506
- "filePushOrder": ["file1.ts", "file2.ts"]
507
- }
508
- ```
509
-
510
- The following configuration values can be used:
511
-
512
- ### `scriptId` (required)
513
-
514
- Specifies the id of the Google Script project that clasp will target.
515
-
516
- 1. Open script url.
517
- 1. File > Project properties > Script ID
518
-
519
-
520
- ### `rootDir` (optional)
521
-
522
- Specifies the **local** directory in which clasp will store your project files. If not specified, clasp will default to the current directory.
523
-
524
- ### `projectId` (optional)
525
-
526
- Specifies the id of the Google Cloud Platform project that clasp will target.
527
- You must [associate Google Script project with Google Cloud Platform](https://github.com/google/clasp/blob/master/docs/run.md#setup-instructions) beforehand.
528
-
529
- 1. Run `clasp open`.
530
- 1. Click `Resources > Cloud Platform project...`.
531
- 1. Specify the project ID `project-id-xxxxxxxxxxxxxxxxxxx`.
532
-
533
- Even if you do not set this manually, clasp will ask this via a prompt to you at the required time.
534
-
535
- ### `fileExtension` (optional)
536
-
537
- Specifies the file extension for **local** script files in your Apps Script project.
590
+ #### Clasp Run
538
591
 
539
- ### `filePushOrder` (optional)
592
+ > **NOTE**: This command requires you to [bring your own Google API credentials](/docs/run.md).
540
593
 
541
- Specifies the files that should be pushed first, useful for scripts that rely on order of execution. All other files are pushed after this list of files.
594
+ - [`clasp run-function [functionName] [--nondev] [--params <StringArray>]`](#run)
542
595
 
543
596
  ## Troubleshooting
544
597
 
545
598
  ### NodeJS Version
546
599
 
547
- The library requires **NodeJS version >= 12.20.0**.
600
+ The library requires **NodeJS version >= 22.0.0**.
548
601
 
549
602
  You can check your version of NodeJS with this command.
550
603
 
@@ -559,6 +612,16 @@ npm install -g npm # Update npm and npx
559
612
  npx n latest # use the n package to update node
560
613
  ```
561
614
 
615
+ ### Debugging & filing issues
616
+
617
+ Clasp uses the [debug](https://www.npmjs.com/package/debug) library for internal logging. If you encounter an issue and want to file a bug report, please include a log with debugging enabled. Enable debugging by setting the envionment variable `DEBUG=clasp:*`
618
+
619
+ Example:
620
+
621
+ ```sh
622
+ DEBUG=clasp:* clasp pull # Runs clasp with verbose debug output
623
+ ```
624
+
562
625
  ### Using a Proxy
563
626
 
564
627
  Clasp supports proxies via the Google APIs Node Module.
@@ -584,10 +647,4 @@ If you have a core feature or use-case you'd like to see, find a GitHub issue or
584
647
  create a detailed proposal of the use-case.
585
648
  PRs are very welcome! See the [issues](https://github.com/google/clasp/issues) (especially **good first issue** and **help wanted**).
586
649
 
587
- ### How to Submit a Pull Request
588
-
589
- 1. Look over the test cases in [test/test.ts](test/test.ts), try cases that the PR may affect.
590
- 1. Run [gts linter](https://github.com/google/gts): `npm run lint`.
591
- 1. Submit a pull request after testing your feature to make sure it works.
592
-
593
650
  ⚡ Powered by the [Apps Script API](https://developers.google.com/apps-script/api/).