`lerna create` <loc> misrecords subpackage location
See original GitHub issueGiven:
{
"version": "0.0.0",
"npmClient": "npm",
"packages": [
"apps/*",
"libs/*"
]
}
When I run lerna create pkg libs/pkg
, it creates the package at apps/pkg
, but still points to an erroneous location. This caused https://github.com/folke/vscode-monorepo-workspace/issues/34.
I later realized I could achieve the desired effect with lerna create pkg libs
, though this prevents you from easily creating a package whose name and directory are different.
Additionally, I didn’t receive an error saying the location was invalid, nor a warning indicating the package was put in the default location.
Expected Behavior
I would prefer if I run lerna create @ns/long-pack-name libs/short
for the package to be placed at libs/short
with name @ns/long-pack-name
. And if libs/short
didn’t match any package globs, I would prefer an error message.
If this doesn’t work for you, I would at least prefer an error to creating the package in a location I didn’t select.
Current Behavior
Currently, no errors are issued, the package is created in the wrong location, and the package isn’t correctly recorded, wherever that data is stored.
Context
This lerna.json is simplified from my setup—a multi-app deployment. I’m subdividing a rather big project into multiple subdirectories to streamline an infra-as-code ci/cd pipeline. I have discovered work arounds for what I need to do (lots of lerna bootstrap
), but I really just want a quick way to initialize new packages.
Your Environment
Executable | Version |
---|---|
lerna --version |
3.20.2 |
npm --version |
6.14.3 |
yarn --version |
no |
node --version |
13.10.1 |
OS | Version |
---|---|
NAME | VERSION |
macOS Sierra | 10.15.3 |
Issue Analytics
- State:
- Created 3 years ago
- Reactions:15
- Comments:6
Top GitHub Comments
It looks like the output folder will simply be the first blob in the
packages
array in yourlerna.json
.At first, my
lerna.json
was simply:And packages would only get placed directly under the
packages
folder, regardless of what path I passed to in[loc]
lerna create <name> [loc]
.Then, when my
lerna.json
was:Packages would only be placed in the
packages/apps
folder, even when I tried to create withlerna create <package-name> ./packages/libs/<package-name>
.Thanks for reporting this folks! We will gladly review PRs to improve this behaviour, I agree it seems to currently be unintuitive or broken in certain cases.
Additionally, I have opened an issue to track improvements to customizing
lerna create
more broadly here: #3444