Skip to content

Commit d496cea

Browse files
committed
cli: works installed directly from npx/npmjs
Replace cli's raiden .sh with node script, and ensure CI's publish_workspace_on_npm_registry depends on build_cli
1 parent 5647780 commit d496cea

File tree

4 files changed

+12
-40
lines changed

4 files changed

+12
-40
lines changed

.circleci/config.yml

+4
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,9 @@ workflows:
360360
mode: production
361361
requires:
362362
- build_sdk
363+
- build_cli:
364+
requires:
365+
- build_sdk
363366
- generate_documentation:
364367
<<: *filter_release_tag
365368
requires:
@@ -375,3 +378,4 @@ workflows:
375378
context: 'Raiden Context'
376379
requires:
377380
- build_dapp
381+
- build_cli

raiden-cli/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## [Unreleased]
44
### Added
55
- [#3101] Add `OneToN` and `UserDepositToken` (SVT/RDN) addresses to `/contracts` and `/user_deposit` endpoints, `eth_balance`, current `block_number` and `network` info properties to `/address` endpoint
6+
- [#3101] You can now install/run raiden-cli from npmjs with `npx -p @raiden_network/raiden-cli raiden <options>`
67

78
[#3101]: https://github.com/raiden-network/light-client/pull/3101
89

raiden-cli/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"build/**"
3434
],
3535
"bin": {
36-
"raiden-cli": "./raiden"
36+
"raiden": "./raiden"
3737
},
3838
"devDependencies": {
3939
"@types/express": "^4.17.13",

raiden-cli/raiden

+6-39
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,7 @@
1-
#!/usr/bin/env bash
2-
3-
set -e
4-
5-
POSSIBLE_INDEX_JS_RELATIVE_PATHS=("index.js" "build/index.js" "bundle/index.js" "../@raiden_network/raiden-cli/index.js")
6-
SCRIPT_DIRECTORY="$(dirname "$(readlink --canonicalize "${BASH_SOURCE[0]}")")"
7-
INDEX_JS_PATH=""
8-
9-
function source_possible_environment_file() {
10-
local environment_file="${SCRIPT_DIRECTORY}/.env"
11-
12-
if [[ -f "$environment_file" ]]; then
13-
set -a
14-
source "$environment_file"
15-
set +a
16-
fi
1+
#!/usr/bin/env node
2+
try {
3+
require('./build');
4+
} catch (e) {
5+
require('./bundle');
176
}
18-
19-
20-
function set_index_js_file_path() {
21-
local possible_index_js_path
22-
23-
for relative_path in "${POSSIBLE_INDEX_JS_RELATIVE_PATHS[@]}"; do
24-
possible_index_js_path="${SCRIPT_DIRECTORY}/${relative_path}"
25-
26-
if [[ -f "$possible_index_js_path" ]]; then
27-
INDEX_JS_PATH=$possible_index_js_path
28-
return
29-
fi
30-
done
31-
32-
echo "Could not find executable path for raiden-cli!"
33-
exit 1
34-
}
35-
36-
source_possible_environment_file
37-
set_index_js_file_path
38-
exec node "$INDEX_JS_PATH" "$@"
39-
40-
# vim: filetype=sh
7+
// vim: filetype=js

0 commit comments

Comments
 (0)