@google/clasp 2.4.2 → 3.0.0-alpha1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +253 -196
- package/build/src/auth/auth.js +176 -0
- package/build/src/auth/auth_code_flow.js +36 -0
- package/build/src/auth/credential_store.js +1 -0
- package/build/src/auth/file_credential_store.js +82 -0
- package/build/src/auth/localhost_auth_code_flow.js +62 -0
- package/build/src/auth/serverless_auth_code_flow.js +32 -0
- package/build/src/commands/clone-script.js +71 -0
- package/build/src/commands/create-deployment.js +33 -0
- package/build/src/commands/create-script.js +75 -0
- package/build/src/commands/create-version.js +31 -0
- package/build/src/commands/delete-deployment.js +71 -0
- package/build/src/commands/disable-api.js +19 -0
- package/build/src/commands/enable-api.js +31 -0
- package/build/src/commands/list-apis.js +23 -0
- package/build/src/commands/list-deployments.js +30 -0
- package/build/src/commands/list-scripts.js +28 -0
- package/build/src/commands/list-versions.js +29 -0
- package/build/src/commands/login.js +54 -53
- package/build/src/commands/logout.js +15 -15
- package/build/src/commands/open-apis.js +11 -0
- package/build/src/commands/open-container.js +15 -0
- package/build/src/commands/open-credentials.js +11 -0
- package/build/src/commands/open-logs.js +11 -0
- package/build/src/commands/open-script.js +18 -0
- package/build/src/commands/open-webapp.js +56 -0
- package/build/src/commands/program.js +108 -0
- package/build/src/commands/pull.js +19 -18
- package/build/src/commands/push.js +64 -74
- package/build/src/commands/run-function.js +61 -0
- package/build/src/commands/setup-logs.js +12 -0
- package/build/src/commands/show-authorized-user.js +18 -0
- package/build/src/commands/show-file-status.js +34 -0
- package/build/src/commands/tail-logs.js +92 -0
- package/build/src/commands/utils.js +82 -0
- package/build/src/constants.js +0 -3
- package/build/src/{apis.js → core/apis.js} +90 -92
- package/build/src/core/clasp.js +171 -0
- package/build/src/core/files.js +359 -0
- package/build/src/core/functions.js +51 -0
- package/build/src/core/logs.js +41 -0
- package/build/src/core/manifest.js +1 -0
- package/build/src/core/project.js +313 -0
- package/build/src/core/services.js +179 -0
- package/build/src/core/utils.js +121 -0
- package/build/src/index.js +16 -354
- package/build/src/intl.js +34 -0
- package/docs/README.md +1 -4
- package/docs/config-files.md +4 -5
- package/docs/run.md +26 -7
- package/package.json +87 -51
- package/CHANGELOG.md +0 -66
- package/build/src/apis.d.ts +0 -34
- package/build/src/apis.js.map +0 -1
- package/build/src/apiutils.d.ts +0 -16
- package/build/src/apiutils.js +0 -81
- package/build/src/apiutils.js.map +0 -1
- package/build/src/auth.d.ts +0 -34
- package/build/src/auth.js +0 -295
- package/build/src/auth.js.map +0 -1
- package/build/src/clasp-error.d.ts +0 -3
- package/build/src/clasp-error.js +0 -10
- package/build/src/clasp-error.js.map +0 -1
- package/build/src/commands/apis.d.ts +0 -10
- package/build/src/commands/apis.js +0 -91
- package/build/src/commands/apis.js.map +0 -1
- package/build/src/commands/clone.d.ts +0 -13
- package/build/src/commands/clone.js +0 -59
- package/build/src/commands/clone.js.map +0 -1
- package/build/src/commands/create.d.ts +0 -16
- package/build/src/commands/create.js +0 -81
- package/build/src/commands/create.js.map +0 -1
- package/build/src/commands/default.d.ts +0 -8
- package/build/src/commands/default.js +0 -10
- package/build/src/commands/default.js.map +0 -1
- package/build/src/commands/deploy.d.ts +0 -13
- package/build/src/commands/deploy.js +0 -51
- package/build/src/commands/deploy.js.map +0 -1
- package/build/src/commands/deployments.d.ts +0 -5
- package/build/src/commands/deployments.js +0 -29
- package/build/src/commands/deployments.js.map +0 -1
- package/build/src/commands/list.d.ts +0 -9
- package/build/src/commands/list.js +0 -34
- package/build/src/commands/list.js.map +0 -1
- package/build/src/commands/login.d.ts +0 -14
- package/build/src/commands/login.js.map +0 -1
- package/build/src/commands/logout.d.ts +0 -5
- package/build/src/commands/logout.js.map +0 -1
- package/build/src/commands/logs.d.ts +0 -17
- package/build/src/commands/logs.js +0 -181
- package/build/src/commands/logs.js.map +0 -1
- package/build/src/commands/open.d.ts +0 -15
- package/build/src/commands/open.js +0 -89
- package/build/src/commands/open.js.map +0 -1
- package/build/src/commands/pull.d.ts +0 -10
- package/build/src/commands/pull.js.map +0 -1
- package/build/src/commands/push.d.ts +0 -11
- package/build/src/commands/push.js.map +0 -1
- package/build/src/commands/run.d.ts +0 -14
- package/build/src/commands/run.js +0 -130
- package/build/src/commands/run.js.map +0 -1
- package/build/src/commands/setting.d.ts +0 -8
- package/build/src/commands/setting.js +0 -53
- package/build/src/commands/setting.js.map +0 -1
- package/build/src/commands/status.d.ts +0 -9
- package/build/src/commands/status.js +0 -25
- package/build/src/commands/status.js.map +0 -1
- package/build/src/commands/undeploy.d.ts +0 -9
- package/build/src/commands/undeploy.js +0 -55
- package/build/src/commands/undeploy.js.map +0 -1
- package/build/src/commands/version.d.ts +0 -5
- package/build/src/commands/version.js +0 -22
- package/build/src/commands/version.js.map +0 -1
- package/build/src/commands/versions.d.ts +0 -5
- package/build/src/commands/versions.js +0 -41
- package/build/src/commands/versions.js.map +0 -1
- package/build/src/conf.d.ts +0 -40
- package/build/src/conf.js +0 -100
- package/build/src/conf.js.map +0 -1
- package/build/src/constants.d.ts +0 -6
- package/build/src/constants.js.map +0 -1
- package/build/src/dotfile.d.ts +0 -50
- package/build/src/dotfile.js +0 -71
- package/build/src/dotfile.js.map +0 -1
- package/build/src/files.d.ts +0 -70
- package/build/src/files.js +0 -318
- package/build/src/files.js.map +0 -1
- package/build/src/index.d.ts +0 -18
- package/build/src/index.js.map +0 -1
- package/build/src/inquirer.d.ts +0 -82
- package/build/src/inquirer.js +0 -111
- package/build/src/inquirer.js.map +0 -1
- package/build/src/manifest.d.ts +0 -123
- package/build/src/manifest.js +0 -142
- package/build/src/manifest.js.map +0 -1
- package/build/src/messages.d.ts +0 -110
- package/build/src/messages.js +0 -161
- package/build/src/messages.js.map +0 -1
- package/build/src/urls.d.ts +0 -21
- package/build/src/urls.js +0 -33
- package/build/src/urls.js.map +0 -1
- package/build/src/utils.d.ts +0 -102
- package/build/src/utils.js +0 -232
- package/build/src/utils.js.map +0 -1
- package/docs/develop.md +0 -81
- package/docs/esmodules.md +0 -81
- package/docs/running-locally.md +0 -31
- package/docs/settings.md +0 -56
- package/docs/typescript.md +0 -354
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import readline from 'readline';
|
|
3
|
-
import { getFunctionNames } from '../apiutils.js';
|
|
4
|
-
import { getLocalScript, loadAPICredentials, script } from '../auth.js';
|
|
5
|
-
import { ClaspError } from '../clasp-error.js';
|
|
6
|
-
import { addScopeToManifest, isValidRunManifest } from '../manifest.js';
|
|
7
|
-
import { ERROR } from '../messages.js';
|
|
8
|
-
import { URL } from '../urls.js';
|
|
9
|
-
import { getProjectSettings, parseJsonOrDie, spinner, stopSpinner } from '../utils.js';
|
|
10
|
-
/**
|
|
11
|
-
* Executes an Apps Script function. Requires clasp login --creds.
|
|
12
|
-
* @param functionName {string} The function name within the Apps Script project.
|
|
13
|
-
* @param options.nondev {boolean} If we want to run the last deployed version vs the latest code.
|
|
14
|
-
* @param options.params {string} JSON string of parameters to be input to function.
|
|
15
|
-
* @see https://developers.google.com/apps-script/api/how-tos/execute
|
|
16
|
-
* @requires `clasp login --creds` to be run beforehand.
|
|
17
|
-
*/
|
|
18
|
-
export default async (functionName, options) => {
|
|
19
|
-
await loadAPICredentials();
|
|
20
|
-
const { scriptId } = await getProjectSettings();
|
|
21
|
-
const devMode = !options.nondev; // Defaults to true
|
|
22
|
-
const { params: jsonString = '[]' } = options;
|
|
23
|
-
const parameters = parseJsonOrDie(jsonString);
|
|
24
|
-
await isValidRunManifest();
|
|
25
|
-
// TODO COMMENT THIS. This uses a method that gives a HTML 404.
|
|
26
|
-
// await enableExecutionAPI();
|
|
27
|
-
// Pushes the latest code if in dev mode.
|
|
28
|
-
// We need to update the manifest before executing to:
|
|
29
|
-
// - Ensure the execution API is enabled.
|
|
30
|
-
// - Ensure we can run functions that were developed locally but not pushed.
|
|
31
|
-
if (devMode) {
|
|
32
|
-
console.log('Running in dev mode.');
|
|
33
|
-
// TODO enable this once we can properly await pushFiles
|
|
34
|
-
// await pushFiles(true);
|
|
35
|
-
}
|
|
36
|
-
await runFunction(functionName !== null && functionName !== void 0 ? functionName : (await getFunctionNames(script, scriptId)), parameters, scriptId, devMode);
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Runs a function.
|
|
40
|
-
* @see https://developers.google.com/apps-script/api/reference/rest/v1/scripts/run#response-body
|
|
41
|
-
*/
|
|
42
|
-
const runFunction = async (functionName, parameters, scriptId, devMode) => {
|
|
43
|
-
var _a;
|
|
44
|
-
try {
|
|
45
|
-
// Load local credentials.
|
|
46
|
-
await loadAPICredentials(true);
|
|
47
|
-
const localScript = await getLocalScript();
|
|
48
|
-
spinner.start(`Running function: ${functionName}`);
|
|
49
|
-
const apiResponse = await localScript.scripts.run({
|
|
50
|
-
scriptId,
|
|
51
|
-
requestBody: { function: functionName, parameters, devMode },
|
|
52
|
-
});
|
|
53
|
-
stopSpinner();
|
|
54
|
-
if (!(apiResponse === null || apiResponse === void 0 ? void 0 : apiResponse.data.done)) {
|
|
55
|
-
throw new ClaspError(ERROR.RUN_NODATA, 0); // Exit gracefully in case localhost server spun up for authorize
|
|
56
|
-
}
|
|
57
|
-
const { error, response } = apiResponse.data;
|
|
58
|
-
// @see https://developers.google.com/apps-script/api/reference/rest/v1/scripts/run#response-body
|
|
59
|
-
if (response) {
|
|
60
|
-
console.log((_a = response.result) !== null && _a !== void 0 ? _a : chalk.red('No response.'));
|
|
61
|
-
}
|
|
62
|
-
else if (error === null || error === void 0 ? void 0 : error.details) {
|
|
63
|
-
// @see https://developers.google.com/apps-script/api/reference/rest/v1/scripts/run#Status
|
|
64
|
-
const { errorMessage, errorType, scriptStackTraceElements } = error.details[0];
|
|
65
|
-
console.error(`${chalk.red('Exception:')}`, errorMessage, scriptStackTraceElements || []);
|
|
66
|
-
throw new ClaspError(errorType);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
catch (error) {
|
|
70
|
-
if (error instanceof ClaspError) {
|
|
71
|
-
throw error;
|
|
72
|
-
}
|
|
73
|
-
stopSpinner();
|
|
74
|
-
if (error) {
|
|
75
|
-
// TODO move these to logError when stable?
|
|
76
|
-
switch (error.code) {
|
|
77
|
-
case 401:
|
|
78
|
-
// The 401 is probably due to this error:
|
|
79
|
-
// "Error: Local client credentials unauthenticated. Check scopes/authorization.""
|
|
80
|
-
// This is probably due to the OAuth client not having authorized scopes.
|
|
81
|
-
console.log(`Hey! It looks like you aren't authenticated for the scopes required by this script.
|
|
82
|
-
Please enter the scopes by doing the following:
|
|
83
|
-
1. Open Your Script: ${URL.SCRIPT(scriptId)}
|
|
84
|
-
2. File > Project Properties > Scopes
|
|
85
|
-
3. Copy/Paste the list of scopes here:
|
|
86
|
-
~ Example ~
|
|
87
|
-
https://mail.google.com/
|
|
88
|
-
https://www.googleapis.com/auth/presentations
|
|
89
|
-
----(When you're done, press <Enter> 2x)----`);
|
|
90
|
-
readScopesFromStdinAndAddToManifest();
|
|
91
|
-
// We probably don't need to show the unauth error
|
|
92
|
-
// since we always prompt the user to fix this now.
|
|
93
|
-
// throw new ClaspError(ERROR.UNAUTHENTICATED_LOCAL);
|
|
94
|
-
break;
|
|
95
|
-
case 403:
|
|
96
|
-
throw new ClaspError(ERROR.PERMISSION_DENIED_LOCAL);
|
|
97
|
-
case 404:
|
|
98
|
-
throw new ClaspError(ERROR.EXECUTE_ENTITY_NOT_FOUND);
|
|
99
|
-
default:
|
|
100
|
-
throw new ClaspError(`(${error.code}) Error: ${error.message}`);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
const readScopesFromStdinAndAddToManifest = () => {
|
|
106
|
-
// Example scopes:
|
|
107
|
-
// https://mail.google.com/
|
|
108
|
-
// https://www.googleapis.com/auth/presentations
|
|
109
|
-
// https://www.googleapis.com/auth/spreadsheets
|
|
110
|
-
const scopes = [];
|
|
111
|
-
const readlineInterface = readline.createInterface({ input: process.stdin, output: process.stdout, prompt: '' });
|
|
112
|
-
const readScope = (input) => {
|
|
113
|
-
if (input === '') {
|
|
114
|
-
readlineInterface.close();
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
scopes.push(input);
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
const addToManifest = async () => {
|
|
121
|
-
await addScopeToManifest(scopes);
|
|
122
|
-
const scopeCount = scopes.length;
|
|
123
|
-
console.log(`Added ${scopeCount} ${scopeCount === 1 ? 'scope' : 'scopes'} to your appsscript.json' oauthScopes`);
|
|
124
|
-
console.log('Please `clasp login --creds <file>` to log in with these new scopes.');
|
|
125
|
-
};
|
|
126
|
-
readlineInterface.prompt();
|
|
127
|
-
readlineInterface.on('line', readScope);
|
|
128
|
-
readlineInterface.on('close', addToManifest);
|
|
129
|
-
};
|
|
130
|
-
//# sourceMappingURL=run.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/commands/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAC,cAAc,EAAE,kBAAkB,EAAE,MAAM,EAAC,MAAM,YAAY,CAAC;AACtE,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAC,kBAAkB,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAC,GAAG,EAAC,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAC,kBAAkB,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAOrF;;;;;;;GAOG;AACH,eAAe,KAAK,EAAE,YAAoB,EAAE,OAAsB,EAAiB,EAAE;IACn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iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;AAC/C,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ProjectSettings } from '../dotfile.js';
|
|
2
|
-
declare const _default: (settingKey?: keyof ProjectSettings | undefined, settingValue?: string | undefined) => Promise<void>;
|
|
3
|
-
/**
|
|
4
|
-
* Gets or sets a setting in .clasp.json
|
|
5
|
-
* @param {keyof ProjectSettings} settingKey The key to set
|
|
6
|
-
* @param {string?} settingValue Optional value to set the key to
|
|
7
|
-
*/
|
|
8
|
-
export default _default;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { ClaspError } from '../clasp-error.js';
|
|
2
|
-
import { ERROR } from '../messages.js';
|
|
3
|
-
import { getProjectSettings, saveProject } from '../utils.js';
|
|
4
|
-
/**
|
|
5
|
-
* Gets or sets a setting in .clasp.json
|
|
6
|
-
* @param {keyof ProjectSettings} settingKey The key to set
|
|
7
|
-
* @param {string?} settingValue Optional value to set the key to
|
|
8
|
-
*/
|
|
9
|
-
export default async (settingKey, settingValue) => {
|
|
10
|
-
var _a;
|
|
11
|
-
const currentSettings = await getProjectSettings();
|
|
12
|
-
// Display all settings if ran `clasp setting`.
|
|
13
|
-
if (!settingKey) {
|
|
14
|
-
console.log(currentSettings);
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
// Make a new spinner piped to stdErr so we don't interfere with output
|
|
18
|
-
if (!settingValue) {
|
|
19
|
-
if (settingKey in currentSettings) {
|
|
20
|
-
let keyValue = (_a = currentSettings[settingKey]) !== null && _a !== void 0 ? _a : '';
|
|
21
|
-
if (Array.isArray(keyValue)) {
|
|
22
|
-
keyValue = keyValue.toString();
|
|
23
|
-
}
|
|
24
|
-
// We don't use console.log as it automatically adds a new line
|
|
25
|
-
// Which interfers with storing the value
|
|
26
|
-
process.stdout.write(keyValue);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
throw new ClaspError(ERROR.UNKNOWN_KEY(settingKey));
|
|
30
|
-
}
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
try {
|
|
34
|
-
const currentValue = settingKey in currentSettings ? currentSettings[settingKey] : '';
|
|
35
|
-
// filePushOrder doesn't work since it requires an array.
|
|
36
|
-
// const filePushOrder = settingKey === 'filePushOrder' ? settingValue : currentSettings.filePushOrder;
|
|
37
|
-
if (['fileExtension', 'projectId', 'rootDir', 'scriptId'].includes(settingKey)) {
|
|
38
|
-
Reflect.set(currentSettings, settingKey, settingValue);
|
|
39
|
-
await saveProject(currentSettings, true);
|
|
40
|
-
console.log(`Updated "${settingKey}": "${currentValue}" → "${settingValue}"`);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
throw new ClaspError(ERROR.UNKNOWN_KEY(settingKey));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
if (error instanceof ClaspError) {
|
|
48
|
-
throw error;
|
|
49
|
-
}
|
|
50
|
-
throw new ClaspError('Unable to update .clasp.json');
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
//# sourceMappingURL=setting.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setting.js","sourceRoot":"","sources":["../../../src/commands/setting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAC,kBAAkB,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAE5D;;;;GAIG;AACH,eAAe,KAAK,EAAE,UAAkC,EAAE,YAAqB,EAAiB,EAAE;;IAChG,MAAM,eAAe,GAAG,MAAM,kBAAkB,EAAE,CAAC;IAEnD,+CAA+C;IAC/C,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QAC7B,OAAO;KACR;IAED,uEAAuE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face CommandOption {
|
|
2
|
-
readonly json?: boolean;
|
|
3
|
-
}
|
|
4
|
-
declare const _default: ({ json }?: CommandOption) => Promise<void>;
|
|
5
|
-
/**
|
|
6
|
-
* Displays the status of which Apps Script files are ignored from .claspignore
|
|
7
|
-
* @param options.json {boolean} Displays the status in json format.
|
|
8
|
-
*/
|
|
9
|
-
export default _default;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { getAllProjectFiles, getOrderedProjectFiles, logFileList, splitProjectFiles } from '../files.js';
|
|
2
|
-
import { LOG } from '../messages.js';
|
|
3
|
-
import { getProjectSettings } from '../utils.js';
|
|
4
|
-
/**
|
|
5
|
-
* Displays the status of which Apps Script files are ignored from .claspignore
|
|
6
|
-
* @param options.json {boolean} Displays the status in json format.
|
|
7
|
-
*/
|
|
8
|
-
export default async ({ json } = { json: false }) => {
|
|
9
|
-
const { filePushOrder, scriptId, rootDir } = await getProjectSettings();
|
|
10
|
-
if (scriptId) {
|
|
11
|
-
const [toPush, toIgnore] = splitProjectFiles(await getAllProjectFiles(rootDir));
|
|
12
|
-
const filesToPush = getOrderedProjectFiles(toPush, filePushOrder).map(file => file.name);
|
|
13
|
-
const untrackedFiles = toIgnore.map(file => file.name);
|
|
14
|
-
if (json) {
|
|
15
|
-
console.log(JSON.stringify({ filesToPush, untrackedFiles }));
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
console.log(LOG.STATUS_PUSH);
|
|
19
|
-
logFileList(filesToPush);
|
|
20
|
-
console.log(); // Separate Ignored files list.
|
|
21
|
-
console.log(LOG.STATUS_IGNORE);
|
|
22
|
-
logFileList(untrackedFiles);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=status.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAE,sBAAsB,EAAE,WAAW,EAAE,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efined, options: CommandOption) => Promise<void>;
|
|
5
|
-
/**
|
|
6
|
-
* Removes a deployment from the Apps Script project.
|
|
7
|
-
* @param deploymentId {string} The deployment's ID
|
|
8
|
-
*/
|
|
9
|
-
export default _default;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import pMap from 'p-map';
|
|
2
|
-
import { loadAPICredentials, script } from '../auth.js';
|
|
3
|
-
import { ClaspError } from '../clasp-error.js';
|
|
4
|
-
import { ERROR, LOG } from '../messages.js';
|
|
5
|
-
import { getProjectSettings, spinner, stopSpinner } from '../utils.js';
|
|
6
|
-
/**
|
|
7
|
-
* Removes a deployment from the Apps Script project.
|
|
8
|
-
* @param deploymentId {string} The deployment's ID
|
|
9
|
-
*/
|
|
10
|
-
export default async (deploymentId, options) => {
|
|
11
|
-
await loadAPICredentials();
|
|
12
|
-
const { scriptId } = await getProjectSettings();
|
|
13
|
-
if (scriptId) {
|
|
14
|
-
if (options.all) {
|
|
15
|
-
const mapper = async ({ deploymentId }) => deleteDeployment(scriptId, deploymentId);
|
|
16
|
-
const deployments = await listDeployments(scriptId);
|
|
17
|
-
deployments.shift(); // @HEAD (Read-only deployments) may not be deleted.
|
|
18
|
-
await pMap(deployments, mapper);
|
|
19
|
-
console.log(LOG.UNDEPLOYMENT_ALL_FINISH);
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
if (!deploymentId) {
|
|
23
|
-
const deployments = await listDeployments(scriptId);
|
|
24
|
-
// @HEAD (Read-only deployments) may not be deleted.
|
|
25
|
-
deployments.shift();
|
|
26
|
-
const lastDeployment = deployments.pop();
|
|
27
|
-
if (!lastDeployment) {
|
|
28
|
-
throw new ClaspError(ERROR.SCRIPT_ID_INCORRECT(scriptId));
|
|
29
|
-
}
|
|
30
|
-
deploymentId = lastDeployment.deploymentId;
|
|
31
|
-
}
|
|
32
|
-
await deleteDeployment(scriptId, deploymentId);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
const deleteDeployment = async (scriptId, deploymentId) => {
|
|
36
|
-
spinner.start(LOG.UNDEPLOYMENT_START(deploymentId));
|
|
37
|
-
const { status } = await script.projects.deployments.delete({ scriptId, deploymentId });
|
|
38
|
-
if (status !== 200) {
|
|
39
|
-
throw new ClaspError(ERROR.READ_ONLY_DELETE);
|
|
40
|
-
}
|
|
41
|
-
stopSpinner();
|
|
42
|
-
console.log(LOG.UNDEPLOYMENT_FINISH(deploymentId));
|
|
43
|
-
};
|
|
44
|
-
const listDeployments = async (scriptId) => {
|
|
45
|
-
const { data, status, statusText } = await script.projects.deployments.list({ scriptId });
|
|
46
|
-
if (status !== 200) {
|
|
47
|
-
throw new ClaspError(statusText);
|
|
48
|
-
}
|
|
49
|
-
const { deployments = [] } = data;
|
|
50
|
-
if (deployments.length === 0) {
|
|
51
|
-
throw new ClaspError(ERROR.SCRIPT_ID_INCORRECT(scriptId));
|
|
52
|
-
}
|
|
53
|
-
return deployments;
|
|
54
|
-
};
|
|
55
|
-
//# sourceMappingURL=undeploy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"undeploy.js","sourceRoot":"","sources":["../../../src/commands/undeploy.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,OAAO,CAAC;AAEzB,OAAO,EAAC,kBAAkB,EAAE,MAAM,EAAC,MAAM,YAAY,CAAC;AACtD,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAC,KAAK,EAAE,GAAG,EAAC,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAC,kBAAkB,EAAE,OAAO,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAMrE;;;GAGG;AACH,eAAe,KAAK,EAAE,YAAgC,EAAE,OAAsB,EAAiB,EAAE;IAC/F,MAAM,kBAAkB,EAAE,CAAC;IAC3B,MAAM,EAAC,QAAQ,EAAC,GAAG,MAAM,kBAAkB,EAAE,CAAC;IAC9C,IAAI,QAAQ,EAAE;QACZ,IAAI,OAA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AAW,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAC;AACrD,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,KAAK,EAAE,QAAgB,EAAE,EAAE;IACjD,MAAM,EAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAC,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,EAAC,QAAQ,EAAC,CAAC,CAAC;IACtF,IAAI,MAAM,KAAK,GAAG,EAAE;QAClB,MAAM,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;KAClC;IAED,MAAM,EAAC,WAAW,GAAG,EAAE,EAAC,GAAG,IAAI,CAAC;IAChC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;QAC5B,MAAM,IAAI,UAAU,CAAC,KAAK,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC;KAC3D;IAED,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { loadAPICredentials, script } from '../auth.js';
|
|
2
|
-
import { ClaspError } from '../clasp-error.js';
|
|
3
|
-
import { descriptionPrompt } from '../inquirer.js';
|
|
4
|
-
import { LOG } from '../messages.js';
|
|
5
|
-
import { getProjectSettings, spinner, stopSpinner } from '../utils.js';
|
|
6
|
-
/**
|
|
7
|
-
* Creates a new version of an Apps Script project.
|
|
8
|
-
*/
|
|
9
|
-
export default async (description) => {
|
|
10
|
-
var _a;
|
|
11
|
-
await loadAPICredentials();
|
|
12
|
-
const { scriptId } = await getProjectSettings();
|
|
13
|
-
description = description !== null && description !== void 0 ? description : (await descriptionPrompt()).description;
|
|
14
|
-
spinner.start(LOG.VERSION_CREATE);
|
|
15
|
-
const { data, status, statusText } = await script.projects.versions.create({ scriptId, requestBody: { description } });
|
|
16
|
-
if (status !== 200) {
|
|
17
|
-
throw new ClaspError(statusText);
|
|
18
|
-
}
|
|
19
|
-
stopSpinner();
|
|
20
|
-
console.log(LOG.VERSION_CREATED((_a = data.versionNumber) !== null && _a !== void 0 ? _a : -1));
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=version.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/commands/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAE,MAAM,EAAC,MAAM,YAAY,CAAC;AACtD,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAC,GAAG,EAAC,MAAM,gBAAgB,CAAC;AACnC,OAAO,EAAC,kBAAkB,EAAE,OAAO,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAErE;;GAEG;AACH,eAAe,KAAK,EAAE,WAAoB,EAAiB,EAAE;;IAC3D,MAAM,kBAAkB,EAAE,CAAC;IAE3B,MAAM,EAAC,QAAQ,EAAC,GAAG,MAAM,kBAAkB,EAAE,CAAC;IAC9C,WAAW,GAAG,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,CAAC,MAAM,iBAAiB,EAAE,CAAC,CAAC,WAAW,CAAC;IAErE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAElC,MAAM,EAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAC,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAC,QAAQ,EAAE,WAAW,EAAE,EAAC,WAAW,EAAC,EAAC,CAAC,CAAC;IACjH,IAAI,MAAM,KAAK,GAAG,EAAE;QAClB,MAAM,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;KAClC;IAED,WAAW,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,eAAe,CAAC,MAAA,IAAI,CAAC,aAAa,mCAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7D,CAAC,CAAC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { loadAPICredentials, script } from '../auth.js';
|
|
2
|
-
import { ClaspError } from '../clasp-error.js';
|
|
3
|
-
import { LOG } from '../messages.js';
|
|
4
|
-
import { getProjectSettings, spinner, stopSpinner } from '../utils.js';
|
|
5
|
-
/**
|
|
6
|
-
* Lists versions of an Apps Script project.
|
|
7
|
-
*/
|
|
8
|
-
export default async () => {
|
|
9
|
-
await loadAPICredentials();
|
|
10
|
-
spinner.start('Grabbing versions…');
|
|
11
|
-
const { scriptId } = await getProjectSettings();
|
|
12
|
-
const versionList = await getVersionList(scriptId);
|
|
13
|
-
stopSpinner();
|
|
14
|
-
const count = versionList.length;
|
|
15
|
-
if (count === 0) {
|
|
16
|
-
throw new ClaspError(LOG.DEPLOYMENT_DNE);
|
|
17
|
-
}
|
|
18
|
-
console.log(LOG.VERSION_NUM(count));
|
|
19
|
-
versionList.reverse();
|
|
20
|
-
for (const version of versionList) {
|
|
21
|
-
console.log(LOG.VERSION_DESCRIPTION(version));
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
const getVersionList = async (scriptId) => {
|
|
25
|
-
let maxPages = 5;
|
|
26
|
-
let pageToken;
|
|
27
|
-
let list = [];
|
|
28
|
-
do {
|
|
29
|
-
const { data, status, statusText } = await script.projects.versions.list({ scriptId, pageSize: 200, pageToken });
|
|
30
|
-
if (status !== 200) {
|
|
31
|
-
throw new ClaspError(statusText);
|
|
32
|
-
}
|
|
33
|
-
const { nextPageToken, versions } = data;
|
|
34
|
-
if (versions) {
|
|
35
|
-
list = [...list, ...(versions !== null && versions !== void 0 ? versions : [])];
|
|
36
|
-
pageToken = nextPageToken !== null && nextPageToken !== void 0 ? nextPageToken : undefined;
|
|
37
|
-
}
|
|
38
|
-
} while (pageToken && --maxPages);
|
|
39
|
-
return list;
|
|
40
|
-
};
|
|
41
|
-
//#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AC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAC,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,SAAS,EAAC,CAAC,CAAC;QAC7G,IAAI,MAAM,KAAK,GAAG,EAAE;YAClB,MAAM,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;SAClC;QAED,MAAM,EAAC,aAAa,EAAE,QAAQ,EAAC,GAAG,IAAI,CAAC;QACvC,IAAI,QAAQ,EAAE;YACZ,IAAI,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE,CAAC,CAAC,CAAC;YACtC,SAAS,GAAG,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,SAAS,CAAC;SACxC;KACF,QAAQ,SAAS,IAAI,EAAE,QAAQ,EAAE;IAElC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
package/build/src/conf.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A Singleton class to hold configuration related objects.
|
|
3
|
-
* Use the `get()` method to access the unique singleton instance.
|
|
4
|
-
*
|
|
5
|
-
* Resolution order for paths is:
|
|
6
|
-
* - Explicitly set paths (via CLI option)
|
|
7
|
-
* - Env var
|
|
8
|
-
* - Well-known location
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
export declare class Conf {
|
|
13
|
-
private _root;
|
|
14
|
-
private _projectConfig;
|
|
15
|
-
private _ignore;
|
|
16
|
-
private _auth;
|
|
17
|
-
private _authLocal;
|
|
18
|
-
private static _instance;
|
|
19
|
-
/**
|
|
20
|
-
* Private to prevent direct construction calls with the `new` operator.
|
|
21
|
-
*/
|
|
22
|
-
private constructor();
|
|
23
|
-
set projectRootDirectory(path: string | undefined);
|
|
24
|
-
get projectRootDirectory(): string | undefined;
|
|
25
|
-
set projectConfig(filePath: string | undefined);
|
|
26
|
-
get projectConfig(): string | undefined;
|
|
27
|
-
set ignore(path: string | undefined);
|
|
28
|
-
get ignore(): string | undefined;
|
|
29
|
-
set auth(path: string | undefined);
|
|
30
|
-
get auth(): string | undefined;
|
|
31
|
-
set authLocal(path: string | undefined);
|
|
32
|
-
get authLocal(): string | undefined;
|
|
33
|
-
private buildPathOrUseEnv;
|
|
34
|
-
/**
|
|
35
|
-
* The static method that controls the access to the Conf singleton instance.
|
|
36
|
-
*
|
|
37
|
-
* @returns {Conf}
|
|
38
|
-
*/
|
|
39
|
-
static get(): Conf;
|
|
40
|
-
}
|
package/build/src/conf.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import os from 'os';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { findUpSync } from 'find-up';
|
|
4
|
-
import { PROJECT_NAME } from './constants.js';
|
|
5
|
-
/**
|
|
6
|
-
* Supported environment variables
|
|
7
|
-
*/
|
|
8
|
-
var ENV;
|
|
9
|
-
(function (ENV) {
|
|
10
|
-
ENV["DOT_CLASP_AUTH"] = "clasp_config_auth";
|
|
11
|
-
ENV["DOT_CLASP_IGNORE"] = "clasp_config_ignore";
|
|
12
|
-
ENV["DOT_CLASP_PROJECT"] = "clasp_config_project";
|
|
13
|
-
// MANIFEST = 'clasp_config_manifest',
|
|
14
|
-
// TSCONFIG = 'clasp_config_tsconfig',
|
|
15
|
-
})(ENV || (ENV = {}));
|
|
16
|
-
/**
|
|
17
|
-
* A Singleton class to hold configuration related objects.
|
|
18
|
-
* Use the `get()` method to access the unique singleton instance.
|
|
19
|
-
*
|
|
20
|
-
* Resolution order for paths is:
|
|
21
|
-
* - Explicitly set paths (via CLI option)
|
|
22
|
-
* - Env var
|
|
23
|
-
* - Well-known location
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*/
|
|
27
|
-
export class Conf {
|
|
28
|
-
/**
|
|
29
|
-
* Private to prevent direct construction calls with the `new` operator.
|
|
30
|
-
*/
|
|
31
|
-
constructor() { }
|
|
32
|
-
set projectRootDirectory(path) {
|
|
33
|
-
this._root = path;
|
|
34
|
-
this._projectConfig = undefined; // Force recalculation of path if root chanaged
|
|
35
|
-
}
|
|
36
|
-
get projectRootDirectory() {
|
|
37
|
-
if (this._root === undefined) {
|
|
38
|
-
const configPath = findUpSync(`.${PROJECT_NAME}.json`);
|
|
39
|
-
this._root = configPath ? path.dirname(configPath) : process.cwd();
|
|
40
|
-
}
|
|
41
|
-
return this._root;
|
|
42
|
-
}
|
|
43
|
-
set projectConfig(filePath) {
|
|
44
|
-
this._projectConfig = filePath;
|
|
45
|
-
if (filePath) {
|
|
46
|
-
this._root = path.dirname(filePath); // Root dir must be same dir as config
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
get projectConfig() {
|
|
50
|
-
if (this._projectConfig === undefined && this.projectRootDirectory) {
|
|
51
|
-
this._projectConfig = this.buildPathOrUseEnv(`.${PROJECT_NAME}.json`, this.projectRootDirectory, ENV.DOT_CLASP_PROJECT);
|
|
52
|
-
}
|
|
53
|
-
return this._projectConfig;
|
|
54
|
-
}
|
|
55
|
-
set ignore(path) {
|
|
56
|
-
this._ignore = path;
|
|
57
|
-
}
|
|
58
|
-
get ignore() {
|
|
59
|
-
if (this._ignore === undefined && this.projectRootDirectory) {
|
|
60
|
-
this._ignore = this.buildPathOrUseEnv(`.${PROJECT_NAME}ignore`, this.projectRootDirectory, ENV.DOT_CLASP_IGNORE);
|
|
61
|
-
}
|
|
62
|
-
return this._ignore;
|
|
63
|
-
}
|
|
64
|
-
set auth(path) {
|
|
65
|
-
this._auth = path;
|
|
66
|
-
}
|
|
67
|
-
get auth() {
|
|
68
|
-
if (this._auth === undefined) {
|
|
69
|
-
this._auth = this.buildPathOrUseEnv(`.${PROJECT_NAME}rc.json`, os.homedir(), ENV.DOT_CLASP_AUTH);
|
|
70
|
-
}
|
|
71
|
-
return this._auth;
|
|
72
|
-
}
|
|
73
|
-
set authLocal(path) {
|
|
74
|
-
this._authLocal = path;
|
|
75
|
-
}
|
|
76
|
-
get authLocal() {
|
|
77
|
-
if (this._authLocal === undefined && this.projectRootDirectory) {
|
|
78
|
-
this._authLocal = this.buildPathOrUseEnv(`.${PROJECT_NAME}rc.json`, this.projectRootDirectory, ENV.DOT_CLASP_AUTH);
|
|
79
|
-
}
|
|
80
|
-
return this._authLocal;
|
|
81
|
-
}
|
|
82
|
-
buildPathOrUseEnv(filename, root, envName) {
|
|
83
|
-
if (envName && process.env[envName] !== undefined) {
|
|
84
|
-
return process.env[envName];
|
|
85
|
-
}
|
|
86
|
-
return path.join(root, filename);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* The static method that controls the access to the Conf singleton instance.
|
|
90
|
-
*
|
|
91
|
-
* @returns {Conf}
|
|
92
|
-
*/
|
|
93
|
-
static get() {
|
|
94
|
-
if (!Conf._instance) {
|
|
95
|
-
Conf._instance = new Conf();
|
|
96
|
-
}
|
|
97
|
-
return Conf._instance;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
//# sourceMappingURL=conf.js.map
|
package/build/src/conf.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conf.js","sourceRoot":"","sources":["../../src/conf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAC,UAAU,EAAC,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;GAEG;AACH,IAAK,GAMJ;AAND,WAAK,GAAG;IACN,2CAAoC,CAAA;IACpC,+CAAwC,CAAA;IACxC,iDAA0C,CAAA;IAC1C,sCAAsC;IACtC,sCAAsC;AACxC,CAAC,EANI,GAAG,KAAH,GAAG,QAMP;AAED;;;;;;;;;;GAUG;AACH,MAAM,OAAO,IAAI;IASf;;OAEG;IACH,gBAAuB,CA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,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF"}
|
package/build/src/constants.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,MAAM,CAAC,MAAM,UAAU,GAAG,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAC;AAE7C,gBAAgB;AAChB,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC;AACpC,MAAM,CAAC,MAAM,yBAAyB,GAAG,YAAY,CAAC;AACtD,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,yBAAyB,OAAO,CAAC"}
|
package/build/src/dotfile.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { Credentials, OAuth2ClientOptions } from 'google-auth-library';
|
|
2
|
-
export type { Dotfile } from 'dotf';
|
|
3
|
-
export interface ProjectSettings {
|
|
4
|
-
scriptId: string;
|
|
5
|
-
rootDir?: string;
|
|
6
|
-
projectId?: string;
|
|
7
|
-
fileExtension?: string;
|
|
8
|
-
filePushOrder?: string[];
|
|
9
|
-
parentId?: string[];
|
|
10
|
-
}
|
|
11
|
-
export declare const DOTFILE: {
|
|
12
|
-
/**
|
|
13
|
-
* Reads ignore.resolve() to get a glob pattern of ignored paths.
|
|
14
|
-
* @return {Promise<string[]>} A list of file glob patterns
|
|
15
|
-
*/
|
|
16
|
-
IGNORE: () => Promise<string[]>;
|
|
17
|
-
/**
|
|
18
|
-
* Gets the closest DOT.PROJECT.NAME in the parent directory of the directory
|
|
19
|
-
* that the command was run in.
|
|
20
|
-
* @return {Dotf} A dotf with that dotfile. Null if there is no file
|
|
21
|
-
*/
|
|
22
|
-
PROJECT: () => import("dotf").Dotfile;
|
|
23
|
-
AUTH: (local?: boolean | undefined) => import("dotf").Dotfile;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* OAuth client settings file.
|
|
27
|
-
* Local credentials are saved in ./.clasprc.json
|
|
28
|
-
* Global credentials are saved in ~/.clasprc.json
|
|
29
|
-
* @example
|
|
30
|
-
* {
|
|
31
|
-
* "token": {
|
|
32
|
-
* "access_token": "",
|
|
33
|
-
* "refresh_token": "",
|
|
34
|
-
* "scope": "https://www.googleapis.com/auth/script.projects https://.../script.webapp.deploy",
|
|
35
|
-
* "token_type": "Bearer",
|
|
36
|
-
* "expiry_date": 1539130731398
|
|
37
|
-
* },
|
|
38
|
-
* "oauth2ClientSettings": {
|
|
39
|
-
* "clientId": "",
|
|
40
|
-
* "clientSecret": "",
|
|
41
|
-
* "redirectUri": "http://localhost"
|
|
42
|
-
* },
|
|
43
|
-
* "isLocalCreds": false
|
|
44
|
-
* }
|
|
45
|
-
*/
|
|
46
|
-
export interface ClaspToken {
|
|
47
|
-
token: Credentials;
|
|
48
|
-
oauth2ClientSettings: OAuth2ClientOptions;
|
|
49
|
-
isLocalCreds: boolean;
|
|
50
|
-
}
|