@dedot/cli 0.3.0 → 0.4.1-next.b1afe683.1
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/bin/dedot.mjs +1 -1
- package/commands/chaintypes.js +91 -0
- package/commands/index.js +2 -0
- package/commands/typink.js +66 -0
- package/dedot.js +16 -0
- package/index.js +7 -0
- package/package.json +12 -8
- package/cjs/commands/chaintypes.js +0 -101
- package/cjs/commands/index.js +0 -18
- package/cjs/commands/typink.js +0 -76
- package/cjs/dedot.js +0 -23
- package/cjs/index.js +0 -10
- package/cjs/package.json +0 -1
- /package/{cjs/commands → commands}/chaintypes.d.ts +0 -0
- /package/{cjs/commands → commands}/index.d.ts +0 -0
- /package/{cjs/commands → commands}/typink.d.ts +0 -0
- /package/{cjs/dedot.d.ts → dedot.d.ts} +0 -0
- /package/{cjs/index.d.ts → index.d.ts} +0 -0
package/bin/dedot.mjs
CHANGED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { rpc } from '@polkadot/types-support/metadata/static-substrate';
|
|
2
|
+
import staticSubstrate from '@polkadot/types-support/metadata/v15/substrate-hex';
|
|
3
|
+
import { ConstantExecutor } from '@dedot/api';
|
|
4
|
+
import { $Metadata, PortableRegistry } from '@dedot/codecs';
|
|
5
|
+
import { generateTypes, generateTypesFromEndpoint } from '@dedot/codegen';
|
|
6
|
+
import ora from 'ora';
|
|
7
|
+
import * as path from 'path';
|
|
8
|
+
export const chaintypes = {
|
|
9
|
+
command: 'chaintypes',
|
|
10
|
+
describe: 'Generate Types & APIs for Substrate-based chains',
|
|
11
|
+
handler: async (yargs) => {
|
|
12
|
+
const { wsUrl, output = '', chain = '', dts = true, subpath = true } = yargs;
|
|
13
|
+
const outDir = path.resolve(output);
|
|
14
|
+
const extension = dts ? 'd.ts' : 'ts';
|
|
15
|
+
const spinner = ora().start();
|
|
16
|
+
const shouldGenerateGenericTypes = wsUrl === 'substrate';
|
|
17
|
+
try {
|
|
18
|
+
let generatedResult;
|
|
19
|
+
if (shouldGenerateGenericTypes) {
|
|
20
|
+
spinner.text = 'Generating Substrate generic chaintypes';
|
|
21
|
+
const metadataHex = staticSubstrate;
|
|
22
|
+
const rpcMethods = rpc.methods;
|
|
23
|
+
const metadata = $Metadata.tryDecode(metadataHex);
|
|
24
|
+
const runtimeVersion = getRuntimeVersion(metadata);
|
|
25
|
+
const runtimeApis = runtimeVersion.apis.reduce((acc, [name, version]) => {
|
|
26
|
+
acc[name] = version;
|
|
27
|
+
return acc;
|
|
28
|
+
}, {});
|
|
29
|
+
generatedResult = await generateTypes(chain || 'substrate', metadata.latest, rpcMethods, runtimeApis, outDir, extension, subpath);
|
|
30
|
+
spinner.succeed('Generated Substrate generic chaintypes');
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
spinner.text = `Generating chaintypes via endpoint: ${wsUrl}`;
|
|
34
|
+
generatedResult = await generateTypesFromEndpoint(chain, wsUrl, outDir, extension, subpath);
|
|
35
|
+
spinner.succeed(`Generated chaintypes via endpoint: ${wsUrl}`);
|
|
36
|
+
}
|
|
37
|
+
console.log(` ➡ Output directory: file://${outDir}`);
|
|
38
|
+
console.log(` ➡ ChainApi interface: ${generatedResult.interfaceName}`);
|
|
39
|
+
console.log('🌈 Done!');
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
if (shouldGenerateGenericTypes) {
|
|
43
|
+
spinner.fail(`Failed to generate Substrate generic chaintypes`);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
spinner.fail(`Failed to generate chaintypes via endpoint: ${wsUrl}`);
|
|
47
|
+
}
|
|
48
|
+
console.error(e);
|
|
49
|
+
}
|
|
50
|
+
spinner.stop();
|
|
51
|
+
},
|
|
52
|
+
builder: (yargs) => {
|
|
53
|
+
return yargs
|
|
54
|
+
.option('wsUrl', {
|
|
55
|
+
type: 'string',
|
|
56
|
+
describe: 'Websocket URL to fetch metadata',
|
|
57
|
+
alias: 'w',
|
|
58
|
+
default: 'ws://127.0.0.1:9944',
|
|
59
|
+
})
|
|
60
|
+
.option('output', {
|
|
61
|
+
type: 'string',
|
|
62
|
+
describe: 'Output folder to put generated files',
|
|
63
|
+
alias: 'o',
|
|
64
|
+
})
|
|
65
|
+
.option('chain', {
|
|
66
|
+
type: 'string',
|
|
67
|
+
describe: 'Custom chain name',
|
|
68
|
+
alias: 'c',
|
|
69
|
+
})
|
|
70
|
+
.option('dts', {
|
|
71
|
+
type: 'boolean',
|
|
72
|
+
describe: 'Generate d.ts files',
|
|
73
|
+
alias: 'd',
|
|
74
|
+
default: true,
|
|
75
|
+
})
|
|
76
|
+
.option('subpath', {
|
|
77
|
+
type: 'boolean',
|
|
78
|
+
describe: 'Using subpath for shared packages (e.g: dedot/types)',
|
|
79
|
+
alias: 's',
|
|
80
|
+
default: true,
|
|
81
|
+
}); // TODO check to verify inputs
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
const getRuntimeVersion = (metadata) => {
|
|
85
|
+
const registry = new PortableRegistry(metadata.latest);
|
|
86
|
+
const executor = new ConstantExecutor({
|
|
87
|
+
registry,
|
|
88
|
+
metadata,
|
|
89
|
+
});
|
|
90
|
+
return executor.execute('system', 'version');
|
|
91
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { generateContractTypes } from '@dedot/codegen';
|
|
2
|
+
import { parseRawMetadata } from '@dedot/contracts';
|
|
3
|
+
import { assert } from '@dedot/utils';
|
|
4
|
+
import * as fs from 'node:fs';
|
|
5
|
+
import ora from 'ora';
|
|
6
|
+
import * as path from 'path';
|
|
7
|
+
export const typink = {
|
|
8
|
+
command: 'typink',
|
|
9
|
+
describe: 'Generate Types & APIs for ink! smart contracts',
|
|
10
|
+
handler: async (yargs) => {
|
|
11
|
+
const { contract, output = '', metadata, dts = true, subpath = true } = yargs;
|
|
12
|
+
assert(metadata, 'Metadata file is required, -h or --help to known more about the command');
|
|
13
|
+
const outDir = path.resolve(output);
|
|
14
|
+
const metadataFile = path.resolve(metadata);
|
|
15
|
+
const extension = dts ? 'd.ts' : 'ts';
|
|
16
|
+
const spinner = ora().start();
|
|
17
|
+
try {
|
|
18
|
+
spinner.text = `Parsing contract metadata file: ${metadata}`;
|
|
19
|
+
const contractMetadata = parseRawMetadata(fs.readFileSync(metadataFile, 'utf-8'));
|
|
20
|
+
spinner.succeed(`Parsed contract metadata file: ${metadata}`);
|
|
21
|
+
spinner.text = 'Generating contract Types & APIs';
|
|
22
|
+
const { interfaceName } = await generateContractTypes(contractMetadata, contract, outDir, extension, subpath);
|
|
23
|
+
spinner.succeed('Generated contract Types & APIs');
|
|
24
|
+
console.log(` ➡ Output directory: file://${outDir}`);
|
|
25
|
+
console.log(` ➡ ContractApi interface: ${interfaceName}`);
|
|
26
|
+
console.log('🌈 Done!');
|
|
27
|
+
spinner.stop();
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
spinner.stop();
|
|
31
|
+
spinner.fail(`Failed to generate contract Types & APIs using metadata file: ${metadata}`);
|
|
32
|
+
console.error(e);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
builder: (yargs) => {
|
|
36
|
+
return yargs
|
|
37
|
+
.option('metadata', {
|
|
38
|
+
type: 'string',
|
|
39
|
+
describe: 'Path to contract metadata file (.json, .contract)',
|
|
40
|
+
alias: 'm',
|
|
41
|
+
demandOption: true,
|
|
42
|
+
})
|
|
43
|
+
.option('output', {
|
|
44
|
+
type: 'string',
|
|
45
|
+
describe: 'Output folder to put generated files',
|
|
46
|
+
alias: 'o',
|
|
47
|
+
})
|
|
48
|
+
.option('contract', {
|
|
49
|
+
type: 'string',
|
|
50
|
+
describe: 'Custom contract name, default is contract name from metadata',
|
|
51
|
+
alias: 'c',
|
|
52
|
+
})
|
|
53
|
+
.option('dts', {
|
|
54
|
+
type: 'boolean',
|
|
55
|
+
describe: 'Generate d.ts files',
|
|
56
|
+
alias: 'd',
|
|
57
|
+
default: true,
|
|
58
|
+
})
|
|
59
|
+
.option('subpath', {
|
|
60
|
+
type: 'boolean',
|
|
61
|
+
describe: 'Using subpath for shared packages (e.g: dedot/contracts)',
|
|
62
|
+
alias: 's',
|
|
63
|
+
default: true,
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
};
|
package/dedot.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import yargs from 'yargs';
|
|
2
|
+
import { hideBin } from 'yargs/helpers';
|
|
3
|
+
import { chaintypes, typink } from './commands/index.js';
|
|
4
|
+
export const dedot = () => {
|
|
5
|
+
yargs(hideBin(process.argv))
|
|
6
|
+
.scriptName('dedot')
|
|
7
|
+
.showHelpOnFail(true)
|
|
8
|
+
.command(chaintypes)
|
|
9
|
+
.command(typink)
|
|
10
|
+
.help('help', 'Show help instructions')
|
|
11
|
+
.alias('h', 'help')
|
|
12
|
+
.alias('v', 'version')
|
|
13
|
+
.epilog(`//-- decode the dots - website: https://dedot.dev --//`)
|
|
14
|
+
.strictCommands()
|
|
15
|
+
.demandCommand(1).argv;
|
|
16
|
+
};
|
package/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dedot/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1-next.b1afe683.1+b1afe68",
|
|
4
4
|
"author": "Thang X. Vu <thang@coongcrafts.io>",
|
|
5
5
|
"homepage": "https://github.com/dedotdev/dedot/tree/main/packages/cli",
|
|
6
6
|
"repository": {
|
|
@@ -12,18 +12,20 @@
|
|
|
12
12
|
"dedot": "./bin/dedot.mjs",
|
|
13
13
|
"djs": "./bin/dedot.mjs"
|
|
14
14
|
},
|
|
15
|
-
"main": "./
|
|
15
|
+
"main": "./index.js",
|
|
16
16
|
"sideEffects": false,
|
|
17
|
+
"type": "module",
|
|
17
18
|
"scripts": {
|
|
18
|
-
"build": "tsc --project tsconfig.build.
|
|
19
|
-
"clean": "rm -rf ./dist && rm -rf ./tsconfig.tsbuildinfo ./tsconfig.build.
|
|
19
|
+
"build": "tsc --project tsconfig.build.json && cp -R ./bin ./dist",
|
|
20
|
+
"clean": "rm -rf ./dist && rm -rf ./tsconfig.tsbuildinfo ./tsconfig.build.tsbuildinfo",
|
|
20
21
|
"start": "ts-node src/index.ts"
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
|
-
"@dedot/api": "0.
|
|
24
|
-
"@dedot/codecs": "0.
|
|
25
|
-
"@dedot/codegen": "0.
|
|
24
|
+
"@dedot/api": "0.4.1-next.b1afe683.1+b1afe68",
|
|
25
|
+
"@dedot/codecs": "0.4.1-next.b1afe683.1+b1afe68",
|
|
26
|
+
"@dedot/codegen": "0.4.1-next.b1afe683.1+b1afe68",
|
|
26
27
|
"@polkadot/types-support": "^12.2.3",
|
|
28
|
+
"ora": "^8.0.1",
|
|
27
29
|
"yargs": "^17.7.2"
|
|
28
30
|
},
|
|
29
31
|
"devDependencies": {
|
|
@@ -34,5 +36,7 @@
|
|
|
34
36
|
"directory": "dist"
|
|
35
37
|
},
|
|
36
38
|
"license": "Apache-2.0",
|
|
37
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "b1afe683dd8f237ef804130b721525a59accd280",
|
|
40
|
+
"module": "./index.js",
|
|
41
|
+
"types": "./index.d.ts"
|
|
38
42
|
}
|
|
@@ -1,101 +0,0 @@
|
|
|
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.chaintypes = void 0;
|
|
30
|
-
const static_substrate_1 = require("@polkadot/types-support/metadata/static-substrate");
|
|
31
|
-
const substrate_hex_1 = __importDefault(require("@polkadot/types-support/metadata/v15/substrate-hex"));
|
|
32
|
-
const api_1 = require("@dedot/api");
|
|
33
|
-
const codecs_1 = require("@dedot/codecs");
|
|
34
|
-
const codegen_1 = require("@dedot/codegen");
|
|
35
|
-
const path = __importStar(require("path"));
|
|
36
|
-
exports.chaintypes = {
|
|
37
|
-
command: 'chaintypes',
|
|
38
|
-
describe: 'Generate chain types & APIs for a Substrate-based blockchain',
|
|
39
|
-
handler: async (yargs) => {
|
|
40
|
-
const { wsUrl, output = '', chain = '', dts = true, subpath = true } = yargs;
|
|
41
|
-
const outDir = path.resolve(output);
|
|
42
|
-
const extension = dts ? 'd.ts' : 'ts';
|
|
43
|
-
if (wsUrl === 'substrate') {
|
|
44
|
-
console.log(`- Generating generic chaintypes`);
|
|
45
|
-
const metadataHex = substrate_hex_1.default;
|
|
46
|
-
const rpcMethods = static_substrate_1.rpc.methods;
|
|
47
|
-
const metadata = codecs_1.$Metadata.tryDecode(metadataHex);
|
|
48
|
-
const runtimeVersion = getRuntimeVersion(metadata);
|
|
49
|
-
const runtimeApis = runtimeVersion.apis.reduce((acc, [name, version]) => {
|
|
50
|
-
acc[name] = version;
|
|
51
|
-
return acc;
|
|
52
|
-
}, {});
|
|
53
|
-
await (0, codegen_1.generateTypes)('substrate', metadata.latest, rpcMethods, runtimeApis, outDir, extension, subpath);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
console.log(`- Generating chaintypes via endpoint ${wsUrl}`);
|
|
57
|
-
await (0, codegen_1.generateTypesFromEndpoint)(chain, wsUrl, outDir, extension, subpath);
|
|
58
|
-
}
|
|
59
|
-
console.log(`- DONE! Output: ${outDir}`);
|
|
60
|
-
},
|
|
61
|
-
builder: (yargs) => {
|
|
62
|
-
return (yargs
|
|
63
|
-
.option('wsUrl', {
|
|
64
|
-
type: 'string',
|
|
65
|
-
describe: 'Websocket Url to fetch metadata',
|
|
66
|
-
alias: 'w',
|
|
67
|
-
default: 'ws://127.0.0.1:9944',
|
|
68
|
-
})
|
|
69
|
-
// TODO add file input
|
|
70
|
-
.option('output', {
|
|
71
|
-
type: 'string',
|
|
72
|
-
describe: 'Output folder to put generated files',
|
|
73
|
-
alias: 'o',
|
|
74
|
-
})
|
|
75
|
-
.option('chain', {
|
|
76
|
-
type: 'string',
|
|
77
|
-
describe: 'Chain name',
|
|
78
|
-
alias: 'c',
|
|
79
|
-
})
|
|
80
|
-
.option('dts', {
|
|
81
|
-
type: 'boolean',
|
|
82
|
-
describe: 'Generate d.ts files',
|
|
83
|
-
alias: 'd',
|
|
84
|
-
default: true,
|
|
85
|
-
})
|
|
86
|
-
.option('subpath', {
|
|
87
|
-
type: 'boolean',
|
|
88
|
-
describe: 'Using subpath for shared packages',
|
|
89
|
-
alias: 's',
|
|
90
|
-
default: true,
|
|
91
|
-
})); // TODO check to verify inputs
|
|
92
|
-
},
|
|
93
|
-
};
|
|
94
|
-
const getRuntimeVersion = (metadata) => {
|
|
95
|
-
const registry = new codecs_1.PortableRegistry(metadata.latest);
|
|
96
|
-
const executor = new api_1.ConstantExecutor({
|
|
97
|
-
registry,
|
|
98
|
-
metadata,
|
|
99
|
-
});
|
|
100
|
-
return executor.execute('system', 'version');
|
|
101
|
-
};
|
package/cjs/commands/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
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("./chaintypes.js"), exports);
|
|
18
|
-
__exportStar(require("./typink.js"), exports);
|
package/cjs/commands/typink.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.typink = void 0;
|
|
27
|
-
const codegen_1 = require("@dedot/codegen");
|
|
28
|
-
const utils_1 = require("@dedot/utils");
|
|
29
|
-
const fs = __importStar(require("node:fs"));
|
|
30
|
-
const path = __importStar(require("path"));
|
|
31
|
-
exports.typink = {
|
|
32
|
-
command: 'typink',
|
|
33
|
-
describe: 'Generate types & APIs for a ink! smart contracts',
|
|
34
|
-
handler: async (yargs) => {
|
|
35
|
-
const { contract, output = '', metadata, dts = true, subpath = true } = yargs;
|
|
36
|
-
(0, utils_1.assert)(metadata, 'Metadata file is required, -h or --help to known more about the command');
|
|
37
|
-
const outDir = path.resolve(output);
|
|
38
|
-
const metadataFile = path.resolve(metadata);
|
|
39
|
-
const extension = dts ? 'd.ts' : 'ts';
|
|
40
|
-
const rawMetadata = fs.readFileSync(metadataFile, 'utf-8');
|
|
41
|
-
console.log(`- Generating contract types via metadata ${metadata}`);
|
|
42
|
-
await (0, codegen_1.generateContractTypes)(rawMetadata, contract, outDir, extension, subpath);
|
|
43
|
-
console.log(`- DONE! Output: ${outDir}`);
|
|
44
|
-
},
|
|
45
|
-
builder: (yargs) => {
|
|
46
|
-
return yargs
|
|
47
|
-
.option('metadata', {
|
|
48
|
-
type: 'string',
|
|
49
|
-
describe: 'Path to contract metadata file (.json, .contract)',
|
|
50
|
-
alias: 'm',
|
|
51
|
-
demandOption: true,
|
|
52
|
-
})
|
|
53
|
-
.option('output', {
|
|
54
|
-
type: 'string',
|
|
55
|
-
describe: 'Output folder to put generated files',
|
|
56
|
-
alias: 'o',
|
|
57
|
-
})
|
|
58
|
-
.option('contract', {
|
|
59
|
-
type: 'string',
|
|
60
|
-
describe: 'Contract name',
|
|
61
|
-
alias: 'c',
|
|
62
|
-
})
|
|
63
|
-
.option('dts', {
|
|
64
|
-
type: 'boolean',
|
|
65
|
-
describe: 'Generate d.ts files',
|
|
66
|
-
alias: 'd',
|
|
67
|
-
default: true,
|
|
68
|
-
})
|
|
69
|
-
.option('subpath', {
|
|
70
|
-
type: 'boolean',
|
|
71
|
-
describe: 'Using subpath for shared packages',
|
|
72
|
-
alias: 's',
|
|
73
|
-
default: true,
|
|
74
|
-
});
|
|
75
|
-
},
|
|
76
|
-
};
|
package/cjs/dedot.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
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.dedot = void 0;
|
|
7
|
-
const yargs_1 = __importDefault(require("yargs"));
|
|
8
|
-
const helpers_1 = require("yargs/helpers");
|
|
9
|
-
const index_js_1 = require("./commands/index.js");
|
|
10
|
-
const dedot = () => {
|
|
11
|
-
(0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
|
|
12
|
-
.scriptName('dedot')
|
|
13
|
-
.showHelpOnFail(true)
|
|
14
|
-
.command(index_js_1.chaintypes)
|
|
15
|
-
.command(index_js_1.typink)
|
|
16
|
-
.help('help', 'Show help instructions')
|
|
17
|
-
.alias('h', 'help')
|
|
18
|
-
.alias('v', 'version')
|
|
19
|
-
.epilog(`//-- decode the dots - website: https://dedot.dev --//`)
|
|
20
|
-
.strictCommands()
|
|
21
|
-
.demandCommand(1).argv;
|
|
22
|
-
};
|
|
23
|
-
exports.dedot = dedot;
|
package/cjs/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dedot = void 0;
|
|
4
|
-
const dedot_js_1 = require("./dedot.js");
|
|
5
|
-
Object.defineProperty(exports, "dedot", { enumerable: true, get: function () { return dedot_js_1.dedot; } });
|
|
6
|
-
// We run this directly for development purpose via ts-node
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
if (process[Symbol.for('ts-node.register.instance')]) {
|
|
9
|
-
(0, dedot_js_1.dedot)();
|
|
10
|
-
}
|
package/cjs/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type": "commonjs"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|