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

chore: move project to ESM #2840

Merged
merged 16 commits into from
Aug 31, 2023
Merged

chore: move project to ESM #2840

merged 16 commits into from
Aug 31, 2023

Conversation

csouchet
Copy link
Member

@csouchet csouchet commented Aug 30, 2023

Instruct Node.js to consider .js file as ESM module.

The package.json file has its type set to "module" and it declares "exports". This can be useful when testing code using bpmn-visualization in a Node.js environment (for instance, bv-experimental-add-ons).
It's also marked as having no side effects ("sideEffects": false) to enable tools like webpack to better manage tree shaking.

Migrate configuration files to ESM. When possible, add typings to ease configuration change in IDE.

  • Configure tools to manage all specific JS/TS extensions.
  • The eslint configuration file is still using CommonJS because v8.48.0 doesn't support ESM. Add typings to ease configuration change in IDE.
  • jest configurations: they have not been migrated to ESM as it would require too much changes in custom setup scripts. This can be done later
  • postcss configuration still using CommonJS as the documentation only mention this "flavor"

Notes

This has been detected as mandatory to run Jest tests in a ESM context. See process-analytics/bv-experimental-add-ons#95 and process-analytics/bv-experimental-add-ons#96 for more details.

Resources

Side effects free:

Configuration of the tools

Resources about exports in package.json

See also process-analytics/bv-experimental-add-ons#99

@csouchet csouchet added the chore Build, CI/CD or repository tasks (issues/PR maintenance, environments, ...) label Aug 30, 2023
@github-actions
Copy link

github-actions bot commented Aug 30, 2023

♻️ PR Preview 35828c1 has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

@github-actions
Copy link

github-actions bot commented Aug 30, 2023

♻️ PR Preview 35828c1 has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

@csouchet csouchet force-pushed the configure_library_to_use_ESM branch from f6a2354 to dd08183 Compare August 30, 2023 14:21
@csouchet csouchet marked this pull request as ready for review August 30, 2023 15:21
@csouchet csouchet changed the title chore: configure the library to use ESM chore: configure the library to generate ESM bundle Aug 30, 2023
@tbouffard tbouffard marked this pull request as draft August 31, 2023 06:56
@tbouffard tbouffard changed the title chore: configure the library to generate ESM bundle chore: move project to ESM Aug 31, 2023
@sonarcloud
Copy link

sonarcloud bot commented Aug 31, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@csouchet csouchet marked this pull request as ready for review August 31, 2023 07:46
Copy link
Member

@tbouffard tbouffard left a comment

Choose a reason for hiding this comment

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

LGTM

@csouchet csouchet merged commit 9c1852d into master Aug 31, 2023
28 checks passed
@csouchet csouchet deleted the configure_library_to_use_ESM branch August 31, 2023 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Build, CI/CD or repository tasks (issues/PR maintenance, environments, ...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants