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

fix(node-resolve): build before publishing for correct version #1063

Merged
merged 1 commit into from Jan 5, 2022

Conversation

lukastaegert
Copy link
Member

Rollup Plugin Name: node-resolve

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.

List any relevant issue numbers:

Description

Currently, the version embedded as version property into the plugin object is always one version behind. This should fix it by running another build immediately before the package is actually published (which happens after the version has been incremented).

@shellscape
Copy link
Collaborator

re: #1050 (comment)

Can we leave that dynamic at runtime? Or is making that part of the build a concern about running in the browser?

@lukastaegert
Copy link
Member Author

I do not think you can run this plugin in the browser anyway, so we could also do this dynamically. Will change it.

@lukastaegert lukastaegert force-pushed the node-resolve/correct-publish-version branch from f5f9ef2 to 6024772 Compare December 14, 2021 14:20
@lukastaegert lukastaegert force-pushed the node-resolve/correct-publish-version branch from 6024772 to c68c42b Compare December 14, 2021 14:20
@lukastaegert
Copy link
Member Author

Done

name: 'external-package-json',
resolveId(source) {
if (source.endsWith('package.json')) {
return { id: '../../package.json', external: true };
Copy link
Collaborator

Choose a reason for hiding this comment

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

for posterity we should add a comment for why it's looking in the parent-parent directory

@lukastaegert
Copy link
Member Author

Ah, just as I was thinking about this, there is actually a reason we cannot do it dynamically after all, otherwise the ESM build would be importing a JSON file, and that is not valid (well, you CAN import JSON from a module in latest Node, but you would need to use import assertions, and, ah well, not sure if I can pull this off easily without a big hack).
So I fear I would rather go back to adding prepublishOnly.

@lukastaegert lukastaegert force-pushed the node-resolve/correct-publish-version branch from c68c42b to 43dac73 Compare December 14, 2021 14:42
@lukastaegert lukastaegert force-pushed the node-resolve/correct-publish-version branch from 43dac73 to 1ce4b55 Compare December 14, 2021 14:46
@lukastaegert
Copy link
Member Author

Reverted it back

@shellscape shellscape merged commit d2c788c into master Jan 5, 2022
@shellscape shellscape deleted the node-resolve/correct-publish-version branch January 5, 2022 14:46
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