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

feat(create): support relative path from root as lerna create location #3478

Merged
merged 5 commits into from Jan 1, 2023

Conversation

fahslaj
Copy link
Contributor

@fahslaj fahslaj commented Dec 29, 2022

Description

Provides a few quality of life updates for the positional argument for lerna create:

  • Allows use of a path relative to the root of the project (./packages/apps)
  • Fixes issue matching with multi-segment paths (lerna create <loc> misrecords subpackage location #2520)
  • No longer fails to match with configured workspace directories due to case sensitivity.
  • Throws an explicit error when the location does not match a configured workspace directory. Previously, this would default to the first configured directory, which was misleading.
  • Throws an explicit error when the "name" argument is not valid and it appears to look like a path (has a / in it). The error hints that the positional should be used instead and links to the create docs.

This does not add support for providing the path and name in one argument.

This is because the name argument must be valid according to npm-package-arg (https://www.npmjs.com/package/npm-package-arg) and can include a npm scope.

For example:
Incorrect:

lerna create packages/apps/my-package
lerna create ./packages/apps/my-package

Correct:

lerna create my-package packages/apps
lerna create my-package ./packages/apps
lerna create my-package /projects/my-repository-absolute-path/packages/apps

Motivation and Context

#2520
#3444

How Has This Been Tested?

This has been tested manually and covered with many e2e tests.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (change that has absolutely no effect on users)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@fahslaj fahslaj changed the title feat(create): support relative path as lerna create location feat(create): support relative path from root as lerna create location Dec 29, 2022
@fahslaj fahslaj marked this pull request as ready for review December 29, 2022 19:27
@JamesHenry JamesHenry merged commit 82825ce into lerna:main Jan 1, 2023
@fahslaj fahslaj deleted the 2520-allow-relative-path branch January 1, 2023 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants