@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/build/src/utils.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { script_v1 as scriptV1 } from 'googleapis';
|
|
2
|
-
import ora from 'ora';
|
|
3
2
|
import type { ClaspToken, ProjectSettings } from './dotfile';
|
|
4
3
|
/**
|
|
5
4
|
* The installed credentials. This is a file downloaded from console.developers.google.com
|
|
@@ -32,7 +31,7 @@ export declare const hasOauthClientSettings: (local?: boolean) => boolean;
|
|
|
32
31
|
* @returns {Promise<ClaspToken>} A promise to get the rc file as object.
|
|
33
32
|
*/
|
|
34
33
|
export declare const getOAuthSettings: (local: boolean) => Promise<ClaspToken>;
|
|
35
|
-
export declare const spinner: ora.Ora;
|
|
34
|
+
export declare const spinner: import("ora").Ora;
|
|
36
35
|
/** Stops the spinner if it is spinning */
|
|
37
36
|
export declare const stopSpinner: () => void;
|
|
38
37
|
export declare const getErrorMessage: (value: any) => any;
|
package/build/src/utils.js
CHANGED
|
@@ -36,7 +36,7 @@ export const getOAuthSettings = async (local) => {
|
|
|
36
36
|
var _a;
|
|
37
37
|
try {
|
|
38
38
|
const result = DOTFILE.AUTH(local).read();
|
|
39
|
-
return result;
|
|
39
|
+
return await result;
|
|
40
40
|
}
|
|
41
41
|
catch (error) {
|
|
42
42
|
throw new ClaspError((_a = getErrorMessage(error)) !== null && _a !== void 0 ? _a : ERROR.NO_CREDENTIALS(local));
|
|
@@ -56,20 +56,20 @@ export const getErrorMessage = (value) => {
|
|
|
56
56
|
if (value && typeof value.error === 'string') {
|
|
57
57
|
return JSON.parse(value.error).error;
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
if ((value === null || value === void 0 ? void 0 : value.statusCode) === 401 || ((value === null || value === void 0 ? void 0 : value.error) && value.error.error && value.error.error.code === 401)) {
|
|
60
60
|
// TODO check if local creds exist:
|
|
61
61
|
// localOathSettingsExist() ? ERROR.UNAUTHENTICATED : ERROR.UNAUTHENTICATED_LOCAL
|
|
62
62
|
return ERROR.UNAUTHENTICATED;
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
if (value && ((value.error && value.error.code === 403) || value.code === 403)) {
|
|
65
65
|
// TODO check if local creds exist:
|
|
66
66
|
// localOathSettingsExist() ? ERROR.PERMISSION_DENIED : ERROR.PERMISSION_DENIED_LOCAL
|
|
67
67
|
return ERROR.PERMISSION_DENIED;
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
if (value && value.code === 429) {
|
|
70
70
|
return ERROR.RATE_LIMIT;
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
if (value === null || value === void 0 ? void 0 : value.error) {
|
|
73
73
|
return `~~ API ERROR (${value.statusCode || value.error.code})=\n${value.error}`;
|
|
74
74
|
}
|
|
75
75
|
return undefined;
|
|
@@ -82,13 +82,13 @@ export const getErrorMessage = (value) => {
|
|
|
82
82
|
* @return {string} The URL of the web application in the online script editor.
|
|
83
83
|
*/
|
|
84
84
|
export const getWebApplicationURL = (value) => {
|
|
85
|
-
var _a;
|
|
85
|
+
var _a, _b;
|
|
86
86
|
const { entryPoints = [] } = value;
|
|
87
87
|
const entryPoint = entryPoints.find((entryPoint) => entryPoint.entryPointType === 'WEB_APP');
|
|
88
88
|
if (entryPoint) {
|
|
89
|
-
return entryPoint.webApp
|
|
89
|
+
return (_a = entryPoint.webApp) === null || _a === void 0 ? void 0 : _a.url;
|
|
90
90
|
}
|
|
91
|
-
throw new ClaspError(ERROR.NO_WEBAPP((
|
|
91
|
+
throw new ClaspError(ERROR.NO_WEBAPP((_b = value.deploymentId) !== null && _b !== void 0 ? _b : ''));
|
|
92
92
|
};
|
|
93
93
|
/**
|
|
94
94
|
* Gets default project name.
|
|
@@ -106,7 +106,7 @@ export const getDefaultProjectName = () => capitalize(path.basename(config.proje
|
|
|
106
106
|
export const getProjectSettings = async () => {
|
|
107
107
|
const dotfile = DOTFILE.PROJECT();
|
|
108
108
|
try {
|
|
109
|
-
if (dotfile.exists()) {
|
|
109
|
+
if (await dotfile.exists()) {
|
|
110
110
|
// Found a dotfile, but does it have the settings, or is it corrupted?
|
|
111
111
|
try {
|
|
112
112
|
const settings = await dotfile.read();
|
|
@@ -203,6 +203,7 @@ export const getProjectId = async (promptUser = true) => {
|
|
|
203
203
|
if (error instanceof ClaspError) {
|
|
204
204
|
throw error;
|
|
205
205
|
}
|
|
206
|
+
// TODO: better error handling
|
|
206
207
|
throw new ClaspError(error.message);
|
|
207
208
|
}
|
|
208
209
|
};
|
package/build/src/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,UAAU,CAAC;AAE1B,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,OAAO,CAAC;AAEzB,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;A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AA2B,IAAI,CAAC,CAAC;YAEpD,eAAe,CAAC,SAAS,GAAG,CAAC,MAAM,eAAe,EAAE,CAAC,CAAC,SAAS,CAAC;YAChE,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;SAChD;QAED,OAAO,MAAA,eAAe,CAAC,SAAS,mCAAI,EAAE,CAAC;KACxC;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,KAAK,YAAY,UAAU,EAAE;YAC/B,MAAM,KAAK,CAAC;SACb;QAED,8BAA8B;QAC9B,MAAM,IAAI,UAAU,CAAE,KAAa,CAAC,OAAO,CAAC,CAAC;KAC9C;AACH,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAEvF;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAI,KAAa,EAAK,EAAE;IACpD,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAM,CAAC;KAC/B;IAAC,MAAM;QACN,MAAM,IAAI,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;KAC1C;AACH,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,MAAc,EAAE,EAAE,CACzD,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,EAAC,uBAAuB,EAAE,IAAI,EAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC"}
|
package/docs/README.md
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
This folder contains advanced guides for `clasp`.
|
|
4
4
|
|
|
5
|
+
- [Configuration](/docs/config-files.md): Learn about the configuration files used by clasp.
|
|
5
6
|
- [Develop clasp](/docs/develop.md): Build, Run, and Test the CLI.
|
|
6
7
|
- [Run](/docs/run.md): Execute Apps Script remotely with `clasp run`.
|
|
7
8
|
- [Running locally](/docs/running-locally.md): Install and use clasp as a local dependency.
|
|
8
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.
|
|
9
11
|
- [TypeScript](/docs/typescript.md): Learn how to develop Apps Script in TypeScript.
|
package/docs/config-files.md
CHANGED
|
@@ -12,9 +12,9 @@ Typescript configuration file | `<rootDir>/tsconfig.json` | Used for user specif
|
|
|
12
12
|
|
|
13
13
|
## Environment variables
|
|
14
14
|
|
|
15
|
-
Environment variables can be set in order to specify the location of the following
|
|
15
|
+
Environment variables can be set in order to specify the location of the following configuration files:
|
|
16
16
|
|
|
17
|
-
File | Environment
|
|
17
|
+
File | Environment variable | Comment
|
|
18
18
|
--- | --- | ---
|
|
19
19
|
Clasp project file | `clasp_config_project` | The filename must start with a dot '.'
|
|
20
20
|
Clasp ignore file | `clasp_config_ignore` |
|
|
@@ -22,9 +22,9 @@ Google Auth file | `clasp_config_auth` | The filename must start with a dot '.'
|
|
|
22
22
|
|
|
23
23
|
## Command line options
|
|
24
24
|
|
|
25
|
-
Command line options can be used in order to specify the location of the following
|
|
25
|
+
Command line options can be used in order to specify the location of the following configuration files:
|
|
26
26
|
|
|
27
|
-
File | Environment
|
|
27
|
+
File | Environment variable | Comment
|
|
28
28
|
--- | --- | ---
|
|
29
29
|
Clasp project file | `-P <path>` or `--project <path>` | The filename must start with a dot '.'
|
|
30
30
|
Clasp ignore file | `-I <path>` or `--ignore <path>` |
|
package/docs/develop.md
CHANGED
|
@@ -58,7 +58,20 @@ After seeing that message, you're ready to test out `clasp`!
|
|
|
58
58
|
|
|
59
59
|
### Run Tests
|
|
60
60
|
|
|
61
|
-
`clasp` has some unit tests that help detect errors.
|
|
61
|
+
`clasp` has some unit tests that help detect errors.
|
|
62
|
+
|
|
63
|
+
The tests require an existing Apps Script project and corresponding GCP project. Follow the instructions in the
|
|
64
|
+
[Apps Script documentation](https://developers.google.com/apps-script/guides/cloud-platform-projects) to create
|
|
65
|
+
a script with a standard GCP project.
|
|
66
|
+
|
|
67
|
+
Once created, set the following environment variables. Replace the values with your corresponding script and project IDs.
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
SCRIPT_ID=15wKnP0deQOjCvCDmpkMo9npnosUYYvaLjNtIFEnOmNxxxxxxxx
|
|
71
|
+
PROJECT_ID=stable-century-447xxxxxxx
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Build and run tests with these commands:
|
|
62
75
|
|
|
63
76
|
```sh
|
|
64
77
|
npm run build;
|
package/docs/esmodules.md
CHANGED
|
@@ -12,12 +12,12 @@ import { nodeResolve } from "@rollup/plugin-node-resolve";
|
|
|
12
12
|
|
|
13
13
|
const extensions = [".ts", ".js"];
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const preventTreeShakingPlugin = () => {
|
|
16
16
|
return {
|
|
17
|
-
name: 'no-
|
|
17
|
+
name: 'no-treeshaking',
|
|
18
18
|
resolveId(id, importer) {
|
|
19
19
|
if (!importer) {
|
|
20
|
-
// let's not
|
|
20
|
+
// let's not treeshake entry points, as we're not exporting anything in Apps Script files
|
|
21
21
|
return {id, moduleSideEffects: "no-treeshake" }
|
|
22
22
|
}
|
|
23
23
|
return null;
|
|
@@ -32,7 +32,7 @@ export default {
|
|
|
32
32
|
format: "esm",
|
|
33
33
|
},
|
|
34
34
|
plugins: [
|
|
35
|
-
|
|
35
|
+
preventTreeShakingPlugin(),
|
|
36
36
|
nodeResolve({
|
|
37
37
|
extensions,
|
|
38
38
|
}),
|
|
@@ -78,4 +78,4 @@ node_modules/**
|
|
|
78
78
|
|
|
79
79
|
Now you can push using your normal `clasp push`-command!
|
|
80
80
|
|
|
81
|
-
This should be enough to start developing a project using ES Modules. A complete example repo can be cloned from [atti187/esmodules](https://github.com/atti187/esmodules).
|
|
81
|
+
This should be enough to start developing a project using ES Modules. A complete example repo can be cloned from [atti187/esmodules](https://github.com/atti187/esmodules).
|
package/docs/run.md
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
### Prerequisites
|
|
6
6
|
|
|
7
|
-
To use `clasp run`, you need to complete
|
|
7
|
+
To use `clasp run`, you need to complete 5 steps:
|
|
8
8
|
|
|
9
|
-
- Set up
|
|
9
|
+
- Set up the **Project ID** in your `.clasp.json` if missing.
|
|
10
10
|
- Create an **OAuth Client ID** (Other). Download as `creds.json`.
|
|
11
11
|
- `clasp login --creds creds.json` with this downloaded file.
|
|
12
12
|
- Add the following to `appsscript.json`:
|
|
@@ -15,6 +15,7 @@ To use `clasp run`, you need to complete 4 steps:
|
|
|
15
15
|
"access": "ANYONE"
|
|
16
16
|
}
|
|
17
17
|
```
|
|
18
|
+
- Deploy your project as an API Executable if necessary
|
|
18
19
|
|
|
19
20
|
#### Setup Instructions
|
|
20
21
|
|
|
@@ -27,9 +28,10 @@ To use `clasp run`, you need to complete 4 steps:
|
|
|
27
28
|
1. Set the `projectId` to your Apps Script project
|
|
28
29
|
- Open `https://console.developers.google.com/apis/credentials/consent?project=[PROJECT_ID]`
|
|
29
30
|
- Set `Application name` to `clasp project` and click `save`.
|
|
30
|
-
- `clasp open`
|
|
31
|
-
- In the menu, click
|
|
32
|
-
-
|
|
31
|
+
- Run `clasp open`
|
|
32
|
+
- In the menu, click `⚙️ Project Settings > Google Cloud Platform (GCP) Project`
|
|
33
|
+
- If the `Project Number` is missing,
|
|
34
|
+
- Click `Change Project`, paste the PROJECT_NUMBER, and click `Set project`
|
|
33
35
|
1. Use your own OAuth 2 client. Create one by following these instructions:
|
|
34
36
|
- `clasp open --creds`
|
|
35
37
|
- Press **Create credentials** > **OAuth client ID**
|
|
@@ -37,6 +39,15 @@ To use `clasp run`, you need to complete 4 steps:
|
|
|
37
39
|
- **Create** > **OK**
|
|
38
40
|
- Download the file (⬇), move it to your directory, and name it `creds.json`. Please keep this file secret!
|
|
39
41
|
1. Call `clasp login --creds creds.json`
|
|
42
|
+
1. Add the following to `appsscript.json`:
|
|
43
|
+
```json
|
|
44
|
+
"executionApi": {
|
|
45
|
+
"access": "ANYONE"
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
1. If you use Google Workspace, enable `Apps Script API`
|
|
49
|
+
- Open `https://console.cloud.google.com/marketplace/product/google/script.googleapis.com?project=[PROJECT_ID]`
|
|
50
|
+
- Press ENABLE button
|
|
40
51
|
|
|
41
52
|
### Run a function
|
|
42
53
|
|
|
@@ -47,6 +58,14 @@ After setup, you can remotely execute Apps Script functions from `clasp`:
|
|
|
47
58
|
- The result is displayed in the output.
|
|
48
59
|
- You can also run functions directly. i.e. `clasp run helloWorld`.
|
|
49
60
|
|
|
61
|
+
If you get an "Script API executable not published/deployed." error, deploy your script as an API Executable:
|
|
62
|
+
|
|
63
|
+
- Run `clasp open`
|
|
64
|
+
- Click `Deploy > New deployment`
|
|
65
|
+
- Select type ⚙ > API Executable
|
|
66
|
+
- Type a `Description`
|
|
67
|
+
- Click `Deploy`
|
|
68
|
+
|
|
50
69
|
### Run a function that requires scopes
|
|
51
70
|
|
|
52
71
|
Many Apps Script functions require special OAuth Scopes (Gmail, Drive, etc.).
|
package/docs/typescript.md
CHANGED
|
@@ -26,7 +26,7 @@ This quickstart guide describes how to create a TypeScript project from scratch.
|
|
|
26
26
|
- `clasp -v`
|
|
27
27
|
|
|
28
28
|
1. Install TypeScript definitions for Apps Script in your project's folder.
|
|
29
|
-
- `npm i -
|
|
29
|
+
- `npm i -D @types/google-apps-script`
|
|
30
30
|
|
|
31
31
|
1. Create a file called `tsconfig.json` to enable TypeScript features:
|
|
32
32
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@google/clasp",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Develop Apps Script Projects locally",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./build/src/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"build/src"
|
|
17
17
|
],
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "npm run compile && npm i
|
|
19
|
+
"build": "npm run compile && npm i --loglevel=error --force",
|
|
20
20
|
"build-fresh": "npm cache clean --force && npm i && npm run build",
|
|
21
21
|
"watch": "tsc --project tsconfig.json --watch",
|
|
22
22
|
"prepare": "npm run compile",
|
|
@@ -60,18 +60,20 @@
|
|
|
60
60
|
"author": "Grant Timmerman",
|
|
61
61
|
"license": "Apache-2.0",
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
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",
|
|
67
68
|
"debounce": "^1.2.1",
|
|
68
|
-
"dotf": "^2.0.
|
|
69
|
-
"find-up": "^
|
|
69
|
+
"dotf": "^2.0.2",
|
|
70
|
+
"find-up": "^6.0.0",
|
|
70
71
|
"fs-extra": "^10.0.0",
|
|
71
72
|
"fuzzy": "^0.1.3",
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
73
|
+
"gaxios": "^4.2.1",
|
|
74
|
+
"google-auth-library": "^7.6.2",
|
|
75
|
+
"googleapis": "^84.0.0",
|
|
76
|
+
"inquirer": "^8.1.2",
|
|
75
77
|
"inquirer-autocomplete-prompt-ipt": "^2.0.0",
|
|
76
78
|
"is-reachable": "^5.0.0",
|
|
77
79
|
"log-symbols": "^5.0.0",
|
|
@@ -79,36 +81,35 @@
|
|
|
79
81
|
"make-dir": "^3.1.0",
|
|
80
82
|
"multimatch": "^5.0.0",
|
|
81
83
|
"normalize-newline": "^4.1.0",
|
|
82
|
-
"open": "^8.2.
|
|
83
|
-
"ora": "^
|
|
84
|
-
"p-map": "^5.
|
|
84
|
+
"open": "^8.2.1",
|
|
85
|
+
"ora": "^6.0.0",
|
|
86
|
+
"p-map": "^5.1.0",
|
|
85
87
|
"read-pkg-up": "^8.0.0",
|
|
86
88
|
"recursive-readdir": "^2.2.2",
|
|
87
89
|
"server-destroy": "^1.0.1",
|
|
88
90
|
"split-lines": "^3.0.0",
|
|
89
91
|
"strip-bom": "^5.0.0",
|
|
90
|
-
"ts2gas": "^4.
|
|
91
|
-
"typescript": "^4.
|
|
92
|
-
"wtfnode": "^0.8.4"
|
|
92
|
+
"ts2gas": "^4.2.0",
|
|
93
|
+
"typescript": "^4.4.2"
|
|
93
94
|
},
|
|
94
95
|
"devDependencies": {
|
|
95
|
-
"@types/chai": "^4.2.
|
|
96
|
+
"@types/chai": "^4.2.21",
|
|
96
97
|
"@types/debounce": "^1.2.0",
|
|
97
|
-
"@types/fs-extra": "^9.0.
|
|
98
|
-
"@types/inquirer": "^7.3.
|
|
99
|
-
"@types/mocha": "^
|
|
100
|
-
"@types/node": "^12.20.
|
|
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",
|
|
101
102
|
"@types/recursive-readdir": "^2.2.0",
|
|
102
103
|
"@types/server-destroy": "^1.0.1",
|
|
103
|
-
"@types/tmp": "^0.2.
|
|
104
|
+
"@types/tmp": "^0.2.1",
|
|
104
105
|
"@types/wtfnode": "^0.7.0",
|
|
105
106
|
"chai": "^4.3.4",
|
|
106
|
-
"coveralls": "^3.1.
|
|
107
|
+
"coveralls": "^3.1.1",
|
|
107
108
|
"gts": "^3.1.0",
|
|
108
|
-
"mocha": "^9.
|
|
109
|
+
"mocha": "^9.1.1",
|
|
109
110
|
"nyc": "^15.1.0",
|
|
110
|
-
"prettier": "^2.3.
|
|
111
|
+
"prettier": "^2.3.2",
|
|
111
112
|
"tmp": "^0.2.1",
|
|
112
|
-
"type-fest": "^1.
|
|
113
|
+
"type-fest": "^2.1.0"
|
|
113
114
|
}
|
|
114
115
|
}
|