Skip to content
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 <pkg> [loc], can use relative path to create package or warn right format #2980

Closed
boyan1010 opened this issue Aug 28, 2021 · 2 comments
Labels
community This is a good first issue for contributing type: bug

Comments

@boyan1010
Copy link

boyan1010 commented Aug 28, 2021

can use relative path to create package

When I read the lerna documentation for the first time, I thought loc should be a path. But the absolute path is too long, so I used a relative path. As a result, it will always be created in the fist package directory.

I have two packages directories in lerna.json :

"packages": [
    "apps/*",
    "libs/*"
  ],

Expected Behavior

when I run command lerna create core ./libs, I would want to create a new package in the libs/ directory.

Current Behavior

Using lerna create, the package keeps creating in apps/ directory.

before run command

├── apps/
└── libs/

run command lerna create core ./libs

├── apps/
 |  └── core/
 |     ├── __tests__/
 |     └── lib/
└── libs/

Possible Solution

Location current supports absolute path and packageName, I think it should support relative path too, eg lerna create core ./libs or warn right location format.

"packages": [
    "apps/*",
    "libs/*"
  ],

Your Environment

Executable Version
lerna --version 4.0.0
npm --version 7.21.1
yarn --version 1.22.10
node --version v16.8.0
OS Version
macOS Big Sur 11.2.3
@boyan1010 boyan1010 changed the title lerna create <pkg> [loc], loc can use relative path to create package or warn right format lerna create <pkg> [loc], can use relative path to create package or warn right format Aug 28, 2021
@JamesHenry
Copy link
Member

Hi @boyan1010 thank you for reporting this!

FYI it seems to work if the leading ./, i.e. in your case this works lerna create core libs

It should not be necessary to omit the leading ./ IMO so I have labelled this as a bug, and a PR would be welcome if you have time!

@JamesHenry JamesHenry added the community This is a good first issue for contributing label Nov 29, 2022
@JamesHenry
Copy link
Member

Actually there appears to be an older issue with much more engagement on it around this issue, so closing in favour of that one: #2520

@JamesHenry JamesHenry closed this as not planned Won't fix, can't repro, duplicate, stale Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community This is a good first issue for contributing type: bug
Projects
None yet
Development

No branches or pull requests

2 participants