-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clients/js: refactor cmds & CLI docs generator (#3182)
* feat: update npm commands for Githun Actions CI * feat: add worm cli github actions * feat: save HTML test report as artifact * chore: update github action, show report correctly * fix: add missing CommandModule type * chore: rm unused import * fix: override auto-detected locale by OS system * feat: infere command modules on doc.ts & main.ts * feat: command args accepts an array of modules * fix: cmds must be outside main, breaks otherwise * fix: import CLI_COMMAND_MODULES outside of main * chore: add missing transfer command from README * chore: rm test branch dependencies * feat: extract info cmds into array const * chore: document command imports as list * chore: package.json spacing * chore: bump @types/yargs version * feat: cast correct array type YargsCommandModule[]
- Loading branch information
1 parent
caec50b
commit d9175bf
Showing
9 changed files
with
106 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// https://github.com/yargs/yargs/blob/main/docs/advanced.md#example-command-hierarchy-using-indexmjs | ||
import * as aptos from "./aptos"; | ||
import * as editVaa from "./editVaa"; | ||
import * as evm from "./evm"; | ||
import * as generate from "./generate"; | ||
import * as info from "./info"; | ||
import * as near from "./near"; | ||
import * as parse from "./parse"; | ||
import * as recover from "./recover"; | ||
import * as submit from "./submit"; | ||
import * as sui from "./sui"; | ||
import * as transfer from "./transfer"; | ||
import * as verifyVaa from "./verifyVaa"; | ||
import * as status from "./status"; | ||
|
||
// Commands can be imported as an array of commands. | ||
// Documentation about command hierarchy can be found here: https://github.com/yargs/yargs/blob/main/docs/advanced.md#example-command-hierarchy-using-indexmjs | ||
export const CLI_COMMAND_MODULES = [ | ||
aptos, | ||
editVaa, | ||
evm, | ||
generate, | ||
info, | ||
near, | ||
parse, | ||
recover, | ||
submit, | ||
sui, | ||
transfer, | ||
verifyVaa, | ||
status, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,12 @@ | ||
import yargs from "yargs"; | ||
import * as chainId from "./chainId"; | ||
import * as contract from "./contract"; | ||
import * as emitter from "./emitter"; | ||
import * as origin from "./origin"; | ||
import * as registrations from "./registrations"; | ||
import * as rpc from "./rpc"; | ||
import * as wrapped from "./wrapped"; | ||
import { YargsCommandModule } from "../Yargs"; | ||
import { INFO_COMMANDS } from "./info"; | ||
|
||
export const command = "info"; | ||
export const desc = "Contract, chain, rpc and address information utilities"; | ||
// Imports modules logic from root commands, more info here -> https://github.com/yargs/yargs/blob/main/docs/advanced.md#providing-a-command-module | ||
export const builder = (y: typeof yargs) => | ||
y | ||
.command(chainId) | ||
.command(contract) | ||
.command(emitter) | ||
.command(origin) | ||
.command(registrations) | ||
.command(rpc) | ||
.command(wrapped); | ||
// Commands can be imported as an array of commands. | ||
// Documentation about command hierarchy can be found here: https://github.com/yargs/yargs/blob/main/docs/advanced.md#example-command-hierarchy-using-indexmjs | ||
y.command(INFO_COMMANDS as unknown as YargsCommandModule[]); | ||
export const handler = () => {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import * as chainId from "./chainId"; | ||
import * as contract from "./contract"; | ||
import * as emitter from "./emitter"; | ||
import * as origin from "./origin"; | ||
import * as registrations from "./registrations"; | ||
import * as rpc from "./rpc"; | ||
import * as wrapped from "./wrapped"; | ||
|
||
// Commands can be imported as an array of commands. | ||
// Documentation about command hierarchy can be found here: https://github.com/yargs/yargs/blob/main/docs/advanced.md#example-command-hierarchy-using-indexmjs | ||
export const INFO_COMMANDS = [ | ||
chainId, | ||
contract, | ||
emitter, | ||
origin, | ||
registrations, | ||
rpc, | ||
wrapped, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters