Comparing version 1.0.1 to 1.1.0
@@ -81,3 +81,4 @@ #!/usr/bin/env node | ||
.command('start') | ||
.option('-i, --input <inp>', 'Select input file, for example "my_input.js".') | ||
.option('-i, --input <inp>', 'Select input file, for example "input_user1.js" or "input_user1.json".') | ||
.option('-l, --library <lib>', 'Select library file, for example "input_library.js".') | ||
.description('Start dex8 task with or without input file.') | ||
@@ -84,0 +85,0 @@ .action(start); |
@@ -9,2 +9,3 @@ /** | ||
const moment = require('moment'); | ||
const { EventEmitter } = require('events'); | ||
@@ -25,2 +26,3 @@ | ||
const input_selected = optionsObj.input; | ||
const library_selected = optionsObj.library; | ||
@@ -41,3 +43,3 @@ | ||
/**** 4) GET main & input ****/ | ||
/**** 4) Fetch main function ****/ | ||
const mainPath = path.join(process.cwd(), 'main.js'); | ||
@@ -49,2 +51,4 @@ const mainExists = await fse.pathExists(mainPath); | ||
/**** 5) Fetch input ****/ | ||
let input; | ||
@@ -60,6 +64,21 @@ if (!!input_selected) { | ||
/**** 6) Fetch input library ****/ | ||
let library; | ||
if (!!library_selected) { | ||
const library_selectedPath = path.join(process.cwd(), library_selected); | ||
const libraryExists = await fse.pathExists(library_selectedPath); | ||
if (!libraryExists) { console.log(chalk.red(`Library file does not exists: ${library_selected}`)); return; } | ||
// delete require.cache[library_selectedPath]; | ||
library = require(library_selectedPath); | ||
} else { | ||
const eventEmitter = new EventEmitter(); | ||
eventEmitter.setMaxListeners(5); // 10 by default | ||
library = { eventEmitter }; | ||
} | ||
/**** 5) EXECUTE main ****/ | ||
/**** 7) EXECUTE main ****/ | ||
try { | ||
const output = await main(input); | ||
const output = await main(input, library); | ||
console.log(`\nTask "${task_title}" is ended on ${shortNow()}`); | ||
@@ -66,0 +85,0 @@ console.log('output:: ', output); |
const FunctionFlow = require('functionflowx'); | ||
const Echo = require('echoer'); | ||
const { EventEmitter } = require('events'); | ||
@@ -7,5 +8,9 @@ const f1 = require('./f1.js'); | ||
module.exports = async (input, eventEmitter) => { | ||
module.exports = async (input) => { | ||
if (!input) { throw new Error('Input is required.'); } | ||
// create event emitter | ||
const eventEmitter = new EventEmitter(); | ||
eventEmitter.setMaxListeners(5); // 10 by default | ||
const ff = new FunctionFlow({ debug: false, msDelay: 800 }, eventEmitter); | ||
@@ -12,0 +17,0 @@ const echo = new Echo(true, 10, eventEmitter); |
{ | ||
"name": "dex8-cli", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"title": "DEX8 CLI", | ||
@@ -5,0 +5,0 @@ "description": "Dex8 CLI is a command line interface which helps developers to create and run dex8.com tasks (automated serverless scripts).", |
@@ -48,3 +48,3 @@ # DEX8 CLI | ||
#### <span style="color:maroon">$ dex8 init <taskName></span> | ||
#### $ dex8 init <taskName> | ||
Use this command to start a new project (Dex8 Task). It will create a taskName folder with initial files. | ||
@@ -54,19 +54,20 @@ a) After init, move to created directory to continue using dex8 commands: *$ cd taskName* | ||
#### <span style="color:maroon">$ dex8 login</span> | ||
#### $ dex8 login | ||
Login to Dex8 Web Panel with your username and password. After successfully logging in, a "conf.js" file is created. It contains a JWT Authentication Token and other sensitive data so please include it in .gitignore and NEVER push this file in the git repository. | ||
#### <span style="color:maroon">$ dex8 logout</span> | ||
#### $ dex8 logout | ||
Logout from Dex8 Web Panel. It is highly recommended to logout every time development work is finished because it will delete the "conf.js" file. | ||
#### <span style="color:maroon">$ dex8 delete <taskName></span> | ||
#### $ dex8 delete <taskName> | ||
Delete a Dex8 task. This command will delete the whole taskName folder. Curent working directory can be either in taskName or in its upper, parent directory. | ||
#### <span style="color:maroon">$ dex8 start -i input.json</span> | ||
#### $ dex8 start -i input.json -l library.js | ||
When a task is created use this command to run a Dex8 task locally. Echo messages will be printed in terminal. | ||
``` | ||
Options: | ||
-i --input <inputFile.js> select input file (initial data for Dex8 task) | ||
-i --input <input.js | input.json> select input file (initial data for Dex8 task) | ||
-l --library <library.js> select library file (initial libs for Dex8 task) | ||
``` | ||
#### <span style="color:maroon">$ dex8 upload</span> | ||
#### $ dex8 upload | ||
Upload the task on the Dex8 serverless platform. | ||
@@ -83,3 +84,3 @@ ``` | ||
#### <span style="color:maroon">$ dex8 update</span> | ||
#### $ dex8 update | ||
Update task details without uploading the task files. | ||
@@ -91,3 +92,3 @@ This command will read what is written in "manifest.json" and "howto.html" and update the task. | ||
#### <span style="color:maroon">$ dex8 download <task_id></span> | ||
#### $ dex8 download <task_id> | ||
Download task files by task_id. Parameter task_id can be found in Web Panel / Tasks table. | ||
@@ -94,0 +95,0 @@ This command will first delete all files in the folder and then create new, downloaded files. |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance 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
34388
678
106
16