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(repo): QoL for subpaths script #4180

Merged
merged 3 commits into from
Sep 17, 2024
Merged

chore(repo): QoL for subpaths script #4180

merged 3 commits into from
Sep 17, 2024

Conversation

LekoArts
Copy link
Member

@LekoArts LekoArts commented Sep 17, 2024

Description

Follow-up to #4172 - this makes package.json#files the source of truth for the subpaths.mjs scripts.

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 17, 2024

🦋 Changeset detected

Latest commit: a04b670

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

* When you add an entry to the package.json "files" field, a subfolder will be automatically created with a package.json pointing to that file
*/

export const subpathNames = packageJson.files.filter(k => k !== 'dist');
Copy link
Member Author

Choose a reason for hiding this comment

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

Source of truth now:

"files": [
"dist",
"ar-SA",
"ca-ES",
"cs-CZ",
"da-DK",
"de-DE",
"el-GR",
"en-US",
"es-ES",
"fi-FI",
"fr-FR",
"he-IL",
"is-IS",
"it-IT",
"ja-JP",
"ko-KR",
"mn-MN",
"nb-NO",
"nl-NL",
"nl-BE",
"pl-PL",
"pt-BR",
"pt-PT",
"ro-RO",
"ru-RU",
"sk-SK",
"sv-SE",
"tr-TR",
"uk-UA",
"vi-VN",
"zh-CN",
"zh-TW",
"es-MX",
"bg-BG",
"th-TH",
"hu-HU",
"sr-RS",
"hr-HR"
],

* When you add an entry to the package.json "files" field, a subfolder will be automatically created with a package.json pointing to that file
*/

export const subpathNames = packageJson.files.filter(k => k !== 'dist');
Copy link
Member Author

@LekoArts LekoArts Sep 17, 2024

Choose a reason for hiding this comment

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

"files": [
"dist",
"internal",
"errors"
],

Previously it extracted the same from this:

"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"./internal": {
"import": {
"types": "./dist/internal.d.mts",
"default": "./dist/internal.mjs"
},
"require": {
"types": "./dist/internal.d.ts",
"default": "./dist/internal.js"
}
},
"./errors": {
"import": {
"types": "./dist/errors.d.mts",
"default": "./dist/errors.mjs"
},
"require": {
"types": "./dist/errors.d.ts",
"default": "./dist/errors.js"
}
},
"./package.json": "./package.json"
},

Copy link
Member

@tmilewski tmilewski left a comment

Choose a reason for hiding this comment

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

🔥

* When you add an entry to the package.json "files" field, a subfolder will be automatically created with a package.json pointing to that file
*/

export const subpathNames = packageJson.files.filter(k => !['dist', 'scripts', 'react'].includes(k));
Copy link
Member Author

Choose a reason for hiding this comment

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

scripts should be left alone, react is a barrel file so handled below

@LekoArts LekoArts merged commit a5a3f0d into main Sep 17, 2024
20 checks passed
@LekoArts LekoArts deleted the subpaths-qol branch September 17, 2024 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants