Comparing version 0.0.1 to 0.1.0
@@ -1,1 +0,36 @@ | ||
module.exports = 'Hello world.'; | ||
var child_process = require('child_process'); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var cl = require('ciel'); | ||
var clog = console.log; | ||
module.exports = function(){ | ||
var initialD = process.cwd(); | ||
fs.readdirSync(initialD).map(nextName => { | ||
var resolvedPath = path.resolve(initialD, nextName); | ||
if( fs.statSync(resolvedPath).isDirectory() ){ | ||
return resolvedPath; | ||
} else return null; | ||
}).filter(nextPath => nextPath !== null).sort().forEach(nextFolderPath => { | ||
if(!( | ||
fs.readdirSync(nextFolderPath).includes('package.json') | ||
)) return cl.skip('No package.json in ' + nextFolderPath); | ||
cl.folder(nextFolderPath); | ||
try { | ||
clog( child_process.execSync('david', { | ||
cwd: nextFolderPath, | ||
encoding: 'utf8' | ||
})); | ||
} catch(err) { | ||
if( err.status !== 1 ){ | ||
cl.fail( require('util').inspect(err, { | ||
depth: null, | ||
colors: true | ||
})); | ||
process.exit(1); | ||
} | ||
clog(err.stdout); | ||
} | ||
}); | ||
}; |
#!/usr/bin/env node | ||
var davids = require('./davicore.js'); | ||
var clog = console.log; | ||
console.log( davids ); | ||
davids(); |
@@ -6,4 +6,4 @@ { | ||
"main": "davicore.js", | ||
"version": "0.0.1", | ||
"description": "Runs the “david” command in each of subdirectories of the current directory.", | ||
"version": "0.1.0", | ||
"description": "Runs the “david” command in each of subfolders (subdirectories) of the current directory.", | ||
"keywords": ["david", "subfolder", "subfolders", "subdirectory", "subdirectories", "folder", "folders", "directory", "directories"], | ||
@@ -15,3 +15,9 @@ "author": { "name": "Mithgol the Webmaster" }, | ||
"url": "https://github.com/Mithgol/david-in-subfolders.git" | ||
}, | ||
"dependencies": { | ||
"ciel": "~0.3.0" | ||
}, | ||
"scripts": { | ||
"test": "jshint --verbose davids.js davicore.js" | ||
} | ||
} |
@@ -1,9 +0,39 @@ | ||
This module (`davids`) runs the [`david`](http://david-dm.org/) command in each of subfolders of the current directory. | ||
[![(a histogram of downloads)](https://nodei.co/npm-dl/davids.png?height=3)](https://npmjs.org/package/davids) | ||
This module is written in JavaScript and requires [Node.js](http://nodejs.org/) to run. It uses some ECMAScript 2015 features, and thus a relatively recent Node.js is required. This module is tested against the latest stable version of Node.js. | ||
This module (`davids`) runs the [`david`](http://david-dm.org/) command in each of subfolders (subdirectories) of the current directory. | ||
This module is currently in an early phase of its development and thus does not have the desired level of feature completeness. | ||
This module is written in JavaScript and requires [Node.js](http://nodejs.org/) to run. It uses some ECMAScript 2016 features, and thus a relatively recent Node.js is required. This module is tested against the latest stable version of Node.js. | ||
## Installing davids | ||
[![(npm package version)](https://nodei.co/npm/davids.png?downloads=true&downloadRank=true)](https://npmjs.org/package/davids) | ||
### Installing as a global application | ||
* Latest packaged version: `npm install -g davids` | ||
* Latest githubbed version: `npm install -g https://github.com/Mithgol/david-in-subfolders/tarball/master` | ||
The application becomes installed globally and appears in the `PATH`. Then use `davids` command to run the application. | ||
### Installing as a portable application | ||
Instead of the above, download the [ZIP-packed](https://github.com/Mithgol/david-in-subfolders/archive/master.zip) source code of the application and unpack it to some directory. Then run `npm install --production` in that directory. | ||
You may now move that directory (for example, on a flash drive) across systems as long as they have the required version of Node.js installed. | ||
Unlike the above (`npm -g`), the application does not appear in the `PATH`, and thus you'll have to run it directly from the application's directory. You'll also have to run `node davids` instead of `davids`. | ||
## Testing davids | ||
[![(build testing status)](https://img.shields.io/travis/Mithgol/david-in-subfolders/master.svg?style=plastic)](https://travis-ci.org/Mithgol/david-in-subfolders) | ||
It is necessary to install [JSHint](http://jshint.com/) for testing. | ||
* You may install JSHint globally (`npm install jshint -g`) or locally (`npm install jshint` in the directory of davids). | ||
After that you may run `npm test` (in the directory of davids). Only the JS code errors are caught; the code's behaviour is not tested. | ||
## License | ||
MIT license (see the `LICENSE` file). |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
5968
8
35
40
1
1
+ Addedciel@~0.3.0
+ Addedansi@0.3.1(transitive)
+ Addedciel@0.3.0(transitive)