broccoli-static-compiler
Advanced tools
Comparing version 0.1.4 to 0.2.0
# master | ||
# 0.2.0 | ||
* Use `node-symlink-or-copy` to use symlinks instead of copying when possible (see | ||
[symlink-change.md](https://github.com/broccolijs/broccoli/blob/master/docs/symlink-change.md)) | ||
# 0.1.4 | ||
@@ -4,0 +9,0 @@ |
29
index.js
@@ -0,4 +1,6 @@ | ||
var fs = require('fs') | ||
var path = require('path') | ||
var mkdirp = require('mkdirp') | ||
var helpers = require('broccoli-kitchen-sink-helpers') | ||
var symlinkOrCopySync = require('symlink-or-copy').sync | ||
var Writer = require('broccoli-writer') | ||
@@ -19,6 +21,7 @@ | ||
return readTree(this.inputTree).then(function (srcDir) { | ||
var sourcePath = path.join(srcDir, self.options.srcDir) | ||
var destPath = path.join(destDir, self.options.destDir) | ||
if (self.options.files == null) { | ||
helpers.copyRecursivelySync( | ||
path.join(srcDir, self.options.srcDir), | ||
path.join(destDir, self.options.destDir)) | ||
self._copy(sourcePath, destPath) | ||
} else { | ||
@@ -32,6 +35,6 @@ var baseDir = path.join(srcDir, self.options.srcDir) | ||
for (var i = 0; i < files.length; i++) { | ||
mkdirp.sync(path.join(destDir, self.options.destDir, path.dirname(files[i]))) | ||
helpers.copyPreserveSync( | ||
path.join(srcDir, self.options.srcDir, files[i]), | ||
path.join(destDir, self.options.destDir, files[i])) | ||
var fileSourcePath = path.join(sourcePath, files[i]) | ||
var fileDestPath = path.join(destPath, files[i]) | ||
self._copy(fileSourcePath, fileDestPath) | ||
} | ||
@@ -41,1 +44,13 @@ } | ||
} | ||
StaticCompiler.prototype._copy = function (sourcePath, destPath) { | ||
if (destPath[destPath.length -1] === '/') { | ||
destPath = destPath.slice(0, -1) | ||
} | ||
var destDir = path.dirname(destPath) | ||
if (!fs.existsSync(destDir)) { | ||
mkdirp.sync(destDir) | ||
} | ||
symlinkOrCopySync(sourcePath, destPath) | ||
} |
{ | ||
"name": "broccoli-static-compiler", | ||
"description": "Broccoli compiler to copy static files", | ||
"version": "0.1.4", | ||
"version": "0.2.0", | ||
"author": "Jo Liss <joliss42@gmail.com>", | ||
@@ -17,6 +17,7 @@ "main": "index.js", | ||
"dependencies": { | ||
"mkdirp": "^0.3.5", | ||
"broccoli-kitchen-sink-helpers": "^0.2.5", | ||
"broccoli-writer": "^0.1.1", | ||
"broccoli-kitchen-sink-helpers": "^0.2.0" | ||
"mkdirp": "^0.5.0", | ||
"symlink-or-copy": "^1.0.0" | ||
} | ||
} |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
5820
46
4
1
+ Addedsymlink-or-copy@^1.0.0
+ Addedsymlink-or-copy@1.3.1(transitive)
- Removedmkdirp@0.3.5(transitive)
Updatedmkdirp@^0.5.0