@cosmwasm/ts-codegen 0.3.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 +89 -0
- package/main/clean.js +62 -0
- package/main/cleanse.js +89 -0
- package/main/cli.js +69 -0
- package/main/cmds.js +26 -0
- package/main/commands/boilerplate.js +195 -0
- package/main/commands/from-partial.js +74 -0
- package/main/commands/generate.js +74 -0
- package/main/commands/react-query.js +74 -0
- package/main/commands/recoil.js +74 -0
- package/main/cosmwasm-typescript-gen.js +28 -0
- package/main/file.js +47 -0
- package/main/from-partial.js +92 -0
- package/main/generate.js +109 -0
- package/main/header.js +14 -0
- package/main/index.js +59 -0
- package/main/parse.js +49 -0
- package/main/prompt.js +118 -0
- package/main/react-query.js +83 -0
- package/main/recoil.js +86 -0
- package/main/utils.js +123 -0
- package/module/clean.js +49 -0
- package/module/cleanse.js +76 -0
- package/module/cli.js +20 -0
- package/module/cmds.js +12 -0
- package/module/commands/boilerplate.js +116 -0
- package/module/commands/from-partial.js +33 -0
- package/module/commands/generate.js +33 -0
- package/module/commands/react-query.js +33 -0
- package/module/commands/recoil.js +33 -0
- package/module/cosmwasm-typescript-gen.js +8 -0
- package/module/file.js +21 -0
- package/module/from-partial.js +41 -0
- package/module/generate.js +57 -0
- package/module/header.js +8 -0
- package/module/index.js +5 -0
- package/module/parse.js +37 -0
- package/module/prompt.js +68 -0
- package/module/react-query.js +31 -0
- package/module/recoil.js +34 -0
- package/module/utils.js +52 -0
- package/package.json +95 -0
- package/types/clean.d.ts +1 -0
- package/types/cli.d.ts +1 -0
- package/types/cmds.d.ts +1 -0
- package/types/commands/boilerplate.d.ts +2 -0
- package/types/commands/from-partial.d.ts +2 -0
- package/types/commands/generate.d.ts +2 -0
- package/types/commands/react-query.d.ts +2 -0
- package/types/commands/recoil.d.ts +2 -0
- package/types/cosmwasm-typescript-gen.d.ts +2 -0
- package/types/file.d.ts +2 -0
- package/types/from-partial.d.ts +2 -0
- package/types/generate.d.ts +2 -0
- package/types/header.d.ts +1 -0
- package/types/index.d.ts +5 -0
- package/types/parse.d.ts +1 -0
- package/types/prompt.d.ts +3 -0
- package/types/react-query.d.ts +2 -0
- package/types/recoil.d.ts +2 -0
- package/types/utils.d.ts +4 -0
@@ -0,0 +1,33 @@
|
|
1
|
+
import { prompt } from '../prompt';
|
2
|
+
import recoil from '../recoil';
|
3
|
+
import { readSchemas } from '../utils';
|
4
|
+
export default (async argv => {
|
5
|
+
const questions = [{
|
6
|
+
_: true,
|
7
|
+
type: 'path',
|
8
|
+
name: 'schema',
|
9
|
+
message: 'which directory contains the the Rust contracts?',
|
10
|
+
default: './schema'
|
11
|
+
}, {
|
12
|
+
_: true,
|
13
|
+
type: 'path',
|
14
|
+
name: 'out',
|
15
|
+
message: 'where is the output directory?',
|
16
|
+
default: './ts'
|
17
|
+
}, {
|
18
|
+
_: true,
|
19
|
+
type: 'string',
|
20
|
+
name: 'name',
|
21
|
+
message: 'contract name?'
|
22
|
+
}];
|
23
|
+
const {
|
24
|
+
schema,
|
25
|
+
out,
|
26
|
+
name
|
27
|
+
} = await prompt(questions, argv);
|
28
|
+
const schemas = readSchemas({
|
29
|
+
schemaDir: schema,
|
30
|
+
argv
|
31
|
+
});
|
32
|
+
await recoil(name, schemas, out);
|
33
|
+
});
|
package/module/file.js
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
import { prompt } from './prompt';
|
3
|
+
import { cli } from './cli';
|
4
|
+
import { readFileSync } from 'fs';
|
5
|
+
|
6
|
+
const argv = require('minimist')(process.argv.slice(2));
|
7
|
+
|
8
|
+
const question = [{
|
9
|
+
_: true,
|
10
|
+
type: 'string',
|
11
|
+
name: 'file',
|
12
|
+
message: 'file'
|
13
|
+
}];
|
14
|
+
|
15
|
+
(async () => {
|
16
|
+
const {
|
17
|
+
file
|
18
|
+
} = await prompt(question, argv);
|
19
|
+
const argvv = JSON.parse(readFileSync(file, 'utf-8'));
|
20
|
+
await cli(argvv);
|
21
|
+
})();
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import { pascal } from "case";
|
2
|
+
import { header } from './header';
|
3
|
+
import { join } from "path";
|
4
|
+
import { sync as mkdirp } from "mkdirp";
|
5
|
+
import * as w from 'wasm-ast-types';
|
6
|
+
import * as t from '@babel/types';
|
7
|
+
import { writeFileSync } from 'fs';
|
8
|
+
import generate from "@babel/generator";
|
9
|
+
import { getMessageProperties } from "wasm-ast-types";
|
10
|
+
import { findAndParseTypes, findExecuteMsg } from "./utils";
|
11
|
+
export default (async (name, schemas, outPath) => {
|
12
|
+
const FromPartialFile = pascal(`${name}Contract`) + '.from-partial.ts';
|
13
|
+
const Contract = pascal(`${name}Contract`) + '.ts';
|
14
|
+
const ExecuteMsg = findExecuteMsg(schemas);
|
15
|
+
const typeHash = await findAndParseTypes(schemas);
|
16
|
+
const body = [];
|
17
|
+
body.push(w.importStmt(['MsgExecuteContractEncodeObject'], 'cosmwasm'));
|
18
|
+
body.push(w.importStmt(['MsgExecuteContract'], 'cosmjs-types/cosmwasm/wasm/v1/tx'));
|
19
|
+
body.push(w.importStmt(['toUtf8'], '@cosmjs/encoding'));
|
20
|
+
|
21
|
+
if (!typeHash.hasOwnProperty('Coin')) {
|
22
|
+
body.push(w.importStmt(['Coin'], '@cosmjs/amino'));
|
23
|
+
}
|
24
|
+
|
25
|
+
body.push(w.importStmt(Object.keys(typeHash), `./${Contract}`.replace(/\.ts$/, ''))); // execute messages
|
26
|
+
|
27
|
+
if (ExecuteMsg) {
|
28
|
+
const children = getMessageProperties(ExecuteMsg);
|
29
|
+
|
30
|
+
if (children.length > 0) {
|
31
|
+
const TheClass = pascal(`${name}MessageComposer`);
|
32
|
+
const Interface = pascal(`${name}Message`);
|
33
|
+
body.push(w.createFromPartialInterface(Interface, ExecuteMsg));
|
34
|
+
body.push(w.createFromPartialClass(TheClass, Interface, ExecuteMsg));
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
const code = header + generate(t.program(body)).code;
|
39
|
+
mkdirp(outPath);
|
40
|
+
writeFileSync(join(outPath, FromPartialFile), code);
|
41
|
+
});
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import { pascal } from "case";
|
2
|
+
import { header } from './header';
|
3
|
+
import { join } from "path";
|
4
|
+
import { sync as mkdirp } from "mkdirp";
|
5
|
+
import * as w from 'wasm-ast-types';
|
6
|
+
import * as t from '@babel/types';
|
7
|
+
import { writeFileSync } from 'fs';
|
8
|
+
import generate from "@babel/generator";
|
9
|
+
import { clean } from "./clean";
|
10
|
+
import { getMessageProperties } from "wasm-ast-types";
|
11
|
+
import { findAndParseTypes, findExecuteMsg, findQueryMsg } from "./utils";
|
12
|
+
export default (async (name, schemas, outPath) => {
|
13
|
+
const Contract = pascal(`${name}Contract`) + '.ts';
|
14
|
+
const QueryMsg = findQueryMsg(schemas);
|
15
|
+
const ExecuteMsg = findExecuteMsg(schemas);
|
16
|
+
const typeHash = await findAndParseTypes(schemas);
|
17
|
+
let Client = null;
|
18
|
+
let Instance = null;
|
19
|
+
let QueryClient = null;
|
20
|
+
let ReadOnlyInstance = null;
|
21
|
+
const body = [];
|
22
|
+
body.push(w.importStmt(['CosmWasmClient', 'ExecuteResult', 'SigningCosmWasmClient'], '@cosmjs/cosmwasm-stargate'));
|
23
|
+
|
24
|
+
if (typeHash.hasOwnProperty('Coin')) {
|
25
|
+
body.push(w.importStmt(['StdFee'], '@cosmjs/amino'));
|
26
|
+
} else {
|
27
|
+
body.push(w.importStmt(['Coin', 'StdFee'], '@cosmjs/amino'));
|
28
|
+
} // TYPES
|
29
|
+
|
30
|
+
|
31
|
+
Object.values(typeHash).forEach(type => {
|
32
|
+
body.push(clean(type));
|
33
|
+
}); // query messages
|
34
|
+
|
35
|
+
if (QueryMsg) {
|
36
|
+
QueryClient = pascal(`${name}QueryClient`);
|
37
|
+
ReadOnlyInstance = pascal(`${name}ReadOnlyInterface`);
|
38
|
+
body.push(w.createQueryInterface(ReadOnlyInstance, QueryMsg));
|
39
|
+
body.push(w.createQueryClass(QueryClient, ReadOnlyInstance, QueryMsg));
|
40
|
+
} // execute messages
|
41
|
+
|
42
|
+
|
43
|
+
if (ExecuteMsg) {
|
44
|
+
const children = getMessageProperties(ExecuteMsg);
|
45
|
+
|
46
|
+
if (children.length > 0) {
|
47
|
+
Client = pascal(`${name}Client`);
|
48
|
+
Instance = pascal(`${name}Interface`);
|
49
|
+
body.push(w.createExecuteInterface(Instance, ReadOnlyInstance, ExecuteMsg));
|
50
|
+
body.push(w.createExecuteClass(Client, Instance, QueryClient, ExecuteMsg));
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
const code = header + generate(t.program(body)).code;
|
55
|
+
mkdirp(outPath);
|
56
|
+
writeFileSync(join(outPath, Contract), code);
|
57
|
+
});
|
package/module/header.js
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
import pkg from '../package.json';
|
2
|
+
const version = process.env.NODE_ENV === 'test' ? 'latest' : pkg.version;
|
3
|
+
export const header = `/**
|
4
|
+
* This file was automatically generated by ${pkg.name}@${version}.
|
5
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
6
|
+
* and run the ${pkg.name} generate command to regenerate this file.
|
7
|
+
*/
|
8
|
+
\n`;
|
package/module/index.js
ADDED
package/module/parse.js
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
import babelTraverse from '@babel/traverse';
|
2
|
+
import { parse } from '@babel/parser';
|
3
|
+
export const parser = codes => {
|
4
|
+
const hash = {};
|
5
|
+
codes.forEach(code => {
|
6
|
+
const plugins = ['typescript'];
|
7
|
+
const ast = parse(code, {
|
8
|
+
sourceType: 'module',
|
9
|
+
plugins
|
10
|
+
});
|
11
|
+
const visitor = visitorFn({
|
12
|
+
addType(key, node) {
|
13
|
+
hash[key] = node;
|
14
|
+
}
|
15
|
+
|
16
|
+
});
|
17
|
+
babelTraverse(ast, visitor);
|
18
|
+
});
|
19
|
+
return hash;
|
20
|
+
};
|
21
|
+
|
22
|
+
const visitorFn = parser => ({
|
23
|
+
TSTypeAliasDeclaration(path) {
|
24
|
+
parser.addType(path.node.id.name, path.parentPath.node); // if (path.node.id.name.endsWith('For_Empty')) {
|
25
|
+
// const newName = path.node.id.name.replace(/For_Empty$/, '_for_Empty');
|
26
|
+
// path.parentPath.node.declaration.id.name = newName;
|
27
|
+
// parser.addType(newName, path.parentPath.node);
|
28
|
+
// } else {
|
29
|
+
// parser.addType(path.node.id.name, path.parentPath.node);
|
30
|
+
// }
|
31
|
+
},
|
32
|
+
|
33
|
+
TSInterfaceDeclaration(path) {
|
34
|
+
parser.addType(path.node.id.name, path.parentPath.node);
|
35
|
+
}
|
36
|
+
|
37
|
+
});
|
package/module/prompt.js
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
2
|
+
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
4
|
+
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
6
|
+
|
7
|
+
import { filter } from 'fuzzy';
|
8
|
+
import { prompt as inquirerer } from 'inquirerer';
|
9
|
+
export const getFuzzySearch = list => {
|
10
|
+
return (answers, input) => {
|
11
|
+
input = input || '';
|
12
|
+
return new Promise(function (resolve) {
|
13
|
+
setTimeout(function () {
|
14
|
+
const fuzzyResult = filter(input, list);
|
15
|
+
resolve(fuzzyResult.map(function (el) {
|
16
|
+
return el.original;
|
17
|
+
}));
|
18
|
+
}, 25);
|
19
|
+
});
|
20
|
+
};
|
21
|
+
};
|
22
|
+
export const getFuzzySearchNames = nameValueItemList => {
|
23
|
+
const list = nameValueItemList.map(({
|
24
|
+
name,
|
25
|
+
value
|
26
|
+
}) => name);
|
27
|
+
return (answers, input) => {
|
28
|
+
input = input || '';
|
29
|
+
return new Promise(function (resolve) {
|
30
|
+
setTimeout(function () {
|
31
|
+
const fuzzyResult = filter(input, list);
|
32
|
+
resolve(fuzzyResult.map(function (el) {
|
33
|
+
return nameValueItemList.find(({
|
34
|
+
name,
|
35
|
+
value
|
36
|
+
}) => el.original == name);
|
37
|
+
}));
|
38
|
+
}, 25);
|
39
|
+
});
|
40
|
+
};
|
41
|
+
};
|
42
|
+
|
43
|
+
const transform = questions => {
|
44
|
+
return questions.map(q => {
|
45
|
+
if (q.type === 'fuzzy') {
|
46
|
+
const choices = q.choices;
|
47
|
+
delete q.choices;
|
48
|
+
return _objectSpread(_objectSpread({}, q), {}, {
|
49
|
+
type: 'autocomplete',
|
50
|
+
source: getFuzzySearch(choices)
|
51
|
+
});
|
52
|
+
} else if (q.type === 'fuzzy:objects') {
|
53
|
+
const choices = q.choices;
|
54
|
+
delete q.choices;
|
55
|
+
return _objectSpread(_objectSpread({}, q), {}, {
|
56
|
+
type: 'autocomplete',
|
57
|
+
source: getFuzzySearchNames(choices)
|
58
|
+
});
|
59
|
+
} else {
|
60
|
+
return q;
|
61
|
+
}
|
62
|
+
});
|
63
|
+
};
|
64
|
+
|
65
|
+
export const prompt = async (questions = [], argv = {}) => {
|
66
|
+
questions = transform(questions);
|
67
|
+
return await inquirerer(questions, argv);
|
68
|
+
};
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { pascal } from "case";
|
2
|
+
import { header } from './header';
|
3
|
+
import { join } from "path";
|
4
|
+
import { sync as mkdirp } from "mkdirp";
|
5
|
+
import * as w from 'wasm-ast-types';
|
6
|
+
import * as t from '@babel/types';
|
7
|
+
import { writeFileSync } from 'fs';
|
8
|
+
import generate from "@babel/generator";
|
9
|
+
import { findAndParseTypes, findQueryMsg } from "./utils";
|
10
|
+
export default (async (name, schemas, outPath) => {
|
11
|
+
const RecoilFile = pascal(`${name}Contract`) + '.react-query.ts';
|
12
|
+
const Contract = pascal(`${name}Contract`) + '.ts';
|
13
|
+
const QueryMsg = findQueryMsg(schemas);
|
14
|
+
const typeHash = await findAndParseTypes(schemas);
|
15
|
+
let QueryClient = null;
|
16
|
+
let ReadOnlyInstance = null;
|
17
|
+
const body = [];
|
18
|
+
body.push(w.importStmt(['useQuery', 'UseQueryOptions'], 'react-query'));
|
19
|
+
body.push(w.importStmt(Object.keys(typeHash), `./${Contract}`.replace(/\.ts$/, ''))); // query messages
|
20
|
+
|
21
|
+
if (QueryMsg) {
|
22
|
+
QueryClient = pascal(`${name}QueryClient`);
|
23
|
+
ReadOnlyInstance = pascal(`${name}ReadOnlyInterface`);
|
24
|
+
body.push(w.importStmt([QueryClient], `./${Contract}`));
|
25
|
+
[].push.apply(body, w.createReactQueryHooks(QueryMsg, name, QueryClient));
|
26
|
+
}
|
27
|
+
|
28
|
+
const code = header + generate(t.program(body)).code;
|
29
|
+
mkdirp(outPath);
|
30
|
+
writeFileSync(join(outPath, RecoilFile), code);
|
31
|
+
});
|
package/module/recoil.js
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
import { pascal } from "case";
|
2
|
+
import { header } from './header';
|
3
|
+
import { join } from "path";
|
4
|
+
import { sync as mkdirp } from "mkdirp";
|
5
|
+
import * as w from 'wasm-ast-types';
|
6
|
+
import * as t from '@babel/types';
|
7
|
+
import { writeFileSync } from 'fs';
|
8
|
+
import generate from "@babel/generator";
|
9
|
+
import { findAndParseTypes, findQueryMsg } from "./utils";
|
10
|
+
export default (async (name, schemas, outPath) => {
|
11
|
+
const RecoilFile = pascal(`${name}Contract`) + '.recoil.ts';
|
12
|
+
const Contract = pascal(`${name}Contract`) + '.ts';
|
13
|
+
const QueryMsg = findQueryMsg(schemas);
|
14
|
+
const typeHash = await findAndParseTypes(schemas);
|
15
|
+
let QueryClient = null;
|
16
|
+
let ReadOnlyInstance = null;
|
17
|
+
const body = [];
|
18
|
+
body.push(w.importStmt(['selectorFamily'], 'recoil'));
|
19
|
+
body.push(w.importStmt(['cosmWasmClient'], './chain'));
|
20
|
+
body.push(w.importStmt(Object.keys(typeHash), `./${Contract}`.replace(/\.ts$/, ''))); // query messages
|
21
|
+
|
22
|
+
if (QueryMsg) {
|
23
|
+
QueryClient = pascal(`${name}QueryClient`);
|
24
|
+
ReadOnlyInstance = pascal(`${name}ReadOnlyInterface`);
|
25
|
+
body.push(w.importStmt([QueryClient], `./${Contract}`));
|
26
|
+
body.push(w.createRecoilQueryClientType());
|
27
|
+
body.push(w.createRecoilQueryClient(name, QueryClient));
|
28
|
+
[].push.apply(body, w.createRecoilSelectors(name, QueryClient, QueryMsg));
|
29
|
+
}
|
30
|
+
|
31
|
+
const code = header + generate(t.program(body)).code;
|
32
|
+
mkdirp(outPath);
|
33
|
+
writeFileSync(join(outPath, RecoilFile), code);
|
34
|
+
});
|
package/module/utils.js
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
import { sync as glob } from 'glob';
|
2
|
+
import { readFileSync } from 'fs';
|
3
|
+
import { cleanse } from './cleanse';
|
4
|
+
import { compile } from 'json-schema-to-typescript';
|
5
|
+
import { parser } from "./parse";
|
6
|
+
export const readSchemas = ({
|
7
|
+
schemaDir,
|
8
|
+
argv,
|
9
|
+
clean = true
|
10
|
+
}) => {
|
11
|
+
const fn = clean ? cleanse : str => str;
|
12
|
+
const files = glob(schemaDir + '/**/*.json');
|
13
|
+
const schemas = files.map(file => JSON.parse(readFileSync(file, 'utf-8')));
|
14
|
+
|
15
|
+
if (argv.packed) {
|
16
|
+
if (schemas.length !== 1) {
|
17
|
+
throw new Error('packed option only supports one file');
|
18
|
+
}
|
19
|
+
|
20
|
+
return Object.values(fn(schemas[0]));
|
21
|
+
}
|
22
|
+
|
23
|
+
return fn(schemas);
|
24
|
+
};
|
25
|
+
export const findQueryMsg = schemas => {
|
26
|
+
const QueryMsg = schemas.find(schema => schema.title === 'QueryMsg');
|
27
|
+
return QueryMsg;
|
28
|
+
};
|
29
|
+
export const findExecuteMsg = schemas => {
|
30
|
+
const ExecuteMsg = schemas.find(schema => schema.title === 'ExecuteMsg' || schema.title === 'ExecuteMsg_for_Empty' || // if cleanse is used, this is never
|
31
|
+
schema.title === 'ExecuteMsgForEmpty');
|
32
|
+
return ExecuteMsg;
|
33
|
+
};
|
34
|
+
export const findAndParseTypes = async schemas => {
|
35
|
+
const Types = schemas;
|
36
|
+
const allTypes = [];
|
37
|
+
|
38
|
+
for (const typ in Types) {
|
39
|
+
if (Types[typ].definitions) {
|
40
|
+
for (const key of Object.keys(Types[typ].definitions)) {
|
41
|
+
// set title
|
42
|
+
Types[typ].definitions[key].title = key;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
const result = await compile(Types[typ], Types[typ].title);
|
47
|
+
allTypes.push(result);
|
48
|
+
}
|
49
|
+
|
50
|
+
const typeHash = parser(allTypes);
|
51
|
+
return typeHash;
|
52
|
+
};
|
package/package.json
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
{
|
2
|
+
"name": "@cosmwasm/ts-codegen",
|
3
|
+
"version": "0.3.9",
|
4
|
+
"description": "A TypeScript Transpiler for CosmWasm Smart Contracts",
|
5
|
+
"author": "Dan Lynch <pyramation@gmail.com>",
|
6
|
+
"homepage": "https://github.com/pyramation/cosmwasm-typescript-gen",
|
7
|
+
"license": "SEE LICENSE IN LICENSE",
|
8
|
+
"main": "main/index.js",
|
9
|
+
"module": "module/index.js",
|
10
|
+
"typings": "types/index.d.ts",
|
11
|
+
"bin": {
|
12
|
+
"cosmwasm-typescript-gen": "main/cosmwasm-typescript-gen.js"
|
13
|
+
},
|
14
|
+
"directories": {
|
15
|
+
"lib": "src",
|
16
|
+
"test": "__tests__"
|
17
|
+
},
|
18
|
+
"files": [
|
19
|
+
"types",
|
20
|
+
"main",
|
21
|
+
"module"
|
22
|
+
],
|
23
|
+
"scripts": {
|
24
|
+
"build:main": "cross-env BABEL_ENV=production babel src --out-dir main --delete-dir-on-start --extensions \".tsx,.ts,.js\"",
|
25
|
+
"build:module": "cross-env MODULE=true babel src --out-dir module --delete-dir-on-start --extensions \".tsx,.ts,.js\"",
|
26
|
+
"build": "npm run build:module && npm run build:main",
|
27
|
+
"build:ts": "tsc --project ./tsconfig.json",
|
28
|
+
"prepare": "npm run build",
|
29
|
+
"dev": "cross-env NODE_ENV=development babel-node src/cosmwasm-typescript-gen --extensions \".tsx,.ts,.js\"",
|
30
|
+
"watch": "cross-env NODE_ENV=development babel-watch src/cosmwasm-typescript-gen --extensions \".tsx,.ts,.js\"",
|
31
|
+
"file": "cross-env NODE_ENV=development babel-watch src/file --extensions \".tsx,.ts,.js\"",
|
32
|
+
"lint": "eslint .",
|
33
|
+
"format": "eslint . --fix",
|
34
|
+
"test": "jest",
|
35
|
+
"test:watch": "jest --watch",
|
36
|
+
"test:debug": "node --inspect node_modules/.bin/jest --runInBand"
|
37
|
+
},
|
38
|
+
"publishConfig": {
|
39
|
+
"access": "public"
|
40
|
+
},
|
41
|
+
"repository": {
|
42
|
+
"type": "git",
|
43
|
+
"url": "https://github.com/pyramation/cosmwasm-typescript-gen"
|
44
|
+
},
|
45
|
+
"keywords": [],
|
46
|
+
"bugs": {
|
47
|
+
"url": "https://github.com/pyramation/cosmwasm-typescript-gen/issues"
|
48
|
+
},
|
49
|
+
"devDependencies": {
|
50
|
+
"@babel/cli": "7.17.10",
|
51
|
+
"@babel/eslint-parser": "^7.18.2",
|
52
|
+
"@babel/node": "^7.18.5",
|
53
|
+
"@types/jest": "^28.1.2",
|
54
|
+
"ast-stringify": "0.1.0",
|
55
|
+
"babel-core": "7.0.0-bridge.0",
|
56
|
+
"babel-jest": "28.1.1",
|
57
|
+
"babel-watch": "^7.0.0",
|
58
|
+
"cosmwasm": "1.1.1",
|
59
|
+
"cross-env": "^7.0.2",
|
60
|
+
"eslint": "8.17.0",
|
61
|
+
"eslint-config-prettier": "^8.5.0",
|
62
|
+
"eslint-plugin-prettier": "^4.0.0",
|
63
|
+
"jest": "^28.1.1",
|
64
|
+
"jest-in-case": "^1.0.2",
|
65
|
+
"prettier": "^2.7.1",
|
66
|
+
"regenerator-runtime": "^0.13.7",
|
67
|
+
"ts-jest": "^28.0.5",
|
68
|
+
"typescript": "^4.7.4"
|
69
|
+
},
|
70
|
+
"dependencies": {
|
71
|
+
"@babel/core": "7.18.5",
|
72
|
+
"@babel/generator": "7.18.2",
|
73
|
+
"@babel/parser": "7.18.5",
|
74
|
+
"@babel/plugin-proposal-class-properties": "7.17.12",
|
75
|
+
"@babel/plugin-proposal-export-default-from": "7.17.12",
|
76
|
+
"@babel/plugin-proposal-object-rest-spread": "7.18.0",
|
77
|
+
"@babel/plugin-transform-runtime": "7.18.5",
|
78
|
+
"@babel/preset-env": "7.18.2",
|
79
|
+
"@babel/preset-typescript": "^7.17.12",
|
80
|
+
"@babel/runtime": "^7.18.3",
|
81
|
+
"@babel/traverse": "7.18.5",
|
82
|
+
"@babel/types": "7.18.4",
|
83
|
+
"case": "1.6.3",
|
84
|
+
"dargs": "7.0.0",
|
85
|
+
"fuzzy": "0.1.3",
|
86
|
+
"glob": "8.0.3",
|
87
|
+
"inquirerer": "0.1.3",
|
88
|
+
"json-schema-to-typescript": "10.1.5",
|
89
|
+
"long": "^5.2.0",
|
90
|
+
"minimist": "1.2.6",
|
91
|
+
"mkdirp": "1.0.4",
|
92
|
+
"shelljs": "0.8.5",
|
93
|
+
"wasm-ast-types": "^0.3.7"
|
94
|
+
}
|
95
|
+
}
|
package/types/clean.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export declare const clean: (obj: any) => any;
|
package/types/cli.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export function cli(argv: any): Promise<void>;
|
package/types/cmds.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export const Commands: typeof Commands;
|
package/types/file.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export declare const header: string;
|
package/types/index.d.ts
ADDED
package/types/parse.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export declare const parser: (codes: any) => {};
|
package/types/utils.d.ts
ADDED