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

fix(shared): Add missing entries to "files" array in package.json #4172

Merged
merged 2 commits into from
Sep 17, 2024

Conversation

LekoArts
Copy link
Member

@LekoArts LekoArts commented Sep 16, 2024

Description

The last couple of PRs merged did miss adding the new subpaths to the files array in package.json. The script that should have checked it miss it, it'll catch it now.

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Copy link

changeset-bot bot commented Sep 16, 2024

🦋 Changeset detected

Latest commit: 85124a3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 15 packages
Name Type
@clerk/shared Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/chrome-extension Patch
@clerk/clerk-js Patch
@clerk/elements Patch
@clerk/clerk-expo Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/clerk-react Patch
@clerk/remix Patch
@clerk/clerk-sdk-node Patch
@clerk/tanstack-start Patch
@clerk/testing Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment on lines +33 to +37

if (pkgFile.files.length !== allFilesNames.length) {
throw new Error('The package.json "files" array length does not match the subpaths.mjs');
}

Copy link
Member

Choose a reason for hiding this comment

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

❓ is this almost the same error as the one that exists right below?

Copy link
Member Author

Choose a reason for hiding this comment

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

The .every error won't fire if the length is not the same, so early return here and make the error clearer

Copy link
Member

Choose a reason for hiding this comment

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

We could merge these 2 checks and throw a single error if any of these checks fail.

@@ -1,5 +1,5 @@
// This file is a helper for the "subpath-workaround.mjs" script
// We have to polyfill our "exports" subpaths :cry:
// When adding an entry to "subpathNames" also add it to "files" in package.json

export const subpathNames = [
Copy link
Member

Choose a reason for hiding this comment

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

Can't we just replace this with package.files ? In order to use package.json as the source of truth ?

Copy link
Member Author

Choose a reason for hiding this comment

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

The files array contains directories (like dist, scripts, react) that need special handling and/or shouldn't get subdirectories created. So one way or another you'd need to add special handling. I can adjust the logic in another PR probably so that files array is the source of truth

@LekoArts LekoArts merged commit 3743eb9 into main Sep 17, 2024
23 checks passed
@LekoArts LekoArts deleted the fix-shared-files-array branch September 17, 2024 06:43
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.

4 participants