broccoli-caching-writer
Advanced tools
Comparing version 0.2.2 to 0.3.0
24
index.js
var fs = require('fs'); | ||
var path = require('path'); | ||
var mkdirp = require('mkdirp') | ||
var walkSync = require('walk-sync'); | ||
var quickTemp = require('quick-temp') | ||
@@ -46,3 +47,3 @@ var Writer = require('broccoli-writer'); | ||
helpers.copyRecursivelySync(self.getCacheDir(), destDir); | ||
linkFromCache(self.getCacheDir(), destDir); | ||
}) | ||
@@ -62,2 +63,23 @@ }; | ||
function linkFromCache(srcDir, destDir) { | ||
var files = walkSync(srcDir); | ||
var length = files.length; | ||
var file; | ||
for (var i = 0; i < length; i++) { | ||
file = files[i]; | ||
var srcFile = path.join(srcDir, file); | ||
var stats = fs.statSync(srcFile); | ||
if (stats.isDirectory()) { continue; } | ||
if (!stats.isFile()) { throw new Error('Can not link non-file.'); } | ||
destFile = path.join(destDir, file); | ||
mkdirp.sync(path.dirname(destFile)); | ||
fs.linkSync(srcFile, destFile); | ||
} | ||
} | ||
function keysForTree (fullPath, options) { | ||
@@ -64,0 +86,0 @@ options = options || {} |
{ | ||
"name": "broccoli-caching-writer", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "Broccoli plugin that allows simple caching (while still allowing N:N) based on the input tree hash.", | ||
@@ -22,5 +22,5 @@ "main": "index.js", | ||
"broccoli-kitchen-sink-helpers": "~0.2.0", | ||
"rimraf": "~2.2.6", | ||
"mkdirp": "~0.4.0", | ||
"quick-temp": "~0.1.2" | ||
"quick-temp": "~0.1.2", | ||
"walk-sync": "~0.1.2" | ||
}, | ||
@@ -27,0 +27,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10687
236
+ Addedwalk-sync@~0.1.2
+ Addedwalk-sync@0.1.3(transitive)
- Removedrimraf@~2.2.6
- Removedrimraf@2.2.8(transitive)