Skip to content

Commit

Permalink
Merge pull request #78 from axelarnetwork/feat/evm-codegen-bin
Browse files Browse the repository at this point in the history
feat: @axelarjs/evm cli
  • Loading branch information
alanrsoares authored Nov 8, 2023
2 parents 4699858 + 7aede24 commit e1468c3
Show file tree
Hide file tree
Showing 4 changed files with 265 additions and 143 deletions.
5 changes: 5 additions & 0 deletions .changeset/nasty-mails-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@axelarjs/evm": patch
---

feat: introduce @axelarjs/evm cli
45 changes: 45 additions & 0 deletions packages/evm/bin/cli.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash

# commands:
# codegen: generate code from abi

COMMAND=$1

# comma separated list of valid commands
VALID_COMMANDS="codegen"

get_npx_compatible_command(){
# check if npx is installed
if command -v npx &> /dev/null
then
echo "npx"
# check if pnpx is installed
elif command -v pnpx &> /dev/null
then
echo "pnpx"
# check if bunx is installed
elif command -v bunx &> /dev/null
then
echo "bunx"
else
echo "npx, pnpx or bunx is required to run this script"
exit 1
fi
}


# get the npx compatible command
NPX_COMMAND=$(get_npx_compatible_command)

case $COMMAND in
codegen)
echo "using '$NPX_COMMAND' to run codegen"
$NPX_COMMAND tsx ./scripts/codegen.ts "$@"
;;
*)
echo "unknown command received: '$COMMAND'"
echo "valid commands:"
# split string into array and print each element on a new line with a - prefix
echo "$VALID_COMMANDS" | tr ',' '\n' | sed 's/^/ * /'
;;
esac
2 changes: 2 additions & 0 deletions packages/evm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
"files": [
"./build",
"./contracts",
"./bin",
"./index.js",
"./index.d.ts",
"./clients.js",
"./clients.d.ts"
],
"bin": "./bin/cli.sh",
"exports": {
".": {
"import": "./build/module/index.js",
Expand Down
Loading

2 comments on commit e1468c3

@vercel
Copy link

@vercel vercel bot commented on e1468c3 Nov 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

axelar-registry – ./apps/registry

axelar-registry-axelar-network.vercel.app
axelar-registry-git-main-axelar-network.vercel.app

@vercel
Copy link

@vercel vercel bot commented on e1468c3 Nov 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

axelar-ui – ./packages/ui

axelar-ui-axelar-network.vercel.app
axelar-ui-git-main-axelar-network.vercel.app
axelar-ui.vercel.app
ui.axelar.dev

Please sign in to comment.