New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lerna create
<loc> misrecords subpackage location
#2520
Comments
I also had the same problem |
run into the same problem |
It looks like the output folder will simply be the first blob in the At first, my
And packages would only get placed directly under the Then, when my
Packages would only be placed in the |
It may be worth noting that if you're using |
i looked at the command code. it's here lerna/commands/create/index.js Line 59 in 1c39987
this logic fails in lot of cases, this explains the reason why we are facing the issue.
this works because indexof logic is satisfied by apps, libs values for loc variable
this works because / in the packages is replaced by \ and when you use packages/apps it is compared against packages\apps from the lerna.json file and it fails. but when you use the value packages\apps it will work.
so you can use any of the above logics, removing indexof and using an exact string match (after removing wild cards and ignoring OS specific file Seperator ) would be a better implementation. Thanks |
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 |
Given:
When I run
lerna create pkg libs/pkg
, it creates the package atapps/pkg
, but still points to an erroneous location. This caused folke/vscode-monorepo-workspace#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 atlibs/short
with name@ns/long-pack-name
. And iflibs/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
lerna --version
npm --version
yarn --version
node --version
The text was updated successfully, but these errors were encountered: