Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

quest-runner

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quest-runner - npm Package Compare versions

Comparing version 0.1.9 to 0.2.0

111

bin.js

@@ -21,9 +21,8 @@ #!/usr/bin/env node

let command = (rest[0] ?? '').toLowerCase();
let name;
let name = process.argv[3];
switch (command.toLowerCase()) {
case '':
command = 'run';
break;
case 'run':
name = process.argv[3];
case 'list':
break;

@@ -33,49 +32,6 @@ default:

}
if (command === 'run') {
let file;
if (name != undefined) {
for (const e of [name, name + '.quest.js']) {
try {
await fs.access(e);
file = e;
break;
}
catch { }
}
}
if (file == undefined) {
const path = require('path');
for (const sub of ['', 'quest', 'test', '../quest', '../test']) {
const dir = 0 < sub.length ? path.join(process.cwd(), sub) : process.cwd();
if (!isDirectory(dir)) continue;
const all = await fs.readdir(dir);
let files = all.filter(path => {
if (name != undefined && !path.startsWith(name)) return false;
return path.endsWith('.quest.js');
});
if (files.length > 0) {
files.sort();
file = path.join(dir, files[0]);
}
if (file != undefined) break;
}
}
if (file == undefined) {
console.error('No script found. Go and create file that name ends with ".quest.js".');
return;
}
let exists = false;
for (const suffix of ['', '.quest.js']) {
try {
await fs.access(file + suffix);
file += suffix;
exists = true;
break;
}
catch { }
};
if (!exists) {
console.error(`Script not found ${file}`);
return;
}
const file = await locateScriptFile(name);
if (!fileExists(file)) return;
if (command == undefined) {
} else if (command === 'run' || command === 'list') {
argv.file = file;

@@ -86,2 +42,3 @@ const code = '' + await fs.readFile(file);

if ((argv.skip || []).length > 0) mode.skip = argv.skip;
if (command === 'list') argv.operation = 'list';
eval(code);

@@ -93,2 +50,5 @@ const result = await play(argv ?? {});

}
} else if (command === 'list') {
argv.file = file;
process.env.MODE = 'list';
}

@@ -125,3 +85,54 @@ }

async function locateScriptFile(name) {
const fs = require('fs').promises;
let file;
if (name != undefined) {
for (const e of [name, name + '.quest.js']) {
try {
await fs.access(e);
file = e;
break;
}
catch { }
}
}
if (file == undefined) {
const path = require('path');
for (const sub of ['', 'quest', 'test', '../quest', '../test']) {
const dir = 0 < sub.length ? path.join(process.cwd(), sub) : process.cwd();
if (!isDirectory(dir)) continue;
const all = await fs.readdir(dir);
let files = all.filter(path => {
if (name != undefined && !path.startsWith(name)) return false;
return path.endsWith('.quest.js');
});
if (files.length > 0) {
files.sort();
file = path.join(dir, files[0]);
}
if (file != undefined) break;
}
}
if (file == undefined) {
console.error('No script found. Go and create file that name ends with ".quest.js".');
return;
}
let exists = false;
for (const suffix of ['', '.quest.js']) {
try {
await fs.access(file + suffix);
file += suffix;
exists = true;
break;
}
catch { }
};
if (!exists) {
console.error(`Script not found ${file}`);
return;
}
return file;
}
main();

@@ -68,2 +68,3 @@

const play = argv => {
if (process.env.X) console.log('X');
if (playing) return;

@@ -95,3 +96,3 @@ playing = true;

}
if (!hideStartTime) {
if (!hideStartTime && argv.operation !== 'list') {
console.log();

@@ -183,4 +184,9 @@ console.log(`${ansi.magentaBright('TIME')} ${ansi.whiteBright(utils.getTimeString(new Date()))}`);

console.log(`${ansi.redBright('STEP')} ${ansi.bgRed(' ' + ansi.whiteBright(1 + index) + ' ')}${name ? ' ' + ansi.greenBright(name) : ''}`);
console.log();
if (argv.operation !== 'list') console.log();
if (argv.operation === 'list') {
index++;
continue;
}
start = utils.getTimeString();

@@ -245,2 +251,3 @@ entry = {

}
if (argv.operation !== 'list') console.log();
}

@@ -281,4 +288,4 @@ catch (error) {

}
}
if (argv.operation === 'list') console.log();
}

@@ -285,0 +292,0 @@ if (fail) {

{
"name": "quest-runner",
"version": "0.1.9",
"version": "0.2.0",
"description": "Tool for creating and processing logic flow scenarios",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc