@hyperweb/telescope 2.2.0 → 2.2.2
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 +13 -13
- package/cli.d.ts +2 -0
- package/cli.js +62 -0
- package/cmds.d.ts +11 -0
- package/cmds.js +17 -0
- package/esm/cli.d.ts +2 -0
- package/esm/cli.js +25 -0
- package/esm/cmds.d.ts +11 -0
- package/esm/cmds.js +11 -0
- package/esm/file.d.ts +2 -0
- package/esm/file.js +19 -0
- package/esm/generators/create-helpers.js +2 -1
- package/esm/generators/create-index.js +2 -2
- package/esm/prompt.d.ts +14 -3
- package/esm/prompt.js +8 -8
- package/esm/telescope.d.ts +2 -0
- package/esm/telescope.js +9 -0
- package/file.d.ts +2 -0
- package/file.js +24 -0
- package/generators/create-helpers.js +4 -6
- package/generators/create-index.js +4 -4
- package/package.json +4 -2
- package/prompt.d.ts +14 -3
- package/prompt.js +8 -8
- package/telescope.d.ts +2 -0
- package/telescope.js +14 -0
package/README.md
CHANGED
|
@@ -142,7 +142,7 @@ For detailed CLI `generate` commands, please refer to our documentation.
|
|
|
142
142
|
You can download proto files using the `download-protos` command provided in the boilerplate:
|
|
143
143
|
|
|
144
144
|
```sh
|
|
145
|
-
|
|
145
|
+
pnpm download-protos
|
|
146
146
|
```
|
|
147
147
|
|
|
148
148
|
After running this command, you'll see:
|
|
@@ -153,10 +153,10 @@ These proto files are downloaded based on your configuration. For detailed CLI `
|
|
|
153
153
|
|
|
154
154
|
### Transpile
|
|
155
155
|
|
|
156
|
-
To generate TypeScript files for your chain, run the `
|
|
156
|
+
To generate TypeScript files for your chain, run the `pnpm codegen` command:
|
|
157
157
|
|
|
158
158
|
```sh
|
|
159
|
-
|
|
159
|
+
pnpm codegen
|
|
160
160
|
```
|
|
161
161
|
|
|
162
162
|
### Build
|
|
@@ -164,8 +164,8 @@ yarn codegen
|
|
|
164
164
|
Finally, build your package to generate JavaScript files and TypeScript definitions:
|
|
165
165
|
|
|
166
166
|
```sh
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
pnpm install
|
|
168
|
+
pnpm build
|
|
169
169
|
```
|
|
170
170
|
|
|
171
171
|
### Publishing
|
|
@@ -374,28 +374,28 @@ Next, navigate to the `./your-project/packages/telescope` directory.
|
|
|
374
374
|
|
|
375
375
|
Install dependencies and download the proto files you need:
|
|
376
376
|
```sh
|
|
377
|
-
|
|
377
|
+
pnpm install
|
|
378
378
|
telescope download --config ./your.config.json
|
|
379
379
|
```
|
|
380
380
|
|
|
381
381
|
Generate TypeScript files for your chain:
|
|
382
382
|
|
|
383
383
|
```sh
|
|
384
|
-
|
|
384
|
+
pnpm codegen
|
|
385
385
|
```
|
|
386
386
|
|
|
387
387
|
### Manual Install
|
|
388
388
|
|
|
389
389
|
To use Telescope in an existing project, run the following command in your project directory:
|
|
390
390
|
```sh
|
|
391
|
-
|
|
391
|
+
pnpm add --save-dev @hyperweb/telescope
|
|
392
392
|
```
|
|
393
393
|
Also install the required helpers and CosmJS [dependencies listed here](#dependencies).
|
|
394
394
|
|
|
395
395
|
We recommend using [Programmatic Usage](#programmatic-usage) for better integration.
|
|
396
396
|
|
|
397
|
-
You can also use the [Telescope CLI](#telescope-cli). When using CLI commands within your project, prefix them with `npx` or `
|
|
398
|
-
- `
|
|
397
|
+
You can also use the [Telescope CLI](#telescope-cli). When using CLI commands within your project, prefix them with `npx` or `pnpm`. For example:
|
|
398
|
+
- `pnpm telescope generate`
|
|
399
399
|
- `npx telescope download`
|
|
400
400
|
|
|
401
401
|
### Programmatic Usage
|
|
@@ -403,7 +403,7 @@ You can also use the [Telescope CLI](#telescope-cli). When using CLI commands wi
|
|
|
403
403
|
First add telescope to your `devDependencies`:
|
|
404
404
|
|
|
405
405
|
```sh
|
|
406
|
-
|
|
406
|
+
pnpm add --save-dev @hyperweb/telescope
|
|
407
407
|
```
|
|
408
408
|
|
|
409
409
|
Install the required helpers and CosmJS [dependencies listed here](#dependencies).
|
|
@@ -1504,7 +1504,7 @@ If you don't use the boilerplate, you will need to manually install
|
|
|
1504
1504
|
* `@cosmjs/tendermint-rpc`
|
|
1505
1505
|
|
|
1506
1506
|
```sh
|
|
1507
|
-
|
|
1507
|
+
pnpm add @cosmjs/amino @cosmjs/proto-signing @cosmjs/stargate @cosmjs/tendermint-rpc
|
|
1508
1508
|
```
|
|
1509
1509
|
|
|
1510
1510
|
If you use the LCD Client generation, you'll need to add
|
|
@@ -1512,7 +1512,7 @@ If you use the LCD Client generation, you'll need to add
|
|
|
1512
1512
|
* `@cosmology/lcd`
|
|
1513
1513
|
|
|
1514
1514
|
```sh
|
|
1515
|
-
|
|
1515
|
+
pnpm add @cosmology/lcd
|
|
1516
1516
|
```
|
|
1517
1517
|
|
|
1518
1518
|
## Troubleshooting
|
package/cli.d.ts
ADDED
package/cli.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.cli = void 0;
|
|
37
|
+
const prompt_1 = require("./prompt");
|
|
38
|
+
const cmds_1 = require("./cmds");
|
|
39
|
+
const pkg = __importStar(require("../package.json"));
|
|
40
|
+
const cli = async (argv) => {
|
|
41
|
+
if (argv.v || argv.version) {
|
|
42
|
+
console.log(pkg.version);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
console.log(`Telescope ${pkg.version}`);
|
|
46
|
+
const { cmd } = await (0, prompt_1.prompt)([
|
|
47
|
+
{
|
|
48
|
+
_: true,
|
|
49
|
+
type: 'fuzzy',
|
|
50
|
+
name: 'cmd',
|
|
51
|
+
message: 'what do you want to do?',
|
|
52
|
+
choices: Object.keys(cmds_1.Commands)
|
|
53
|
+
}
|
|
54
|
+
], argv);
|
|
55
|
+
if (typeof cmds_1.Commands[cmd] === 'function') {
|
|
56
|
+
await cmds_1.Commands[cmd](argv);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
console.log('command not found.');
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
exports.cli = cli;
|
package/cmds.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const Commands: {
|
|
2
|
+
generate: (argv: any) => Promise<any>;
|
|
3
|
+
install: (argv: any) => Promise<void>;
|
|
4
|
+
download: (argv: {
|
|
5
|
+
[key: string]: string | string[];
|
|
6
|
+
} | import("./protod/types").DownloadOptions) => Promise<any>;
|
|
7
|
+
transpile: (argv: {
|
|
8
|
+
[key: string]: string | string[];
|
|
9
|
+
}) => Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
export { Commands };
|
package/cmds.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
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 generate_1 = __importDefault(require("./commands/generate"));
|
|
8
|
+
const install_1 = __importDefault(require("./commands/install"));
|
|
9
|
+
const download_1 = __importDefault(require("./commands/download"));
|
|
10
|
+
const transpile_1 = __importDefault(require("./commands/transpile"));
|
|
11
|
+
const Commands = {
|
|
12
|
+
generate: generate_1.default,
|
|
13
|
+
install: install_1.default,
|
|
14
|
+
download: download_1.default,
|
|
15
|
+
transpile: transpile_1.default
|
|
16
|
+
};
|
|
17
|
+
exports.Commands = Commands;
|
package/esm/cli.d.ts
ADDED
package/esm/cli.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { prompt } from './prompt';
|
|
2
|
+
import { Commands as commands } from './cmds';
|
|
3
|
+
import * as pkg from '../package.json';
|
|
4
|
+
export const cli = async (argv) => {
|
|
5
|
+
if (argv.v || argv.version) {
|
|
6
|
+
console.log(pkg.version);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
console.log(`Telescope ${pkg.version}`);
|
|
10
|
+
const { cmd } = await prompt([
|
|
11
|
+
{
|
|
12
|
+
_: true,
|
|
13
|
+
type: 'fuzzy',
|
|
14
|
+
name: 'cmd',
|
|
15
|
+
message: 'what do you want to do?',
|
|
16
|
+
choices: Object.keys(commands)
|
|
17
|
+
}
|
|
18
|
+
], argv);
|
|
19
|
+
if (typeof commands[cmd] === 'function') {
|
|
20
|
+
await commands[cmd](argv);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
console.log('command not found.');
|
|
24
|
+
}
|
|
25
|
+
};
|
package/esm/cmds.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const Commands: {
|
|
2
|
+
generate: (argv: any) => Promise<any>;
|
|
3
|
+
install: (argv: any) => Promise<void>;
|
|
4
|
+
download: (argv: {
|
|
5
|
+
[key: string]: string | string[];
|
|
6
|
+
} | import("./protod/types").DownloadOptions) => Promise<any>;
|
|
7
|
+
transpile: (argv: {
|
|
8
|
+
[key: string]: string | string[];
|
|
9
|
+
}) => Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
export { Commands };
|
package/esm/cmds.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import _commands_generate from './commands/generate';
|
|
2
|
+
import _commands_install from './commands/install';
|
|
3
|
+
import _commands_download from './commands/download';
|
|
4
|
+
import _commands_transpile from './commands/transpile';
|
|
5
|
+
const Commands = {
|
|
6
|
+
generate: _commands_generate,
|
|
7
|
+
install: _commands_install,
|
|
8
|
+
download: _commands_download,
|
|
9
|
+
transpile: _commands_transpile
|
|
10
|
+
};
|
|
11
|
+
export { Commands };
|
package/esm/file.d.ts
ADDED
package/esm/file.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { prompt } from './prompt';
|
|
3
|
+
import { cli } from './cli';
|
|
4
|
+
import { readFileSync } from 'fs';
|
|
5
|
+
import minimist from 'minimist';
|
|
6
|
+
const argv = minimist(process.argv.slice(2));
|
|
7
|
+
const question = [
|
|
8
|
+
{
|
|
9
|
+
_: true,
|
|
10
|
+
type: 'string',
|
|
11
|
+
name: 'file',
|
|
12
|
+
message: 'file'
|
|
13
|
+
}
|
|
14
|
+
];
|
|
15
|
+
(async () => {
|
|
16
|
+
const { file } = await prompt(question, argv);
|
|
17
|
+
const argvv = JSON.parse(readFileSync(file, 'utf-8'));
|
|
18
|
+
await cli(argvv);
|
|
19
|
+
})();
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { join, dirname } from "path";
|
|
2
2
|
import { mkdirp } from "mkdirp";
|
|
3
|
-
import
|
|
3
|
+
import { findAndRequirePackageJson } from "find-and-require-package-json";
|
|
4
4
|
import { writeContentToFile } from "../utils/files";
|
|
5
5
|
import { external, externalComet, externalIcJs, getHelper, getHelperForBigint, getReactQueryHelper, getVueQueryHelperHooks, mobx, grpcGateway, grpcWeb, pinia, varint, utf8, getHelperForBinary, getRegistryHelper, getTypesHelper, jsonSafe, decimal, getHelperFuncTypes, getHelperFuncTypesForInterface, getReactQueryHelperHooks, getReactQueryHelperHooksIcJs, } from "../helpers";
|
|
6
|
+
const pkg = findAndRequirePackageJson(__dirname);
|
|
6
7
|
const version = process.env.NODE_ENV === "test" ? "latest" : pkg.version;
|
|
7
8
|
const header = `/**
|
|
8
9
|
* This file and any referenced files were automatically generated by ${pkg.name}@${version}
|
|
@@ -3,9 +3,9 @@ import { join, dirname } from "path";
|
|
|
3
3
|
import { mkdirp } from "mkdirp";
|
|
4
4
|
import * as t from "@babel/types";
|
|
5
5
|
import generate from "@babel/generator";
|
|
6
|
-
|
|
7
|
-
import pkg from "../../package.json";
|
|
6
|
+
import { findAndRequirePackageJson } from "find-and-require-package-json";
|
|
8
7
|
import { writeContentToFile } from "../utils/files";
|
|
8
|
+
const pkg = findAndRequirePackageJson(__dirname);
|
|
9
9
|
const version = process.env.NODE_ENV === "test" ? "latest" : pkg.version;
|
|
10
10
|
export const plugin = (builder) => {
|
|
11
11
|
if (!builder.options.bundle.enabled) {
|
package/esm/prompt.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
import { type InquirerQuestion } from 'inquirerer';
|
|
2
|
+
export declare const getFuzzySearch: (list: string[]) => (_answers: unknown, input?: string) => Promise<unknown>;
|
|
3
|
+
interface NameValueItem {
|
|
4
|
+
name: string;
|
|
5
|
+
value: unknown;
|
|
6
|
+
}
|
|
7
|
+
interface Question extends InquirerQuestion {
|
|
8
|
+
type?: string;
|
|
9
|
+
choices?: string[] | NameValueItem[];
|
|
10
|
+
source?: unknown;
|
|
11
|
+
}
|
|
12
|
+
export declare const getFuzzySearchNames: (nameValueItemList: NameValueItem[]) => (_answers: unknown, input?: string) => Promise<unknown>;
|
|
13
|
+
export declare const prompt: (questions?: Question[], argv?: unknown) => Promise<any>;
|
|
14
|
+
export {};
|
package/esm/prompt.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { filter } from 'fuzzy';
|
|
2
2
|
import { prompt as inquirerer } from 'inquirerer';
|
|
3
3
|
export const getFuzzySearch = (list) => {
|
|
4
|
-
return (
|
|
4
|
+
return (_answers, input) => {
|
|
5
5
|
input = input || '';
|
|
6
6
|
return new Promise(function (resolve) {
|
|
7
7
|
setTimeout(function () {
|
|
@@ -14,14 +14,14 @@ export const getFuzzySearch = (list) => {
|
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
export const getFuzzySearchNames = (nameValueItemList) => {
|
|
17
|
-
const list = nameValueItemList.map(({ name
|
|
18
|
-
return (
|
|
17
|
+
const list = nameValueItemList.map(({ name }) => name);
|
|
18
|
+
return (_answers, input) => {
|
|
19
19
|
input = input || '';
|
|
20
20
|
return new Promise(function (resolve) {
|
|
21
21
|
setTimeout(function () {
|
|
22
22
|
const fuzzyResult = filter(input, list);
|
|
23
23
|
resolve(fuzzyResult.map(function (el) {
|
|
24
|
-
return nameValueItemList.find(({ name
|
|
24
|
+
return nameValueItemList.find(({ name }) => el.original == name);
|
|
25
25
|
}));
|
|
26
26
|
}, 25);
|
|
27
27
|
});
|
|
@@ -35,7 +35,7 @@ const transform = (questions) => {
|
|
|
35
35
|
return {
|
|
36
36
|
...q,
|
|
37
37
|
type: 'autocomplete',
|
|
38
|
-
source: getFuzzySearch(choices)
|
|
38
|
+
source: getFuzzySearch(choices),
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
else if (q.type === 'fuzzy:objects') {
|
|
@@ -44,7 +44,7 @@ const transform = (questions) => {
|
|
|
44
44
|
return {
|
|
45
45
|
...q,
|
|
46
46
|
type: 'autocomplete',
|
|
47
|
-
source: getFuzzySearchNames(choices)
|
|
47
|
+
source: getFuzzySearchNames(choices),
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
@@ -53,6 +53,6 @@ const transform = (questions) => {
|
|
|
53
53
|
});
|
|
54
54
|
};
|
|
55
55
|
export const prompt = async (questions = [], argv = {}) => {
|
|
56
|
-
|
|
57
|
-
return await inquirerer(
|
|
56
|
+
const transformed = transform(questions);
|
|
57
|
+
return await inquirerer(transformed, argv);
|
|
58
58
|
};
|
package/esm/telescope.js
ADDED
package/file.d.ts
ADDED
package/file.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const prompt_1 = require("./prompt");
|
|
8
|
+
const cli_1 = require("./cli");
|
|
9
|
+
const fs_1 = require("fs");
|
|
10
|
+
const minimist_1 = __importDefault(require("minimist"));
|
|
11
|
+
const argv = (0, minimist_1.default)(process.argv.slice(2));
|
|
12
|
+
const question = [
|
|
13
|
+
{
|
|
14
|
+
_: true,
|
|
15
|
+
type: 'string',
|
|
16
|
+
name: 'file',
|
|
17
|
+
message: 'file'
|
|
18
|
+
}
|
|
19
|
+
];
|
|
20
|
+
(async () => {
|
|
21
|
+
const { file } = await (0, prompt_1.prompt)(question, argv);
|
|
22
|
+
const argvv = JSON.parse((0, fs_1.readFileSync)(file, 'utf-8'));
|
|
23
|
+
await (0, cli_1.cli)(argvv);
|
|
24
|
+
})();
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.plugin = void 0;
|
|
7
4
|
const path_1 = require("path");
|
|
8
5
|
const mkdirp_1 = require("mkdirp");
|
|
9
|
-
const
|
|
6
|
+
const find_and_require_package_json_1 = require("find-and-require-package-json");
|
|
10
7
|
const files_1 = require("../utils/files");
|
|
11
8
|
const helpers_1 = require("../helpers");
|
|
12
|
-
const
|
|
9
|
+
const pkg = (0, find_and_require_package_json_1.findAndRequirePackageJson)(__dirname);
|
|
10
|
+
const version = process.env.NODE_ENV === "test" ? "latest" : pkg.version;
|
|
13
11
|
const header = `/**
|
|
14
|
-
* This file and any referenced files were automatically generated by ${
|
|
12
|
+
* This file and any referenced files were automatically generated by ${pkg.name}@${version}
|
|
15
13
|
* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
|
|
16
14
|
* and run the transpile command or npm scripts command that is used to regenerate this bundle.
|
|
17
15
|
*/
|
|
@@ -42,10 +42,10 @@ const path_1 = require("path");
|
|
|
42
42
|
const mkdirp_1 = require("mkdirp");
|
|
43
43
|
const t = __importStar(require("@babel/types"));
|
|
44
44
|
const generator_1 = __importDefault(require("@babel/generator"));
|
|
45
|
-
|
|
46
|
-
const package_json_1 = __importDefault(require("../../package.json"));
|
|
45
|
+
const find_and_require_package_json_1 = require("find-and-require-package-json");
|
|
47
46
|
const files_1 = require("../utils/files");
|
|
48
|
-
const
|
|
47
|
+
const pkg = (0, find_and_require_package_json_1.findAndRequirePackageJson)(__dirname);
|
|
48
|
+
const version = process.env.NODE_ENV === "test" ? "latest" : pkg.version;
|
|
49
49
|
const plugin = (builder) => {
|
|
50
50
|
if (!builder.options.bundle.enabled) {
|
|
51
51
|
return;
|
|
@@ -58,7 +58,7 @@ const plugin = (builder) => {
|
|
|
58
58
|
const indexContent = (0, generator_1.default)(finalAst).code;
|
|
59
59
|
mkdirp_1.mkdirp.sync((0, path_1.dirname)(indexOutFile));
|
|
60
60
|
const header = `/**
|
|
61
|
-
* This file and any referenced files were automatically generated by ${
|
|
61
|
+
* This file and any referenced files were automatically generated by ${pkg.name}@${version}
|
|
62
62
|
* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
|
|
63
63
|
* and run the transpile command or npm scripts command that is used to regenerate this bundle.
|
|
64
64
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperweb/telescope",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "A TypeScript Transpiler for Cosmos Protobufs",
|
|
5
5
|
"author": "Constructive <developers@constructive.io>",
|
|
6
6
|
"homepage": "https://github.com/hyperweb-io/telescope",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@keplr-wallet/unit": "^0.12.53",
|
|
62
|
+
"@types/minimist": "^1.2.5",
|
|
62
63
|
"ast-stringify": "0.1.0",
|
|
63
64
|
"cross-env": "^7.0.2",
|
|
64
65
|
"makage": "^0.1.12",
|
|
@@ -79,6 +80,7 @@
|
|
|
79
80
|
"dargs": "7.0.0",
|
|
80
81
|
"deepmerge": "4.3.1",
|
|
81
82
|
"dotty": "0.1.2",
|
|
83
|
+
"find-and-require-package-json": "^0.9.1",
|
|
82
84
|
"fuzzy": "0.1.3",
|
|
83
85
|
"glob": "8.0.3",
|
|
84
86
|
"inquirerer": "0.1.3",
|
|
@@ -91,5 +93,5 @@
|
|
|
91
93
|
"shelljs": "^0.8.5",
|
|
92
94
|
"yaml": "^2.3.4"
|
|
93
95
|
},
|
|
94
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "97fcfb8a8fc94e0b84795c59e1378371c90622d7"
|
|
95
97
|
}
|
package/prompt.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
import { type InquirerQuestion } from 'inquirerer';
|
|
2
|
+
export declare const getFuzzySearch: (list: string[]) => (_answers: unknown, input?: string) => Promise<unknown>;
|
|
3
|
+
interface NameValueItem {
|
|
4
|
+
name: string;
|
|
5
|
+
value: unknown;
|
|
6
|
+
}
|
|
7
|
+
interface Question extends InquirerQuestion {
|
|
8
|
+
type?: string;
|
|
9
|
+
choices?: string[] | NameValueItem[];
|
|
10
|
+
source?: unknown;
|
|
11
|
+
}
|
|
12
|
+
export declare const getFuzzySearchNames: (nameValueItemList: NameValueItem[]) => (_answers: unknown, input?: string) => Promise<unknown>;
|
|
13
|
+
export declare const prompt: (questions?: Question[], argv?: unknown) => Promise<any>;
|
|
14
|
+
export {};
|
package/prompt.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.prompt = exports.getFuzzySearchNames = exports.getFuzzySearch = void 0;
|
|
|
4
4
|
const fuzzy_1 = require("fuzzy");
|
|
5
5
|
const inquirerer_1 = require("inquirerer");
|
|
6
6
|
const getFuzzySearch = (list) => {
|
|
7
|
-
return (
|
|
7
|
+
return (_answers, input) => {
|
|
8
8
|
input = input || '';
|
|
9
9
|
return new Promise(function (resolve) {
|
|
10
10
|
setTimeout(function () {
|
|
@@ -18,14 +18,14 @@ const getFuzzySearch = (list) => {
|
|
|
18
18
|
};
|
|
19
19
|
exports.getFuzzySearch = getFuzzySearch;
|
|
20
20
|
const getFuzzySearchNames = (nameValueItemList) => {
|
|
21
|
-
const list = nameValueItemList.map(({ name
|
|
22
|
-
return (
|
|
21
|
+
const list = nameValueItemList.map(({ name }) => name);
|
|
22
|
+
return (_answers, input) => {
|
|
23
23
|
input = input || '';
|
|
24
24
|
return new Promise(function (resolve) {
|
|
25
25
|
setTimeout(function () {
|
|
26
26
|
const fuzzyResult = (0, fuzzy_1.filter)(input, list);
|
|
27
27
|
resolve(fuzzyResult.map(function (el) {
|
|
28
|
-
return nameValueItemList.find(({ name
|
|
28
|
+
return nameValueItemList.find(({ name }) => el.original == name);
|
|
29
29
|
}));
|
|
30
30
|
}, 25);
|
|
31
31
|
});
|
|
@@ -40,7 +40,7 @@ const transform = (questions) => {
|
|
|
40
40
|
return {
|
|
41
41
|
...q,
|
|
42
42
|
type: 'autocomplete',
|
|
43
|
-
source: (0, exports.getFuzzySearch)(choices)
|
|
43
|
+
source: (0, exports.getFuzzySearch)(choices),
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
else if (q.type === 'fuzzy:objects') {
|
|
@@ -49,7 +49,7 @@ const transform = (questions) => {
|
|
|
49
49
|
return {
|
|
50
50
|
...q,
|
|
51
51
|
type: 'autocomplete',
|
|
52
|
-
source: (0, exports.getFuzzySearchNames)(choices)
|
|
52
|
+
source: (0, exports.getFuzzySearchNames)(choices),
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
@@ -58,7 +58,7 @@ const transform = (questions) => {
|
|
|
58
58
|
});
|
|
59
59
|
};
|
|
60
60
|
const prompt = async (questions = [], argv = {}) => {
|
|
61
|
-
|
|
62
|
-
return await (0, inquirerer_1.prompt)(
|
|
61
|
+
const transformed = transform(questions);
|
|
62
|
+
return await (0, inquirerer_1.prompt)(transformed, argv);
|
|
63
63
|
};
|
|
64
64
|
exports.prompt = prompt;
|
package/telescope.d.ts
ADDED
package/telescope.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const cli_1 = require("./cli");
|
|
8
|
+
const minimist_1 = __importDefault(require("minimist"));
|
|
9
|
+
const argv = (0, minimist_1.default)(process.argv.slice(2), {
|
|
10
|
+
boolean: ['ssh']
|
|
11
|
+
});
|
|
12
|
+
(async () => {
|
|
13
|
+
await (0, cli_1.cli)(argv);
|
|
14
|
+
})();
|