@lerna/create
Advanced tools
Comparing version 6.3.1-beta.8 to 6.4.0
37
index.js
@@ -55,9 +55,15 @@ "use strict"; | ||
if (!name && pkgName.includes("/")) { | ||
throw new ValidationError( | ||
"ENOPKGNAME", | ||
"Invalid package name. Use the <loc> positional to specify package directory.\nSee https://github.com/lerna/lerna/tree/main/commands/create#usage for details." | ||
); | ||
} | ||
// optional scope is _not_ included in the directory name | ||
this.dirName = scope ? name.split("/").pop() : name; | ||
this.pkgName = name; | ||
this.pkgsDir = | ||
this.project.packageParentDirs.find((pd) => pd.indexOf(pkgLocation) > -1) || | ||
this.project.packageParentDirs[0]; | ||
this.pkgsDir = this._getPackagesDir(pkgLocation); | ||
this.camelName = camelCase(this.dirName); | ||
@@ -148,2 +154,27 @@ | ||
_getPackagesDir(pkgLocation) { | ||
const packageParentDirs = this.project.packageParentDirs; | ||
if (!pkgLocation) { | ||
return packageParentDirs[0]; | ||
} | ||
const normalizedPkgLocation = path | ||
.resolve(this.project.rootPath, path.normalize(pkgLocation)) | ||
.toLowerCase(); | ||
const packageParentDirsLower = packageParentDirs.map((p) => p.toLowerCase()); | ||
// using indexOf over includes due to platform differences (/private/tmp should match /tmp on macOS) | ||
const matchingPathIndex = packageParentDirsLower.findIndex((p) => p.indexOf(normalizedPkgLocation) > -1); | ||
if (matchingPathIndex > -1) { | ||
return packageParentDirs[matchingPathIndex]; | ||
} | ||
throw new ValidationError( | ||
"ENOPKGDIR", | ||
`Location "${pkgLocation}" is not configured as a workspace directory.` | ||
); | ||
} | ||
execute() { | ||
@@ -150,0 +181,0 @@ let chain = Promise.resolve(); |
{ | ||
"name": "@lerna/create", | ||
"version": "6.3.1-beta.8", | ||
"version": "6.4.0", | ||
"description": "Create a new lerna-managed package", | ||
@@ -36,6 +36,6 @@ "keywords": [ | ||
"dependencies": { | ||
"@lerna/child-process": "6.3.1-beta.8", | ||
"@lerna/command": "6.3.1-beta.8", | ||
"@lerna/npm-conf": "6.3.1-beta.8", | ||
"@lerna/validation-error": "6.3.1-beta.8", | ||
"@lerna/child-process": "6.4.0", | ||
"@lerna/command": "6.4.0", | ||
"@lerna/npm-conf": "6.4.0", | ||
"@lerna/validation-error": "6.4.0", | ||
"dedent": "^0.7.0", | ||
@@ -54,3 +54,3 @@ "fs-extra": "^9.1.0", | ||
}, | ||
"gitHead": "329eb99e3080cc4d5de53960a7d0421091b08782" | ||
"gitHead": "1053de382bac5c7a5ec1a54d493935eda75e0796" | ||
} |
@@ -18,4 +18,9 @@ # `@lerna/create` | ||
loc A custom package location, defaulting to the first configured package | ||
location [string] | ||
location. The location must match a configured packages directory. | ||
[string] | ||
``` | ||
**Note**: For more info on how Lerna package directories are configured, see https://lerna.js.org/docs/faq#how-does-lerna-detect-packages. | ||
``` | ||
Command Options: | ||
@@ -22,0 +27,0 @@ --access When using a scope, set publishConfig.access value |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
28759
725
0
42
+ Added@lerna/child-process@6.4.0(transitive)
+ Added@lerna/command@6.4.0(transitive)
+ Added@lerna/npm-conf@6.4.0(transitive)
+ Added@lerna/package@6.4.0(transitive)
+ Added@lerna/package-graph@6.4.0(transitive)
+ Added@lerna/prerelease-id-from-version@6.4.0(transitive)
+ Added@lerna/project@6.4.0(transitive)
+ Added@lerna/validation-error@6.4.0(transitive)
+ Added@lerna/write-log-file@6.4.0(transitive)
- Removed@lerna/child-process@6.3.1-beta.8(transitive)
- Removed@lerna/command@6.3.1-beta.8(transitive)
- Removed@lerna/npm-conf@6.3.1-beta.8(transitive)
- Removed@lerna/package@6.3.1-beta.8(transitive)
- Removed@lerna/package-graph@6.3.1-beta.8(transitive)
- Removed@lerna/prerelease-id-from-version@6.3.1-beta.8(transitive)
- Removed@lerna/project@6.3.1-beta.8(transitive)
- Removed@lerna/validation-error@6.3.1-beta.8(transitive)
- Removed@lerna/write-log-file@6.3.1-beta.8(transitive)
Updated@lerna/child-process@6.4.0
Updated@lerna/command@6.4.0
Updated@lerna/npm-conf@6.4.0