mirror of
https://github.com/vvsviridov/enm-cli.git
synced 2025-10-23 00:12:23 +00:00
update check
This commit is contained in:
28
README.md
28
README.md
@@ -1,9 +1,9 @@
|
||||
# CLI application based on ENM (Ericsson Network Manager) REST API
|
||||
# 💻 CLI application based on ENM (Ericsson Network Manager) REST API
|
||||
|
||||
[](https://github.com/vvsviridov/enm-cli)
|
||||
[](https://www.npmjs.com/package/enm-cli)
|
||||
|
||||
## Key Features
|
||||
## 🛠 Key Features
|
||||
|
||||
- 🚲 Simple and easy to use
|
||||
- 📟 Does not require GUI
|
||||
@@ -11,7 +11,7 @@
|
||||
- 🏗 Allows to make changes in config mode
|
||||
- 🤯 No needs to remember nodes IP addresses
|
||||
|
||||
## Installation
|
||||
## 💾 Installation
|
||||
|
||||
First you need **node.js** which can be downloaded from official site [nodejs.org](https://nodejs.org/en/download/) and installed as described in the docs.
|
||||
|
||||
@@ -41,7 +41,7 @@ npm link
|
||||
|
||||
... to add application to your OS $PATH variable if you want to run it from anywhere.
|
||||
|
||||
## Store your credentials
|
||||
## 🔏 Store your credentials
|
||||
|
||||
### Dotenv file
|
||||
|
||||
@@ -56,7 +56,7 @@ PASSWORD=YourPassword
|
||||
|
||||
By default you'll be prompted for username and password
|
||||
|
||||
## Launch apllication
|
||||
## 🚀 Launch apllication
|
||||
|
||||
```shell
|
||||
> enm-cli -l USERNAME -p PASSWORD -u https://enm.your.company.domain.com
|
||||
@@ -67,7 +67,7 @@ By default you'll be prompted for username and password
|
||||
Shell Terminal
|
||||
```
|
||||
|
||||
## Usage
|
||||
## 🕹 Usage
|
||||
|
||||
Recommended environment is Windows Terminal (not _cmd.exe_) or any shell with rich formatting support. After application successfully launched youll see root content and available commands.
|
||||
|
||||
@@ -86,7 +86,7 @@ Options:
|
||||
-h, --help display help for command
|
||||
```
|
||||
|
||||
## AutoProvisioning Application
|
||||
## 🗂 AutoProvisioning Application
|
||||
|
||||

|
||||
|
||||
@@ -197,7 +197,7 @@ Available commands are:
|
||||
- `[back]` - Return to project's nodes.
|
||||
- `[exit]` - Exit this app.
|
||||
|
||||
## TopologyBrowser Application
|
||||
## 🔭 TopologyBrowser Application
|
||||
|
||||

|
||||
|
||||
@@ -516,15 +516,15 @@ CONSTRAINTS
|
||||
Value Resolution: null
|
||||
```
|
||||
|
||||
## Bulk Import
|
||||
## 🗃 Bulk Import
|
||||
|
||||

|
||||
|
||||
## Shell Terminal
|
||||
## ⌨️ Shell Terminal
|
||||
|
||||

|
||||
|
||||
## Contribution
|
||||
## 📝 Contribution
|
||||
|
||||
1. [Fork it]
|
||||
2. Create your feature branch (`git checkout -b my-new-feature`)
|
||||
@@ -532,7 +532,7 @@ CONSTRAINTS
|
||||
4. Push to the branch (`git push origin my-new-feature`)
|
||||
5. Create new Pull Request
|
||||
|
||||
## Known Issues
|
||||
## 🦠 Known Issues
|
||||
|
||||
### flickering issue
|
||||
|
||||
@@ -544,11 +544,11 @@ Add 1 to _clearLine()_ on this line
|
||||
this.stream.clearLine(1);
|
||||
```
|
||||
|
||||
## Credits
|
||||
## 💵 Credits
|
||||
|
||||
[Contact Me](https://github.com/vvsviridov/) to request new feature or bugs reporting.
|
||||
|
||||
## Changes
|
||||
## 💣 Changes
|
||||
|
||||
1.0.0 - Is released
|
||||
|
||||
|
@@ -4,6 +4,10 @@ const { Command, Option } = require('commander')
|
||||
const pkg = require('../package.json')
|
||||
const inquirer = require('inquirer')
|
||||
const path = require('path')
|
||||
const { exec } = require('child_process')
|
||||
const { promisify } = require('util')
|
||||
const semver = require('semver')
|
||||
const chalk = require('chalk')
|
||||
|
||||
const { isEmpty } = require('../util/validation')
|
||||
|
||||
@@ -20,6 +24,27 @@ if (process.env.NODE_ENV === 'development') {
|
||||
process.on('uncaughtException', (exception) => console.log(exception))
|
||||
}
|
||||
|
||||
|
||||
const executeCommand = promisify(exec)
|
||||
|
||||
async function checkVersion() {
|
||||
try {
|
||||
const { stdout } = await executeCommand(`npm view ${pkg.name} version`)
|
||||
if (semver.lt(pkg.version, stdout.trim())) {
|
||||
console.log(`
|
||||
The version ${chalk.red(pkg.version)} of ${chalk.bold(pkg.name)} is out of date.
|
||||
The latest version is ${chalk.green(stdout.trim())}
|
||||
To update, run:
|
||||
|
||||
${chalk.bold('npm update -g ' + pkg.name)}
|
||||
`)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Error occurred while check for update: ${error.message}`)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const applications = [
|
||||
{
|
||||
id: 'tplg',
|
||||
@@ -110,6 +135,9 @@ async function selectApplication() {
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
if (!process.env.DISABLE_UPDATE_CHECK) {
|
||||
await checkVersion()
|
||||
}
|
||||
const app = await selectApplication()
|
||||
await app.login()
|
||||
await app.inputHandler()
|
||||
|
56
package-lock.json
generated
56
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "enm-cli",
|
||||
"version": "1.0.6a",
|
||||
"version": "1.0.6c",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "enm-cli",
|
||||
"version": "1.0.6a",
|
||||
"version": "1.0.6c",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"axios": "^0.21.2",
|
||||
@@ -21,6 +21,7 @@
|
||||
"inquirer-date-prompt": "^2.0.1",
|
||||
"inquirer-file-tree-selection-prompt": "^1.0.18",
|
||||
"ora": "^5.4.1",
|
||||
"semver": "^7.3.8",
|
||||
"tough-cookie": "^4.0.0",
|
||||
"ws": "^8.11.0"
|
||||
},
|
||||
@@ -528,6 +529,17 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/lru-cache": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
||||
"dependencies": {
|
||||
"yallist": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
"version": "1.52.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||
@@ -698,6 +710,20 @@
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "7.3.8",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
|
||||
"integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
|
||||
"dependencies": {
|
||||
"lru-cache": "^6.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/signal-exit": {
|
||||
"version": "3.0.7",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
|
||||
@@ -847,6 +873,11 @@
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -1171,6 +1202,14 @@
|
||||
"is-unicode-supported": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"lru-cache": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
||||
"requires": {
|
||||
"yallist": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.52.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||
@@ -1285,6 +1324,14 @@
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"semver": {
|
||||
"version": "7.3.8",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
|
||||
"integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
|
||||
"requires": {
|
||||
"lru-cache": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"signal-exit": {
|
||||
"version": "3.0.7",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
|
||||
@@ -1390,6 +1437,11 @@
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz",
|
||||
"integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==",
|
||||
"requires": {}
|
||||
},
|
||||
"yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "enm-cli",
|
||||
"version": "1.0.6c",
|
||||
"version": "1.0.6-c",
|
||||
"description": "This is a cli application for Ericsson Network Manager (ENM)",
|
||||
"bin": "./bin/enm-cli.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"example": "node ./bin/enm-cli.js -u https://example.com/api/v1/"
|
||||
},
|
||||
"keywords": [
|
||||
"Ericsson",
|
||||
@@ -41,6 +41,7 @@
|
||||
"inquirer-date-prompt": "^2.0.1",
|
||||
"inquirer-file-tree-selection-prompt": "^1.0.18",
|
||||
"ora": "^5.4.1",
|
||||
"semver": "^7.3.8",
|
||||
"tough-cookie": "^4.0.0",
|
||||
"ws": "^8.11.0"
|
||||
},
|
||||
|
Reference in New Issue
Block a user