@tunnckocore/utils
Advanced tools
Comparing version 0.5.3 to 0.6.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [0.6.0](https://github.com/tunnckoCore/opensource/compare/@tunnckocore/utils@0.5.3...@tunnckocore/utils@0.6.0) (2019-09-19) | ||
### Features | ||
* **utils:** rename props, provide packageRootPath ([f31e802](https://github.com/tunnckoCore/opensource/commit/f31e802)) | ||
## [0.5.3](https://github.com/tunnckoCore/opensource/compare/@tunnckocore/utils@0.5.2...@tunnckocore/utils@0.5.3) (2019-09-19) | ||
@@ -8,0 +19,0 @@ |
{ | ||
"version": "0.5.3", | ||
"version": "0.6.0", | ||
"name": "@tunnckocore/utils", | ||
@@ -38,3 +38,3 @@ "description": "Utility functions and helpers for internal usage and monorepos", | ||
], | ||
"gitHead": "292cfa46bdd66a7f544bde02fb18a4ef91b75a76" | ||
"gitHead": "8a0ca03bbc3ee827575d88353f0e89dbb5d70782" | ||
} |
@@ -82,9 +82,9 @@ const fs = require('fs'); | ||
const fromRoot = (...x) => path.resolve(cwd, ...x); | ||
const packagePath = fromRoot('package.json'); | ||
const lernaPath = fromRoot('lerna.json'); | ||
const pkg = parseJson(packagePath); | ||
const lerna = parseJson(lernaPath); | ||
const packageJsonPath = fromRoot('package.json'); | ||
const lernaJsonPath = fromRoot('lerna.json'); | ||
const packageJson = parseJson(packageJsonPath); | ||
const lernaJson = parseJson(lernaJsonPath); | ||
const workspaces = [] | ||
.concat(lerna.packages || (pkg.workspaces || [])) | ||
.concat(lernaJson.packages || (packageJson.workspaces || [])) | ||
.filter((x) => typeof x === 'string') | ||
@@ -95,3 +95,3 @@ .filter(Boolean) | ||
// console.log('workspaces', workspaces); | ||
let exts = [].concat(pkg.extensions).filter(Boolean); | ||
let exts = [].concat(packageJson.extensions).filter(Boolean); | ||
@@ -107,3 +107,15 @@ if (exts.length === 0) { | ||
return { workspaces, extensions, exts, lerna, lernaPath, pkg, packagePath }; | ||
const fpath = [lernaJsonPath, packageJsonPath].find((x) => fs.existsSync(x)); | ||
const packageRootPath = fpath ? path.dirname(fpath) : null; | ||
return { | ||
workspaces, | ||
extensions, | ||
exts, | ||
lernaJson, | ||
lernaJsonPath, | ||
packageJson, | ||
packageJsonPath, | ||
packageRootPath, | ||
}; | ||
} |
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
6180
100