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

feat: provide cjs and esm builds #86

Merged
merged 2 commits into from
Sep 13, 2023
Merged

Conversation

felipebergamin
Copy link
Member

@felipebergamin felipebergamin commented Aug 30, 2023

Description

  • Changes library build process to include commonjs and esmodules builds under build/ directory.
  • Types are not dependent of the module system used, so they are generated only once under build/types.
  • Add exports entry to package.json pointing to the correct entry file depending on which module system is being used
  • Change all relative imports to include .js file extension, as required for esmodules
  • Changed build script to build both distributions in parallel
  • A package.json with "type": "commonjs" is required for commonjs distribution, so a script is invoked to create this file under build/cjs to make it work for cjs projects.

Related Issues

Progress

Pull request checklist

  • Tests: This PR includes tests for covering the features or bug fixes (if applicable).
  • Docs: This PR updates/creates the necessary documentation.
  • CI: Make sure your Pull Request passes all CI checks. If not, clarify the motif behind that and the action plan to solve it (may reference a ticket)

How to test it

Visual reference

yarn.lock Outdated Show resolved Hide resolved
DDDKnightmare
DDDKnightmare previously approved these changes Sep 1, 2023
- Provide cjs and esm distributions under build/(esm|cjs) dirs
- Generate .d.ts files under build/types
Base automatically changed from chore/update-apollo-libs to master September 13, 2023 11:18
@felipebergamin felipebergamin dismissed DDDKnightmare’s stale review September 13, 2023 11:18

The base branch was changed.

@felipebergamin felipebergamin merged commit 2d0e53f into master Sep 13, 2023
1 check passed
@felipebergamin felipebergamin deleted the feat/esm-and-cjs-builds branch September 13, 2023 16:53
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.

2 participants