Comparing version 0.0.1 to 0.0.2
85
index.js
@@ -1,10 +0,77 @@ | ||
{ | ||
"name": "darwin", | ||
"version": "0.0.1", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
}, | ||
"author": "", | ||
"license": "MIT" | ||
var p = require('path'); | ||
var fs = require('fs-extra'); | ||
var glob = require("globby"); | ||
var noisy = false; | ||
function darwin(base, files) { | ||
noisy && console.log('darwin', base, files && files.length); | ||
base = base || process.cwd(); | ||
files = files || []; | ||
this.cd = function(newbase) { | ||
noisy && console.log('base', newbase); | ||
return new darwin(p.resolve(base, newbase)); | ||
}; | ||
this.glob = function(pattern, options) { | ||
noisy && console.log('glob', base, pattern, options); | ||
options || (options = {}); | ||
options.cwd = base; | ||
files = glob.sync(pattern, options).map(function(file) { | ||
return new File(base, file); | ||
}); | ||
return new darwin(base, files); | ||
}; | ||
this.each = function(fn) { | ||
files.forEach(fn); | ||
return this; | ||
}; | ||
this.file = function(name) { | ||
return new File(base, name); | ||
}; | ||
this.get = function() { | ||
return files.length && files[0].get(); | ||
}; | ||
} | ||
function File(base, file) { | ||
var path = p.resolve(base, file); | ||
var content = null; | ||
this.name = function() { | ||
return file; | ||
}; | ||
this.get = function() { | ||
noisy && console.log(this.toString()); | ||
if (content == null) { | ||
content = fs.readFileSync(path, 'UTF-8'); | ||
} | ||
return content; | ||
}; | ||
this.set = function(str) { | ||
content = str; | ||
return this; | ||
}; | ||
this.write = function() { | ||
noisy && console.log(this.toString()); | ||
if (content != null) { | ||
fs.outputFileSync(path, content, 'UTF-8'); | ||
} | ||
}; | ||
this.toString = function() { | ||
return base + '+' + file + '=' + path; | ||
}; | ||
} | ||
module.exports = new darwin(); |
{ | ||
"name": "darwin", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "", | ||
"author": "Ali Shakiba", | ||
"keywords": [ | ||
"fs", | ||
"path", | ||
"glob", | ||
"math", | ||
"file", | ||
"directory", | ||
"select", | ||
"pipe", | ||
"build", | ||
"engine", | ||
"make", | ||
"generator", | ||
"template", | ||
"website", | ||
"static" | ||
], | ||
"license": "MIT", | ||
@@ -11,5 +28,7 @@ "repository": { | ||
}, | ||
"main": "index.js", | ||
"scripts": { | ||
"dependencies": { | ||
"fs-extra": "~0.13.0", | ||
"glob": "~4.3.4", | ||
"globby": "~1.1.0" | ||
} | ||
} |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
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
2163
60
0
3
1
+ Addedfs-extra@~0.13.0
+ Addedglob@~4.3.4
+ Addedglobby@~1.1.0
+ Addedarray-union@1.0.2(transitive)
+ Addedarray-uniq@1.0.3(transitive)
+ Addedasync@0.9.2(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedfs-extra@0.13.0(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedglob@4.3.57.2.3(transitive)
+ Addedglobby@1.1.0(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedjsonfile@2.4.0(transitive)
+ Addedminimatch@2.0.103.1.2(transitive)
+ Addedncp@1.0.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedrimraf@2.7.1(transitive)
+ Addedwrappy@1.0.2(transitive)