New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

adventure-runner

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adventure-runner - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

65

index.js
'use strict';
var fs = require('fs'),
path = require('path'),
adventure = require('adventure');
path = require('path'),
adventure = require('adventure'),
caller = path.dirname(require('caller')());
module.exports = function (name, problems) {
var getDirectories = function(srcpath) {
if(! fs.existsSync(srcpath)) {
throw new Error(srcpath || 'srcpath' + ' not found!');
}
return fs.readdirSync(srcpath).filter(function(file) {
return fs.statSync(path.join(srcpath, file)).isDirectory();
});
};
if (typeof name !== 'string') {
throw new TypeError('Expected a string');
}
var requireProblems = function (problems, root) {
root = root || './problems/';
var advent = adventure(name);
problems.forEach(function(prob){
console.log(advent);
advent.add(prob, function () {
return require(path.join(root + prob));
});
});
advent.execute(process.argv.slice(2));
};
if (problems instanceof Array) {
if(! fs.existsSync('./problems')) {
throw new Error('./problems dir not found!');
}
requireProblems(problems);
} else {
requireProblems(getDirectories(problems),problems);
var getDirectories = function (srcpath) {
if (!fs.existsSync(srcpath)) {
throw new Error(srcpath || 'srcpath' + ' not found!');
}
return fs.readdirSync(srcpath).filter(function (file) {
return fs.statSync(path.join(srcpath, file)).isDirectory();
});
};
if (typeof name !== 'string') {
throw new TypeError('Expected a string');
}
var requireProblems = function (problems, root) {
root = root || path.join(caller, 'problems/');
var advent = adventure(name);
problems.forEach(function (prob) {
advent.add(prob, function () {
return require(path.join(root + prob));
});
});
advent.execute(process.argv.slice(2));
};
if (problems instanceof Array) {
requireProblems(problems);
} else {
requireProblems(getDirectories(path.join(caller, problems)));
}
};
{
"name": "adventure-runner",
"version": "1.0.0",
"version": "2.0.0",
"description": "Runner util for nodeschool adventures",

@@ -26,4 +26,5 @@ "license": "MIT",

"dependencies": {
"adventure": "^2.10.0"
"adventure": "^2.10.0",
"caller": "^1.0.0"
}
}
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