@cosmwasm/ts-codegen 1.14.0 → 1.15.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/README.md +3 -4
- package/commands/create-boilerplate.js +2 -1
- package/commands/install.js +21 -7
- package/esm/commands/create-boilerplate.js +2 -1
- package/esm/commands/install.js +22 -8
- package/esm/helpers/create-helpers.js +1 -1
- package/esm/helpers/index.js +1 -1
- package/helpers/index.d.ts +1 -1
- package/helpers/index.js +1 -1
- package/package.json +13 -7
package/README.md
CHANGED
|
@@ -616,14 +616,13 @@ export_schema_with_title(
|
|
|
616
616
|
### Initial setup
|
|
617
617
|
|
|
618
618
|
```
|
|
619
|
-
|
|
620
|
-
yarn bootstrap
|
|
619
|
+
pnpm install
|
|
621
620
|
```
|
|
622
621
|
|
|
623
622
|
### Building
|
|
624
623
|
|
|
625
624
|
```
|
|
626
|
-
|
|
625
|
+
pnpm build
|
|
627
626
|
```
|
|
628
627
|
|
|
629
628
|
### Tests
|
|
@@ -632,7 +631,7 @@ Then `cd` into a package and run the tests
|
|
|
632
631
|
|
|
633
632
|
```
|
|
634
633
|
cd ./packages/ast
|
|
635
|
-
|
|
634
|
+
pnpm test:watch
|
|
636
635
|
```
|
|
637
636
|
|
|
638
637
|
### Working with ASTs
|
|
@@ -36,6 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const child_process_1 = require("child_process");
|
|
39
40
|
const dargs_1 = __importDefault(require("dargs"));
|
|
40
41
|
const fs_1 = require("fs");
|
|
41
42
|
const glob_1 = require("glob");
|
|
@@ -55,7 +56,7 @@ exports.default = async (argv) => {
|
|
|
55
56
|
message: 'Enter your new module name',
|
|
56
57
|
},
|
|
57
58
|
], argv);
|
|
58
|
-
|
|
59
|
+
(0, child_process_1.execFileSync)('git', ['clone', repo, '--', name], { stdio: 'inherit' });
|
|
59
60
|
shell.cd(name);
|
|
60
61
|
const questions = JSON.parse((0, fs_1.readFileSync)(`.questions.json`, 'utf-8'));
|
|
61
62
|
const fullname = shell
|
package/commands/install.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const child_process_1 = require("child_process");
|
|
3
4
|
const fs_1 = require("fs");
|
|
4
5
|
const glob_1 = require("glob");
|
|
5
6
|
const mkdirp_1 = require("mkdirp");
|
|
@@ -7,18 +8,25 @@ const os_1 = require("os");
|
|
|
7
8
|
const parse_package_name_1 = require("parse-package-name");
|
|
8
9
|
const path_1 = require("path");
|
|
9
10
|
const rimraf_1 = require("rimraf");
|
|
10
|
-
const shelljs_1 = require("shelljs");
|
|
11
11
|
const prompt_1 = require("../utils/prompt");
|
|
12
12
|
const TMPDIR = (0, os_1.tmpdir)();
|
|
13
13
|
const rnd = () => Math.random().toString(36).substring(2, 15) +
|
|
14
14
|
Math.random().toString(36).substring(2, 15);
|
|
15
15
|
const getPackages = (names) => {
|
|
16
|
-
return names
|
|
17
|
-
.map((pkg) => {
|
|
16
|
+
return names.map((pkg) => {
|
|
18
17
|
const { name, version } = (0, parse_package_name_1.parse)(pkg);
|
|
19
18
|
return `${name}@${version}`;
|
|
20
|
-
})
|
|
21
|
-
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
const move = (src, dst) => {
|
|
22
|
+
try {
|
|
23
|
+
(0, fs_1.renameSync)(src, dst);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
// fall back to copy + remove across devices
|
|
27
|
+
(0, fs_1.cpSync)(src, dst, { recursive: true });
|
|
28
|
+
(0, rimraf_1.sync)(src);
|
|
29
|
+
}
|
|
22
30
|
};
|
|
23
31
|
exports.default = async (argv) => {
|
|
24
32
|
// don't prompt if we got this...
|
|
@@ -65,7 +73,13 @@ exports.default = async (argv) => {
|
|
|
65
73
|
const tmp = (0, path_1.join)(TMPDIR, rnd());
|
|
66
74
|
(0, mkdirp_1.sync)(tmp);
|
|
67
75
|
process.chdir(tmp);
|
|
68
|
-
(0,
|
|
76
|
+
(0, child_process_1.execFileSync)('npm', [
|
|
77
|
+
'install',
|
|
78
|
+
...getPackages(pkg),
|
|
79
|
+
'--production',
|
|
80
|
+
'--prefix',
|
|
81
|
+
'./smart-contracts',
|
|
82
|
+
], { stdio: 'inherit' });
|
|
69
83
|
// protos
|
|
70
84
|
const pkgs = (0, glob_1.globSync)('./smart-contracts/**/package.json').sort();
|
|
71
85
|
const cmds = pkgs
|
|
@@ -93,7 +107,7 @@ exports.default = async (argv) => {
|
|
|
93
107
|
(0, rimraf_1.sync)(dst);
|
|
94
108
|
console.log(`installing ${pkg}...`);
|
|
95
109
|
(0, mkdirp_1.sync)((0, path_1.dirname)(dst));
|
|
96
|
-
(
|
|
110
|
+
move(src, dst);
|
|
97
111
|
}
|
|
98
112
|
// package
|
|
99
113
|
const packageInfo = JSON.parse((0, fs_1.readFileSync)('./smart-contracts/package.json', 'utf-8'));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { execFileSync } from 'child_process';
|
|
1
2
|
import dargs from 'dargs';
|
|
2
3
|
import { lstatSync, readFileSync, writeFileSync } from 'fs';
|
|
3
4
|
import { globSync as glob } from 'glob';
|
|
@@ -17,7 +18,7 @@ export default async (argv) => {
|
|
|
17
18
|
message: 'Enter your new module name',
|
|
18
19
|
},
|
|
19
20
|
], argv);
|
|
20
|
-
|
|
21
|
+
execFileSync('git', ['clone', repo, '--', name], { stdio: 'inherit' });
|
|
21
22
|
shell.cd(name);
|
|
22
23
|
const questions = JSON.parse(readFileSync(`.questions.json`, 'utf-8'));
|
|
23
24
|
const fullname = shell
|
package/esm/commands/install.js
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { execFileSync } from 'child_process';
|
|
2
|
+
import { cpSync, readFileSync, renameSync, writeFileSync } from 'fs';
|
|
2
3
|
import { globSync as glob } from 'glob';
|
|
3
4
|
import { sync as mkdirp } from 'mkdirp';
|
|
4
5
|
import { tmpdir } from 'os';
|
|
5
6
|
import { parse } from 'parse-package-name';
|
|
6
7
|
import { basename, dirname, extname, join, resolve } from 'path';
|
|
7
8
|
import { sync as rimraf } from 'rimraf';
|
|
8
|
-
import { exec } from 'shelljs';
|
|
9
9
|
import { prompt } from '../utils/prompt';
|
|
10
10
|
const TMPDIR = tmpdir();
|
|
11
11
|
const rnd = () => Math.random().toString(36).substring(2, 15) +
|
|
12
12
|
Math.random().toString(36).substring(2, 15);
|
|
13
13
|
const getPackages = (names) => {
|
|
14
|
-
return names
|
|
15
|
-
.map((pkg) => {
|
|
14
|
+
return names.map((pkg) => {
|
|
16
15
|
const { name, version } = parse(pkg);
|
|
17
16
|
return `${name}@${version}`;
|
|
18
|
-
})
|
|
19
|
-
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
const move = (src, dst) => {
|
|
20
|
+
try {
|
|
21
|
+
renameSync(src, dst);
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
// fall back to copy + remove across devices
|
|
25
|
+
cpSync(src, dst, { recursive: true });
|
|
26
|
+
rimraf(src);
|
|
27
|
+
}
|
|
20
28
|
};
|
|
21
29
|
export default async (argv) => {
|
|
22
30
|
// don't prompt if we got this...
|
|
@@ -63,7 +71,13 @@ export default async (argv) => {
|
|
|
63
71
|
const tmp = join(TMPDIR, rnd());
|
|
64
72
|
mkdirp(tmp);
|
|
65
73
|
process.chdir(tmp);
|
|
66
|
-
|
|
74
|
+
execFileSync('npm', [
|
|
75
|
+
'install',
|
|
76
|
+
...getPackages(pkg),
|
|
77
|
+
'--production',
|
|
78
|
+
'--prefix',
|
|
79
|
+
'./smart-contracts',
|
|
80
|
+
], { stdio: 'inherit' });
|
|
67
81
|
// protos
|
|
68
82
|
const pkgs = glob('./smart-contracts/**/package.json').sort();
|
|
69
83
|
const cmds = pkgs
|
|
@@ -91,7 +105,7 @@ export default async (argv) => {
|
|
|
91
105
|
rimraf(dst);
|
|
92
106
|
console.log(`installing ${pkg}...`);
|
|
93
107
|
mkdirp(dirname(dst));
|
|
94
|
-
|
|
108
|
+
move(src, dst);
|
|
95
109
|
}
|
|
96
110
|
// package
|
|
97
111
|
const packageInfo = JSON.parse(readFileSync('./smart-contracts/package.json', 'utf-8'));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { sync as mkdirp } from 'mkdirp';
|
|
2
2
|
import { basename, dirname, extname, join } from 'path';
|
|
3
|
-
import { contractContextBase, contractContextBaseShortHandCtor, contractsContextTSX,
|
|
3
|
+
import { baseClient, contractContextBase, contractContextBaseShortHandCtor, contractsContextTSX, } from '../helpers';
|
|
4
4
|
import { writeContentToFile } from '../utils/files';
|
|
5
5
|
import { header } from '../utils/header';
|
|
6
6
|
const write = (outPath, file, content, varname) => {
|
package/esm/helpers/index.js
CHANGED
package/helpers/index.d.ts
CHANGED
package/helpers/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./baseClient"), exports);
|
|
17
18
|
__exportStar(require("./contractContextBase"), exports);
|
|
18
19
|
__exportStar(require("./contractContextBaseShortHandCtor"), exports);
|
|
19
|
-
__exportStar(require("./baseClient"), exports);
|
|
20
20
|
__exportStar(require("./contractsContextTSX"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmwasm/ts-codegen",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"description": "@cosmwasm/ts-codegen converts your CosmWasm smart contracts into dev-friendly TypeScript classes so you can focus on shipping code.",
|
|
5
5
|
"author": "Constructive <developers@constructive.io>",
|
|
6
6
|
"homepage": "https://github.com/hyperweb-io/ts-codegen",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"scripts": {
|
|
20
20
|
"copy": "copyfiles -f LICENSE-Apache LICENSE-MIT README.md package.json dist",
|
|
21
21
|
"clean": "rimraf dist/**",
|
|
22
|
-
"
|
|
22
|
+
"prepublishOnly": "npm run build",
|
|
23
23
|
"cmds": "tsx ./scripts/cmds.ts",
|
|
24
|
-
"build": "npm run clean
|
|
24
|
+
"build": "npm run clean && tsc && tsc -p tsconfig.esm.json && npm run copy",
|
|
25
25
|
"lint": "eslint . --fix",
|
|
26
26
|
"format": "prettier --write --log-level warn \"./**/*.ts\"",
|
|
27
27
|
"test": "jest",
|
|
@@ -38,13 +38,14 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@babel/generator": "7.24.4",
|
|
41
|
+
"@babel/parser": "^7.24.0",
|
|
41
42
|
"@babel/traverse": "7.24.1",
|
|
42
43
|
"@babel/types": "7.24.0",
|
|
43
44
|
"@chain-registry/types": "^0.17.1",
|
|
44
45
|
"@chain-registry/utils": "^1.51.71",
|
|
45
46
|
"@chain-registry/v2": "^1.71.229",
|
|
46
|
-
"@cosmwasm/ts-codegen-ast": "
|
|
47
|
-
"@cosmwasm/ts-codegen-types": "
|
|
47
|
+
"@cosmwasm/ts-codegen-ast": "1.11.0",
|
|
48
|
+
"@cosmwasm/ts-codegen-types": "1.6.0",
|
|
48
49
|
"@interchainjs/amino": "1.17.1",
|
|
49
50
|
"@interchainjs/cosmos": "1.17.1",
|
|
50
51
|
"@interchainjs/types": "1.17.1",
|
|
@@ -61,16 +62,21 @@
|
|
|
61
62
|
"minimatch": "^10.0.3",
|
|
62
63
|
"minimist": "1.2.6",
|
|
63
64
|
"mkdirp": "1.0.4",
|
|
64
|
-
"nested-obj": "0.
|
|
65
|
+
"nested-obj": "0.2.2",
|
|
65
66
|
"parse-package-name": "1.0.0",
|
|
66
67
|
"rimraf": "3.0.2",
|
|
67
68
|
"shelljs": "0.8.5"
|
|
68
69
|
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@types/babel__generator": "^7.6.8",
|
|
72
|
+
"@types/babel__traverse": "^7.20.6",
|
|
73
|
+
"@types/minimist": "^1.2.5"
|
|
74
|
+
},
|
|
69
75
|
"keywords": [
|
|
70
76
|
"cosmwasm",
|
|
71
77
|
"interchain",
|
|
72
78
|
"smart contracts",
|
|
73
79
|
"codegen"
|
|
74
80
|
],
|
|
75
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "96c718f07b2b172059bce58d98e73a3ba8961631"
|
|
76
82
|
}
|