woven-planet-cli v1.0.1
WovenPlanet
This project was generated with Express.js version 4.17.1.
Requirements
OS: mac, windows, linuxNode js
Development server
Extract the zip file and go to Project Src then Run npm install
Run node . or node index.js or PORT=<Dynamic Port> node . / PORT=<Dynamic Port> node index.js for a dev server.
Install
Run npm install -g . or npm install -g index.js to install the package globally on the system.
Tip: You can list all globally installed Node.js modules using npm ls -g --depth=0
Run in Terminal
Run woven to execute CLI in terminal and enjoy the application.
Deployment
To deploy the package, enter the command npm publish.
distribute npm package to user npm i woven-planet-cli
Application Structure
woven-planet-cli
├── assets
├── files # Storage Directory
├── bin
│ ├── bcommon.js # The module includes all the common functions
│ ├── router.js # The module includes all the necessary api
├── ndex.js # Loader application file that is Runs once the app is loaded
└── package.jsonModules
In this Application, I am using Express - Node.js web application framework. Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. in this application, I created 3 modules named Index.js, Common.js, and router.js. index.js is used to launch the application. in the router.js module, I defined all the API need for the CLI. the common.js module is responsible for the common function that is using in the whole project.
Modules
- index.js
- router.js
- common.js
Index
Requirements:
const request = require('supertest');
const express = require('express');
const router = require('./route');
const common = require('./common');| Function | Parameter | Description |
|---|---|---|
| init | - | Function for welcome message |
| run | - | Function for demonstrating the action list |
| fetchList | - | Function for fetching files stored and list them to user |
| uploadFile | url, local | Get the URL and local parameters and upload the files. local is used for internet URL or local URL |
| deleteFile | name | Get the name and remove the file from storage |
| deleteFromList | - | Show list of file stored and by choosing an item, it will be removed |
Router
Requirements:
const express = require('express');
const router = express.Router();
const fs = require('fs');
const path = require('path');
const request = require('request');
const common = require('./common');| API | Method | Description |
|---|---|---|
| Upload | post | Get a local / internet url and upload the file in the storage |
| List | get | Fetch the files stored in the storage |
| Delete | delete | Get a file name and delete the file from storage |
Common
Requirements:
const chalk = require("chalk");
const boxen = require("boxen");
const figlet = require("figlet");
const inquirer = require("inquirer");| Function | Description |
|---|---|
| showLogo | Function for showing a text as a logo in big size |
| showMessage | Function for showing a coloring text |
| askQuestions | Function for creating a question list |
| showMessageBox | Function for showing a custom message box |
Author
Mehdi Sadeghian
Email: sadeghian.me@gmail.com
LinkedIn: https://www.linkedin.com/in/mehdi-sadeghian626127/