Socket
Socket
Sign inDemoInstall

directory-layout

Package Overview
Dependencies
9
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

bin/generate.js

9

lib/generate.js

@@ -6,2 +6,3 @@ var fs = require('fs');

var byline = require('byline');
var Promise = require('bluebird');

@@ -62,5 +63,8 @@ function parseFilePaths (root, filePaths, options) {

var layout = "";
var defer = Promise.defer();
dir.paths(root, function(err, paths) {
if (err) throw err;
if (err) {
defer.reject();
}

@@ -71,3 +75,6 @@ paths = parsePaths(paths);

writeToFile(paths, options);
defer.resolve();
});
return defer.promise;
}

@@ -74,0 +81,0 @@

15

lib/verify.js
var fs = require('fs');
var path = require('path');
var byline = require('byline');
var Promise = require('bluebird');

@@ -37,3 +38,4 @@

var nestedLevel = [];
var failure = 0;
var deferred = Promise.defer();
var failures = [];

@@ -68,14 +70,15 @@ readStream

if(!checkIfResourceExists(location)) {
console.log("Issue with: " + location);
failure++;
failures.push(location);
}
})
.on('end', function () {
if(failure > 0) {
console.log('\n' + failure + ' failure(s) found');
if(failures.length > 0) {
deferred.reject(failures);
}
else {
console.log('0 failure, verified successfully.');
deferred.resolve();
}
});
return deferred.promise;
};

@@ -82,0 +85,0 @@

{
"name": "directory-layout",
"version": "1.0.0",
"version": "1.0.1",
"description": "Verifies directory layout for existence of files and folders in specified positions",

@@ -8,4 +8,17 @@ "main": "lib/verify.js",

"license": "MIT",
"directories": {
"test": "test"
},
"bin": {
"verify": "bin/verify.js",
"generate": "bin/generate.js"
},
"repository": {
"type": "git",
"url": "https://github.com/ApoorvSaxena/grunt-directory-layout"
},
"dependencies": {
"bluebird": "^3.3.5",
"byline": "^4.2.1",
"commander": "^2.9.0",
"node-dir": "^0.1.11",

@@ -18,3 +31,10 @@ "underscore": "^1.8.3"

"test": "npm run test-layout-generator && npm run test-layout-verifier"
}
},
"keywords": [
"directory",
"layout",
"structure",
"test"
],
"readmeFilename": "README.md"
}

@@ -5,5 +5,5 @@ ### Directory Layout Verifier

Creation of directory structure is also automated, thus you don't need to create it by yourself. Checkout our tests folder for further understanding.
Creation of directory structure is also automated, checkout our [tests](https://github.com/ApoorvSaxena/directory-layout/tree/master/test) folder for further understanding.
We've used markdown syntax to store the directory structure, easy for you to verify visually (if possible).
We've used markdown syntax to store the directory structure, easy for you to verify visually. Here's an [example](https://raw.githubusercontent.com/ApoorvSaxena/directory-layout/master/test/output/layout.md).

@@ -17,8 +17,12 @@ ##### Usage:

LayoutGenerator.generate('test/fixtures/', {
output: './test/output/layout.md',
ignore: [
'.DS_Store'
]
});
LayoutGenerator
.generate('test/fixtures/', {
output: './test/output/layout.md',
ignore: [
'.DS_Store'
]
})
.then(function() {
console.log('Layout successfully generated');
});
```

@@ -31,5 +35,15 @@

LayoutVerifier.verify('test/output/layout.md', {
root: './test/fixtures'
});
LayoutVerifier
.verify('test/output/layout.md', {
root: './test/fixtures'
})
.then(function() {
console.log('Successfully resolved');
})
.catch(function(failures) {
console.log('Failures found at: ');
for (var i = 0; i < failures.length; i++) {
console.log("- " + failures[i]);
}
});
```

@@ -36,0 +50,0 @@

var LayoutGenerator = require('../lib/generate.js');
LayoutGenerator.generate('test/fixtures/', {
output: './test/output/layout.md',
ignore: [
'.DS_Store'
]
});
LayoutGenerator
.generate('test/fixtures/', {
output: './test/output/layout.md',
ignore: [
'.DS_Store'
]
})
.then(function() {
console.log('Layout successfully generated');
});
var LayoutVerifier = require('../lib/verify.js');
LayoutVerifier.verify('test/output/layout.md', {
root: './test/fixtures'
});
LayoutVerifier
.verify('test/output/layout.md', {
root: './test/fixtures'
})
.then(function() {
console.log('Successfully resolved');
})
.catch(function(failures) {
console.log('Failures found at: ');
for (var i = 0; i < failures.length; i++) {
console.log("- " + failures[i]);
}
});
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc