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

Convert scripts to ES modules #10834

Merged
merged 1 commit into from
Aug 27, 2024
Merged

Conversation

jonkoops
Copy link
Contributor

@jonkoops jonkoops commented Aug 3, 2024

Converts the various scripts in the repository to use the ES module syntax instead of CommonJS. This helps future proof these scripts and makes it more consistent with how the rest of the code is written.

This work also simplifies landing #10831, as it allows easy tracking of which files can be used with "type": "module". Subsequent work will also remove the .mjs extension in favor of using a 'plain' .js extension combined with "type": "module". At which point all remaining CommonJS modules will be given the .cjs extension to identify them, or by adding a package-level "type": "require".

@jonkoops jonkoops changed the base branch from main to v6 August 23, 2024 17:11
@jonkoops jonkoops force-pushed the esm-scripts branch 8 times, most recently from 6c9fed6 to 6028310 Compare August 24, 2024 15:32
@jonkoops
Copy link
Contributor Author

Marking this one as ready to be reviewed, the documentation is failing on CI as it needs the updated workflows, but since it is triggered from the target branch it doesn't pass. I've tested this locally, and it works, so the failure can be ignored.

@jonkoops jonkoops marked this pull request as ready for review August 24, 2024 15:42
@@ -62,7 +62,7 @@ runs:
- name: Run build
if: inputs.skip-build != 'true' && steps.cache-build.outputs.cache-hit != 'true'
shell: bash
run: yarn build && yarn build:umd
run: yarn build && yarn build:umd && yarn clean:exports
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This seems to be a regression that was introduced, this script was previously ran on CI and was lost in refactoring. I've restored it here, and I will create a patch to fix this for v5 as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this removal was actually intentional, as we now lo longer export our demo files in the top level index of react-core, which is what that clean:exports was fixing before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, it seems it was removed under #10114, but the script was left behind. I've pushed some changes to remove this script entirely.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file was orphaned, so I removed it.

Copy link
Contributor Author

@jonkoops jonkoops Aug 24, 2024

Choose a reason for hiding this comment

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

This file already exists as a .mjs variant, this was likely accidentally restored as part of a merge conflict, so I removed it.

@wise-king-sullyman wise-king-sullyman merged commit 35e789b into patternfly:v6 Aug 27, 2024
12 of 13 checks passed
@patternfly-build
Copy link
Contributor

Your changes have been released in:

Thanks for your contribution! 🎉

@jonkoops jonkoops deleted the esm-scripts branch August 27, 2024 20:14
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.

5 participants