@google/clasp 2.5.0 → 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 +251 -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 +53 -54
  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 -355
  47. package/build/src/intl.js +34 -0
  48. package/docs/README.md +0 -5
  49. package/docs/config-files.md +0 -1
  50. package/docs/run.md +2 -2
  51. package/package.json +86 -51
  52. package/CHANGELOG.md +0 -79
  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 -37
  59. package/build/src/auth.js +0 -310
  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 -90
  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 -60
  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 -15
  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 -364
  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 -94
  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,42 +75,216 @@ The following command provide basic Apps Script project management.
90
75
  clasp
91
76
  ```
92
77
 
93
- - [`clasp login [--no-localhost] [--creds <file>] [--status] [--redirect-port]`](#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
 
@@ -136,9 +295,9 @@ Logs the user in. Saves the client credentials to a `.clasprc.json` file.
136
295
 
137
296
  #### Examples
138
297
 
298
+ - `clasp login`
139
299
  - `clasp login --no-localhost`
140
- - `clasp login --creds creds.json`
141
- - `clasp login --status`
300
+ - `clasp login --user test-user --creds client_secret.json`
142
301
  - `clasp login --redirect-port 37473`
143
302
 
144
303
  ### Logout
@@ -164,21 +323,21 @@ Creates a new script project. Prompts the user for the script type if not specif
164
323
 
165
324
  #### Examples
166
325
 
167
- - `clasp create`
168
- - `clasp create --type standalone` (default)
169
- - `clasp create --type docs`
170
- - `clasp create --type sheets`
171
- - `clasp create --type slides`
172
- - `clasp create --type forms`
173
- - `clasp create --type webapp`
174
- - `clasp create --type api`
175
- - `clasp create --title "My Script"`
176
- - `clasp create --rootDir ./dist`
177
- - `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"`
178
337
 
179
338
  These options can be combined like so:
180
339
 
181
- - `clasp create --title "My Script" --parentId "1D_Gxyv*****************************NXO7o" --rootDir ./dist`
340
+ - `clasp create-script --title "My Script" --parentId "1D_Gxyv*****************************NXO7o" --rootDir ./dist`
182
341
 
183
342
  ### Clone
184
343
 
@@ -192,9 +351,9 @@ Clones the script project from script.google.com.
192
351
 
193
352
  #### Examples
194
353
 
195
- - `clasp clone "15ImUCpyi1Jsd8yF8Z6wey_7cw793CymWTLxOqwMka3P1CzE5hQun6qiC"`
196
- - `clasp clone "https://script.google.com/d/15ImUCpyi1Jsd8yF8Z6wey_7cw793CymWTLxOqwMka3P1CzE5hQun6qiC/edit"`
197
- - `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`
198
357
 
199
358
  ### Pull
200
359
 
@@ -249,29 +408,20 @@ Ignores files:
249
408
 
250
409
  #### Examples
251
410
 
252
- - `clasp status`
253
- - `clasp status --json`
411
+ - `clasp show-file-status`
412
+ - `clasp show-file-status --json`
254
413
 
255
414
  ### Open
256
415
 
257
- Opens the current directory's `clasp` project on script.google.com. Provide a `scriptId` to open a different script. Can also open web apps.
258
-
259
- #### Options
416
+ Clasp offers several commands to opens the current directory's `clasp` project and related resources.
260
417
 
261
- - `[scriptId]`: The optional script project to open.
262
- - `--webapp`: Open web application in a browser.
263
- - `--creds`: Open the URL to create credentials.
264
- - `--addon`: List parent IDs and open the URL of the first one.
265
- - `--deploymentId <id>`: Use custom deployment ID with `--webapp`.
266
418
 
267
419
  #### Examples
268
420
 
269
- - `clasp open`
270
- - `clasp open "15ImUCpyi1Jsd8yF8Z6wey_7cw793CymWTLxOqwMka3P1CzE5hQun6qiC"`
271
- - `clasp open --webapp`
272
- - `clasp open --creds`
273
- - `clasp open --addon`
274
- - `clasp open --webapp --deploymentId abcd1234`
421
+ - `clasp open-script`
422
+ - `clasp open-web-app`
423
+ - `clasp open-container`
424
+ - `clasp open-credentials-setup`
275
425
 
276
426
  ### Deployments
277
427
 
@@ -279,7 +429,7 @@ List deployments of a script.
279
429
 
280
430
  #### Examples
281
431
 
282
- - `clasp deployments`
432
+ - `clasp list-deployments`
283
433
 
