@taqueria/plugin-tzcompose 0.49.9
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 +40 -0
- package/index.d.ts +2 -0
- package/index.js +109 -0
- package/index.js.map +1 -0
- package/index.mjs +112 -0
- package/index.mjs.map +1 -0
- package/index.ts +35 -0
- package/package.json +43 -0
- package/proxy.ts +14 -0
- package/run.ts +75 -0
- package/tsconfig.json +109 -0
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Hello World Plugin for Taqueria
|
|
2
|
+
|
|
3
|
+
The Hello World plugin provides a basic example of a Taqueria plugin. This plugin is intended to be used as a template for creating new plugins.
|
|
4
|
+
|
|
5
|
+
It is written in TypeScript and compiled to a JavaScript bundle for NodeJS using [tsup](https://github.com/egoist/tsup) and uses the `@taqueria/node-sdk` - as are all plugins that the Pinnacle Labs team develops for Taqueria.
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- Taqueria v0.42.0 or later
|
|
10
|
+
- Node.js v18.18.0 or later
|
|
11
|
+
|
|
12
|
+
## Building
|
|
13
|
+
|
|
14
|
+
To build the Hello World plugin, run the following command from the root of this repository:
|
|
15
|
+
|
|
16
|
+
```shell
|
|
17
|
+
npm run build -w taqueria-plugin-helloworld
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
To install the Hello World plugin on a Taqueria project, navigate to the project folder and run:
|
|
23
|
+
|
|
24
|
+
```shell
|
|
25
|
+
cd [taqueria-project]
|
|
26
|
+
taq init # if the project isn't already initialized
|
|
27
|
+
taq install /path/to/taqueria-repo/taqueria-plugin-helloworld
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Usage:
|
|
31
|
+
|
|
32
|
+
The Hello World plugin provides a single command to Taqueria: `taq hello`.
|
|
33
|
+
|
|
34
|
+
## Plugin Development
|
|
35
|
+
|
|
36
|
+
We suggest cloning our hello-world plugin and using as a boilerplate.
|
|
37
|
+
|
|
38
|
+
See the following documentation from our Taqueria website, [taqueria.io](https://taqueria.io):
|
|
39
|
+
- [Building a Taqueria Plugin](https://taqueria.io/docs/taqueria-dev/making-plugins/)
|
|
40
|
+
- [Taqueria Architecture](https://taqueria.io/docs/taqueria-internals/architecture/)
|
package/index.d.ts
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// index.ts
|
|
4
|
+
var import_node_sdk3 = require("@taqueria/node-sdk");
|
|
5
|
+
|
|
6
|
+
// proxy.ts
|
|
7
|
+
var import_node_sdk2 = require("@taqueria/node-sdk");
|
|
8
|
+
|
|
9
|
+
// run.ts
|
|
10
|
+
var import_node_sdk = require("@taqueria/node-sdk");
|
|
11
|
+
var import_path = require("path");
|
|
12
|
+
var getDockerImage = () => "ghcr.io/pinnacle-labs/tzgo/tzcompose:latest";
|
|
13
|
+
var getRPCUrl = (parsedArgs) => {
|
|
14
|
+
var _a, _b, _c;
|
|
15
|
+
const currentEnv = parsedArgs.config.environment[(0, import_node_sdk.getCurrentEnvironment)(parsedArgs)];
|
|
16
|
+
if (typeof currentEnv === "object") {
|
|
17
|
+
if (currentEnv.sandboxes.length > 0) {
|
|
18
|
+
const sandboxName = currentEnv.sandboxes[0];
|
|
19
|
+
const sandboxConfig = parsedArgs.config.sandbox ?? {};
|
|
20
|
+
const rpcUrl = (_b = (_a = sandboxConfig[sandboxName]) == null ? void 0 : _a.rpcUrl) == null ? void 0 : _b.replace("localhost", "host.docker.internal");
|
|
21
|
+
return rpcUrl;
|
|
22
|
+
} else {
|
|
23
|
+
const networkName = currentEnv.networks[0];
|
|
24
|
+
const networkConfig = parsedArgs.config.network ?? {};
|
|
25
|
+
const rpcUrl = (_c = networkConfig[networkName]) == null ? void 0 : _c.rpcUrl;
|
|
26
|
+
return rpcUrl;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var getEnvConf = (parsedArgs) => {
|
|
31
|
+
const projectDir = parsedArgs.projectDir;
|
|
32
|
+
const env = (0, import_node_sdk.getCurrentEnvironment)(parsedArgs);
|
|
33
|
+
const filePath = (0, import_path.join)(projectDir, ".taq", `config.local.${env}.json`);
|
|
34
|
+
return (0, import_node_sdk.readJsonFileWithoutTransform)(filePath).catch(() => ({})).then(JSON.stringify);
|
|
35
|
+
};
|
|
36
|
+
var getConf = (parsedArgs) => {
|
|
37
|
+
const projectDir = parsedArgs.projectDir;
|
|
38
|
+
const env = (0, import_node_sdk.getCurrentEnvironment)(parsedArgs);
|
|
39
|
+
const filePath = (0, import_path.join)(projectDir, ".taq", `config.json`);
|
|
40
|
+
return (0, import_node_sdk.readJsonFileWithoutTransform)(filePath).catch(() => ({})).then(JSON.stringify);
|
|
41
|
+
};
|
|
42
|
+
var getDockerCommand = async (parsedArgs) => {
|
|
43
|
+
const config = await getConf(parsedArgs);
|
|
44
|
+
const envConfig = await getEnvConf(parsedArgs);
|
|
45
|
+
const rpcUrl = getRPCUrl(parsedArgs);
|
|
46
|
+
const dockerImage = getDockerImage();
|
|
47
|
+
const sanitizedConfig = config.replace(/'/g, "\\'");
|
|
48
|
+
const sanitizedEnvConfig = envConfig.replace(/'/g, "\\'");
|
|
49
|
+
const verbosityLevel = parsedArgs.v ? parseInt(parsedArgs.v) : 0;
|
|
50
|
+
const verbosityFlag = verbosityLevel > 0 ? `-v${new Array(verbosityLevel).fill("v").join("")}` : "";
|
|
51
|
+
if (!rpcUrl)
|
|
52
|
+
return Promise.reject("No RPC URL found in the config");
|
|
53
|
+
return Promise.resolve(
|
|
54
|
+
`docker run --add-host=host.docker.internal:host-gateway -it -v ${parsedArgs.projectDir}:/project ${dockerImage} run ${verbosityFlag} -rpc ${rpcUrl} -taqconfig '${sanitizedConfig}' -taqconfigenv '${sanitizedEnvConfig}'`
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
function run(parsedArgs) {
|
|
58
|
+
if (!parsedArgs.scriptPath)
|
|
59
|
+
return (0, import_node_sdk.sendAsyncErr)("scriptPath is required.");
|
|
60
|
+
return getDockerCommand(parsedArgs).then(import_node_sdk.spawnCmd).catch(import_node_sdk.sendAsyncErr).then(() => {
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// proxy.ts
|
|
65
|
+
var proxy = (parsedArgs) => {
|
|
66
|
+
const unsafeArgs = parsedArgs;
|
|
67
|
+
switch (unsafeArgs.task) {
|
|
68
|
+
case "run":
|
|
69
|
+
return run(unsafeArgs);
|
|
70
|
+
default:
|
|
71
|
+
return (0, import_node_sdk2.sendAsyncErr)(`${unsafeArgs.task} is not an understood task by the TzCompose plugin`);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
var proxy_default = proxy;
|
|
75
|
+
|
|
76
|
+
// index.ts
|
|
77
|
+
import_node_sdk3.Plugin.create((_) => ({
|
|
78
|
+
alias: "tzcompose",
|
|
79
|
+
schema: "1.0",
|
|
80
|
+
version: "0.1",
|
|
81
|
+
tasks: [
|
|
82
|
+
import_node_sdk3.Task.create({
|
|
83
|
+
task: "run",
|
|
84
|
+
command: "run <scriptPath>",
|
|
85
|
+
aliases: [],
|
|
86
|
+
description: "Runs a script using tzcompose",
|
|
87
|
+
options: [
|
|
88
|
+
import_node_sdk3.Option.create({
|
|
89
|
+
flag: "verbosity",
|
|
90
|
+
shortFlag: "v",
|
|
91
|
+
description: "Verbose level (1-3)",
|
|
92
|
+
type: "number"
|
|
93
|
+
})
|
|
94
|
+
],
|
|
95
|
+
positionals: [
|
|
96
|
+
import_node_sdk3.PositionalArg.create({
|
|
97
|
+
description: "The path of the script to run using TzCompose",
|
|
98
|
+
required: true,
|
|
99
|
+
type: "string",
|
|
100
|
+
placeholder: "scriptPath"
|
|
101
|
+
})
|
|
102
|
+
],
|
|
103
|
+
handler: "proxy",
|
|
104
|
+
encoding: "none"
|
|
105
|
+
})
|
|
106
|
+
],
|
|
107
|
+
proxy: proxy_default
|
|
108
|
+
}), process.argv);
|
|
109
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts","proxy.ts","run.ts"],"sourcesContent":["import { Option, Plugin, PositionalArg, Task } from '@taqueria/node-sdk';\nimport proxy from './proxy';\n\nPlugin.create(_ => ({\n\talias: 'tzcompose',\n\tschema: '1.0',\n\tversion: '0.1',\n\ttasks: [\n\t\tTask.create({\n\t\t\ttask: 'run',\n\t\t\tcommand: 'run <scriptPath>',\n\t\t\taliases: [],\n\t\t\tdescription: 'Runs a script using tzcompose',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'verbosity',\n\t\t\t\t\tshortFlag: 'v',\n\t\t\t\t\tdescription: 'Verbose level (1-3)',\n\t\t\t\t\ttype: 'number',\n\t\t\t\t}),\n\t\t\t],\n\t\t\tpositionals: [\n\t\t\t\tPositionalArg.create({\n\t\t\t\t\tdescription: 'The path of the script to run using TzCompose',\n\t\t\t\t\trequired: true,\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tplaceholder: 'scriptPath',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'none',\n\t\t}),\n\t],\n\tproxy,\n}), process.argv);\n","import { RequestArgs, sendAsyncErr } from '@taqueria/node-sdk';\nimport run, { RunArgs } from './run';\n\nexport const proxy = <T extends RequestArgs.t>(parsedArgs: T): Promise<void> => {\n\tconst unsafeArgs = parsedArgs as unknown as RunArgs;\n\tswitch (unsafeArgs.task) {\n\t\tcase 'run':\n\t\t\treturn run(unsafeArgs);\n\t\tdefault:\n\t\t\treturn sendAsyncErr(`${unsafeArgs.task} is not an understood task by the TzCompose plugin`);\n\t}\n};\n\nexport default proxy;\n","import {\n\tgetCurrentEnvironment,\n\treadJsonFileWithoutTransform,\n\tRequestArgs,\n\tsendAsyncErr,\n\tspawnCmd,\n} from '@taqueria/node-sdk';\nimport { join } from 'path';\n\nconst getDockerImage = () => 'ghcr.io/pinnacle-labs/tzgo/tzcompose:latest';\n\nexport interface RunArgs extends RequestArgs.t {\n\ttask: 'run';\n\tv?: string;\n\tscriptPath: string;\n}\n\nconst getRPCUrl = (parsedArgs: RunArgs) => {\n\tconst currentEnv = parsedArgs.config.environment[getCurrentEnvironment(parsedArgs)];\n\tif (typeof (currentEnv) === 'object') {\n\t\tif (currentEnv.sandboxes.length > 0) {\n\t\t\tconst sandboxName = currentEnv.sandboxes[0];\n\t\t\tconst sandboxConfig = parsedArgs.config.sandbox ?? {};\n\t\t\tconst rpcUrl = sandboxConfig[sandboxName]?.rpcUrl?.replace('localhost', 'host.docker.internal');\n\t\t\treturn rpcUrl;\n\t\t} else {\n\t\t\tconst networkName = currentEnv.networks[0];\n\t\t\tconst networkConfig = parsedArgs.config.network ?? {};\n\t\t\tconst rpcUrl = networkConfig[networkName]?.rpcUrl;\n\t\t\treturn rpcUrl;\n\t\t}\n\t}\n};\n\nconst getEnvConf = (parsedArgs: RunArgs) => {\n\tconst projectDir = parsedArgs.projectDir;\n\tconst env = getCurrentEnvironment(parsedArgs);\n\tconst filePath = join(projectDir, '.taq', `config.local.${env}.json`);\n\treturn readJsonFileWithoutTransform(filePath).catch(() => ({})).then(JSON.stringify);\n};\n\nconst getConf = (parsedArgs: RunArgs) => {\n\tconst projectDir = parsedArgs.projectDir;\n\tconst env = getCurrentEnvironment(parsedArgs);\n\tconst filePath = join(projectDir, '.taq', `config.json`);\n\treturn readJsonFileWithoutTransform(filePath).catch(() => ({})).then(JSON.stringify);\n};\n\nconst getDockerCommand = async (parsedArgs: RunArgs) => {\n\tconst config = await getConf(parsedArgs);\n\tconst envConfig = await getEnvConf(parsedArgs);\n\tconst rpcUrl = getRPCUrl(parsedArgs);\n\tconst dockerImage = getDockerImage();\n\n\t// Escape single quotes\n\tconst sanitizedConfig = config.replace(/'/g, \"\\\\'\");\n\tconst sanitizedEnvConfig = envConfig.replace(/'/g, \"\\\\'\");\n\tconst verbosityLevel = parsedArgs.v ? parseInt(parsedArgs.v) : 0;\n\tconst verbosityFlag = verbosityLevel > 0 ? `-v${new Array(verbosityLevel).fill('v').join('')}` : '';\n\n\tif (!rpcUrl) return Promise.reject('No RPC URL found in the config');\n\n\treturn Promise.resolve(\n\t\t`docker run --add-host=host.docker.internal:host-gateway -it -v ${parsedArgs.projectDir}:/project ${dockerImage} run ${verbosityFlag} -rpc ${rpcUrl} -taqconfig '${sanitizedConfig}' -taqconfigenv '${sanitizedEnvConfig}'`,\n\t);\n};\n\nexport default function run(parsedArgs: RunArgs) {\n\tif (!parsedArgs.scriptPath) return sendAsyncErr('scriptPath is required.');\n\n\treturn getDockerCommand(parsedArgs)\n\t\t.then(spawnCmd)\n\t\t.catch(sendAsyncErr)\n\t\t.then(() => {});\n}\n"],"mappings":";;;AAAA,IAAAA,mBAAoD;;;ACApD,IAAAC,mBAA0C;;;ACA1C,sBAMO;AACP,kBAAqB;AAErB,IAAM,iBAAiB,MAAM;AAQ7B,IAAM,YAAY,CAAC,eAAwB;AAjB3C;AAkBC,QAAM,aAAa,WAAW,OAAO,gBAAY,uCAAsB,UAAU,CAAC;AAClF,MAAI,OAAQ,eAAgB,UAAU;AACrC,QAAI,WAAW,UAAU,SAAS,GAAG;AACpC,YAAM,cAAc,WAAW,UAAU,CAAC;AAC1C,YAAM,gBAAgB,WAAW,OAAO,WAAW,CAAC;AACpD,YAAM,UAAS,yBAAc,WAAW,MAAzB,mBAA4B,WAA5B,mBAAoC,QAAQ,aAAa;AACxE,aAAO;AAAA,IACR,OAAO;AACN,YAAM,cAAc,WAAW,SAAS,CAAC;AACzC,YAAM,gBAAgB,WAAW,OAAO,WAAW,CAAC;AACpD,YAAM,UAAS,mBAAc,WAAW,MAAzB,mBAA4B;AAC3C,aAAO;AAAA,IACR;AAAA,EACD;AACD;AAEA,IAAM,aAAa,CAAC,eAAwB;AAC3C,QAAM,aAAa,WAAW;AAC9B,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AAC/E,QAAM,aAAa;AACnB,UAAQ,WAAW,MAAM;AAAA,IACxB,KAAK;AACJ,aAAO,IAAI,UAAU;AAAA,IACtB;AACC,iBAAO,+BAAa,GAAG,WAAW,IAAI,oDAAoD;AAAA,EAC5F;AACD;AAEA,IAAO,gBAAQ;;;ADVf,wBAAO,OAAO,QAAM;AAAA,EACnB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,OAAO;AAAA,IACN,sBAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAS,CAAC;AAAA,MACV,aAAa;AAAA,MACb,SAAS;AAAA,QACR,wBAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,WAAW;AAAA,UACX,aAAa;AAAA,UACb,MAAM;AAAA,QACP,CAAC;AAAA,MACF;AAAA,MACA,aAAa;AAAA,QACZ,+BAAc,OAAO;AAAA,UACpB,aAAa;AAAA,UACb,UAAU;AAAA,UACV,MAAM;AAAA,UACN,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,MACT,UAAU;AAAA,IACX,CAAC;AAAA,EACF;AAAA,EACA;AACD,IAAI,QAAQ,IAAI;","names":["import_node_sdk","import_node_sdk"]}
|
package/index.mjs
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// index.ts
|
|
2
|
+
import { Option, Plugin, PositionalArg, Task } from "@taqueria/node-sdk";
|
|
3
|
+
|
|
4
|
+
// proxy.ts
|
|
5
|
+
import { sendAsyncErr as sendAsyncErr2 } from "@taqueria/node-sdk";
|
|
6
|
+
|
|
7
|
+
// run.ts
|
|
8
|
+
import {
|
|
9
|
+
getCurrentEnvironment,
|
|
10
|
+
readJsonFileWithoutTransform,
|
|
11
|
+
sendAsyncErr,
|
|
12
|
+
spawnCmd
|
|
13
|
+
} from "@taqueria/node-sdk";
|
|
14
|
+
import { join } from "path";
|
|
15
|
+
var getDockerImage = () => "ghcr.io/pinnacle-labs/tzgo/tzcompose:latest";
|
|
16
|
+
var getRPCUrl = (parsedArgs) => {
|
|
17
|
+
var _a, _b, _c;
|
|
18
|
+
const currentEnv = parsedArgs.config.environment[getCurrentEnvironment(parsedArgs)];
|
|
19
|
+
if (typeof currentEnv === "object") {
|
|
20
|
+
if (currentEnv.sandboxes.length > 0) {
|
|
21
|
+
const sandboxName = currentEnv.sandboxes[0];
|
|
22
|
+
const sandboxConfig = parsedArgs.config.sandbox ?? {};
|
|
23
|
+
const rpcUrl = (_b = (_a = sandboxConfig[sandboxName]) == null ? void 0 : _a.rpcUrl) == null ? void 0 : _b.replace("localhost", "host.docker.internal");
|
|
24
|
+
return rpcUrl;
|
|
25
|
+
} else {
|
|
26
|
+
const networkName = currentEnv.networks[0];
|
|
27
|
+
const networkConfig = parsedArgs.config.network ?? {};
|
|
28
|
+
const rpcUrl = (_c = networkConfig[networkName]) == null ? void 0 : _c.rpcUrl;
|
|
29
|
+
return rpcUrl;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
var getEnvConf = (parsedArgs) => {
|
|
34
|
+
const projectDir = parsedArgs.projectDir;
|
|
35
|
+
const env = getCurrentEnvironment(parsedArgs);
|
|
36
|
+
const filePath = join(projectDir, ".taq", `config.local.${env}.json`);
|
|
37
|
+
return readJsonFileWithoutTransform(filePath).catch(() => ({})).then(JSON.stringify);
|
|
38
|
+
};
|
|
39
|
+
var getConf = (parsedArgs) => {
|
|
40
|
+
const projectDir = parsedArgs.projectDir;
|
|
41
|
+
const env = getCurrentEnvironment(parsedArgs);
|
|
42
|
+
const filePath = join(projectDir, ".taq", `config.json`);
|
|
43
|
+
return readJsonFileWithoutTransform(filePath).catch(() => ({})).then(JSON.stringify);
|
|
44
|
+
};
|
|
45
|
+
var getDockerCommand = async (parsedArgs) => {
|
|
46
|
+
const config = await getConf(parsedArgs);
|
|
47
|
+
const envConfig = await getEnvConf(parsedArgs);
|
|
48
|
+
const rpcUrl = getRPCUrl(parsedArgs);
|
|
49
|
+
const dockerImage = getDockerImage();
|
|
50
|
+
const sanitizedConfig = config.replace(/'/g, "\\'");
|
|
51
|
+
const sanitizedEnvConfig = envConfig.replace(/'/g, "\\'");
|
|
52
|
+
const verbosityLevel = parsedArgs.v ? parseInt(parsedArgs.v) : 0;
|
|
53
|
+
const verbosityFlag = verbosityLevel > 0 ? `-v${new Array(verbosityLevel).fill("v").join("")}` : "";
|
|
54
|
+
if (!rpcUrl)
|
|
55
|
+
return Promise.reject("No RPC URL found in the config");
|
|
56
|
+
return Promise.resolve(
|
|
57
|
+
`docker run --add-host=host.docker.internal:host-gateway -it -v ${parsedArgs.projectDir}:/project ${dockerImage} run ${verbosityFlag} -rpc ${rpcUrl} -taqconfig '${sanitizedConfig}' -taqconfigenv '${sanitizedEnvConfig}'`
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
function run(parsedArgs) {
|
|
61
|
+
if (!parsedArgs.scriptPath)
|
|
62
|
+
return sendAsyncErr("scriptPath is required.");
|
|
63
|
+
return getDockerCommand(parsedArgs).then(spawnCmd).catch(sendAsyncErr).then(() => {
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// proxy.ts
|
|
68
|
+
var proxy = (parsedArgs) => {
|
|
69
|
+
const unsafeArgs = parsedArgs;
|
|
70
|
+
switch (unsafeArgs.task) {
|
|
71
|
+
case "run":
|
|
72
|
+
return run(unsafeArgs);
|
|
73
|
+
default:
|
|
74
|
+
return sendAsyncErr2(`${unsafeArgs.task} is not an understood task by the TzCompose plugin`);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
var proxy_default = proxy;
|
|
78
|
+
|
|
79
|
+
// index.ts
|
|
80
|
+
Plugin.create((_) => ({
|
|
81
|
+
alias: "tzcompose",
|
|
82
|
+
schema: "1.0",
|
|
83
|
+
version: "0.1",
|
|
84
|
+
tasks: [
|
|
85
|
+
Task.create({
|
|
86
|
+
task: "run",
|
|
87
|
+
command: "run <scriptPath>",
|
|
88
|
+
aliases: [],
|
|
89
|
+
description: "Runs a script using tzcompose",
|
|
90
|
+
options: [
|
|
91
|
+
Option.create({
|
|
92
|
+
flag: "verbosity",
|
|
93
|
+
shortFlag: "v",
|
|
94
|
+
description: "Verbose level (1-3)",
|
|
95
|
+
type: "number"
|
|
96
|
+
})
|
|
97
|
+
],
|
|
98
|
+
positionals: [
|
|
99
|
+
PositionalArg.create({
|
|
100
|
+
description: "The path of the script to run using TzCompose",
|
|
101
|
+
required: true,
|
|
102
|
+
type: "string",
|
|
103
|
+
placeholder: "scriptPath"
|
|
104
|
+
})
|
|
105
|
+
],
|
|
106
|
+
handler: "proxy",
|
|
107
|
+
encoding: "none"
|
|
108
|
+
})
|
|
109
|
+
],
|
|
110
|
+
proxy: proxy_default
|
|
111
|
+
}), process.argv);
|
|
112
|
+
//# sourceMappingURL=index.mjs.map
|
package/index.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts","proxy.ts","run.ts"],"sourcesContent":["import { Option, Plugin, PositionalArg, Task } from '@taqueria/node-sdk';\nimport proxy from './proxy';\n\nPlugin.create(_ => ({\n\talias: 'tzcompose',\n\tschema: '1.0',\n\tversion: '0.1',\n\ttasks: [\n\t\tTask.create({\n\t\t\ttask: 'run',\n\t\t\tcommand: 'run <scriptPath>',\n\t\t\taliases: [],\n\t\t\tdescription: 'Runs a script using tzcompose',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'verbosity',\n\t\t\t\t\tshortFlag: 'v',\n\t\t\t\t\tdescription: 'Verbose level (1-3)',\n\t\t\t\t\ttype: 'number',\n\t\t\t\t}),\n\t\t\t],\n\t\t\tpositionals: [\n\t\t\t\tPositionalArg.create({\n\t\t\t\t\tdescription: 'The path of the script to run using TzCompose',\n\t\t\t\t\trequired: true,\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tplaceholder: 'scriptPath',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'none',\n\t\t}),\n\t],\n\tproxy,\n}), process.argv);\n","import { RequestArgs, sendAsyncErr } from '@taqueria/node-sdk';\nimport run, { RunArgs } from './run';\n\nexport const proxy = <T extends RequestArgs.t>(parsedArgs: T): Promise<void> => {\n\tconst unsafeArgs = parsedArgs as unknown as RunArgs;\n\tswitch (unsafeArgs.task) {\n\t\tcase 'run':\n\t\t\treturn run(unsafeArgs);\n\t\tdefault:\n\t\t\treturn sendAsyncErr(`${unsafeArgs.task} is not an understood task by the TzCompose plugin`);\n\t}\n};\n\nexport default proxy;\n","import {\n\tgetCurrentEnvironment,\n\treadJsonFileWithoutTransform,\n\tRequestArgs,\n\tsendAsyncErr,\n\tspawnCmd,\n} from '@taqueria/node-sdk';\nimport { join } from 'path';\n\nconst getDockerImage = () => 'ghcr.io/pinnacle-labs/tzgo/tzcompose:latest';\n\nexport interface RunArgs extends RequestArgs.t {\n\ttask: 'run';\n\tv?: string;\n\tscriptPath: string;\n}\n\nconst getRPCUrl = (parsedArgs: RunArgs) => {\n\tconst currentEnv = parsedArgs.config.environment[getCurrentEnvironment(parsedArgs)];\n\tif (typeof (currentEnv) === 'object') {\n\t\tif (currentEnv.sandboxes.length > 0) {\n\t\t\tconst sandboxName = currentEnv.sandboxes[0];\n\t\t\tconst sandboxConfig = parsedArgs.config.sandbox ?? {};\n\t\t\tconst rpcUrl = sandboxConfig[sandboxName]?.rpcUrl?.replace('localhost', 'host.docker.internal');\n\t\t\treturn rpcUrl;\n\t\t} else {\n\t\t\tconst networkName = currentEnv.networks[0];\n\t\t\tconst networkConfig = parsedArgs.config.network ?? {};\n\t\t\tconst rpcUrl = networkConfig[networkName]?.rpcUrl;\n\t\t\treturn rpcUrl;\n\t\t}\n\t}\n};\n\nconst getEnvConf = (parsedArgs: RunArgs) => {\n\tconst projectDir = parsedArgs.projectDir;\n\tconst env = getCurrentEnvironment(parsedArgs);\n\tconst filePath = join(projectDir, '.taq', `config.local.${env}.json`);\n\treturn readJsonFileWithoutTransform(filePath).catch(() => ({})).then(JSON.stringify);\n};\n\nconst getConf = (parsedArgs: RunArgs) => {\n\tconst projectDir = parsedArgs.projectDir;\n\tconst env = getCurrentEnvironment(parsedArgs);\n\tconst filePath = join(projectDir, '.taq', `config.json`);\n\treturn readJsonFileWithoutTransform(filePath).catch(() => ({})).then(JSON.stringify);\n};\n\nconst getDockerCommand = async (parsedArgs: RunArgs) => {\n\tconst config = await getConf(parsedArgs);\n\tconst envConfig = await getEnvConf(parsedArgs);\n\tconst rpcUrl = getRPCUrl(parsedArgs);\n\tconst dockerImage = getDockerImage();\n\n\t// Escape single quotes\n\tconst sanitizedConfig = config.replace(/'/g, \"\\\\'\");\n\tconst sanitizedEnvConfig = envConfig.replace(/'/g, \"\\\\'\");\n\tconst verbosityLevel = parsedArgs.v ? parseInt(parsedArgs.v) : 0;\n\tconst verbosityFlag = verbosityLevel > 0 ? `-v${new Array(verbosityLevel).fill('v').join('')}` : '';\n\n\tif (!rpcUrl) return Promise.reject('No RPC URL found in the config');\n\n\treturn Promise.resolve(\n\t\t`docker run --add-host=host.docker.internal:host-gateway -it -v ${parsedArgs.projectDir}:/project ${dockerImage} run ${verbosityFlag} -rpc ${rpcUrl} -taqconfig '${sanitizedConfig}' -taqconfigenv '${sanitizedEnvConfig}'`,\n\t);\n};\n\nexport default function run(parsedArgs: RunArgs) {\n\tif (!parsedArgs.scriptPath) return sendAsyncErr('scriptPath is required.');\n\n\treturn getDockerCommand(parsedArgs)\n\t\t.then(spawnCmd)\n\t\t.catch(sendAsyncErr)\n\t\t.then(() => {});\n}\n"],"mappings":";AAAA,SAAS,QAAQ,QAAQ,eAAe,YAAY;;;ACApD,SAAsB,gBAAAA,qBAAoB;;;ACA1C;AAAA,EACC;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,OACM;AACP,SAAS,YAAY;AAErB,IAAM,iBAAiB,MAAM;AAQ7B,IAAM,YAAY,CAAC,eAAwB;AAjB3C;AA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AAA,EACF;AAAA,EACA;AACD,IAAI,QAAQ,IAAI;","names":["sendAsyncErr","sendAsyncErr"]}
|
package/index.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Option, Plugin, PositionalArg, Task } from '@taqueria/node-sdk';
|
|
2
|
+
import proxy from './proxy';
|
|
3
|
+
|
|
4
|
+
Plugin.create(_ => ({
|
|
5
|
+
alias: 'tzcompose',
|
|
6
|
+
schema: '1.0',
|
|
7
|
+
version: '0.1',
|
|
8
|
+
tasks: [
|
|
9
|
+
Task.create({
|
|
10
|
+
task: 'run',
|
|
11
|
+
command: 'run <scriptPath>',
|
|
12
|
+
aliases: [],
|
|
13
|
+
description: 'Runs a script using tzcompose',
|
|
14
|
+
options: [
|
|
15
|
+
Option.create({
|
|
16
|
+
flag: 'verbosity',
|
|
17
|
+
shortFlag: 'v',
|
|
18
|
+
description: 'Verbose level (1-3)',
|
|
19
|
+
type: 'number',
|
|
20
|
+
}),
|
|
21
|
+
],
|
|
22
|
+
positionals: [
|
|
23
|
+
PositionalArg.create({
|
|
24
|
+
description: 'The path of the script to run using TzCompose',
|
|
25
|
+
required: true,
|
|
26
|
+
type: 'string',
|
|
27
|
+
placeholder: 'scriptPath',
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
handler: 'proxy',
|
|
31
|
+
encoding: 'none',
|
|
32
|
+
}),
|
|
33
|
+
],
|
|
34
|
+
proxy,
|
|
35
|
+
}), process.argv);
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@taqueria/plugin-tzcompose",
|
|
3
|
+
"version": "0.49.9",
|
|
4
|
+
"description": "A TzCompose plugin for Taqueria using the GoTz SDK",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "npx tsc -noEmit -p ./tsconfig.json && npx tsup"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"taqueria",
|
|
11
|
+
"plugin",
|
|
12
|
+
"tzcompose",
|
|
13
|
+
"tezos",
|
|
14
|
+
"deploy",
|
|
15
|
+
"gotz"
|
|
16
|
+
],
|
|
17
|
+
"author": "Pinnacle Labs <support@pinnaclelabs.limited>",
|
|
18
|
+
"license": "Apache-2.0",
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"tsup": "^8.0.1",
|
|
21
|
+
"typescript": "^5.3.3"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@taqueria/node-sdk": "^0.49.9"
|
|
25
|
+
},
|
|
26
|
+
"tsup": {
|
|
27
|
+
"entry": [
|
|
28
|
+
"index.ts"
|
|
29
|
+
],
|
|
30
|
+
"sourcemap": true,
|
|
31
|
+
"target": "node16",
|
|
32
|
+
"outDir": "./",
|
|
33
|
+
"dts": true,
|
|
34
|
+
"clean": false,
|
|
35
|
+
"skipNodeModulesBundle": true,
|
|
36
|
+
"platform": "node",
|
|
37
|
+
"format": [
|
|
38
|
+
"esm",
|
|
39
|
+
"cjs"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"types": "./index.d.ts"
|
|
43
|
+
}
|
package/proxy.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RequestArgs, sendAsyncErr } from '@taqueria/node-sdk';
|
|
2
|
+
import run, { RunArgs } from './run';
|
|
3
|
+
|
|
4
|
+
export const proxy = <T extends RequestArgs.t>(parsedArgs: T): Promise<void> => {
|
|
5
|
+
const unsafeArgs = parsedArgs as unknown as RunArgs;
|
|
6
|
+
switch (unsafeArgs.task) {
|
|
7
|
+
case 'run':
|
|
8
|
+
return run(unsafeArgs);
|
|
9
|
+
default:
|
|
10
|
+
return sendAsyncErr(`${unsafeArgs.task} is not an understood task by the TzCompose plugin`);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default proxy;
|
package/run.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getCurrentEnvironment,
|
|
3
|
+
readJsonFileWithoutTransform,
|
|
4
|
+
RequestArgs,
|
|
5
|
+
sendAsyncErr,
|
|
6
|
+
spawnCmd,
|
|
7
|
+
} from '@taqueria/node-sdk';
|
|
8
|
+
import { join } from 'path';
|
|
9
|
+
|
|
10
|
+
const getDockerImage = () => 'ghcr.io/pinnacle-labs/tzgo/tzcompose:latest';
|
|
11
|
+
|
|
12
|
+
export interface RunArgs extends RequestArgs.t {
|
|
13
|
+
task: 'run';
|
|
14
|
+
v?: string;
|
|
15
|
+
scriptPath: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const getRPCUrl = (parsedArgs: RunArgs) => {
|
|
19
|
+
const currentEnv = parsedArgs.config.environment[getCurrentEnvironment(parsedArgs)];
|
|
20
|
+
if (typeof (currentEnv) === 'object') {
|
|
21
|
+
if (currentEnv.sandboxes.length > 0) {
|
|
22
|
+
const sandboxName = currentEnv.sandboxes[0];
|
|
23
|
+
const sandboxConfig = parsedArgs.config.sandbox ?? {};
|
|
24
|
+
const rpcUrl = sandboxConfig[sandboxName]?.rpcUrl?.replace('localhost', 'host.docker.internal');
|
|
25
|
+
return rpcUrl;
|
|
26
|
+
} else {
|
|
27
|
+
const networkName = currentEnv.networks[0];
|
|
28
|
+
const networkConfig = parsedArgs.config.network ?? {};
|
|
29
|
+
const rpcUrl = networkConfig[networkName]?.rpcUrl;
|
|
30
|
+
return rpcUrl;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const getEnvConf = (parsedArgs: RunArgs) => {
|
|
36
|
+
const projectDir = parsedArgs.projectDir;
|
|
37
|
+
const env = getCurrentEnvironment(parsedArgs);
|
|
38
|
+
const filePath = join(projectDir, '.taq', `config.local.${env}.json`);
|
|
39
|
+
return readJsonFileWithoutTransform(filePath).catch(() => ({})).then(JSON.stringify);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const getConf = (parsedArgs: RunArgs) => {
|
|
43
|
+
const projectDir = parsedArgs.projectDir;
|
|
44
|
+
const env = getCurrentEnvironment(parsedArgs);
|
|
45
|
+
const filePath = join(projectDir, '.taq', `config.json`);
|
|
46
|
+
return readJsonFileWithoutTransform(filePath).catch(() => ({})).then(JSON.stringify);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const getDockerCommand = async (parsedArgs: RunArgs) => {
|
|
50
|
+
const config = await getConf(parsedArgs);
|
|
51
|
+
const envConfig = await getEnvConf(parsedArgs);
|
|
52
|
+
const rpcUrl = getRPCUrl(parsedArgs);
|
|
53
|
+
const dockerImage = getDockerImage();
|
|
54
|
+
|
|
55
|
+
// Escape single quotes
|
|
56
|
+
const sanitizedConfig = config.replace(/'/g, "\\'");
|
|
57
|
+
const sanitizedEnvConfig = envConfig.replace(/'/g, "\\'");
|
|
58
|
+
const verbosityLevel = parsedArgs.v ? parseInt(parsedArgs.v) : 0;
|
|
59
|
+
const verbosityFlag = verbosityLevel > 0 ? `-v${new Array(verbosityLevel).fill('v').join('')}` : '';
|
|
60
|
+
|
|
61
|
+
if (!rpcUrl) return Promise.reject('No RPC URL found in the config');
|
|
62
|
+
|
|
63
|
+
return Promise.resolve(
|
|
64
|
+
`docker run --add-host=host.docker.internal:host-gateway -it -v ${parsedArgs.projectDir}:/project ${dockerImage} run ${verbosityFlag} -rpc ${rpcUrl} -taqconfig '${sanitizedConfig}' -taqconfigenv '${sanitizedEnvConfig}'`,
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default function run(parsedArgs: RunArgs) {
|
|
69
|
+
if (!parsedArgs.scriptPath) return sendAsyncErr('scriptPath is required.');
|
|
70
|
+
|
|
71
|
+
return getDockerCommand(parsedArgs)
|
|
72
|
+
.then(spawnCmd)
|
|
73
|
+
.catch(sendAsyncErr)
|
|
74
|
+
.then(() => {});
|
|
75
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Projects */
|
|
6
|
+
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
|
+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
+
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
|
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
|
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
+
|
|
13
|
+
/* Language and Environment */
|
|
14
|
+
"target": "ES2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
|
+
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
+
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
+
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
|
18
|
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
20
|
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
22
|
+
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
23
|
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
+
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
26
|
+
|
|
27
|
+
/* Modules */
|
|
28
|
+
"module": "commonjs", /* Specify what module code is generated. */
|
|
29
|
+
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
30
|
+
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
31
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
32
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
33
|
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
34
|
+
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
35
|
+
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
36
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
37
|
+
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
38
|
+
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
39
|
+
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
40
|
+
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
41
|
+
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
42
|
+
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
43
|
+
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
44
|
+
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
45
|
+
|
|
46
|
+
/* JavaScript Support */
|
|
47
|
+
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
48
|
+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
49
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
50
|
+
|
|
51
|
+
/* Emit */
|
|
52
|
+
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
53
|
+
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
54
|
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
55
|
+
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
56
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
57
|
+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
58
|
+
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
|
59
|
+
// "removeComments": true, /* Disable emitting comments. */
|
|
60
|
+
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
61
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
62
|
+
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
63
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
64
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
65
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
66
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
67
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
68
|
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
69
|
+
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
70
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
71
|
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
72
|
+
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
73
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
74
|
+
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
75
|
+
|
|
76
|
+
/* Interop Constraints */
|
|
77
|
+
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
78
|
+
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
79
|
+
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
80
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
81
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
82
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
83
|
+
|
|
84
|
+
/* Type Checking */
|
|
85
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
86
|
+
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
87
|
+
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
88
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
89
|
+
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
90
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
91
|
+
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
92
|
+
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
93
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
94
|
+
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
95
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
96
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
97
|
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
98
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
99
|
+
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
100
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
101
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
102
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
103
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
104
|
+
|
|
105
|
+
/* Completeness */
|
|
106
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
107
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
108
|
+
}
|
|
109
|
+
}
|