@travetto/manifest
Advanced tools
Comparing version 3.0.0-rc.7 to 3.0.0-rc.8
@@ -26,2 +26,19 @@ // @ts-check | ||
/** | ||
* Get module name from a given file | ||
* @param {string} file | ||
* @return {Promise<string|void>} | ||
*/ | ||
async function $getModuleFromFile(file) { | ||
let dir = path.dirname(file); | ||
let prev; | ||
while (dir !== prev && !(await fs.stat(path.resolve(dir, 'package.json')).catch(() => false))) { | ||
prev = dir; | ||
dir = path.dirname(dir); | ||
} | ||
try { | ||
return (await $getPkg(dir)).name; | ||
} catch { } | ||
} | ||
/** | ||
* Get workspace root | ||
@@ -64,2 +81,6 @@ * @return {Promise<string>} | ||
if (!folder && process.env.TRV_MODULE) { | ||
// If module is actually a file, try to detect | ||
if (/[.](t|j)s$/.test(process.env.TRV_MODULE)) { | ||
process.env.TRV_MODULE = await $getModuleFromFile(process.env.TRV_MODULE) ?? process.env.TRV_MODULE; | ||
} | ||
const req = createRequire(`${workspacePath}/node_modules`); | ||
@@ -66,0 +87,0 @@ try { |
{ | ||
"name": "@travetto/manifest", | ||
"version": "3.0.0-rc.7", | ||
"version": "3.0.0-rc.8", | ||
"description": "Manifest support", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
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
54102
1451
10