Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
Use flagged-respawn to respawn Node.js cleanly for near repl
Browse files Browse the repository at this point in the history
This also enables user to pass desired Node.js/V8 flags
  • Loading branch information
vgrichina committed Jan 16, 2020
1 parent 4025809 commit d0d0474
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 12 deletions.
15 changes: 11 additions & 4 deletions bin/near
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#!/bin/sh
CLI_PATH="$(dirname "$0")"/near-cli.js
node --experimental-repl-await "$CLI_PATH" "$@"

#!/usr/bin/env node
const flaggedRespawn = require('flagged-respawn');
require('v8flags')((e, flags) => {
if (e) {
throw e;
}
flaggedRespawn(
flags.concat(['--experimental_repl_await']),
process.argv.indexOf('repl') == -1 ? process.argv : process.argv.concat(['--experimental-repl-await']),
ready => ready && require('./near-cli.js'));
})
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
},
"homepage": "https://github.com/nearprotocol/near-shell#readme",
"bin": {
"near": "./bin/near",
"near-cli.js": "./bin/near-cli.js"
"near": "./bin/near"
},
"devDependencies": {
"eslint": "^6.4.0",
Expand All @@ -36,12 +35,14 @@
"bn": "^1.0.5",
"bs58": "^4.0.1",
"chalk": "^3.0.0",
"flagged-respawn": "^1.0.1",
"is-ci": "^2.0.0",
"jest-environment-node": "^24.5.0",
"ncp": "^2.0.0",
"nearlib": "^0.20.0",
"rimraf": "^3.0.0",
"update-notifier": "^4.0.0",
"v8flags": "^3.1.3",
"yargs": "^15.0.1"
},
"keywords": [
Expand Down
36 changes: 30 additions & 6 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d0d0474

Please sign in to comment.