@cosmwasm/ts-codegen 0.35.7 → 1.1.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/LICENSE-Apache +201 -0
- package/LICENSE-MIT +21 -0
- package/README.md +106 -101
- package/{types/src/builder → builder}/builder.d.ts +2 -2
- package/builder/builder.js +172 -0
- package/builder/index.js +17 -0
- package/bundler/bundler.d.ts +8 -0
- package/bundler/bundler.js +79 -0
- package/bundler/index.js +17 -0
- package/cli.d.ts +2 -0
- package/cli.js +24 -0
- package/cmds.d.ts +2 -0
- package/cmds.js +14 -0
- package/commands/create-boilerplate.d.ts +3 -0
- package/commands/create-boilerplate.js +132 -0
- package/commands/generate.d.ts +3 -0
- package/commands/generate.js +175 -0
- package/commands/install.d.ts +3 -0
- package/commands/install.js +107 -0
- package/{src/builder/builder.ts → esm/builder/builder.js} +39 -139
- package/esm/builder/index.js +1 -0
- package/esm/bundler/bundler.js +47 -0
- package/esm/bundler/index.js +1 -0
- package/esm/cli.js +20 -0
- package/{src → esm}/cmds.js +0 -1
- package/{src/commands/create-boilerplate.ts → esm/commands/create-boilerplate.js} +35 -70
- package/{src/commands/generate.ts → esm/commands/generate.js} +19 -24
- package/{src/commands/install.ts → esm/commands/install.js} +22 -35
- package/esm/file.js +18 -0
- package/esm/generators/client.js +67 -0
- package/esm/generators/create-helpers.js +36 -0
- package/esm/generators/message-builder.js +58 -0
- package/esm/generators/message-composer.js +55 -0
- package/esm/generators/react-query.js +76 -0
- package/esm/generators/recoil.js +58 -0
- package/esm/generators/types.js +58 -0
- package/{src/index.ts → esm/index.js} +4 -6
- package/esm/plugins/client.js +59 -0
- package/esm/plugins/message-builder.js +52 -0
- package/esm/plugins/message-composer.js +46 -0
- package/esm/plugins/plugin-base.js +47 -0
- package/esm/plugins/provider-bundle.js +58 -0
- package/esm/plugins/provider.js +73 -0
- package/esm/plugins/react-query.js +69 -0
- package/esm/plugins/recoil.js +51 -0
- package/esm/plugins/types.js +38 -0
- package/{src → esm}/ts-codegen.js +1 -2
- package/{src/utils/clean.ts → esm/utils/clean.js} +7 -7
- package/{src/utils/cleanse.ts → esm/utils/cleanse.js} +18 -22
- package/esm/utils/files.js +42 -0
- package/{src/utils/parse.ts → esm/utils/parse.js} +4 -13
- package/esm/utils/prompt.js +59 -0
- package/{src/utils/schemas.ts → esm/utils/schemas.js} +16 -44
- package/esm/utils/unused.js +47 -0
- package/file.js +20 -0
- package/generators/client.js +95 -0
- package/generators/create-helpers.js +43 -0
- package/generators/message-builder.js +86 -0
- package/generators/message-composer.js +83 -0
- package/generators/react-query.js +104 -0
- package/generators/recoil.js +86 -0
- package/generators/types.js +86 -0
- package/{module/helpers → helpers}/contractContextBase.js +5 -2
- package/{module/helpers → helpers}/contractContextBaseShortHandCtor.js +5 -2
- package/{module/helpers → helpers}/contractsContextTSX.js +5 -2
- package/{module/helpers/index.js → helpers/index.d.ts} +1 -1
- package/helpers/index.js +19 -0
- package/{types/src/index.d.ts → index.d.ts} +1 -0
- package/index.js +41 -0
- package/package.json +28 -63
- package/plugins/client.js +86 -0
- package/plugins/index.d.ts +1 -0
- package/plugins/index.js +17 -0
- package/plugins/message-builder.js +79 -0
- package/plugins/message-composer.js +73 -0
- package/{types/src/plugins → plugins}/plugin-base.d.ts +1 -1
- package/plugins/plugin-base.js +77 -0
- package/plugins/provider-bundle.js +85 -0
- package/{types/src/plugins → plugins}/provider.d.ts +2 -2
- package/plugins/provider.js +102 -0
- package/plugins/react-query.js +96 -0
- package/plugins/recoil.js +78 -0
- package/plugins/types.js +65 -0
- package/ts-codegen.js +8 -0
- package/utils/clean.js +49 -0
- package/utils/cleanse.js +89 -0
- package/utils/files.js +73 -0
- package/utils/header.js +14 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +17 -0
- package/utils/parse.d.ts +1 -0
- package/utils/parse.js +43 -0
- package/utils/prompt.d.ts +3 -0
- package/utils/prompt.js +65 -0
- package/utils/schemas.d.ts +11 -0
- package/utils/schemas.js +81 -0
- package/utils/unused.js +73 -0
- package/main/builder/builder.js +0 -308
- package/main/builder/index.js +0 -16
- package/main/bundler/bundler.js +0 -61
- package/main/bundler/index.js +0 -16
- package/main/cli.js +0 -51
- package/main/cmds.js +0 -15
- package/main/commands/create-boilerplate.js +0 -166
- package/main/commands/generate.js +0 -196
- package/main/commands/install.js +0 -138
- package/main/file.js +0 -35
- package/main/generators/client.js +0 -90
- package/main/generators/create-helpers.js +0 -38
- package/main/generators/message-composer.js +0 -77
- package/main/generators/msg-builder.js +0 -84
- package/main/generators/react-query.js +0 -102
- package/main/generators/recoil.js +0 -81
- package/main/generators/types.js +0 -82
- package/main/helpers/contractContextBase.js +0 -8
- package/main/helpers/contractContextBaseShortHandCtor.js +0 -8
- package/main/helpers/contractsContextTSX.js +0 -8
- package/main/helpers/index.js +0 -38
- package/main/index.js +0 -119
- package/main/plugins/client.js +0 -112
- package/main/plugins/index.js +0 -16
- package/main/plugins/message-builder.js +0 -102
- package/main/plugins/message-composer.js +0 -98
- package/main/plugins/plugin-base.js +0 -103
- package/main/plugins/provider-bundle.js +0 -108
- package/main/plugins/provider.js +0 -126
- package/main/plugins/react-query.js +0 -120
- package/main/plugins/recoil.js +0 -108
- package/main/plugins/types.js +0 -89
- package/main/ts-codegen.js +0 -20
- package/main/utils/clean.js +0 -53
- package/main/utils/cleanse.js +0 -87
- package/main/utils/files.js +0 -57
- package/main/utils/header.js +0 -11
- package/main/utils/index.js +0 -16
- package/main/utils/parse.js +0 -44
- package/main/utils/prompt.js +0 -98
- package/main/utils/schemas.js +0 -144
- package/main/utils/unused.js +0 -57
- package/module/builder/builder.js +0 -143
- package/module/builder/index.js +0 -1
- package/module/bundler/bundler.js +0 -36
- package/module/bundler/index.js +0 -1
- package/module/cli.js +0 -19
- package/module/cmds.js +0 -8
- package/module/commands/create-boilerplate.js +0 -102
- package/module/commands/generate.js +0 -163
- package/module/commands/install.js +0 -98
- package/module/file.js +0 -18
- package/module/generators/client.js +0 -65
- package/module/generators/create-helpers.js +0 -33
- package/module/generators/message-composer.js +0 -52
- package/module/generators/msg-builder.js +0 -58
- package/module/generators/react-query.js +0 -75
- package/module/generators/recoil.js +0 -53
- package/module/generators/types.js +0 -55
- package/module/index.js +0 -14
- package/module/plugins/client.js +0 -63
- package/module/plugins/index.js +0 -1
- package/module/plugins/message-builder.js +0 -55
- package/module/plugins/message-composer.js +0 -49
- package/module/plugins/plugin-base.js +0 -66
- package/module/plugins/provider-bundle.js +0 -56
- package/module/plugins/provider.js +0 -68
- package/module/plugins/react-query.js +0 -72
- package/module/plugins/recoil.js +0 -57
- package/module/plugins/types.js +0 -42
- package/module/ts-codegen.js +0 -6
- package/module/utils/clean.js +0 -44
- package/module/utils/cleanse.js +0 -78
- package/module/utils/files.js +0 -40
- package/module/utils/header.js +0 -8
- package/module/utils/index.js +0 -1
- package/module/utils/parse.js +0 -35
- package/module/utils/prompt.js +0 -63
- package/module/utils/schemas.js +0 -85
- package/module/utils/unused.js +0 -43
- package/src/builder/index.ts +0 -1
- package/src/bundler/bundler.ts +0 -67
- package/src/bundler/index.ts +0 -1
- package/src/cli.js +0 -21
- package/src/file.js +0 -20
- package/src/generators/client.ts +0 -109
- package/src/generators/create-helpers.ts +0 -71
- package/src/generators/message-composer.ts +0 -86
- package/src/generators/msg-builder.ts +0 -78
- package/src/generators/react-query.ts +0 -102
- package/src/generators/recoil.ts +0 -92
- package/src/generators/types.ts +0 -94
- package/src/helpers/index.ts +0 -3
- package/src/plugins/client.ts +0 -124
- package/src/plugins/index.ts +0 -1
- package/src/plugins/message-builder.ts +0 -85
- package/src/plugins/message-composer.ts +0 -89
- package/src/plugins/plugin-base.ts +0 -122
- package/src/plugins/provider-bundle.ts +0 -98
- package/src/plugins/provider.ts +0 -115
- package/src/plugins/react-query.ts +0 -115
- package/src/plugins/recoil.ts +0 -89
- package/src/plugins/types.ts +0 -74
- package/src/utils/files.ts +0 -73
- package/src/utils/index.ts +0 -1
- package/src/utils/prompt.js +0 -65
- package/src/utils/unused.ts +0 -52
- package/types/src/bundler/bundler.d.ts +0 -4
- package/types/src/cli.d.ts +0 -1
- package/types/src/cmds.d.ts +0 -1
- package/types/src/commands/create-boilerplate.d.ts +0 -2
- package/types/src/commands/generate.d.ts +0 -2
- package/types/src/commands/install.d.ts +0 -2
- package/types/src/generators/msg-builder.ts +0 -5
- package/types/src/plugins/msg-builder.d.ts +0 -12
- package/types/src/plugins/use-contracts.d.ts +0 -12
- package/types/src/types.d.ts +0 -16
- package/types/src/utils/parse.d.ts +0 -1
- package/types/src/utils/prompt.d.ts +0 -3
- package/types/src/utils/schemas.d.ts +0 -10
- /package/{types/src/builder → builder}/index.d.ts +0 -0
- /package/{types/src/bundler → bundler}/index.d.ts +0 -0
- /package/{src/helpers/contractContextBase.ts → esm/helpers/contractContextBase.js} +0 -0
- /package/{src/helpers/contractContextBaseShortHandCtor.ts → esm/helpers/contractContextBaseShortHandCtor.js} +0 -0
- /package/{src/helpers/contractsContextTSX.ts → esm/helpers/contractsContextTSX.js} +0 -0
- /package/{types/src/helpers/index.d.ts → esm/helpers/index.js} +0 -0
- /package/{types/src/plugins/index.d.ts → esm/plugins/index.js} +0 -0
- /package/{src/utils/header.ts → esm/utils/header.js} +0 -0
- /package/{types/src/utils/index.d.ts → esm/utils/index.js} +0 -0
- /package/{types/src/file.d.ts → file.d.ts} +0 -0
- /package/{types/src/generators → generators}/client.d.ts +0 -0
- /package/{types/src/generators → generators}/create-helpers.d.ts +0 -0
- /package/{types/src/generators/msg-builder.d.ts → generators/message-builder.d.ts} +0 -0
- /package/{types/src/generators → generators}/message-composer.d.ts +0 -0
- /package/{types/src/generators → generators}/react-query.d.ts +0 -0
- /package/{types/src/generators → generators}/recoil.d.ts +0 -0
- /package/{types/src/generators → generators}/types.d.ts +0 -0
- /package/{types/src/helpers → helpers}/contractContextBase.d.ts +0 -0
- /package/{types/src/helpers → helpers}/contractContextBaseShortHandCtor.d.ts +0 -0
- /package/{types/src/helpers → helpers}/contractsContextTSX.d.ts +0 -0
- /package/{types/src/plugins → plugins}/client.d.ts +0 -0
- /package/{types/src/plugins → plugins}/message-builder.d.ts +0 -0
- /package/{types/src/plugins → plugins}/message-composer.d.ts +0 -0
- /package/{types/src/plugins → plugins}/provider-bundle.d.ts +0 -0
- /package/{types/src/plugins → plugins}/react-query.d.ts +0 -0
- /package/{types/src/plugins → plugins}/recoil.d.ts +0 -0
- /package/{types/src/plugins → plugins}/types.d.ts +0 -0
- /package/{types/src/ts-codegen.d.ts → ts-codegen.d.ts} +0 -0
- /package/{types/src/utils → utils}/clean.d.ts +0 -0
- /package/{types/src/utils → utils}/cleanse.d.ts +0 -0
- /package/{types/src/utils → utils}/files.d.ts +0 -0
- /package/{types/src/utils → utils}/header.d.ts +0 -0
- /package/{types/src/utils → utils}/unused.d.ts +0 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.TSBuilder = void 0;
|
|
30
|
+
const wasm_ast_types_1 = require("wasm-ast-types");
|
|
31
|
+
const header_1 = require("../utils/header");
|
|
32
|
+
const path_1 = require("path");
|
|
33
|
+
const fs_1 = require("fs");
|
|
34
|
+
const mkdirp_1 = require("mkdirp");
|
|
35
|
+
const path_2 = require("path");
|
|
36
|
+
const utils_1 = require("../utils");
|
|
37
|
+
const deepmerge_1 = __importDefault(require("deepmerge"));
|
|
38
|
+
const case_1 = require("case");
|
|
39
|
+
const bundler_1 = require("../bundler");
|
|
40
|
+
const generator_1 = __importDefault(require("@babel/generator"));
|
|
41
|
+
const t = __importStar(require("@babel/types"));
|
|
42
|
+
const react_query_1 = require("../plugins/react-query");
|
|
43
|
+
const recoil_1 = require("../plugins/recoil");
|
|
44
|
+
const message_builder_1 = require("../plugins/message-builder");
|
|
45
|
+
const message_composer_1 = require("../plugins/message-composer");
|
|
46
|
+
const client_1 = require("../plugins/client");
|
|
47
|
+
const types_1 = require("../plugins/types");
|
|
48
|
+
const provider_1 = require("../plugins/provider");
|
|
49
|
+
const create_helpers_1 = require("../generators/create-helpers");
|
|
50
|
+
const provider_bundle_1 = require("../plugins/provider-bundle");
|
|
51
|
+
const defaultOpts = {
|
|
52
|
+
bundle: {
|
|
53
|
+
enabled: true,
|
|
54
|
+
scope: 'contracts',
|
|
55
|
+
bundleFile: 'bundle.ts'
|
|
56
|
+
},
|
|
57
|
+
useShorthandCtor: true
|
|
58
|
+
};
|
|
59
|
+
;
|
|
60
|
+
;
|
|
61
|
+
;
|
|
62
|
+
;
|
|
63
|
+
function getContract(contractOpt) {
|
|
64
|
+
if (typeof contractOpt === 'string') {
|
|
65
|
+
const name = (0, path_2.basename)(contractOpt);
|
|
66
|
+
const contractName = (0, case_1.pascal)(name);
|
|
67
|
+
return {
|
|
68
|
+
name: contractName,
|
|
69
|
+
dir: contractOpt
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
name: (0, case_1.pascal)(contractOpt.name),
|
|
74
|
+
dir: contractOpt.dir
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
class TSBuilder {
|
|
78
|
+
contracts;
|
|
79
|
+
outPath;
|
|
80
|
+
options;
|
|
81
|
+
plugins = [];
|
|
82
|
+
builderContext = new wasm_ast_types_1.BuilderContext();
|
|
83
|
+
files = [];
|
|
84
|
+
loadDefaultPlugins() {
|
|
85
|
+
this.plugins.push(new types_1.TypesPlugin(this.options), new client_1.ClientPlugin(this.options), new message_composer_1.MessageComposerPlugin(this.options), new react_query_1.ReactQueryPlugin(this.options), new recoil_1.RecoilPlugin(this.options), new message_builder_1.MessageBuilderPlugin(this.options), new provider_1.ContractsContextProviderPlugin(this.options));
|
|
86
|
+
}
|
|
87
|
+
constructor({ contracts, outPath, options, plugins }) {
|
|
88
|
+
this.contracts = contracts;
|
|
89
|
+
this.outPath = outPath;
|
|
90
|
+
this.options = (0, deepmerge_1.default)((0, deepmerge_1.default)(wasm_ast_types_1.defaultOptions, defaultOpts), options ?? {});
|
|
91
|
+
this.loadDefaultPlugins();
|
|
92
|
+
if (plugins && plugins.length) {
|
|
93
|
+
this.plugins.push(...plugins);
|
|
94
|
+
}
|
|
95
|
+
this.plugins.forEach(plugin => plugin.setBuilder(this));
|
|
96
|
+
}
|
|
97
|
+
async build() {
|
|
98
|
+
await this.process();
|
|
99
|
+
await this.after();
|
|
100
|
+
}
|
|
101
|
+
// lifecycle functions
|
|
102
|
+
async process() {
|
|
103
|
+
for (const contractOpt of this.contracts) {
|
|
104
|
+
const contract = getContract(contractOpt);
|
|
105
|
+
//resolve contract schema.
|
|
106
|
+
const contractInfo = await (0, utils_1.readSchemas)({
|
|
107
|
+
schemaDir: contract.dir
|
|
108
|
+
});
|
|
109
|
+
//lifecycle and plugins.
|
|
110
|
+
await this.render(contract.name, contractInfo);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
async render(name, contractInfo) {
|
|
114
|
+
for (const plugin of this.plugins) {
|
|
115
|
+
let files = await plugin.render(name, contractInfo, this.outPath);
|
|
116
|
+
if (files && files.length) {
|
|
117
|
+
this.files.push(...files);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
async after() {
|
|
122
|
+
//create useContracts bundle file
|
|
123
|
+
const contractsProviderBundlePlugin = new provider_bundle_1.ContractsProviderBundlePlugin(this.options);
|
|
124
|
+
contractsProviderBundlePlugin.setBuilder(this);
|
|
125
|
+
//contractContextProviders.ts
|
|
126
|
+
const files = await contractsProviderBundlePlugin.render("contractContextProviders", {
|
|
127
|
+
schemas: [],
|
|
128
|
+
}, this.outPath);
|
|
129
|
+
if (files && files.length) {
|
|
130
|
+
this.files.push(...files);
|
|
131
|
+
}
|
|
132
|
+
const helpers = (0, create_helpers_1.createHelpers)({
|
|
133
|
+
outPath: this.outPath,
|
|
134
|
+
contracts: this.contracts,
|
|
135
|
+
options: this.options,
|
|
136
|
+
plugins: this.plugins,
|
|
137
|
+
}, this.builderContext);
|
|
138
|
+
if (helpers && helpers.length) {
|
|
139
|
+
this.files.push(...helpers);
|
|
140
|
+
}
|
|
141
|
+
if (this.options.bundle.enabled) {
|
|
142
|
+
this.bundle();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
async bundle() {
|
|
146
|
+
const allFiles = this.files;
|
|
147
|
+
const bundleFile = this.options.bundle.bundleFile;
|
|
148
|
+
const bundlePath = (0, path_1.join)(this.options?.bundle?.bundlePath ?? this.outPath, bundleFile);
|
|
149
|
+
const bundleVariables = {};
|
|
150
|
+
const importPaths = [];
|
|
151
|
+
allFiles.forEach(file => {
|
|
152
|
+
(0, bundler_1.createFileBundle)(`${this.options.bundle.scope}.${file.contract}`, file.filename, bundlePath, importPaths, bundleVariables);
|
|
153
|
+
});
|
|
154
|
+
const ast = (0, bundler_1.recursiveModuleBundle)(bundleVariables);
|
|
155
|
+
const nodes = [
|
|
156
|
+
...importPaths,
|
|
157
|
+
...ast
|
|
158
|
+
];
|
|
159
|
+
// @ts-ignore
|
|
160
|
+
let code = (0, generator_1.default)(t.program(
|
|
161
|
+
// @ts-ignore
|
|
162
|
+
nodes)).code;
|
|
163
|
+
if (this.options?.bundle?.bundlePath) {
|
|
164
|
+
(0, mkdirp_1.sync)(this.options?.bundle?.bundlePath);
|
|
165
|
+
}
|
|
166
|
+
(0, mkdirp_1.sync)(this.outPath);
|
|
167
|
+
if (code.trim() === '')
|
|
168
|
+
code = 'export {};';
|
|
169
|
+
(0, fs_1.writeFileSync)(bundlePath, header_1.header + code);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
exports.TSBuilder = TSBuilder;
|
package/builder/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./builder"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as t from '@babel/types';
|
|
2
|
+
export interface BundleData {
|
|
3
|
+
__export?: boolean;
|
|
4
|
+
[key: string]: boolean | BundleData;
|
|
5
|
+
}
|
|
6
|
+
export declare const recursiveModuleBundle: (obj: BundleData) => t.ExportNamedDeclaration[];
|
|
7
|
+
export declare const importNamespace: (ident: string, path: string) => t.ImportDeclaration;
|
|
8
|
+
export declare const createFileBundle: (pkg: string, filename: string, bundleFile: string, importPaths: (t.ImportDeclaration | t.ImportDefaultSpecifier | t.ImportNamespaceSpecifier)[], bundleVariables: BundleData) => void;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.createFileBundle = exports.importNamespace = exports.recursiveModuleBundle = void 0;
|
|
30
|
+
const t = __importStar(require("@babel/types"));
|
|
31
|
+
const nested_obj_1 = __importDefault(require("nested-obj"));
|
|
32
|
+
const path_1 = require("path");
|
|
33
|
+
const recursiveModuleBundle = (obj) => {
|
|
34
|
+
return Object.keys(obj).map(key => {
|
|
35
|
+
const value = obj[key];
|
|
36
|
+
if (typeof value === 'object' && value && value.__export) {
|
|
37
|
+
// e.g. abci
|
|
38
|
+
// 1. create variable for abci
|
|
39
|
+
// 2. splat ALL _0, parms into abci
|
|
40
|
+
// 3. export that variable
|
|
41
|
+
const nmspc = t.variableDeclaration('const', [t.variableDeclarator(t.identifier(key), t.objectExpression(Object.keys(obj[key])
|
|
42
|
+
.filter(a => a !== '__export')
|
|
43
|
+
.filter(a => a.startsWith('_'))
|
|
44
|
+
.map(a => t.spreadElement(t.identifier(a)))))]);
|
|
45
|
+
const others = Object.keys(obj[key])
|
|
46
|
+
.filter(a => a !== '__export')
|
|
47
|
+
.filter(a => !a.startsWith('_'));
|
|
48
|
+
if (others.length) {
|
|
49
|
+
throw new Error('namespace and package not supported, yet.');
|
|
50
|
+
}
|
|
51
|
+
// return nmspc;
|
|
52
|
+
return t.exportNamedDeclaration(nmspc, []);
|
|
53
|
+
}
|
|
54
|
+
else if (typeof value === 'object' && value) {
|
|
55
|
+
// you can make a namespace for obj[key]
|
|
56
|
+
// e.g. libs
|
|
57
|
+
return t.exportNamedDeclaration(t.tsModuleDeclaration(t.identifier(key), t.tsModuleBlock((0, exports.recursiveModuleBundle)(obj[key]))));
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
throw new Error('Invalid structure for BundleData');
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
exports.recursiveModuleBundle = recursiveModuleBundle;
|
|
65
|
+
const importNamespace = (ident, path) => t.importDeclaration([
|
|
66
|
+
t.importNamespaceSpecifier(t.identifier(ident))
|
|
67
|
+
], t.stringLiteral(path.replace((0, path_1.extname)(path), '')));
|
|
68
|
+
exports.importNamespace = importNamespace;
|
|
69
|
+
let counter = 0;
|
|
70
|
+
const createFileBundle = (pkg, filename, bundleFile, importPaths, bundleVariables) => {
|
|
71
|
+
let rel = (0, path_1.relative)((0, path_1.dirname)(bundleFile), filename);
|
|
72
|
+
if (!rel.startsWith('.'))
|
|
73
|
+
rel = `./${rel}`;
|
|
74
|
+
const variable = `_${counter++}`;
|
|
75
|
+
importPaths.push((0, exports.importNamespace)(variable, rel));
|
|
76
|
+
nested_obj_1.default.set(bundleVariables, pkg + '.__export', true);
|
|
77
|
+
nested_obj_1.default.set(bundleVariables, pkg + '.' + variable, true);
|
|
78
|
+
};
|
|
79
|
+
exports.createFileBundle = createFileBundle;
|
package/bundler/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./bundler"), exports);
|
package/cli.d.ts
ADDED
package/cli.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cli = void 0;
|
|
4
|
+
const prompt_1 = require("./utils/prompt");
|
|
5
|
+
const cmds_1 = require("./cmds");
|
|
6
|
+
const question = [
|
|
7
|
+
{
|
|
8
|
+
_: true,
|
|
9
|
+
type: 'fuzzy',
|
|
10
|
+
name: 'cmd',
|
|
11
|
+
message: 'what do you want to do?',
|
|
12
|
+
choices: Object.keys(cmds_1.Commands)
|
|
13
|
+
}
|
|
14
|
+
];
|
|
15
|
+
const cli = async (argv) => {
|
|
16
|
+
var { cmd } = await (0, prompt_1.prompt)(question, argv);
|
|
17
|
+
if (typeof cmds_1.Commands[cmd] === 'function') {
|
|
18
|
+
await cmds_1.Commands[cmd](argv);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
console.log('command not found.');
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.cli = cli;
|
package/cmds.d.ts
ADDED
package/cmds.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Commands = void 0;
|
|
7
|
+
const create_boilerplate_1 = __importDefault(require("./commands/create-boilerplate"));
|
|
8
|
+
const generate_1 = __importDefault(require("./commands/generate"));
|
|
9
|
+
const install_1 = __importDefault(require("./commands/install"));
|
|
10
|
+
const Commands = {};
|
|
11
|
+
exports.Commands = Commands;
|
|
12
|
+
Commands['create-boilerplate'] = create_boilerplate_1.default;
|
|
13
|
+
Commands['generate'] = generate_1.default;
|
|
14
|
+
Commands['install'] = install_1.default;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const shell = __importStar(require("shelljs"));
|
|
30
|
+
const prompt_1 = require("../utils/prompt");
|
|
31
|
+
const dargs_1 = __importDefault(require("dargs"));
|
|
32
|
+
const glob = require('glob').sync;
|
|
33
|
+
const fs = require('fs');
|
|
34
|
+
const path = require('path');
|
|
35
|
+
const repo = 'https://github.com/cosmology-tech/ts-codegen-module-boilerplate';
|
|
36
|
+
exports.default = async (argv) => {
|
|
37
|
+
if (!shell.which('git')) {
|
|
38
|
+
shell.echo('Sorry, this script requires git');
|
|
39
|
+
return shell.exit(1);
|
|
40
|
+
}
|
|
41
|
+
const { name } = await (0, prompt_1.prompt)([
|
|
42
|
+
{
|
|
43
|
+
type: 'string',
|
|
44
|
+
name: 'name',
|
|
45
|
+
message: 'Enter your new module name',
|
|
46
|
+
}
|
|
47
|
+
], argv);
|
|
48
|
+
shell.exec(`git clone ${repo} ${name}`);
|
|
49
|
+
shell.cd(name);
|
|
50
|
+
const questions = JSON.parse(fs.readFileSync(`.questions.json`));
|
|
51
|
+
const fullname = shell
|
|
52
|
+
.exec('git config --global user.name', { silent: true })
|
|
53
|
+
.trim();
|
|
54
|
+
const email = shell
|
|
55
|
+
.exec('git config --global user.email', { silent: true })
|
|
56
|
+
.trim();
|
|
57
|
+
// @__USERNAME__/__MODULENAME__
|
|
58
|
+
// __PACKAGE_IDENTIFIER__
|
|
59
|
+
const args = (0, dargs_1.default)({
|
|
60
|
+
_: [],
|
|
61
|
+
...argv,
|
|
62
|
+
__MODULENAME__: name,
|
|
63
|
+
__USERFULLNAME__: fullname,
|
|
64
|
+
__USEREMAIL__: email,
|
|
65
|
+
}, { allowCamelCase: true });
|
|
66
|
+
const results = await (0, prompt_1.prompt)(questions, args);
|
|
67
|
+
let scopedResults;
|
|
68
|
+
const license = await (0, prompt_1.prompt)([
|
|
69
|
+
{
|
|
70
|
+
name: '__LICENSE__',
|
|
71
|
+
message: 'Which license?',
|
|
72
|
+
choices: ['MIT', 'closed'],
|
|
73
|
+
type: 'list',
|
|
74
|
+
required: true,
|
|
75
|
+
},
|
|
76
|
+
], []);
|
|
77
|
+
if (results.__ACCESS__ === 'public') {
|
|
78
|
+
scopedResults = await (0, prompt_1.prompt)([
|
|
79
|
+
{
|
|
80
|
+
type: 'confirm',
|
|
81
|
+
name: 'scoped',
|
|
82
|
+
message: 'use npm scopes?',
|
|
83
|
+
required: true,
|
|
84
|
+
},
|
|
85
|
+
], []);
|
|
86
|
+
}
|
|
87
|
+
const files = []
|
|
88
|
+
.concat(glob(process.cwd() + '/**/.*'))
|
|
89
|
+
.concat(glob(process.cwd() + '/**/*'));
|
|
90
|
+
for (let i = 0; i < files.length; i++) {
|
|
91
|
+
const templateFile = files[i];
|
|
92
|
+
if (fs.lstatSync(templateFile).isDirectory())
|
|
93
|
+
continue;
|
|
94
|
+
let content = fs.readFileSync(templateFile).toString();
|
|
95
|
+
if (path.basename(templateFile) === 'LICENSE' &&
|
|
96
|
+
license.__LICENSE__ === 'closed') {
|
|
97
|
+
content = `Copyright (c) 2023 __USERFULLNAME__ <__USEREMAIL__> - All Rights Reserved
|
|
98
|
+
Unauthorized copying via any medium is strictly prohibited
|
|
99
|
+
Proprietary and confidential`;
|
|
100
|
+
}
|
|
101
|
+
Object.keys(results).forEach(key => {
|
|
102
|
+
if (/^__/.test(key)) {
|
|
103
|
+
content = content.replace(new RegExp(key, 'g'), results[key]);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
if (results.__ACCESS__ === 'public') {
|
|
107
|
+
if (scopedResults.scoped) {
|
|
108
|
+
content = content.replace(/__PACKAGE_IDENTIFIER__/g, `@${results.__USERNAME__}/${results.__MODULENAME__}`);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
content = content.replace(/__PACKAGE_IDENTIFIER__/g, `${results.__MODULENAME__}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
content = content.replace(/__PACKAGE_IDENTIFIER__/g, `@${results.__USERNAME__}/${results.__MODULENAME__}`);
|
|
116
|
+
}
|
|
117
|
+
// if (path.basename(templateFile) === 'README.md') {
|
|
118
|
+
// content = `# ${results.__MODULENAME__}`;
|
|
119
|
+
// }
|
|
120
|
+
fs.writeFileSync(templateFile, content);
|
|
121
|
+
}
|
|
122
|
+
shell.rm('-rf', '.git');
|
|
123
|
+
shell.rm('-rf', '.questions.json');
|
|
124
|
+
console.log(`
|
|
125
|
+
|
|
126
|
+
|||
|
|
127
|
+
(o o)
|
|
128
|
+
ooO--(_)--Ooo-
|
|
129
|
+
|
|
130
|
+
✨ Great work!
|
|
131
|
+
`);
|
|
132
|
+
};
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
// @ts-nocheck
|
|
7
|
+
const prompt_1 = require("../utils/prompt");
|
|
8
|
+
const index_1 = __importDefault(require("../index"));
|
|
9
|
+
exports.default = async (argv) => {
|
|
10
|
+
const questions = [
|
|
11
|
+
{
|
|
12
|
+
_: true,
|
|
13
|
+
type: 'path',
|
|
14
|
+
name: 'schema',
|
|
15
|
+
message: 'which directory contains the the Rust contracts?',
|
|
16
|
+
default: './schema'
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
_: true,
|
|
20
|
+
type: 'path',
|
|
21
|
+
name: 'out',
|
|
22
|
+
message: 'where is the output directory?',
|
|
23
|
+
default: './ts'
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
_: true,
|
|
27
|
+
type: 'string',
|
|
28
|
+
name: 'name',
|
|
29
|
+
message: 'contract name?'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: 'checkbox',
|
|
33
|
+
name: 'plugin',
|
|
34
|
+
message: 'which plugins?',
|
|
35
|
+
choices: [
|
|
36
|
+
'client',
|
|
37
|
+
'recoil',
|
|
38
|
+
'react-query',
|
|
39
|
+
'message-composer'
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: 'confirm',
|
|
44
|
+
name: 'bundle',
|
|
45
|
+
message: 'enable bundle?',
|
|
46
|
+
default: true
|
|
47
|
+
}
|
|
48
|
+
];
|
|
49
|
+
if (argv.typesOnly) {
|
|
50
|
+
argv.plugin = 'types';
|
|
51
|
+
}
|
|
52
|
+
let { schema, out, name, plugin, bundle } = await (0, prompt_1.prompt)(questions, argv);
|
|
53
|
+
if (!Array.isArray(plugin))
|
|
54
|
+
plugin = [plugin];
|
|
55
|
+
///////// REACT QUERY
|
|
56
|
+
const questions2 = [];
|
|
57
|
+
if (plugin.includes('react-query')) {
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
[].push.apply(questions2, [
|
|
60
|
+
{
|
|
61
|
+
type: 'confirm',
|
|
62
|
+
name: 'optionalClient',
|
|
63
|
+
message: 'optionalClient?',
|
|
64
|
+
default: false
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
type: 'list',
|
|
68
|
+
name: 'version',
|
|
69
|
+
message: 'which react-query version?',
|
|
70
|
+
default: 'v4',
|
|
71
|
+
choices: ['v3', 'v4']
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
type: 'confirm',
|
|
75
|
+
name: 'queryKeys',
|
|
76
|
+
message: 'queryKeys?',
|
|
77
|
+
default: false
|
|
78
|
+
},
|
|
79
|
+
]);
|
|
80
|
+
}
|
|
81
|
+
;
|
|
82
|
+
const { optionalClient, version, queryKeys } = await (0, prompt_1.prompt)(questions2, argv);
|
|
83
|
+
const questions3 = [];
|
|
84
|
+
if (version === 'v4') {
|
|
85
|
+
[].push.apply(questions3, [
|
|
86
|
+
// currently we only support v4 for useMutation
|
|
87
|
+
{
|
|
88
|
+
type: 'confirm',
|
|
89
|
+
name: 'mutations',
|
|
90
|
+
message: 'Generate useMutation hooks?',
|
|
91
|
+
default: false
|
|
92
|
+
}
|
|
93
|
+
]);
|
|
94
|
+
}
|
|
95
|
+
;
|
|
96
|
+
const { mutations } = await (0, prompt_1.prompt)(questions3, argv);
|
|
97
|
+
const queryFactoryQuestions = [];
|
|
98
|
+
if (queryKeys) {
|
|
99
|
+
[].push.apply(queryFactoryQuestions, [
|
|
100
|
+
// Only can use queryFactory if queryKeys is enabled
|
|
101
|
+
{
|
|
102
|
+
type: 'confirm',
|
|
103
|
+
name: 'queryFactory',
|
|
104
|
+
message: 'queryFactory? ',
|
|
105
|
+
default: false
|
|
106
|
+
}
|
|
107
|
+
]);
|
|
108
|
+
}
|
|
109
|
+
;
|
|
110
|
+
const { queryFactory } = await (0, prompt_1.prompt)(queryFactoryQuestions, argv);
|
|
111
|
+
///////// END REACT QUERY
|
|
112
|
+
///////// BUNDLE
|
|
113
|
+
const questions4 = [];
|
|
114
|
+
if (bundle) {
|
|
115
|
+
[].push.apply(questions4, [
|
|
116
|
+
{
|
|
117
|
+
type: 'string',
|
|
118
|
+
name: 'bundleFile',
|
|
119
|
+
message: 'bundleFile?',
|
|
120
|
+
default: 'index.ts'
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
type: 'string',
|
|
124
|
+
name: 'bundleScope',
|
|
125
|
+
message: 'bundleScope?',
|
|
126
|
+
default: 'contracts'
|
|
127
|
+
}
|
|
128
|
+
]);
|
|
129
|
+
}
|
|
130
|
+
;
|
|
131
|
+
const { bundleFile, bundleScope } = await (0, prompt_1.prompt)(questions4, argv);
|
|
132
|
+
///////// END BUNDLE
|
|
133
|
+
const options = {
|
|
134
|
+
types: {
|
|
135
|
+
enabled: true
|
|
136
|
+
},
|
|
137
|
+
client: {
|
|
138
|
+
enabled: plugin.includes('client') ||
|
|
139
|
+
plugin.includes('recoil') ||
|
|
140
|
+
plugin.includes('react-query')
|
|
141
|
+
},
|
|
142
|
+
reactQuery: {
|
|
143
|
+
enabled: plugin.includes('react-query'),
|
|
144
|
+
optionalClient,
|
|
145
|
+
queryKeys,
|
|
146
|
+
version,
|
|
147
|
+
mutations,
|
|
148
|
+
queryFactory
|
|
149
|
+
},
|
|
150
|
+
recoil: {
|
|
151
|
+
enabled: plugin.includes('recoil'),
|
|
152
|
+
},
|
|
153
|
+
messageComposer: {
|
|
154
|
+
enabled: plugin.includes('message-composer')
|
|
155
|
+
},
|
|
156
|
+
messageBuilder: {
|
|
157
|
+
enabled: plugin.includes('message-builder')
|
|
158
|
+
},
|
|
159
|
+
bundle: {
|
|
160
|
+
enabled: bundle,
|
|
161
|
+
scope: bundleScope,
|
|
162
|
+
bundleFile
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
await (0, index_1.default)({
|
|
166
|
+
contracts: [
|
|
167
|
+
{
|
|
168
|
+
name,
|
|
169
|
+
dir: schema
|
|
170
|
+
}
|
|
171
|
+
],
|
|
172
|
+
outPath: out,
|
|
173
|
+
options
|
|
174
|
+
});
|
|
175
|
+
};
|