@google/clasp 2.4.1 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +7 -5
- package/build/src/apiutils.js +4 -8
- package/build/src/apiutils.js.map +1 -1
- package/build/src/auth.d.ts +3 -0
- package/build/src/auth.js +24 -11
- package/build/src/auth.js.map +1 -1
- package/build/src/commands/apis.js +9 -9
- package/build/src/commands/apis.js.map +1 -1
- package/build/src/commands/clone.js +3 -3
- package/build/src/commands/clone.js.map +1 -1
- package/build/src/commands/create.js +6 -6
- package/build/src/commands/create.js.map +1 -1
- package/build/src/commands/default.d.ts +1 -1
- package/build/src/commands/default.js.map +1 -1
- package/build/src/commands/deploy.js +1 -2
- package/build/src/commands/deploy.js.map +1 -1
- package/build/src/commands/deployments.js +1 -2
- package/build/src/commands/deployments.js.map +1 -1
- package/build/src/commands/list.js +2 -3
- package/build/src/commands/list.js.map +1 -1
- package/build/src/commands/login.d.ts +1 -0
- package/build/src/commands/login.js +5 -4
- package/build/src/commands/login.js.map +1 -1
- package/build/src/commands/logout.js +8 -7
- package/build/src/commands/logout.js.map +1 -1
- package/build/src/commands/logs.js +6 -6
- package/build/src/commands/logs.js.map +1 -1
- package/build/src/commands/open.js +1 -1
- package/build/src/commands/open.js.map +1 -1
- package/build/src/commands/pull.js +1 -2
- package/build/src/commands/pull.js.map +1 -1
- package/build/src/commands/push.js +6 -7
- package/build/src/commands/push.js.map +1 -1
- package/build/src/commands/run.js +1 -2
- package/build/src/commands/run.js.map +1 -1
- package/build/src/commands/setting.js +1 -1
- package/build/src/commands/setting.js.map +1 -1
- package/build/src/commands/status.d.ts +1 -1
- package/build/src/commands/status.js +3 -4
- package/build/src/commands/status.js.map +1 -1
- package/build/src/commands/undeploy.js +1 -2
- package/build/src/commands/undeploy.js.map +1 -1
- package/build/src/commands/version.js +1 -2
- package/build/src/commands/version.js.map +1 -1
- package/build/src/commands/versions.js +3 -4
- package/build/src/commands/versions.js.map +1 -1
- package/build/src/conf.js +5 -10
- package/build/src/conf.js.map +1 -1
- package/build/src/dotfile.js +2 -2
- package/build/src/dotfile.js.map +1 -1
- package/build/src/files.d.ts +1 -1
- package/build/src/files.js +61 -18
- package/build/src/files.js.map +1 -1
- package/build/src/index.d.ts +16 -0
- package/build/src/index.js +35 -43
- package/build/src/index.js.map +1 -1
- package/build/src/inquirer.js.map +1 -1
- package/build/src/manifest.js +6 -8
- package/build/src/manifest.js.map +1 -1
- package/build/src/messages.js +1 -1
- package/build/src/utils.d.ts +1 -2
- package/build/src/utils.js +10 -9
- package/build/src/utils.js.map +1 -1
- package/docs/README.md +2 -0
- package/docs/config-files.md +4 -4
- package/docs/develop.md +14 -1
- package/docs/esmodules.md +5 -5
- package/docs/run.md +24 -5
- package/docs/typescript.md +1 -1
- package/package.json +28 -27
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.5.0](https://github.com/google/clasp/compare/v2.4.2...v2.5.0) (2025-01-09)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* Add support for custom redirect port in clasp login ([#1020](https://github.com/google/clasp/issues/1020)) ([d55832e](https://github.com/google/clasp/commit/d55832e59d63c480ae591f7d1ecba457ebfafb7b))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* Don't write files on clone if unable to fetch project ([#824](https://github.com/google/clasp/issues/824)) ([b3b292a](https://github.com/google/clasp/commit/b3b292acfcc9bb191a3f4171601b8c420c187546))
|
|
14
|
+
* Rethrow error so command exits with error status ([#1019](https://github.com/google/clasp/issues/1019)) ([29ac629](https://github.com/google/clasp/commit/29ac62988b970b1905fe2601828bf7dcaac47b54))
|
|
15
|
+
|
|
16
|
+
## [2.4.2](https://github.com/google/clasp/compare/v2.4.1...v2.4.2) (2022-09-26)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* remove online check ([#936](https://github.com/google/clasp/issues/936)) ([6775d9f](https://github.com/google/clasp/commit/6775d9f674886ac11ee2a23d59cbe62dd141d97b))
|
|
22
|
+
|
|
3
23
|
### [2.4.1](https://www.github.com/google/clasp/compare/v2.4.0...v2.4.1) (2021-08-09)
|
|
4
24
|
|
|
5
25
|
|
package/README.md
CHANGED
|
@@ -90,7 +90,7 @@ The following command provide basic Apps Script project management.
|
|
|
90
90
|
clasp
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
- [`clasp login [--no-localhost] [--creds <file>] [--status]`](#login)
|
|
93
|
+
- [`clasp login [--no-localhost] [--creds <file>] [--status] [--redirect-port]`](#login)
|
|
94
94
|
- [`clasp logout`](#logout)
|
|
95
95
|
- [`clasp create [--title <title>] [--type <type>] [--rootDir <dir>] [--parentId <id>]`](#create)
|
|
96
96
|
- [`clasp clone <scriptId | scriptURL> [versionNumber] [--rootDir <dir>]`](#clone)
|
|
@@ -132,12 +132,14 @@ Logs the user in. Saves the client credentials to a `.clasprc.json` file.
|
|
|
132
132
|
- `--no-localhost`: Do not run a local server, manually enter code instead.
|
|
133
133
|
- `--creds <file>`: Use custom credentials used for `clasp run`. Saves a `.clasprc.json` file to current working directory. This file should be private!
|
|
134
134
|
- `--status`: Print who you are currently logged in as, if anyone.
|
|
135
|
+
- `--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
136
|
|
|
136
137
|
#### Examples
|
|
137
138
|
|
|
138
139
|
- `clasp login --no-localhost`
|
|
139
140
|
- `clasp login --creds creds.json`
|
|
140
141
|
- `clasp login --status`
|
|
142
|
+
- `clasp login --redirect-port 37473`
|
|
141
143
|
|
|
142
144
|
### Logout
|
|
143
145
|
|
|
@@ -347,7 +349,7 @@ Lists your most recent Apps Script projects.
|
|
|
347
349
|
|
|
348
350
|
## Advanced Commands
|
|
349
351
|
|
|
350
|
-
> **NOTE**: These commands require Project ID/credentials setup (see below).
|
|
352
|
+
> **NOTE**: These commands require Project ID/credentials setup ([see below](#projectid-optional)).
|
|
351
353
|
|
|
352
354
|
### Logs
|
|
353
355
|
|
|
@@ -447,7 +449,7 @@ If `newValue` is omitted it returns the current setting value.
|
|
|
447
449
|
|
|
448
450
|
#### Options
|
|
449
451
|
|
|
450
|
-
- `settingKey`: settingKey
|
|
452
|
+
- `settingKey`: settingKey The key in `.clasp.json` you want to change
|
|
451
453
|
- `newValue`: newValue The new value for the setting
|
|
452
454
|
|
|
453
455
|
#### Examples
|
|
@@ -544,7 +546,7 @@ Specifies the files that should be pushed first, useful for scripts that rely on
|
|
|
544
546
|
|
|
545
547
|
### NodeJS Version
|
|
546
548
|
|
|
547
|
-
The library requires **NodeJS version >=
|
|
549
|
+
The library requires **NodeJS version >= 12.20.0**.
|
|
548
550
|
|
|
549
551
|
You can check your version of NodeJS with this command.
|
|
550
552
|
|
|
@@ -586,7 +588,7 @@ PRs are very welcome! See the [issues](https://github.com/google/clasp/issues) (
|
|
|
586
588
|
|
|
587
589
|
### How to Submit a Pull Request
|
|
588
590
|
|
|
589
|
-
1. Look over the test cases in
|
|
591
|
+
1. Look over the test cases in [test/test.ts](test/test.ts), try cases that the PR may affect.
|
|
590
592
|
1. Run [gts linter](https://github.com/google/gts): `npm run lint`.
|
|
591
593
|
1. Submit a pull request after testing your feature to make sure it works.
|
|
592
594
|
|
package/build/src/apiutils.js
CHANGED
|
@@ -17,8 +17,9 @@ export const getFunctionNames = async (script, scriptId) => {
|
|
|
17
17
|
}
|
|
18
18
|
const { files = [] } = content.data;
|
|
19
19
|
const functionNames = files
|
|
20
|
-
.
|
|
21
|
-
.
|
|
20
|
+
.filter(file => { var _a; return (_a = file.functionSet) === null || _a === void 0 ? void 0 : _a.values; })
|
|
21
|
+
.flatMap(file => file.functionSet.values)
|
|
22
|
+
.map(func => func.name);
|
|
22
23
|
// Returns a Promise
|
|
23
24
|
// https://www.npmjs.com/package/inquirer-autocomplete-prompt-ipt#options
|
|
24
25
|
// Example: https://github.com/ruyadorno/inquirer-autocomplete-prompt/blob/master/example.js#L76
|
|
@@ -55,12 +56,7 @@ export const enableOrDisableAPI = async (serviceName, enable) => {
|
|
|
55
56
|
}
|
|
56
57
|
const name = `projects/${await getProjectIdOrDie()}/services/${serviceName}.googleapis.com`;
|
|
57
58
|
try {
|
|
58
|
-
|
|
59
|
-
await serviceUsage.services.enable({ name });
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
await serviceUsage.services.disable({ name });
|
|
63
|
-
}
|
|
59
|
+
await (enable ? serviceUsage.services.enable({ name }) : serviceUsage.services.disable({ name }));
|
|
64
60
|
await enableOrDisableAdvanceServiceInManifest(serviceName, enable);
|
|
65
61
|
console.log(`${enable ? 'Enable' : 'Disable'}d ${serviceName} API.`);
|
|
66
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiutils.js","sourceRoot":"","sources":["../../src/apiutils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"apiutils.js","sourceRoot":"","sources":["../../src/apiutils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAC,kBAAkB,EAAE,YAAY,EAAC,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAC,kBAAkB,EAAqB,MAAM,eAAe,CAAC;AACrE,OAAO,EAAC,uCAAuC,EAAC,MAAM,eAAe,CAAC;AACtE,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AACpC,OAAO,EAAC,YAAY,EAAE,OAAO,EAAE,WAAW,EAAC,MAAM,YAAY,CAAC;AAE9D;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,MAAqC,EAAE,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,GAAG,YAAY,MAAM,iBAAiB,EAAE,iCAAiC,CAAC;IACpF,MAAM,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAC,IAAI,EAAC,CAAC,CAAC;AAC7C,CAAC,CAAC"}
|
package/build/src/auth.d.ts
CHANGED
|
@@ -19,11 +19,14 @@ export declare const defaultScopes: string[];
|
|
|
19
19
|
* @param {boolean} useLocalhost Uses a local HTTP server if true. Manual entry o.w.
|
|
20
20
|
* @param {ClaspCredentials?} creds An optional credentials object.
|
|
21
21
|
* @param {string[]} [scopes=[]] List of OAuth scopes to authorize.
|
|
22
|
+
* @param {number?} redirectPort Optional custom port for the local HTTP server during the authorization process.
|
|
23
|
+
* If not specified, a random available port will be used.
|
|
22
24
|
*/
|
|
23
25
|
export declare const authorize: (options: {
|
|
24
26
|
readonly creds?: Readonly<ClaspCredentials>;
|
|
25
27
|
readonly scopes: readonly string[];
|
|
26
28
|
readonly useLocalhost: boolean;
|
|
29
|
+
readonly redirectPort?: number;
|
|
27
30
|
}) => Promise<void>;
|
|
28
31
|
export declare const getLoggedInEmail: () => Promise<string | null | undefined>;
|
|
29
32
|
/**
|
package/build/src/auth.js
CHANGED
|
@@ -3,12 +3,11 @@ import { google } from 'googleapis';
|
|
|
3
3
|
import { createServer } from 'http';
|
|
4
4
|
import open from 'open';
|
|
5
5
|
import readline from 'readline';
|
|
6
|
-
import
|
|
6
|
+
import enableDestroy from 'server-destroy';
|
|
7
7
|
import { ClaspError } from './clasp-error.js';
|
|
8
8
|
import { DOTFILE } from './dotfile.js';
|
|
9
9
|
import { ERROR, LOG } from './messages.js';
|
|
10
|
-
import {
|
|
11
|
-
import enableDestroy from 'server-destroy';
|
|
10
|
+
import { getOAuthSettings } from './utils.js';
|
|
12
11
|
/**
|
|
13
12
|
* Authentication with Google's APIs.
|
|
14
13
|
*/
|
|
@@ -80,6 +79,8 @@ export const defaultScopes = [
|
|
|
80
79
|
* @param {boolean} useLocalhost Uses a local HTTP server if true. Manual entry o.w.
|
|
81
80
|
* @param {ClaspCredentials?} creds An optional credentials object.
|
|
82
81
|
* @param {string[]} [scopes=[]] List of OAuth scopes to authorize.
|
|
82
|
+
* @param {number?} redirectPort Optional custom port for the local HTTP server during the authorization process.
|
|
83
|
+
* If not specified, a random available port will be used.
|
|
83
84
|
*/
|
|
84
85
|
export const authorize = async (options) => {
|
|
85
86
|
try {
|
|
@@ -117,7 +118,9 @@ export const authorize = async (options) => {
|
|
|
117
118
|
}
|
|
118
119
|
const oAuth2ClientAuthUrlOptions = { access_type: 'offline', scope };
|
|
119
120
|
// Grab a token from the credentials.
|
|
120
|
-
const token = await (options.useLocalhost
|
|
121
|
+
const token = await (options.useLocalhost
|
|
122
|
+
? authorizeWithLocalhost(oAuth2ClientOptions, oAuth2ClientAuthUrlOptions, options.redirectPort)
|
|
123
|
+
: authorizeWithoutLocalhost(oAuth2ClientOptions, oAuth2ClientAuthUrlOptions));
|
|
121
124
|
console.log(`${LOG.AUTH_SUCCESSFUL}\n`);
|
|
122
125
|
// Save the token and own creds together.
|
|
123
126
|
let claspToken;
|
|
@@ -173,15 +176,26 @@ export const loadAPICredentials = async (local = false) => {
|
|
|
173
176
|
* a temporary HTTP server to handle the auth redirect.
|
|
174
177
|
* @param {OAuth2ClientOptions} oAuth2ClientOptions The required client options for auth
|
|
175
178
|
* @param {GenerateAuthUrlOpts} oAuth2ClientAuthUrlOptions Auth URL options
|
|
179
|
+
* @param {number?} redirectPort Optional custom port for the local HTTP server to handle the auth redirect.
|
|
180
|
+
* If not specified, a random available port will be used.
|
|
176
181
|
* Used for local/global testing.
|
|
177
182
|
*/
|
|
178
|
-
const authorizeWithLocalhost = async (oAuth2ClientOptions, oAuth2ClientAuthUrlOptions) => {
|
|
183
|
+
const authorizeWithLocalhost = async (oAuth2ClientOptions, oAuth2ClientAuthUrlOptions, redirectPort) => {
|
|
179
184
|
// Wait until the server is listening, otherwise we don't have
|
|
180
185
|
// the server port needed to set up the Oauth2Client.
|
|
181
|
-
const server = await new Promise(resolve => {
|
|
186
|
+
const server = await new Promise((resolve, reject) => {
|
|
182
187
|
const s = createServer();
|
|
183
188
|
enableDestroy(s);
|
|
184
|
-
|
|
189
|
+
const port = redirectPort || 0;
|
|
190
|
+
s.listen(port, () => resolve(s)).on('error', (err) => {
|
|
191
|
+
if (err.code === 'EADDRINUSE') {
|
|
192
|
+
console.error(`Error: Port ${port} is already in use. Please specify a different port with --redirect-port.`);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
console.error(`Error: Unable to start the server on port ${port}.`, err.message);
|
|
196
|
+
}
|
|
197
|
+
reject(err);
|
|
198
|
+
});
|
|
185
199
|
});
|
|
186
200
|
const { port } = server.address();
|
|
187
201
|
const client = new OAuth2Client({ ...oAuth2ClientOptions, redirectUri: `http://localhost:${port}` });
|
|
@@ -202,7 +216,7 @@ const authorizeWithLocalhost = async (oAuth2ClientOptions, oAuth2ClientAuthUrlOp
|
|
|
202
216
|
});
|
|
203
217
|
const authUrl = client.generateAuthUrl(oAuth2ClientAuthUrlOptions);
|
|
204
218
|
console.log(LOG.AUTHORIZE(authUrl));
|
|
205
|
-
(async () =>
|
|
219
|
+
(async () => open(authUrl))();
|
|
206
220
|
});
|
|
207
221
|
server.destroy();
|
|
208
222
|
return (await client.getToken(authCode)).tokens;
|
|
@@ -232,7 +246,7 @@ const authorizeWithoutLocalhost = async (oAuth2ClientOptions, oAuth2ClientAuthUr
|
|
|
232
246
|
return (await client.getToken(authCode)).tokens;
|
|
233
247
|
};
|
|
234
248
|
/**
|
|
235
|
-
* Set OAuth client
|
|
249
|
+
* Set OAuth client credentials from rc.
|
|
236
250
|
* Can be global or local.
|
|
237
251
|
* Saves new credentials if access token refreshed.
|
|
238
252
|
* @param {ClaspToken} rc OAuth client settings from rc file.
|
|
@@ -248,7 +262,6 @@ const setOauthClientCredentials = async (rc) => {
|
|
|
248
262
|
};
|
|
249
263
|
// Set credentials and refresh them.
|
|
250
264
|
try {
|
|
251
|
-
await checkIfOnlineOrDie();
|
|
252
265
|
if (rc.isLocalCreds) {
|
|
253
266
|
const { clientId, clientSecret, redirectUri } = rc.oauth2ClientSettings;
|
|
254
267
|
localOAuth2Client = new OAuth2Client({ clientId, clientSecret, redirectUri });
|
|
@@ -271,7 +284,7 @@ const setOauthClientCredentials = async (rc) => {
|
|
|
271
284
|
};
|
|
272
285
|
// /**
|
|
273
286
|
// * Compare global OAuth client scopes against manifest and prompt user to
|
|
274
|
-
// * authorize if new scopes found (local OAuth
|
|
287
|
+
// * authorize if new scopes found (local OAuth credentials only).
|
|
275
288
|
// * @param {ClaspToken} rc OAuth client settings from rc file.
|
|
276
289
|
// */
|
|
277
290
|
// // TODO: currently unused. Check relevancy
|
package/build/src/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAC,MAAM,EAAwB,MAAM,YAAY,CAAC;AACzD,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAClC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAC,MAAM,EAAwB,MAAM,YAAY,CAAC;AACzD,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAClC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,aAAa,MAAM,gBAAgB,CAAC;AAM3C,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO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I,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;KAC/C;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,KAAK,YAAY,UAAU,EAAE;YAC/B,MAAM,KAAK,CAAC;SACb;QAED,MAAM,IAAI,UAAU,CAAC,GAAG,KAAK,CAAC,YAAY,GAAG,KAAK,EAAE,CAAC,CAAC;KACvD;AACH,CAAC,CAAC;AAEF,MAAM;AACN,4EAA4E;AAC5E,mEAAmE;AACnE,gEAAgE;AAChE,MAAM;AACN,6CAA6C;AAC7C,yEAAyE;AACzE,UAAU;AACV,6BAA6B;AAC7B,2CAA2C;AAC3C,qHAAqH;AACrH,kDAAkD;AAClD,mHAAmH;AACnH,0CAA0C;AAC1C,kFAAkF;AAClF,iDAAiD;AAEjD,4BAA4B;AAC5B,gFAAgF;AAChF,+EAA+E;AAC/E,QAAQ;AACR,sBAAsB;AACtB,oDAAoD;AACpD,qFAAqF;AACrF,MAAM;AACN,IAAI"}
|
|
@@ -5,7 +5,7 @@ import { discovery, loadAPICredentials, serviceUsage } from '../auth.js';
|
|
|
5
5
|
import { ClaspError } from '../clasp-error.js';
|
|
6
6
|
import { ERROR } from '../messages.js';
|
|
7
7
|
import { URL } from '../urls.js';
|
|
8
|
-
import {
|
|
8
|
+
import { getProjectId } from '../utils.js';
|
|
9
9
|
/**
|
|
10
10
|
* Acts as a router to apis subcommands
|
|
11
11
|
* Calls functions for list, enable, or disable
|
|
@@ -15,7 +15,7 @@ export default async (options) => {
|
|
|
15
15
|
await loadAPICredentials();
|
|
16
16
|
// clasp apis --open
|
|
17
17
|
if (options.open) {
|
|
18
|
-
return
|
|
18
|
+
return openApiUrl();
|
|
19
19
|
}
|
|
20
20
|
const [_bin, _sourcePath, ...args] = process.argv;
|
|
21
21
|
const [_command, subCommand, serviceName] = args;
|
|
@@ -25,7 +25,6 @@ export default async (options) => {
|
|
|
25
25
|
enable: async () => enableOrDisableAPI(serviceName, true),
|
|
26
26
|
list: async () => {
|
|
27
27
|
var _a, _b, _c;
|
|
28
|
-
await checkIfOnlineOrDie();
|
|
29
28
|
/**
|
|
30
29
|
* List currently enabled APIs.
|
|
31
30
|
*/
|
|
@@ -43,10 +42,10 @@ export default async (options) => {
|
|
|
43
42
|
}
|
|
44
43
|
// Filter out the disabled ones. Print the enabled ones.
|
|
45
44
|
const enabledAPIs = serviceList.filter((service) => service.state === 'ENABLED');
|
|
46
|
-
for (const
|
|
47
|
-
if (
|
|
48
|
-
const name = (_b =
|
|
49
|
-
console.log(`${name.slice(0, name.indexOf('.'))} - ${
|
|
45
|
+
for (const { config } of enabledAPIs) {
|
|
46
|
+
if (config === null || config === void 0 ? void 0 : config.documentation) {
|
|
47
|
+
const name = (_b = config.name) !== null && _b !== void 0 ? _b : 'Unknown name.';
|
|
48
|
+
console.log(`${name.slice(0, name.indexOf('.'))} - ${config.documentation.summary}`);
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
/**
|
|
@@ -66,10 +65,11 @@ export default async (options) => {
|
|
|
66
65
|
// Sort the services based on id
|
|
67
66
|
publicServices.sort((a, b) => (a.id > b.id ? 1 : a.id < b.id ? -1 : 0));
|
|
68
67
|
// Format the list
|
|
69
|
-
|
|
68
|
+
for (const service of publicServices) {
|
|
69
|
+
console.log(`${service.name.padEnd(25)} - ${service.description.padEnd(60)}`);
|
|
70
|
+
}
|
|
70
71
|
},
|
|
71
72
|
undefined: async () => {
|
|
72
|
-
await apiSubCommands.list();
|
|
73
73
|
console.log(`# Try these commands:
|
|
74
74
|
- clasp apis list
|
|
75
75
|
- clasp apis enable slides
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apis.js","sourceRoot":"","sources":["../../../src/commands/apis.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"apis.js","sourceRoot":"","sources":["../../../src/commands/apis.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,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AC,CAAC;IAC/C,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACrB,MAAM,IAAI,CAAC,OAAO,EAAE,EAAC,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC;AACrC,CAAC,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { fetchProject, hasProject, writeProjectFiles } from '../files.js';
|
|
|
4
4
|
import { scriptIdPrompt } from '../inquirer.js';
|
|
5
5
|
import { ERROR, LOG } from '../messages.js';
|
|
6
6
|
import { extractScriptId } from '../urls.js';
|
|
7
|
-
import {
|
|
7
|
+
import { saveProject, spinner } from '../utils.js';
|
|
8
8
|
import status from './status.js';
|
|
9
9
|
import { Conf } from '../conf.js';
|
|
10
10
|
const config = Conf.get();
|
|
@@ -20,14 +20,14 @@ export default async (scriptId, versionNumber, options) => {
|
|
|
20
20
|
if (options.rootDir) {
|
|
21
21
|
config.projectRootDirectory = options.rootDir;
|
|
22
22
|
}
|
|
23
|
-
await checkIfOnlineOrDie();
|
|
24
23
|
if (hasProject()) {
|
|
25
24
|
throw new ClaspError(ERROR.FOLDER_EXISTS());
|
|
26
25
|
}
|
|
27
26
|
const id = scriptId ? extractScriptId(scriptId) : await getScriptId();
|
|
28
27
|
spinner.start(LOG.CLONING);
|
|
28
|
+
const files = await fetchProject(id, versionNumber);
|
|
29
29
|
await saveProject({ scriptId: id, rootDir: config.projectRootDirectory }, false);
|
|
30
|
-
await writeProjectFiles(
|
|
30
|
+
await writeProjectFiles(files, config.projectRootDirectory);
|
|
31
31
|
await status();
|
|
32
32
|
};
|
|
33
33
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clone.js","sourceRoot":"","sources":["../../../src/commands/clone.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,EAAE,kBAAkB,EAAC,MAAM,YAAY,CAAC;AACrD,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAC,YAAY,EAAE,UAAU,EAAE,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AA,CAAC,CAAC;QAEJ,OAAO,CAAC,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC;KACjD;IAED,MAAM,IAAI,UAAU,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAChD,CAAC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import is from '@sindresorhus/is';
|
|
1
2
|
import { SCRIPT_TYPES } from '../apis.js';
|
|
2
3
|
import { drive, loadAPICredentials, script } from '../auth.js';
|
|
3
4
|
import { ClaspError } from '../clasp-error.js';
|
|
@@ -5,7 +6,7 @@ import { fetchProject, hasProject, writeProjectFiles } from '../files.js';
|
|
|
5
6
|
import { scriptTypePrompt } from '../inquirer.js';
|
|
6
7
|
import { manifestExists } from '../manifest.js';
|
|
7
8
|
import { ERROR, LOG } from '../messages.js';
|
|
8
|
-
import {
|
|
9
|
+
import { getDefaultProjectName, getProjectSettings, saveProject, spinner, stopSpinner } from '../utils.js';
|
|
9
10
|
import { Conf } from '../conf.js';
|
|
10
11
|
const config = Conf.get();
|
|
11
12
|
/**
|
|
@@ -22,7 +23,6 @@ export default async (options) => {
|
|
|
22
23
|
config.projectRootDirectory = options.rootDir;
|
|
23
24
|
}
|
|
24
25
|
// Handle common errors.
|
|
25
|
-
await checkIfOnlineOrDie();
|
|
26
26
|
if (hasProject()) {
|
|
27
27
|
throw new ClaspError(ERROR.FOLDER_EXISTS());
|
|
28
28
|
}
|
|
@@ -30,7 +30,7 @@ export default async (options) => {
|
|
|
30
30
|
// Create defaults.
|
|
31
31
|
const { parentId: optionParentId, title: name = getDefaultProjectName(), type: optionType } = options;
|
|
32
32
|
let parentId = optionParentId;
|
|
33
|
-
const filetype = optionType !== null && optionType !== void 0 ? optionType : (
|
|
33
|
+
const filetype = optionType !== null && optionType !== void 0 ? optionType : (optionParentId ? '' : (await scriptTypePrompt()).type);
|
|
34
34
|
// Create files with MIME type.
|
|
35
35
|
// https://developers.google.com/drive/api/v3/mime-types
|
|
36
36
|
const DRIVE_FILE_MIMETYPES = {
|
|
@@ -51,10 +51,10 @@ export default async (options) => {
|
|
|
51
51
|
spinner.start(LOG.CREATE_PROJECT_START(name));
|
|
52
52
|
let projectExist;
|
|
53
53
|
try {
|
|
54
|
-
projectExist =
|
|
54
|
+
projectExist = is.string((await getProjectSettings()).scriptId);
|
|
55
55
|
}
|
|
56
56
|
catch {
|
|
57
|
-
process.exitCode = 0; // To reset `exitCode` that was
|
|
57
|
+
process.exitCode = 0; // To reset `exitCode` that was overridden in ClaspError constructor.
|
|
58
58
|
projectExist = false;
|
|
59
59
|
}
|
|
60
60
|
if (projectExist) {
|
|
@@ -62,7 +62,7 @@ export default async (options) => {
|
|
|
62
62
|
}
|
|
63
63
|
// Create a new Apps Script project
|
|
64
64
|
const { data, status, statusText } = await script.projects.create({
|
|
65
|
-
requestBody: { parentId
|
|
65
|
+
requestBody: { parentId, title: name },
|
|
66
66
|
});
|
|
67
67
|
stopSpinner();
|
|
68
68
|
if (status !== 200) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AACxC,OAAO,EAAC,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAC,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAC,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAC,MAAM,aAAa,CAAC;AACxE,OAAO,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAC,KAAK,EAAE,GAAG,EAAC,MAAM,gBAAgB,CAAC;AAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/create.ts"],"names":[],"mappings":"AA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: (_: unknown, command: ReadonlyDeep<Command>) => Promise<void>;
|
|
4
4
|
/**
|
|
5
5
|
* Displays a default message when an unknown command is typed.
|
|
6
6
|
* @param command {string} The command that was typed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.js","sourceRoot":"","sources":["../../../src/commands/default.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"default.js","sourceRoot":"","sources":["../../../src/commands/default.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAC;AAErC;;;GAGG;AACH,eAAe,KAAK,EAAE,CAAU,EAAE,OAA8B,EAAiB,EAAE;IACjF,MAAM,IAAI,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { loadAPICredentials, script } from '../auth.js';
|
|
|
2
2
|
import { ClaspError } from '../clasp-error.js';
|
|
3
3
|
import { PROJECT_MANIFEST_BASENAME as manifestFileName } from '../constants.js';
|
|
4
4
|
import { ERROR, LOG } from '../messages.js';
|
|
5
|
-
import {
|
|
5
|
+
import { getProjectSettings, spinner, stopSpinner } from '../utils.js';
|
|
6
6
|
/**
|
|
7
7
|
* Deploys an Apps Script project.
|
|
8
8
|
* @param options.versionNumber {string} The project version to deploy at.
|
|
@@ -10,7 +10,6 @@ import { checkIfOnlineOrDie, getProjectSettings, spinner, stopSpinner } from '..
|
|
|
10
10
|
* @param options.deploymentId {string} The deployment ID to redeploy.
|
|
11
11
|
*/
|
|
12
12
|
export default async (options) => {
|
|
13
|
-
await checkIfOnlineOrDie();
|
|
14
13
|
await loadAPICredentials();
|
|
15
14
|
const { scriptId } = await getProjectSettings();
|
|
16
15
|
if (!scriptId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../src/commands/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAE,MAAM,EAAC,MAAM,YAAY,CAAC;AACtD,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAC,yBAAyB,IAAI,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAC,KAAK,EAAE,GAAG,EAAC,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAC,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../src/commands/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAE,MAAM,EAAC,MAAM,YAAY,CAAC;AACtD,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAC,yBAAyB,IAAI,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAC,KAAK,EAAE,GAAG,EAAC,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAC,kBAAkB,EAAE,OAAO,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAQrE;;;;;GAKG;AACH,eAAe,KAAK,EAAE,OAAsB,EAAiB,EAAE;IAC7D,MAAM,kBAAkB,EAAE,CAAC;IAC3B,MAAM,EAAC,QAAQ,EAAC,GAAG,MAAM,kBAAkB,EAAE,CAAC;IAC9C,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO;KACR;IAED,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE9C,IAAI,EAAC,aAAa,EAAC,GAAG,OAAO,CAAC;IAC9B,MAAM,EAAC,YAAY,EAAE,WAAW,GAAG,EAAE,EAAC,GAAG,OAAO,CAAC;IAEjD,sCAAsC;IACtC,IAAI,CAAC,aAAa,EAAE;QAClB,MAAM,EACJ,IAAI,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
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { loadAPICredentials, script } from '../auth.js';
|
|
2
2
|
import { ClaspError } from '../clasp-error.js';
|
|
3
3
|
import { LOG } from '../messages.js';
|
|
4
|
-
import {
|
|
4
|
+
import { getProjectSettings, spinner, stopSpinner } from '../utils.js';
|
|
5
5
|
/**
|
|
6
6
|
* Lists a script's deployments.
|
|
7
7
|
*/
|
|
8
8
|
export default async () => {
|
|
9
|
-
await checkIfOnlineOrDie();
|
|
10
9
|
await loadAPICredentials();
|
|
11
10
|
const { scriptId } = await getProjectSettings();
|
|
12
11
|
if (scriptId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployments.js","sourceRoot":"","sources":["../../../src/commands/deployments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAE,MAAM,EAAC,MAAM,YAAY,CAAC;AACtD,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAC,GAAG,EAAC,MAAM,gBAAgB,CAAC;AACnC,OAAO,EAAC,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"deployments.js","sourceRoot":"","sources":["../../../src/commands/deployments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAE,MAAM,EAAC,MAAM,YAAY,CAAC;AACtD,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAC,GAAG,EAAC,MAAM,gBAAgB,CAAC;AACnC,OAAO,EAAC,kBAAkB,EAAE,OAAO,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAErE;;GAEG;AACH,eAAe,KAAK,IAAmB,EAAE;IACvC,MAAM,kBAAkB,EAAE,CAAC;IAC3B,MAAM,EAAC,QAAQ,EAAC,GAAG,MAAM,kBAAkB,EAAE,CAAC;IAC9C,IAAI,QAAQ,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;QAE7C,MAAM,EACJ,IAAI,EAAE,EAAC,WAAW,GAAG,EAAE,EAAC,EACxB,MAAM,EACN,UAAU,GACX,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,EAAC,QAAQ,EAAC,CAAC,CAAC;QAEvD,WAAW,EAAE,CAAC;QAEd,IAAI,MAAM,KAAK,GAAG,EAAE;YAClB,MAAM,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;SAClC;QAED,MAAM,eAAe,GAAG,WAAW,CAAC,MAAM,CAAC;QAC3C,OAAO,CAAC,GAAG,CAAC,GAAG,eAAe,IAAI,eAAe,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC;QAC3F,KAAK,MAAM,EAAC,YAAY,EAAE,gBAAgB,EAAC,IAAI,WAAW,EAAE;YAC1D,IAAI,YAAY,IAAI,gBAAgB,EAAE;gBACpC,MAAM,aAAa,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,gBAAgB,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;gBACtG,MAAM,WAAW,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC5F,OAAO,CAAC,GAAG,CAAC,KAAK,YAAY,IAAI,aAAa,IAAI,WAAW,EAAE,CAAC,CAAC;aAClE;SACF;KACF;AACH,CAAC,CAAC"}
|
|
@@ -2,14 +2,13 @@ import { drive, loadAPICredentials } from '../auth.js';
|
|
|
2
2
|
import { ClaspError } from '../clasp-error.js';
|
|
3
3
|
import { ERROR, LOG } from '../messages.js';
|
|
4
4
|
import { URL } from '../urls.js';
|
|
5
|
-
import {
|
|
5
|
+
import { ellipsize, spinner, stopSpinner } from '../utils.js';
|
|
6
6
|
/**
|
|
7
7
|
* Lists a user's Apps Script projects using Google Drive.
|
|
8
8
|
* @param options.noShorten {boolean}
|
|
9
9
|
*/
|
|
10
10
|
export default async (options) => {
|
|
11
11
|
var _a;
|
|
12
|
-
await checkIfOnlineOrDie();
|
|
13
12
|
await loadAPICredentials();
|
|
14
13
|
spinner.start(LOG.FINDING_SCRIPTS);
|
|
15
14
|
const { data: { files = [] }, status, } = await drive.files.list({
|
|
@@ -25,7 +24,7 @@ export default async (options) => {
|
|
|
25
24
|
stopSpinner();
|
|
26
25
|
if (files.length > 0) {
|
|
27
26
|
for (const file of files) {
|
|
28
|
-
console.log(`${
|
|
27
|
+
console.log(`${options.noShorten ? file.name : ellipsize(file.name, 20)} - ${URL.SCRIPT((_a = file.id) !== null && _a !== void 0 ? _a : '')}`);
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
30
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,kBAAkB,EAAC,MAAM,YAAY,CAAC;AACrD,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAC,KAAK,EAAE,GAAG,EAAC,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAC,GAAG,EAAC,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,kBAAkB,EAAC,MAAM,YAAY,CAAC;AACrD,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAC,KAAK,EAAE,GAAG,EAAC,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAC,GAAG,EAAC,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAM5D;;;GAGG;AACH,eAAe,KAAK,EAAE,OAAsB,EAAiB,EAAE;;IAC7D,MAAM,kBAAkB,EAAE,CAAC;IAE3B,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAEnC,MAAM,EACJ,IAAI,EAAE,EAAC,KAAK,GAAG,EAAE,EAAC,EAClB,MAAM,GACP,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC;QACzB,QAAQ,EAAE,EAAE;QACZ,mCAAmC;QACnC,qEAAqE;QACrE,4CAA4C;QAC5C,CAAC,EAAE,+CAA+C;KACnD,CAAC,CAAC;IAEH,IAAI,MAAM,KAAK,GAAG,EAAE;QAClB,MAAM,IAAI,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KACnC;IAED,WAAW,EAAE,CAAC;IAEd,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QACpB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAK,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,IAAK,EAAE,EAAE,CAAC,MAAM,GAAG,CAAC,MAAM,CAAC,MAAA,IAAI,CAAC,EAAE,mCAAI,EAAE,CAAC,EAAE,CAAC,CAAC;SAC7G;KACF;SAAM;QACL,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;KACtC;AACH,CAAC,CAAC"}
|
|
@@ -7,7 +7,7 @@ import { authorize, defaultScopes, getLoggedInEmail, scopeWebAppDeploy } from '.
|
|
|
7
7
|
import { FS_OPTIONS } from '../constants.js';
|
|
8
8
|
import { readManifest } from '../manifest.js';
|
|
9
9
|
import { ERROR, LOG } from '../messages.js';
|
|
10
|
-
import {
|
|
10
|
+
import { hasOauthClientSettings, safeIsOnline } from '../utils.js';
|
|
11
11
|
const { readJsonSync } = fs;
|
|
12
12
|
/**
|
|
13
13
|
* Logs the user in. Saves the client credentials to an either local or global rc file.
|
|
@@ -36,9 +36,10 @@ export default async (options) => {
|
|
|
36
36
|
console.error(ERROR.LOGGED_IN_GLOBAL);
|
|
37
37
|
}
|
|
38
38
|
console.log(LOG.LOGIN(isLocalLogin));
|
|
39
|
-
await checkIfOnlineOrDie();
|
|
40
39
|
// Localhost check
|
|
41
40
|
const useLocalhost = Boolean(options.localhost);
|
|
41
|
+
// Use the specified redirectPort if provided
|
|
42
|
+
const redirectPort = options.redirectPort;
|
|
42
43
|
// Using own credentials.
|
|
43
44
|
if (options.creds) {
|
|
44
45
|
// First read the manifest to detect any additional scopes in "oauthScopes" fields.
|
|
@@ -54,12 +55,12 @@ export default async (options) => {
|
|
|
54
55
|
File > Project Properties > Scopes\n`);
|
|
55
56
|
// Read credentials file.
|
|
56
57
|
const creds = readJsonSync(options.creds, FS_OPTIONS);
|
|
57
|
-
await authorize({ creds, scopes, useLocalhost });
|
|
58
|
+
await authorize({ creds, scopes, useLocalhost, redirectPort });
|
|
58
59
|
await enableAppsScriptAPI();
|
|
59
60
|
return;
|
|
60
61
|
}
|
|
61
62
|
// Not using own credentials
|
|
62
63
|
// Use the default scopes needed for clasp.
|
|
63
|
-
await authorize({ scopes: defaultScopes, useLocalhost });
|
|
64
|
+
await authorize({ scopes: defaultScopes, useLocalhost, redirectPort });
|
|
64
65
|
};
|
|
65
66
|
//# sourceMappingURL=login.js.map
|