284
434
  ### Deploy
285
435
 
@@ -297,11 +447,11 @@ To update/redeploy an existing deployment, provide the deployment ID.
297
447
 
298
448
  #### Examples
299
449
 
300
- - `clasp deploy` (create new deployment and new version)
301
- - `clasp deploy --versionNumber 4` (create new deployment)
302
- - `clasp deploy --description "Updates sidebar logo."` (deploy with description)
303
- - `clasp deploy --deploymentId abcd1234` (redeploy and create new version)
304
- - `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`
305
455
 
306
456
  ### Undeploy
307
457
 
@@ -314,9 +464,9 @@ Undeploys a deployment of a script.
314
464
 
315
465
  #### Examples
316
466
 
317
- - `clasp undeploy` (undeploy the last deployment.)
318
- - `clasp undeploy "123"`
319
- - `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`
320
470
 
321
471
  ### Version
322
472
 
@@ -328,8 +478,8 @@ Creates an immutable version of the script.
328
478
 
329
479
  #### Examples
330
480
 
331
- - `clasp version`
332
- - `clasp version "Bump the version."`
481
+ - `clasp create-version`
482
+ - `clasp create-version "Bump the version."`
333
483
 
334
484
  ### Versions
335
485
 
@@ -337,7 +487,7 @@ List versions of a script.
337
487
 
338
488
  #### Examples
339
489
 
340
- - `clasp versions`
490
+ - `clasp list-versions`
341
491
 
342
492
  ### List
343
493
 
@@ -345,7 +495,7 @@ Lists your most recent Apps Script projects.
345
495
 
346
496
  #### Examples
347
497
 
348
- - `clasp list`: Prints `helloworld1 – xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ...`
498
+ - `clasp list-scripts`: Prints `helloworld1 – xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ...`
349
499
 
350
500
  ## Advanced Commands
351
501
 
@@ -358,8 +508,6 @@ Prints out most recent the _StackDriver logs_. These are logs from `console.log`
358
508
  #### Options
359
509
 
360
510
  - `--json`: Output logs in json format.
361
- - `--open`: Open StackDriver logs in a browser.
362
- - `--setup`: Setup StackDriver logs.
363
511
  - `--watch`: Retrieves the newest logs every 5 seconds.
364
512
  - `--simplified`: Removes timestamps from the logs.
365
513
 
@@ -372,7 +520,6 @@ INFO Sat Apr 07 2019 10:58:31 GMT-0700 (PDT) myFunction info message
372
520
  ```
373
521
 
374
522
  - `clasp logs --json`
375
- - `clasp logs --open`
376
523
  - `clasp logs --watch`
377
524
  - `clasp logs --simplified`
378
525
 
@@ -402,8 +549,8 @@ Below is a short summary:
402
549
 
403
550
  #### Examples
404
551
 
405
- - `clasp run 'sendEmail'`
406
- - `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]'`
407
554
 
408
555
  ### List/Enable/Disable Google APIs
409
556
 
@@ -413,8 +560,8 @@ List available APIs. Enables and disables Google APIs.
413
560
 
