@google/clasp 2.5.0 → 3.0.1-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 +63 -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
@@ -18,365 +18,26 @@
18
18
  /**
19
19
  * clasp - The Apps Script CLI
20
20
  */
21
- import { program } from 'commander';
21
+ import Debug from 'debug';
22
22
  import loudRejection from 'loud-rejection';
23
- import { dirname } from 'path';
24
- import { readPackageUpSync } from 'read-pkg-up';
25
- import { fileURLToPath } from 'url';
26
- import fs from 'fs-extra';
27
- import { ClaspError } from './clasp-error.js';
28
- import apis from './commands/apis.js';
29
- import clone from './commands/clone.js';
30
- import create from './commands/create.js';
31
- import defaultCmd from './commands/default.js';
32
- import deploy from './commands/deploy.js';
33
- import deployments from './commands/deployments.js';
34
- import list from './commands/list.js';
35
- import login from './commands/login.js';
36
- import logout from './commands/logout.js';
37
- import logs from './commands/logs.js';
38
- import openCmd from './commands/open.js';
39
- import pull from './commands/pull.js';
40
- import push from './commands/push.js';
41
- import run from './commands/run.js';
42
- import setting from './commands/setting.js';
43
- import status from './commands/status.js';
44
- import undeploy from './commands/undeploy.js';
45
- import version from './commands/version.js';
46
- import versions from './commands/versions.js';
47
- import { Conf } from './conf.js';
48
- import { PROJECT_NAME } from './constants.js';
49
- import { spinner, stopSpinner } from './utils.js';
50
- const __dirname = dirname(fileURLToPath(import.meta.url));
51
- // instantiate the config singleton (and loads environment variables as a side effect)
52
- const config = Conf.get();
23
+ import { makeProgram } from './commands/program.js';
24
+ const debug = Debug('clasp:cli');
53
25
  // Ensure any unhandled exception won't go unnoticed
54
26
  loudRejection();
