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

Configure repository.directory for monorepo packages #471

Merged
merged 2 commits into from May 8, 2020

Conversation

jasonkarns
Copy link
Contributor

@jasonkarns jasonkarns commented May 6, 2020

Summary

Configure each package's package.json#repository.directory
property to properly reflect the location of the package within
the repository.

This is the standard configuration value for deep-linking into a
package's directory within a monorepo.

npm RFC: https://github.com/npm/rfcs/blob/latest/implemented/0010-monorepo-subdirectory-declaration.md

This will ensure the packages' pages on npmjs.org will link to the
correct directory.

Also, eventually, it will ensure the npm repo command opens to the
correct location: npm/cli#163

Lastly, this is required for monorepo packages to be successfully
published to the GitHub Package Registry (if that is ever considered in
the future).
https://help.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-npm-for-use-with-github-packages#publishing-multiple-packages-to-the-same-repository

Test plan

n/a

Issues

This is the standard configuration value for deep-linking into a
package's directory within a monorepo.

npm RFC: https://github.com/npm/rfcs/blob/latest/implemented/0010-monorepo-subdirectory-declaration.md

This will ensure the packages' pages on npmjs.org will link to the
correct directory.

Also, _eventually_, it will ensure the `npm repo` command opens to the
correct location: npm/cli#163

Lastly, this is _required_ for monorepo packages to be successfully
published to the GitHub Package Registry (if that is ever considered in
the future).
https://help.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-npm-for-use-with-github-packages#publishing-multiple-packages-to-the-same-repository
Copy link
Contributor

@mjc1283 mjc1283 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool, I didn't know this was being standardized!

@jasonkarns
Copy link
Contributor Author

@mjc1283 same! I only learned about it when I tried to publish our fork to github package registry. Since the package registry ties packages to a repo, having multiple packages published to a single repo is problematic. So they require this configuration to make it work (somehow). All the rest I only stumbled on afterwards!

(And it's a bummer that the npm CLI is still pending the PR to respect it. I use the npm repo command heavily and it's annoying that it doesn't yet work well with monorepos. 😞 )

@mjc1283 mjc1283 merged commit 990245f into optimizely:master May 8, 2020
@jasonkarns jasonkarns deleted the repository-directory branch May 8, 2020 20:08
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