truffle-box
Advanced tools
Comparing version 1.0.30 to 1.0.31-ens.0
27
box.js
@@ -10,3 +10,9 @@ const utils = require("./lib/utils"); | ||
function parseSandboxOptions(options) { | ||
if (typeof options === "string") { | ||
if (typeof options === "function") { | ||
return { | ||
name: "default", | ||
unsafeCleanup: false, | ||
setGracefulCleanup: false | ||
}; | ||
} else if (typeof options === "string") { | ||
// back compatibility for when `options` used to be `name` | ||
@@ -95,3 +101,3 @@ return { | ||
// Cleanup temporary files even when an uncaught exception occurs | ||
sandbox: async options => { | ||
sandbox: (options, callback) => { | ||
const { name, unsafeCleanup, setGracefulCleanup } = parseSandboxOptions( | ||
@@ -101,2 +107,6 @@ options | ||
if (typeof options === "function") { | ||
callback = options; | ||
} | ||
if (setGracefulCleanup) { | ||
@@ -107,8 +117,15 @@ tmp.setGracefulCleanup(); | ||
const tmpDir = tmp.dirSync({ unsafeCleanup }); | ||
await Box.unbox( | ||
Box.unbox( | ||
`https://github.com/trufflesuite/truffle-init-${name}`, | ||
tmpDir.name, | ||
options | ||
); | ||
return Config.load(path.join(tmpDir.name, "truffle-config.js"), {}); | ||
) | ||
.then(() => { | ||
const config = Config.load( | ||
path.join(tmpDir.name, "truffle-config.js"), | ||
{} | ||
); | ||
callback(null, config); | ||
}) | ||
.catch(callback); | ||
} | ||
@@ -115,0 +132,0 @@ }; |
@@ -1,6 +0,8 @@ | ||
const fse = require("fs-extra"); | ||
var fs = require("fs-extra"); | ||
function setDefaults(config = {}) { | ||
const hooks = config.hooks || {}; | ||
function setDefaults(config) { | ||
config = config || {}; | ||
var hooks = config.hooks || {}; | ||
return { | ||
@@ -20,3 +22,3 @@ ignore: config.ignore || [], | ||
function read(path) { | ||
return fse | ||
return fs | ||
.readFile(path) | ||
@@ -29,4 +31,4 @@ .catch(() => "{}") | ||
module.exports = { | ||
read, | ||
setDefaults | ||
read: read, | ||
setDefaults: setDefaults | ||
}; |
{ | ||
"name": "truffle-box", | ||
"version": "1.0.30", | ||
"version": "1.0.31-ens.0", | ||
"description": "Truffle project boilerplate utility", | ||
@@ -29,3 +29,3 @@ "main": "box.js", | ||
"tmp": "0.0.33", | ||
"truffle-config": "^1.1.14", | ||
"truffle-config": "^1.1.15-ens.0", | ||
"vcsurl": "^0.1.1" | ||
@@ -36,3 +36,3 @@ }, | ||
}, | ||
"gitHead": "c074274b98f14f1a26bfd23a8c791a0d1548868c" | ||
"gitHead": "23d3748cc9b1acd1532c90e471d617e0827f4e56" | ||
} |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
0
23938
11
2
Updatedtruffle-config@^1.1.15-ens.0