electra-cli
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -5,2 +5,10 @@ #!/usr/bin/env node | ||
require('../src/start')() | ||
commander | ||
.option('-r, --rebuild', `Let the wallet.dat as is but remove all the other Electra user | ||
directory files before starting the daemon. | ||
`) | ||
.parse(process.argv) | ||
require('../src/start')({ | ||
rebuild: Boolean(commander.rebuild), | ||
}) |
@@ -0,0 +0,0 @@ #!/usr/bin/env node |
{ | ||
"name": "electra-cli", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "CLI tools for Electra daemon and blockchain.", | ||
"license": "MIT", | ||
"main": "./bin/electra.js", | ||
@@ -11,2 +12,3 @@ "bin": { | ||
"scripts": { | ||
"start": "node src/serve", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
@@ -16,5 +18,13 @@ }, | ||
"@inspired-beings/log": "^1.2.0", | ||
"axios": "^0.18.0", | ||
"chalk": "^2.4.1", | ||
"commander": "^2.15.1", | ||
"electra-js": "0.15.0", | ||
"moment": "^2.22.2" | ||
"electra-js": "0.16.1", | ||
"extract-zip": "^1.6.7", | ||
"moment": "^2.22.2", | ||
"numeral": "^2.0.6", | ||
"progress": "^2.0.0", | ||
"request": "^2.87.0", | ||
"request-progress": "^3.0.0", | ||
"rimraf": "^2.6.2" | ||
}, | ||
@@ -33,2 +43,3 @@ "author": { | ||
], | ||
"keywords": [], | ||
"repository": { | ||
@@ -38,4 +49,2 @@ "type": "git", | ||
}, | ||
"keywords": [], | ||
"license": "MIT", | ||
"bugs": { | ||
@@ -42,0 +51,0 @@ "url": "https://github.com/Electra-project/electra-cli/issues" |
@@ -1,2 +0,2 @@ | ||
# electra-cli | ||
# Electra CLI | ||
@@ -11,16 +11,59 @@ NodeJS CLI tools for Electra daemon and blockchain. | ||
[![NSP Status](https://nodesecurity.io/orgs/electra-project/projects/60adf17a-da9b-467c-96ef-84ae7e4280b6/badge)](https://nodesecurity.io/orgs/electra-project/projects/60adf17a-da9b-467c-96ef-84ae7e4280b6) | ||
[![Known Vulnerabilities](https://snyk.io/test/github/Electra-project/electra-cli/badge.svg)](https://snyk.io/test/github/Electra-project/electra-cli) | ||
## Installation | ||
**Prerequisites** | ||
### Local | ||
The local installation is useful if you want to use Electra CLI tools. | ||
**Prerequisites:** | ||
- [Node v8+ (with npm)](https://nodejs.org) | ||
Then: | ||
```bash | ||
npm i -g electra-cli | ||
``` | ||
npm i -g electra-cli | ||
### Remote | ||
The remote installation is useful if you want to run a Server Node to help the network and eventually publish it as a bootstrap node for new Electra wallet users. | ||
#### Deploy a Server Node | ||
**Prerequisites:** | ||
- APT-based OS (Debian, Ubuntu, etc). | ||
- Full root access. | ||
```bash | ||
cd ~ | ||
sudo apt-get update | ||
sudo apt-get install git -y | ||
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash | ||
# or: curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash | ||
source ~/.bashrc | ||
nvm install 10 | ||
git clone https://github.com/Electra-project/electra-cli.git | ||
cd electra-cli | ||
npm i | ||
npm start | ||
``` | ||
> **Note**<br> | ||
> You may need to bind your internal IP port (5817) to your external IP one (same port) via your host online management website (Azure, AWS, etc). | ||
#### Update a Server Node | ||
```bash | ||
cd ~/electra-cli | ||
git pull | ||
npm i | ||
npm start | ||
``` | ||
## Usage | ||
The usage part only concerns local installtions as a tool belt. | ||
electra <command> | ||
Just type `electra` to show the manual and list the available commands. |
@@ -1,3 +0,1 @@ | ||
#!/usr/bin/env node | ||
const ElectraJs = require('electra-js') | ||
@@ -9,3 +7,6 @@ const fs = require('fs') | ||
const path = require('path') | ||
const rimraf = require('rimraf') | ||
const onSigint = require('./helpers/onSigint') | ||
const LOG_LENGTH = 20 | ||
@@ -22,3 +23,3 @@ const VERSION = require(path.resolve(__dirname, '..', `package.json`)).version | ||
.split(os.EOL) | ||
.filter(line => !line.startsWith('ThreadRPCServer')) | ||
.filter(line => !line.startsWith('ThreadRPCServer') && line.trim().length !== 0) | ||
@@ -43,4 +44,15 @@ log.clear() | ||
module.exports = async function () { | ||
process.on('SIGINT', async () => { | ||
module.exports = async function (options) { | ||
if (options.rebuild) { | ||
log.info('Removing all Electra user directory files BUT keeping the "wallet.dat" file...') | ||
try { | ||
rimraf.sync(path.resolve(electraJs.constants.DAEMON_USER_DIR_PATH, '!(wallet.dat)')) | ||
} | ||
catch { | ||
log.err(`Error: ${err}`) | ||
} | ||
} | ||
onSigint(async () => { | ||
if (timerId !== undefined) clearTimeout(timerId) | ||
@@ -51,3 +63,3 @@ log.clear() | ||
log.info('Electra daemon stopped.') | ||
process.exit(); | ||
process.exit() | ||
}) | ||
@@ -54,0 +66,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13789
13
242
69
12
9
1
+ Addedaxios@^0.18.0
+ Addedchalk@^2.4.1
+ Addedextract-zip@^1.6.7
+ Addednumeral@^2.0.6
+ Addedprogress@^2.0.0
+ Addedrequest@^2.87.0
+ Addedrequest-progress@^3.0.0
+ Addedrimraf@^2.6.2
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedbuffer-crc32@0.2.13(transitive)
+ Addedbuffer-from@1.1.2(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedconcat-stream@1.6.2(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addedelectra-js@0.16.1(transitive)
+ Addedextract-zip@1.7.0(transitive)
+ Addedfd-slicer@1.1.0(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedms@2.0.0(transitive)
+ Addednumeral@2.0.6(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpend@1.2.0(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedrimraf@2.7.1(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedtypedarray@0.0.6(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedyauzl@2.10.0(transitive)
- Removedelectra-js@0.15.0(transitive)
Updatedelectra-js@0.16.1