55
- const manifest = readPackageUpSync({ cwd: __dirname });
56
- // CLI
57
- /**
58
- * Set global CLI configurations
59
- */
60
- program.storeOptionsAsProperties(false);
61
- /**
62
- * Displays clasp version
63
- */
64
- program.version(manifest ? manifest.packageJson.version : 'unknown', '-v, --version', 'output the current version');
65
- program.name(PROJECT_NAME).usage('<command> [options]').description(`${PROJECT_NAME} - The Apps Script CLI`);
66
- /**
67
- * Path to an auth file, or to a folder with a '.clasprc.json' file.
68
- */
69
- program
70
- .option('-A, --auth <file>', "path to an auth file or a folder with a '.clasprc.json' file.")
71
- .on('option:auth', (auth) => {
72
- config.auth = auth;
73
- });
74
- /**
75
- * Path to an ignore file, or to a folder with a '.claspignore'.
76
- */
77
- program
78
- .option('-I, --ignore <file>', "path to an ignore file or a folder with a '.claspignore' file.")
79
- .on('option:ignore', (ignore) => {
80
- config.ignore = ignore;
81
- });
82
- /**
83
- * Path to a project file, or to a folder with a '.clasp.json'.
84
- */
85
- program
86
- .option('-P, --project <file>', "path to a project file or to a folder with a '.clasp.json' file.")
87
- .on('option:project', (path) => {
88
- const stats = fs.lstatSync(path);
89
- if (stats.isDirectory()) {
90
- config.projectRootDirectory = path;
27
+ const program = makeProgram();
28
+ try {
29
+ debug('Running clasp with args: %s', process.argv.join(' '));
30
+ // User input is provided from the process' arguments
31
+ await program.parseAsync(process.argv);
32
+ }
33
+ catch (error) {
34
+ debug('Error: %O', error);
35
+ if (error instanceof Error) {
36
+ process.exitCode = 1;
37
+ console.error(error.message);
91
38
  }
92
39
  else {
93
- config.projectConfig = path;
40
+ process.exitCode = 1;
41
+ console.error('Unknown error', error);
94
42
  }
95
- });
96
- /**
97
- * Logs the user in. Saves the client credentials to an rc file.
98
- * @name login
99
- * @param {string?} [--no-localhost] Do not run a local server, manually enter code instead.
100
- * @param {string?} [--creds] Relative path to credentials (from GCP).
101
- * @example login (uses default clasp credentials)
102
- * @example login --creds credentials.json (uses your credentials file).
103
- * @see test
104
- */
105
- program
106
- .command('login')
107
- .description('Log in to script.google.com')
108
- .option('--no-localhost', 'Do not run a local server, manually enter code instead')
109
- .option('--creds <file>', 'Relative path to credentials (from GCP).')
110
- .option('--status', 'Print who is logged in')
111
- .option('--redirect-port <port>', 'Specify a custom port for the redirect URL.')
112
- .action(login);
113
- /**
114
- * Logs out the user by deleting client credentials.
115
- * @name logout
116
- * @example logout
117
- */
118
- program.command('logout').description('Log out').action(logout);
119
- /**
120
- * Creates a new script project.
121
- * @name create
122
- * @param {string?} [--title] An optional project title.
123
- * @param {string?} [--parentId] An optional project parent Id. The Drive ID of a parent file
124
- * that the created script project is bound to. This is usually the ID of a
125
- * Google Doc, Google Sheet, Google Form, or Google Slides file. If not set, a
126
- * standalone script project is created.
127
- * https://drive.google.com/open?id=<ID>
128
- * @param {string?} [--rootDir] Local root directory that store your project files.
129
- * @example create
130
- * @example create "My Script"
131
- * @example create "My Script" "1D_Gxyv*****************************NXO7o"
132
- * @see https://developers.google.com/apps-script/api/reference/rest/v1/projects/create
133
- */
134
- program
135
- .command('create')
136
- .description('Create a script')
137
- .option('--type <type>', 'Creates a new Apps Script project attached to a new Document, Spreadsheet, Presentation, Form, or as a standalone script, web app, or API.')
138
- .option('--title <title>', 'The project title.')
139
- .option('--parentId <id>', 'A project parent Id.')
140
- .option('--rootDir <rootDir>', 'Local root directory in which clasp will store your project files.')
141
- .action(create);
142
- /**
143
- * Fetches a project and saves the script id locally.
144
- * @param {string?} [scriptId] The script ID to clone.
145
- * @param {string?} [versionNumber] The version of the script to clone.
146
- * @param {string?} [--rootDir] Local root directory that store your project files.
147
- */
148
- program
149
- .command('clone [scriptId] [versionNumber]')
150
- .description('Clone a project')
151
- .option('--rootDir <rootDir>', 'Local root directory in which clasp will store your project files.')
152
- .action(clone);
153
- /**
154
- * Fetches a project from either a provided or saved script id.
155
- * Updates local files with Apps Script project.
156
- * @name pull
157
- * @example pull
158
- */
159
- program
160
- .command('pull')
161
- .description('Fetch a remote project')
162
- .option('--versionNumber <version>', 'The version number of the project to retrieve.')
163
- .action(pull);
164
- /**
165
- * Force writes all local files to the script management server.
166
- * @name push
167
- * @desc Ignores files:
168
- * - That start with a .
169
- * - That don't have an accepted file extension
170
- * - That are ignored (filename matches a glob pattern in the ignore file)
171
- * @example push
172
- * @example push --force
173
- * @example push --watch
174
- */
175
- program
176
- .command('push')
177
- .description('Update the remote project')
178
- .option('-f, --force', 'Forcibly overwrites the remote manifest.')
179
- .option('-w, --watch', 'Watches for local file changes. Pushes when a non-ignored file changes.')
180
- .action(push);
181
- /**
182
- * Lists files that will be written to the server on `push`.
183
- * @name status
184
- * @desc Ignores files:
185
- * - That start with a .
186
- * - That don't have an accepted file extension
187
- * - That are ignored (filename matches a glob pattern in the ignore file)
188
- * @example status
189
- */
190
- program
191
- .command('status')
192
- .description('Lists files that will be pushed by clasp')
193
- .option('--json', 'Show status in JSON form')
194
- .action(status);
195
- /**
196
- * Opens the `clasp` project on script.google.com. Provide a `scriptId` to open a different script.
197
- * @name open
198
- * @param {string?} [scriptId] The optional script project to open.
199
- * @example open
200
- * @example open [scriptId]
201
- */
202
- program
203
- .command('open [scriptId]')
204
- .description('Open a script')
205
- .option('--webapp', 'Open web application in the browser')
206
- .option('--creds', 'Open the URL to create credentials')
207
- .option('--addon', 'List parent IDs and open the URL of the first one')
208
- .option('--deploymentId <id>', 'Use custom deployment ID with webapp')
209
- .action(openCmd);
210
- /**
211
- * List deployments of a script
212
- * @name deployments
213
- * @example deployments
214
- */
215
- program.command('deployments').description('List deployment ids of a script').action(deployments);
216
- /**
217
- * Creates a version and deploys a script.
218
- * The response gives the version of the deployment.
219
- * @name deploy
220
- * @example deploy (create new deployment and new version)
221
- * @example deploy --versionNumber 4 (create new deployment)
222
- * @example deploy --description "Updates sidebar logo." (deploy with description)
223
- * @example deploy --deploymentId 123 (create new version)
224
- * @example deploy -V 7 -d "Updates sidebar logo." -i 456
225
- */
226
- program
227
- .command('deploy')
228
- .description('Deploy a project')
229
- .option('-V, --versionNumber <version>', 'The project version') // We can't use `version` in subcommand
230
- .option('-d, --description <description>', 'The deployment description')
231
- .option('-i, --deploymentId <id>', 'The deployment ID to redeploy')
232
- .action(deploy);
233
- /**
234
- * Undeploys a deployment of a script.
235
- * @name undeploy
236
- * @param {string?} [deploymentId] The deployment ID.
237
- * @param {boolean?} all Setup StackDriver logs.
238
- * @example "undeploy" (undeploy the last deployment.)
239
- * @example "undeploy 123"
240
- * @example "undeploy --all"
241
- */
242
- program
243
- .command('undeploy [deploymentId]')
244
- .description('Undeploy a deployment of a project')
245
- .option('-a, --all', 'Undeploy all deployments')
246
- .action(undeploy);
247
- /**
248
- * Creates an immutable version of the script.
249
- * @name version
250
- * @param {string?} description The description of the script version.
251
- * @example version
252
- * @example version "Bump the version."
253
- */
254
- program.command('version [description]').description('Creates an immutable version of the script').action(version);
255
- /**
256
- * List versions of a script.
257
- * @name versions
258
- * @example versions
259
- */
260
- program.command('versions').description('List versions of a script').action(versions);
261
- /**
262
- * Lists your most recent 10 Apps Script projects.
263
- * @name list
264
- * @example list # helloworld1 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ...
265
- * @todo Add --all flag to list all projects.
266
- */
267
- program
268
- .command('list')
269
- .description('List App Scripts projects')
270
- .option('--noShorten', 'Do not shorten long names', false)
271
- .action(list);
272
- /**
273
- * Prints StackDriver logs.
274
- * @name logs
275
- * @param {boolean?} json Output logs in json format.
276
- * @param {boolean?} open Open StackDriver logs in a browser.
277
- * @param {boolean?} setup Setup StackDriver logs.
278
- */
279
- program
280
- .command('logs')
281
- .description('Shows the StackDriver logs')
282
- .option('--json', 'Show logs in JSON form')
283
- .option('--open', 'Open the StackDriver logs in the browser')
284
- .option('--setup', 'Setup StackDriver logs')
285
- .option('--watch', 'Watch and print new logs')
286
- .option('--simplified', 'Hide timestamps with logs')
287
- .action(logs);
288
- /**
289
- * Remotely executes an Apps Script function.
290
- * This function runs your script in the cloud. You must supply
291
- * the functionName params. For now, it can
292
- * only run functions that do not require other authorization.
293
- * @name run
294
- * @param {string} functionName The function in the script that you want to run.
295
- * @param {boolean?} nondev Run script function in non-devMode.
296
- * @example run 'sendEmail'
297
- * @see https://developers.google.com/apps-script/api/reference/rest/v1/scripts/run
298
- * @requires `clasp login --creds` to be run beforehand.
299
- */
300
- program
301
- .command('run [functionName]')
302
- .description('Run a function in your Apps Scripts project')
303
- .option('--nondev', 'Run script function in non-devMode')
304
- .option('-p, --params [StringArray]', 'Add parameters required for the function as a JSON String Array')
305
- .action(run);
306
- /**
307
- * List, enable, or disable APIs for your project.
308
- * Currently, only list is supported.
309
- * @name apis
310
- * @example apis list
311
- * @example apis enable drive
312
- */
313
- program
314
- .command('apis')
315
- .description(`List, enable, or disable APIs
316
- list
317
- enable <api>
318
- disable <api>`)
319
- .option('--open', 'Open the API Console in the browser')
320
- .action(apis);
321
- /**
322
- * Update .clasp.json settings file.
323
- * If `newValue` is omitted, it returns the current setting value
324
- * If `settingKey` is omitted, it returns all keys in .clasp.json
325
- * @name setting
326
- * @param {string?} settingKey They key in .clasp.json you want to change
327
- * @param {string?} newValue The new value for the setting
328
- * @example setting
329
- * @example setting scriptId
330
- * @example setting scriptId new-id
331
- */
332
- program
333
- .command('setting [settingKey] [newValue]')
334
- .alias('settings')
335
- .description('Update <settingKey> in .clasp.json')
336
- .action(setting);
337
- /**
338
- * All other commands are given a help message.
339
- * @example random
340
- */
341
- program.command('*', { isDefault: true }).description('Any other command is not supported').action(defaultCmd);
342
- /**
343
- * @internal
344
- * Displays clasp paths
345
- */
346
- program
347
- .command('paths')
348
- .description('List current config files path')
349
- .action(() => {
350
- console.log('project', config.projectConfig);
351
- console.log('ignore', config.ignore);
352
- console.log('auth', config.auth);
353
- });
354
- const [_bin, _sourcePath, ...args] = process.argv;
355
- // Defaults to help if commands are not provided
356
- if (args.length === 0) {
357
- program.outputHelp();
358
43
  }
359
- (async () => {
360
- try {
361
- // User input is provided from the process' arguments
362
- await program.parseAsync(process.argv);
363
- stopSpinner();
364
- }
365
- catch (error) {
366
- spinner.stop();
367
- if (error instanceof ClaspError) {
368
- // ClaspError handles process.exitCode
369
- console.error(error.message);
370
- }
371
- else if (error instanceof Error) {
372
- process.exitCode = 1;
373
- console.error(error.message);
374
- }
375
- else {
376
- process.exitCode = 1;
377
- console.error('Unknown error', error);
378
- }
379
- }
380
- spinner.clear();
381
- })();
382
- //# sourceMappingURL=index.js.map
@@ -0,0 +1,34 @@
1
+ import { createIntl, createIntlCache } from '@formatjs/intl';
2
+ import Debug from 'debug';
3
+ const debug = Debug('clasp:intl');
4
+ function isDefined(item) {
5
+ return item !== null && item !== undefined;
6
+ }
7
+ function getLocale() {
8
+ const envLocales = [process.env.LC_ALL, process.env.LC_CTYPE, process.env.LANG].filter(isDefined);
9
+ for (const envLocale of envLocales) {
10
+ try {
11
+ // Attempt to normalize the locale string (e.g., "en_US" to "en-US")
12
+ const normalizedLocale = new Intl.Locale(envLocale).toString();
13
+ return normalizedLocale;
14
+ }
15
+ catch (_error) {
16
+ // Ignore invalid locale strings and try the next one
17
+ debug('Invalid locale string: %s', envLocale);
18
+ }
19
+ }
20
+ return 'en';
21
+ }
22
+ function loadMessages(_locale) {
23
+ // TODO - L10N not implemented yet.
24
+ return {};
25
+ }
26
+ const cache = createIntlCache();
27
+ const locale = getLocale();
28
+ debug('Using locale: %s', locale);
29
+ export const intl = createIntl({
30
+ // Locale of the application
31
+ locale,
32
+ defaultLocale: 'en',
33
+ messages: loadMessages(locale),
34
+ }, cache);
package/docs/README.md CHANGED
@@ -3,9 +3,4 @@
3
3
  This folder contains advanced guides for `clasp`.
4
4
 
5
5
  - [Configuration](/docs/config-files.md): Learn about the configuration files used by clasp.
6
- - [Develop clasp](/docs/develop.md): Build, Run, and Test the CLI.
7
6
  - [Run](/docs/run.md): Execute Apps Script remotely with `clasp run`.
8
- - [Running locally](/docs/running-locally.md): Install and use clasp as a local dependency.
9
- - [Settings](/docs/settings.md): Set up JSON autocompletion and `.gs` syntax highlighting.
10
- - [ES modules](/docs/esmodules.md): Learn how to use ES modules with Apps Script.
11
- - [TypeScript](/docs/typescript.md): Learn how to develop Apps Script in TypeScript.
@@ -53,4 +53,3 @@ list | | | Read |
53
53
  logs | ??? | | Read | ???
54
54
  run | Read | | Read | ???
55
55
  apis | ??? | | Read | ???
56
- setting | Read | | ??? | ???
package/docs/run.md CHANGED
@@ -38,7 +38,7 @@ To use `clasp run`, you need to complete 5 steps:
38
38
  - Application type: **Desktop App**
39
39
  - **Create** > **OK**
40
40
  - Download the file (⬇), move it to your directory, and name it `creds.json`. Please keep this file secret!
41
- 1. Call `clasp login --creds creds.json`
41
+ 1. Call `clasp login --user <name> --creds creds.json`
42
42
  1. Add the following to `appsscript.json`:
43
43
  ```json
44
44
  "executionApi": {
@@ -76,4 +76,4 @@ To run functions that use these scopes, you must add the scopes to your Apps Scr
76
76
  - `File > Project Properties > Scopes`
77
77
  - Add these scopes to your `appsscript.json`.
78
78
  - Log in again: `clasp login --creds creds.json`. This will add these scopes to your credentials.
79
- - `clasp run sendMail`
79
+ - `clasp run --user <name> sendMail`
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@google/clasp",
3
- "version": "2.5.0",
3
+ "version": "3.0.1-alpha1",
4
4
  "description": "Develop Apps Script Projects locally",
5
5
  "type": "module",
6
6
  "exports": "./build/src/index.js",
7
7
  "main": "build/src/index.js",
8
8
  "engines": {
9
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
9
+ "node": " >=20.0.0"
10
10
  },
11
11
  "bin": {
12
12
  "clasp": "build/src/index.js"
@@ -18,19 +18,29 @@
18
18
  "scripts": {
19
19
  "build": "npm run compile && npm i --loglevel=error --force",
20
20
  "build-fresh": "npm cache clean --force && npm i && npm run build",
21
- "watch": "tsc --project tsconfig.json --watch",
21
+ "watch": "tspc --project tsconfig.json --watch",
22
22
  "prepare": "npm run compile",
23
23
  "lint": "npm run check",
24
- "test": "nyc mocha --cache false --timeout 100000 --recursive build/test",
24
+ "test": "nyc mocha",
25
25
  "coverage": "nyc --cache false report --reporter=text-lcov | coveralls",
26
- "prettier": "prettier src test --write",
27
- "check": "gts check src/*.ts src/**/*.ts test/*.ts test/**/*.ts",
28
- "clean": "gts clean",
29
- "compile": "tsc",
30
- "fix": "gts fix src/*.ts src/**/*.ts test/*.ts test/**/*.ts",
31
- "pretest": "npm run compile && npm run check"
26
+ "prettier": "biome format src test --write",
27
+ "check": "biome check src test && npm run compile",
28
+ "clean": "rm -rf build",
29
+ "compile": "tspc",
30
+ "fix": "biome check src test --fix",
31
+ "clasp": "node --loader ts-node/esm --no-warnings src/index.ts"
32
+ },
33
+ "messageformat": {
34
+ "locale": [
35
+ "en"
36
+ ],
37
+ "include": [
38
+ "src/messages/"
39
+ ],
40
+ "outfile": "src/messages/messages.js"
32
41
  },
33
42
  "nyc": {
43
+ "extends": "@istanbuljs/nyc-config-typescript",
34
44
  "include": [
35
45
  "src/**/*.ts"
36
46
  ],
@@ -60,56 +70,81 @@
60
70
  "author": "Grant Timmerman",
61
71
  "license": "Apache-2.0",
62
72
  "dependencies": {
63
- "@sindresorhus/is": "^4.0.1",
64
- "chalk": "^4.1.2",
65
- "chokidar": "^3.5.2",
66
- "cli-truncate": "^3.0.0",
67
- "commander": "^8.1.0",
68
- "debounce": "^1.2.1",
73
+ "@formatjs/intl": "^3.1.4",
74
+ "@messageformat/core": "^3.4.0",
75
+ "@sindresorhus/is": "^7.0.1",
76
+ "@types/debug": "^4.1.12",
77
+ "chalk": "^5.4.1",
78
+ "chokidar": "^4.0.3",
79
+ "cli-truncate": "^4.0.0",
80
+ "commander": "^13.0.0",
81
+ "debounce": "^2.2.0",
82
+ "debug": "^4.4.0",
69
83
  "dotf": "^2.0.2",
70
- "find-up": "^6.0.0",
71
- "fs-extra": "^10.0.0",
84
+ "fdir": "^6.4.3",
85
+ "find-up": "^7.0.0",
72
86
  "fuzzy": "^0.1.3",
73
- "gaxios": "^4.2.1",
74
- "google-auth-library": "^7.6.2",
75
- "googleapis": "^84.0.0",
76
- "inquirer": "^8.1.2",
77
- "inquirer-autocomplete-prompt-ipt": "^2.0.0",
78
- "is-reachable": "^5.0.0",
79
- "log-symbols": "^5.0.0",
87
+ "gaxios": "^6.7.1",
88
+ "google-auth-library": "^9.15.0",
89
+ "googleapis": "^144.0.0",
90
+ "googleapis-common": "7.2.0",
91
+ "inflection": "^3.0.2",
92
+ "inquirer": "^12.3.2",
93
+ "inquirer-autocomplete-standalone": "^0.8.1",
94
+ "log-symbols": "^7.0.0",
80
95
  "loud-rejection": "^2.2.0",
81
- "make-dir": "^3.1.0",
82
- "multimatch": "^5.0.0",
96
+ "make-dir": "^5.0.0",
97
+ "micromatch": "^4.0.8",
98
+ "multimatch": "^7.0.0",
83
99
  "normalize-newline": "^4.1.0",
84
- "open": "^8.2.1",
85
- "ora": "^6.0.0",
86
- "p-map": "^5.1.0",
87
- "read-pkg-up": "^8.0.0",
88
- "recursive-readdir": "^2.2.2",
100
+ "normalize-path": "^3.0.0",
101
+ "open": "^10.1.0",
102
+ "ora": "^8.1.1",
103
+ "p-map": "^7.0.3",
104
+ "picomatch": "^4.0.2",
105
+ "read-pkg-up": "^11.0.0",
89
106
  "server-destroy": "^1.0.1",
90
107
  "split-lines": "^3.0.0",
91
108
  "strip-bom": "^5.0.0",
92
- "ts2gas": "^4.2.0",
93
- "typescript": "^4.4.2"
109
+ "typescript": "^5.7.3"
94
110
  },
95
111
  "devDependencies": {
96
- "@types/chai": "^4.2.21",
97
- "@types/debounce": "^1.2.0",
98
- "@types/fs-extra": "^9.0.12",
99
- "@types/inquirer": "^7.3.3",
100
- "@types/mocha": "^9.0.0",
101
- "@types/node": "^12.20.21",
102
- "@types/recursive-readdir": "^2.2.0",
103
- "@types/server-destroy": "^1.0.1",
104
- "@types/tmp": "^0.2.1",
105
- "@types/wtfnode": "^0.7.0",
106
- "chai": "^4.3.4",
112
+ "@biomejs/biome": "^1.9.4",
113
+ "@commander-js/extra-typings": "^13.0.0",
114
+ "@formatjs/ts-transformer": "^3.13.32",
115
+ "@istanbuljs/nyc-config-typescript": "^1.0.2",
116
+ "@messageformat/cli": "^4.0.1",
117
+ "@types/chai": "^5.0.1",
118
+ "@types/chai-as-promised": "^8.0.1",
119
+ "@types/chai-fs": "^2.0.5",
120
+ "@types/chai-subset": "^1.3.5",
121
+ "@types/debounce": "^1.2.4",
122
+ "@types/fs-extra": "^11.0.4",
123
+ "@types/micromatch": "^4.0.9",
124
+ "@types/mocha": "^10.0.10",
125
+ "@types/mock-fs": "^4.13.4",
126
+ "@types/node": "^22.10.10",
127
+ "@types/normalize-path": "^3.0.2",
128
+ "@types/picomatch": "^3.0.2",
129
+ "@types/server-destroy": "^1.0.4",
130
+ "@types/sinon": "^17.0.4",
131
+ "@types/tmp": "^0.2.6",
132
+ "@types/wtfnode": "^0.7.3",
133
+ "chai": "^5.1.2",
134
+ "chai-as-promised": "^8.0.1",
135
+ "chai-subset": "^1.6.0",
107
136
  "coveralls": "^3.1.1",
108
- "gts": "^3.1.0",
109
- "mocha": "^9.1.1",
110
- "nyc": "^15.1.0",
111
- "prettier": "^2.3.2",
112
- "tmp": "^0.2.1",
113
- "type-fest": "^2.1.0"
137
+ "mocha": "^11.1.0",
138
+ "mock-fs": "^5.4.1",
139
+ "nock": "^14.0.0",
140
+ "nyc": "^17.1.0",
141
+ "sinon": "^19.0.2",
142
+ "source-map-support": "^0.5.21",
143
+ "tmp": "^0.2.3",
144
+ "ts-node": "^10.9.2",
145
+ "ts-patch": "^3.3.0",
146
+ "type-fest": "^4.33.0",
147
+ "why-is-node-running": "^3.2.2",
148
+ "wtfnode": "^0.10.0"
114
149
  }
115
150
  }