Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat!: new esm builds#2822

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
elylucasctfl wants to merge43 commits intomaster
base:master
Choose a base branch
Loading
fromnew-beta
Draft

feat!: new esm builds#2822

elylucasctfl wants to merge43 commits intomasterfromnew-beta

Conversation

@elylucasctfl
Copy link
Contributor

@elylucasctflelylucasctfl commentedNov 20, 2025
edited
Loading

This pull request introduces significant changes to the build system, package exports, and type exports for the Contentful Management API client. The main focus is on migrating the build process from Babel/Webpack to Rollup, modernizing the package structure for better compatibility with modern bundlers, and improving the type exports for easier consumption. There are also updates to CI/CD workflows and deprecation notices.

BREAKING CHANGE:

This is a breaking change and changes might need to be made to your project. See theMIGRATION.md guide for more info.

Build System and Packaging Modernization:

  • Migrated the build process from Babel/Webpack to Rollup, introducing a newrollup.config.js with configurations for ESM, CommonJS bundles, and type declarations. This change streamlines the build process and improves compatibility with modern JavaScript tooling.[1][2][3][4]
  • Updated thepackage.json to use the newexports field for conditional exports (ESM, CJS, and types), set the new entry points, and removed legacy build scripts and fields. The minimum Node.js version is now 20.[1][2][3]
  • Added new build dependencies for Rollup and related plugins, and removed Babel/Webpack-specific scripts.[1][2]

Type Exports and API Surface Improvements:

  • Promoted several types that were previously only available via deep imports (e.g.,AppActionCallResponse,CommentStatus,EntryReferenceProps,ActionType,ConstraintType,WebhookCallDetailsProps,WebhookCallOverviewProps,WebhookHealthProps) to be exported directly fromlib/export-types.ts, making them easier to import and improving DX.[1][2][3][4][5]
  • ExportedOptionalDefaults fromlib/plain/wrappers/wrap.ts in the main index, clarifying its intended usage as private and subject to change.[1][2]

Release and CI/CD Updates:

  • Updated the GitHub Actions workflow to allow releases from a new branch (refs/heads/new-beta), supporting an additional prerelease channel.[1][2]

Most Important Changes:

Build System and Packaging:

  • Migrated build process to Rollup with a newrollup.config.js, providing ESM, CJS, and type declaration outputs, and updated related scripts and dependencies inpackage.json.[1][2][3][4]
  • Modernizedpackage.json exports field for better bundler compatibility, updated entry points, and increased minimum Node.js version to 20.[1][2]

Type Exports and API Surface:

  • Promoted several types for direct export fromlib/export-types.ts, eliminating the need for deep imports and improving developer experience.[1][2][3][4][5]
  • ExportedOptionalDefaults in the main index and clarified its private usage in documentation.[1][2]

Deprecations and CI/CD:

  • Added a deprecation warning to thecreateClient method, guiding users towards newer alternatives.
  • Updated release workflow to support a new prerelease channel (new-beta).[1][2]

AppActionCall,
AppActionCallProps,
AppActionCallErrorProps,
AppActionCallResponse,// was previously deep imported in user_interface
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

exported a few types that weren't exported before but imported deeply in user_interface

PlainClientAPI,
AppKeyProps,
}from'../../lib/contentful-management'
}from'../../lib/index'
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

all these test changes were importing from the main index file instead of contentful-management, which was renamed to index.ts

importcommonjsfrom'@rollup/plugin-commonjs'
importjsonfrom'@rollup/plugin-json'
// import alias from '@rollup/plugin-alias'
// import terser from '@rollup/plugin-terser'
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

all the commented out code here was in support of creating the browser bundles, which I didn't do initially to save time, and I want to bring it up to the group if this is even worth keeping

types.d.ts Outdated
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

this file was how the types were exported before. It was included as a part of the bundle at the root and allowed imports from 'contentful-management/types'

}),
json(),
],
external:[/node_modules\/(?!tslib.*)/],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
external:[/node_modules\/(?!tslib.*)/],
external:['contentful-sdk-core','fast-copy','axios'],

Did this regex work for you? For me, they are not prefixed withnode_modules.

When going with a simple array, it works well for me.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

When used in conjunction with nodeResolve, this will make it so no packages in node_modules (except tslib) get included in the bundle. Good precaution in case we add a new dependency and we don't remember to update these arrays.

@axe312ger
Copy link
Collaborator

A few more things I found, and couldn't add a comment as review:

  • webpack config is still there, including some webpack related depdencies
  • .nvmrc is still on v18
  • you miss the updated SDK-Core beta in the package.json

@elylucasctflelylucasctfl changed the titlefeat: new esm buildsfeat!: new esm buildsDec 1, 2025
elylucasand others added17 commitsDecember 1, 2025 10:00
BREAKING CHANGE:This is a breaking change and changes might need to be made to your project. See the MIGRATION.md guide for more info.
Co-authored-by: Ely Lucas <ely.lucas@contentful.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@axe312geraxe312geraxe312ger left review comments

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@elylucasctfl@axe312ger@elylucas@whitelisab

[8]ページ先頭

©2009-2025 Movatter.jp