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

Bundle Pure ESM Packages into /vendors/*.js as CommonJS #12217

Merged
merged 23 commits into from Feb 6, 2022

Conversation

sosukesuzuki
Copy link
Member

@sosukesuzuki sosukesuzuki commented Feb 3, 2022

Description

Bundles external Pure ESM Packages to CJS (#12209 (comment)).

See https://github.com/prettier/prettier/blob/b62b8e6d414d10b7cb37c343012a3a89a38aad8a/scripts/vendors/README.md for architecture.

In this PR, bundles following 3 packages:

  • string-width
  • globby(globby is replaced with fast-glob in our source code)
  • mem

Checklist

Try the playground for this PR

@fisker
Copy link
Member

fisker commented Feb 3, 2022

Can we do this in postinstall script?

@duailibe
Copy link
Member

duailibe commented Feb 3, 2022

Can we do this in postinstall script?

My 2 cents, I personally don't like putting stuff in postinstall

@sosukesuzuki sosukesuzuki force-pushed the esm-vendors branch 2 times, most recently from 460084c to 5a86d5f Compare February 4, 2022 04:05
@sosukesuzuki
Copy link
Member Author

We don't have many opportunities to run this script, so I don't think it's worth running it in postinstall. We can also set up a postinstall later if we feel it is necessary.

@sosukesuzuki sosukesuzuki marked this pull request as ready for review February 4, 2022 04:23

const changelogUnreleasedDir = fileURLToPath(
new URL("../changelog_unreleased", import.meta.url)
);

const files = globby.sync(["blog-post-intro.md", "*/*.md"], {
const files = globbySync(["blog-post-intro.md", "*/*.md"], {
Copy link
Member

Choose a reason for hiding this comment

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

Globby accepts URL as cwd now.

Copy link
Member

@fisker fisker Feb 4, 2022

Choose a reason for hiding this comment

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

Actually this file is the reason I propose sindresorhus/globby#176

@sosukesuzuki sosukesuzuki merged commit 0abd190 into prettier:main Feb 6, 2022
@sosukesuzuki sosukesuzuki deleted the esm-vendors branch February 6, 2022 08:31
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants