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

Add support for extendedPublishConfig, apply to workspace resolver #2146

Merged

Conversation

sgb-io
Copy link
Contributor

@sgb-io sgb-io commented Sep 16, 2022

Thanks @steveukx for providing prior art in git-js! My implementation is very similar, but I've come up with some alternative naming, let me know what you think.

  • Adds a script to the root which enables a extendedPublishConfig block in the package.json of any packages in the project. The idea is that we can make changes to the project before publishing, very similar to the native publishConfig option, however, is not restricted to what fields we can change.
  • All items in extendedPublishConfig will override fields of the same name at publish time
  • We also remove scripts, since they are useless in published packages. This isn't required to achieve the desired result here, but could help avoid confusion should a user attempt to use scripts in the wrong way
  • Applied extendedPublishConfig to the workspace resolver package. In this case, we have made the main and types fields change to the built versions at publish time.

The end result is that developers no longer need to build the workspace resolver package in local dev - the dependency can be imported right away, and the types just work.

@changeset-bot
Copy link

changeset-bot bot commented Sep 16, 2022

🦋 Changeset detected

Latest commit: 11b3d0c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@modular-scripts/workspace-resolver Patch
modular-scripts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

//
// It also removes `scripts` on the assumption none are needed when installing npm libraries.

const PACKAGES_TO_EXTEND = ['workspace-resolver'];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Technically this is directory names. I figured that having a hardcoded static list of packages to apply this to, is fine for the scope of this project.

@coveralls
Copy link
Collaborator

Coverage Status

Coverage increased (+0.1%) to 33.724% when pulling 11b3d0c on sgb-io:feat/use-workspace-resolver-without-build into 1287b1b on jpmorganchase:main.

@sgb-io sgb-io merged commit db7acd0 into jpmorganchase:main Sep 20, 2022
@sgb-io sgb-io deleted the feat/use-workspace-resolver-without-build branch September 20, 2022 11:36
This was referenced Sep 20, 2022
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.

3 participants