liferay-npm-build-tools-common
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -26,3 +26,3 @@ 'use strict'; | ||
if (info.dir != '') { | ||
if (_path2.default.basename(info.dir) != '') { | ||
mkdirp(info.dir); | ||
@@ -29,0 +29,0 @@ } |
@@ -24,6 +24,7 @@ 'use strict'; | ||
* @param {String} modulePath the relative or absolute path to a JS module file | ||
* @return {String} the full path to the package.json file | ||
* @return {String} the full path to the package.json file (with native path | ||
* separators) | ||
*/ | ||
function getPackageJsonPath(modulePath) { | ||
return getPackageDir(modulePath) + '/package.json'; | ||
return _path2.default.join(getPackageDir(modulePath), 'package.json'); | ||
} | ||
@@ -34,9 +35,11 @@ | ||
* @param {String} modulePath the relative or absolute path to a JS module file | ||
* @return {String} the full path to the package directory | ||
* @return {String} the full path to the package directory (with native path | ||
* separators) | ||
*/ | ||
function getPackageDir(modulePath) { | ||
var dir = packageDirCache[modulePath]; | ||
var absModulePath = _path2.default.resolve(modulePath); | ||
var dir = packageDirCache[absModulePath]; | ||
if (!dir) { | ||
dir = _path2.default.resolve(modulePath); | ||
dir = absModulePath; | ||
var found = false; | ||
@@ -46,3 +49,3 @@ | ||
try { | ||
_fs2.default.statSync('' + dir + _path2.default.sep + '/package.json'); | ||
_fs2.default.statSync(_path2.default.join(dir, 'package.json')); | ||
found = true; | ||
@@ -60,3 +63,3 @@ } catch (err) { | ||
packageDirCache[modulePath] = dir; | ||
packageDirCache[absModulePath] = dir; | ||
} | ||
@@ -63,0 +66,0 @@ |
{ | ||
"name": "liferay-npm-build-tools-common", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Utility library for Liferay NPM Build Tools.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -12,3 +12,3 @@ import fs from 'fs'; | ||
if (info.dir != '') { | ||
if (path.basename(info.dir) != '') { | ||
mkdirp(info.dir); | ||
@@ -15,0 +15,0 @@ } |
@@ -9,6 +9,7 @@ import fs from 'fs'; | ||
* @param {String} modulePath the relative or absolute path to a JS module file | ||
* @return {String} the full path to the package.json file | ||
* @return {String} the full path to the package.json file (with native path | ||
* separators) | ||
*/ | ||
export function getPackageJsonPath(modulePath) { | ||
return `${getPackageDir(modulePath)}/package.json`; | ||
return path.join(getPackageDir(modulePath), 'package.json'); | ||
} | ||
@@ -19,9 +20,11 @@ | ||
* @param {String} modulePath the relative or absolute path to a JS module file | ||
* @return {String} the full path to the package directory | ||
* @return {String} the full path to the package directory (with native path | ||
* separators) | ||
*/ | ||
export function getPackageDir(modulePath) { | ||
let dir = packageDirCache[modulePath]; | ||
let absModulePath = path.resolve(modulePath); | ||
let dir = packageDirCache[absModulePath]; | ||
if (!dir) { | ||
dir = path.resolve(modulePath); | ||
dir = absModulePath; | ||
let found = false; | ||
@@ -31,3 +34,3 @@ | ||
try { | ||
fs.statSync(`${dir}${path.sep}/package.json`); | ||
fs.statSync(path.join(dir, 'package.json')); | ||
found = true; | ||
@@ -47,3 +50,3 @@ } catch (err) { | ||
packageDirCache[modulePath] = dir; | ||
packageDirCache[absModulePath] = dir; | ||
} | ||
@@ -50,0 +53,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
7851
8
139
1