414
561
  Lists Google APIs that can be enabled as [Advanced Services](https://developers.google.com/apps-script/guides/services/advanced).
415
562
 
416
- - `clasp apis`
417
- - `clasp apis list`
563
+ - `clasp list-apis`
564
+ - `clasp list-apis`
418
565
 
419
566
  #### Enable/Disable APIs
420
567
 
@@ -422,14 +569,14 @@ Enables or disables APIs with the Google Cloud project. These APIs are used via
422
569
 
423
570
  The API name can be found using `clasp apis list`.
424
571
 
425
- - `clasp apis enable drive`
426
- - `clasp apis disable drive`
572
+ - `clasp enable-api drive`
573
+ - `clasp disable-api drive`
427
574
 
428
575
  #### Open APIs Console
429
576
 
430
577
  Open the Google Cloud Console where you can view and manage API access.
431
578
 
432
- - `clasp apis --open`
579
+ - `clasp open-api-console`
433
580
 
434
581
  ### Help
435
582
 
@@ -440,113 +587,17 @@ Displays the help function.
440
587
  - `clasp`
441
588
  - `clasp help`
442
589
 
443
- ### Setting
444
-
445
- Update `.clasp.json` settings file.
446
-
447
- If `settingKey` is omitted it prints the current settings.
448
- If `newValue` is omitted it returns the current setting value.
449
-
450
- #### Options
451
-
452
- - `settingKey`: settingKey The key in `.clasp.json` you want to change
453
- - `newValue`: newValue The new value for the setting
454
-
455
- #### Examples
456
-
457
- - `clasp setting`
458
- - `clasp setting scriptId`
459
- - `clasp setting scriptId new-id`
460
-
461
- ## Guides
462
-
463
- ### Ignore File (`.claspignore`)
464
-
465
- Like `.gitignore`, `.claspignore` allows you to ignore files that you do not wish to not upload on `clasp push`. Steps:
466
-
467
- 1. Create a file called `.claspignore` in your project's root directory.
468
- 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/**`.
469
-
470
- A sample `.claspignore` ignoring everything except the manifest and `build/main.js`:
471
-
472
- ```text
473
- **/**
474
- !build/main.js
475
- !appsscript.json
476
- ```
477
-
478
- _Note_: The `.claspignore` patterns are applied relative from the `rootDir`.
479
-
480
- 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.
481
-
482
- ```text
483
- # ignore all files…
484
- **/**
485
-
486
- # except the extensions…
487
- !appsscript.json
488
- !**/*.gs
489
- !**/*.js
490
- !**/*.ts
491
- !**/*.html
492
-
493
- # ignore even valid files if in…
494
- .git/**
495
- node_modules/**
496
- ```
497
-
498
- ## Project Settings File (`.clasp.json`)
499
-
500
- 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`:
501
-
502
- ```json
503
- {
504
- "scriptId": "",
505
- "rootDir": "build/",
506
- "projectId": "project-id-xxxxxxxxxxxxxxxxxxx",
507
- "fileExtension": "ts",
508
- "filePushOrder": ["file1.ts", "file2.ts"]
509
- }
510
- ```
511
-
512
- The following configuration values can be used:
513
-
514
- ### `scriptId` (required)
515
-
516
- Specifies the id of the Google Script project that clasp will target.
517
-
518
- 1. Open script url.
519
- 1. File > Project properties > Script ID
520
-
521
-
522
- ### `rootDir` (optional)
523
-
524
- Specifies the **local** directory in which clasp will store your project files. If not specified, clasp will default to the current directory.
525
-
526
- ### `projectId` (optional)
527
-
528
- Specifies the id of the Google Cloud Platform project that clasp will target.
529
- You must [associate Google Script project with Google Cloud Platform](https://github.com/google/clasp/blob/master/docs/run.md#setup-instructions) beforehand.
530
-
531
- 1. Run `clasp open`.
532
- 1. Click `Resources > Cloud Platform project...`.
533
- 1. Specify the project ID `project-id-xxxxxxxxxxxxxxxxxxx`.
534
-
535
- Even if you do not set this manually, clasp will ask this via a prompt to you at the required time.
536
-
537
- ### `fileExtension` (optional)
538
-
539
- Specifies the file extension for **local** script files in your Apps Script project.
590
+ #### Clasp Run
540
591
 
541
- ### `filePushOrder` (optional)
592
+ > **NOTE**: This command requires you to [bring your own Google API credentials](/docs/run.md).
542
593
 
543
- 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)
544
595
 
545
596
  ## Troubleshooting
546
597
 
547
598
  ### NodeJS Version
548
599
 
549
- The library requires **NodeJS version >= 12.20.0**.
600
+ The library requires **NodeJS version >= 22.0.0**.
550
601
 
551
602
  You can check your version of NodeJS with this command.
552
603
 
@@ -561,6 +612,16 @@ npm install -g npm # Update npm and npx
561
612
  npx n latest # use the n package to update node
562
613
  ```
563
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
+
564
625
  ### Using a Proxy
565
626
 
566
627
  Clasp supports proxies via the Google APIs Node Module.
@@ -586,10 +647,4 @@ If you have a core feature or use-case you'd like to see, find a GitHub issue or
586
647
  create a detailed proposal of the use-case.
587
648
  PRs are very welcome! See the [issues](https://github.com/google/clasp/issues) (especially **good first issue** and **help wanted**).
588
649
 
589
- ### How to Submit a Pull Request
590
-
591
- 1. Look over the test cases in [test/test.ts](test/test.ts), try cases that the PR may affect.
592
- 1. Run [gts linter](https://github.com/google/gts): `npm run lint`.
593
- 1. Submit a pull request after testing your feature to make sure it works.
594
-
595
650
  ⚡ Powered by the [Apps Script API](https://developers.google.com/apps-script/api/).