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: simplify Babel configuration #10189

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
esmodules: true
}
}
],
'@babel/preset-typescript',
'@babel/preset-react'
],
plugins: [
['@babel/plugin-proposal-decorators', { legacy: true }],
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-object-rest-spread'
]
presets: ['@babel/preset-typescript', '@babel/preset-react'],
plugins: ['@babel/plugin-transform-modules-commonjs']
};
1 change: 0 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ module.exports = {
'^.+\\.svg$': 'jest-transform-stub'
},
setupFilesAfterEnv: ['<rootDir>/packages/testSetup.ts'],
transformIgnorePatterns: ['node_modules/(?!@patternfly|@novnc|@popperjs|lodash|monaco-editor|react-monaco-editor)'],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've removed transformIgnorePatterns as the default already excludes the node_modules directory. It doesn't seem that any of the listed dependencies need to be included, the tests work fine without. Aside from that this also improves the startup time for test execution by about 5 seconds on my machine.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm I'd tried removing that option before and run into issues because of imports that we did need to transform, but if we're not seeing problems related to that when the unit tests run maybe we've resolved that issue in other ways.

If so that's AWESOME, if not we can always revert this change if need be, it's not like it will impact consumers even if it doesn't work out.

testPathIgnorePatterns: ['<rootDir>/packages/react-integration/'],
coveragePathIgnorePatterns: ['/dist/'],
moduleNameMapper: {
Expand Down
22 changes: 8 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,10 @@
},
"homepage": "https://github.com/patternfly/patternfly-react#readme",
"devDependencies": {
"@babel/core": "^7.21.8",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.21.0",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
"@babel/plugin-proposal-private-methods": "^7.18.6",
"@babel/plugin-proposal-private-property-in-object": "^7.21.0",
"@babel/preset-env": "^7.21.5",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.21.5",
"@babel/core": "^7.24.3",
"@babel/plugin-transform-modules-commonjs": "^7.24.1",
"@babel/preset-react": "^7.24.1",
"@babel/preset-typescript": "^7.24.1",
"@octokit/rest": "^20.0.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
Expand All @@ -43,8 +37,7 @@
"@types/react-dom": "^18",
"@typescript-eslint/eslint-plugin": "^5.59.2",
"@typescript-eslint/parser": "^5.59.2",
"babel-jest": "^27.2.5",
"jest-transform-stub": "^2.0.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yarn moved some of these dependencies around for some reason, but they should all have still have the same version, so I left it as-is.

"babel-jest": "^29.7.0",
"concurrently": "^7.6.0",
"eslint": "^8.39.0",
"eslint-plugin-markdown": "^3.0.0",
Expand All @@ -56,6 +49,7 @@
"husky": "^4.3.0",
"jest": "27.2.5",
"jest-cli": "27.2.5",
"jest-transform-stub": "^2.0.0",
"lerna": "^7.1.5",
"lint-staged": "^14.0.0",
"mutation-observer": "^1.0.3",
Expand All @@ -64,9 +58,9 @@
"react": "^18",
"react-dom": "^18",
"surge": "^0.23.1",
"ts-node": "^10.9.1",
"ts-patch": "^2.1.0",
"typescript": "^4.7.4",
"ts-node": "^10.9.1"
"typescript": "^4.7.4"
},
"scripts": {
"build": "yarn clean && yarn build:generate && yarn build:esm && yarn build:cjs && yarn build:subpaths && yarn build:single:packages",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@patternfly/react-tokens": "^5.3.0-prerelease.2"
},
"devDependencies": {
"@patternfly/documentation-framework": "^5.0.15",
"@patternfly/documentation-framework": "^5.8.2",
"@patternfly/patternfly-a11y": "4.3.1",
"rimraf": "^2.6.3",
"shx": "^0.3.4"
Expand Down
Loading
Loading