fixturify-project
Advanced tools
Comparing version 1.5.2 to 1.5.3
15
index.js
@@ -5,2 +5,4 @@ 'use strict'; | ||
const tmp = require('tmp'); | ||
const fs = require('fs'); | ||
tmp.setGracefulCleanup(); | ||
@@ -17,3 +19,3 @@ | ||
module.exports = class Project { | ||
constructor(name, version = '0.0.0') { | ||
constructor(name, version = '0.0.0', cb) { | ||
this.pkg = { | ||
@@ -35,6 +37,11 @@ name, | ||
this._tmp = tmp.dirSync({ unsafeCleanup: true }); | ||
this._root = fs.realpathSync(this._tmp.name); | ||
if (typeof cb === 'function') { | ||
cb(this); | ||
} | ||
} | ||
get root() { | ||
return this._tmp.name; | ||
return this._root; | ||
} | ||
@@ -59,2 +66,6 @@ | ||
static fromJSON(json, name) { | ||
if (json[name] === undefined) { | ||
throw new Error(`${name} was expected, but not found`); | ||
} | ||
let files = JSON.parse(JSON.stringify(json[name])); | ||
@@ -61,0 +72,0 @@ let pkg = JSON.parse(files['package.json']); |
{ | ||
"name": "fixturify-project", | ||
"version": "1.5.2", | ||
"version": "1.5.3", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:stefanpenner/node-fixturify-project", |
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
27010
435
6