Socket
Socket
Sign inDemoInstall

denim

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

denim - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

7

HISTORY.md
History
=======
## 0.1.1
* Fix bug wherein `gitignore-parser` did not correctly match `.gitignore` glob
patterns like `git` actually does. Switch to `parse-gitignore` library and
add regression tests.
[#9](https://github.com/FormidableLabs/denim/issues/9)
## 0.1.0

@@ -5,0 +12,0 @@

24

lib/templates.js

@@ -7,3 +7,4 @@ "use strict";

var fs = require("fs-extra");
var ignoreParser = require("gitignore-parser");
var ignoreParser = require("parse-gitignore");
var mm = require("micromatch");
var isBinaryFile = require("isbinaryfile");

@@ -278,4 +279,12 @@ var fileType = require("file-type");

// Read source gitignore from templated or real filename.
fs.readFile(ignoreFile.path, cb);
// Read source gitignore from templated or real filename into parser. (SYNC).
var ignoreGlobs;
var loadErr;
try {
ignoreGlobs = ignoreParser(ignoreFile.path);
} catch (err) {
loadErr = err;
}
cb(loadErr, ignoreGlobs);
}],

@@ -288,4 +297,4 @@

// Get ignore filter (if any).
var ignoreSrc = (results.loadIgnore || "").toString();
if (!ignoreSrc) {
var ignoreGlobs = results.loadIgnore;
if (!ignoreGlobs) {
return void cb(null, results.walkTemplates);

@@ -295,3 +304,2 @@ }

// Have ignores. Process and filter.
var gitignore = ignoreParser.compile(ignoreSrc);
var filtered = results.walkTemplates.filter(function (stat) {

@@ -302,6 +310,6 @@ // Get relative, resolved path.

// Default include algorithm.
var isIncluded = gitignore.accepts(relPath);
var isIgnored = mm.any(relPath, ignoreGlobs);
// Push to overridable filter function.
return templatesFilter(relPath, isIncluded);
return templatesFilter(relPath, !isIgnored);
});

@@ -308,0 +316,0 @@

{
"name": "denim",
"version": "0.1.0",
"version": "0.1.1",
"description": "A lightweight, npm-based template engine.",

@@ -34,7 +34,8 @@ "repository": {

"fs-extra": "^0.30.0",
"gitignore-parser": "0.0.2",
"inquirer": "^0.11.1",
"isbinaryfile": "^3.0.0",
"lodash": "^4.17.2",
"micromatch": "^2.3.11",
"nopt": "^3.0.6",
"parse-gitignore": "^0.3.1",
"tar": "^2.2.1",

@@ -41,0 +42,0 @@ "temp": "^0.8.3"

@@ -197,2 +197,34 @@ "use strict";

// Correctly applies git ignore rules.
// Bug: https://github.com/FormidableLabs/denim/issues/9
it("allows npmignore, npmrc when npm is in gitignore", stdioWrap(function (done) {
var stubs = mockFlow({
"templates": {
".gitignore": ".npm\n",
".npmignore": "holla",
".npmrc": "// holla too",
".npm": {
"test.txt": "should be ignored"
}
}
});
// Note: These have to match prompt fields + `destination` in order.
stubs.prompt
.reset()
.onCall(0).yields("dest");
init({ argv: ["node", SCRIPT, "mock-module"] }, function (err) {
if (err) { return void done(err); }
expect(base.fileRead("dest/.gitignore")).to.contain(".npm");
expect(base.fileRead("dest/.npmignore")).to.contain("holla");
expect(base.fileRead("dest/.npmrc")).to.contain("holla");
expect(base.fileExists(".npm/test.txt")).to.be.false;
done();
});
}));
it("initializes a basic project", stdioWrap(function (done) {

@@ -199,0 +231,0 @@ var stubs = mockFlow({

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