PKG_PATH, pkgPath

This commit is contained in:
Michael Bradley, Jr 2018-09-10 01:53:12 -05:00 committed by Pascal Precht
parent bcc7542f28
commit fd856f8163
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
2 changed files with 10 additions and 0 deletions

View File

@ -20,6 +20,11 @@ if (!process.env.EMBARK_PATH) {
process.env.EMBARK_PATH = utils.joinPath(__dirname, '..'); process.env.EMBARK_PATH = utils.joinPath(__dirname, '..');
} }
// set the anchor for embark's fs.pkgPath()
if (!process.env.PKG_PATH) {
process.env.PKG_PATH = process.env.PWD;
}
// NOTE: setting NODE_PATH at runtime won't effect lookup behavior in the // NOTE: setting NODE_PATH at runtime won't effect lookup behavior in the
// current process, but will take effect in child processes; this enables // current process, but will take effect in child processes; this enables
// lookup of *global* embark's own node_modules from within dapp scripts (such // lookup of *global* embark's own node_modules from within dapp scripts (such

View File

@ -106,6 +106,10 @@ function dappPath() {
return anchoredPath('DAPP_PATH', ...arguments); return anchoredPath('DAPP_PATH', ...arguments);
} }
function pkgPath() {
return anchoredPath('PKG_PATH', ...arguments);
}
function createWriteStream() { function createWriteStream() {
return fs.createWriteStream.apply(fs.createWriteStream, arguments); return fs.createWriteStream.apply(fs.createWriteStream, arguments);
} }
@ -156,6 +160,7 @@ module.exports = {
removeSync, removeSync,
embarkPath, embarkPath,
dappPath, dappPath,
pkgPath,
createWriteStream, createWriteStream,
tmpDir, tmpDir,
copyPreserve copyPreserve