Skip to content

Commit

Permalink
fix: replace babel-plugin-emotion with @emotion/babel-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel910 committed Feb 21, 2024
1 parent 82ee9e6 commit 59165fa
Show file tree
Hide file tree
Showing 25 changed files with 152 additions and 174 deletions.
64 changes: 34 additions & 30 deletions jest.config.base.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { basename, join, dirname } = require("path");
const fs = require("fs");
const merge = require("merge");
const merge = require("deepmerge");
const findUp = require("find-up");
const tsPreset = require("ts-jest/presets/js-with-babel/jest-preset");
const { version } = require("@webiny/cli/package.json");
Expand All @@ -16,36 +16,40 @@ module.exports = function ({ path }, presets = []) {

process.env.JEST_DYNALITE_CONFIG_DIRECTORY = path;

const merged = merge.recursive(true, { setupFilesAfterEnv: [] }, tsPreset, {
displayName: name,
modulePaths: [`${path}/src`],
testMatch: [`${path}/**/*${type}.test.[jt]s?(x)`],
transform: {
"^.+\\.[jt]sx?$": [
"ts-jest",
{
isolatedModules: true,
babelConfig: `${path}/.babelrc.js`,
diagnostics: false
}
]
},
transformIgnorePatterns: ["/node_modules/(?!(nanoid)/)"],
moduleDirectories: ["node_modules"],
moduleNameMapper: {
"~tests/(.*)": `${path}/__tests__/$1`,
"~/(.*)": `${path}/src/$1`
},
modulePathIgnorePatterns: [
"<rootDir>/.verdaccio",
"<rootDir>/.webiny",
"<rootDir>/apps",
"<rootDir>/packages/.*/dist"
],
globals: {
WEBINY_VERSION: version
const merged = merge.all([
{ setupFilesAfterEnv: [] },
tsPreset,
{
displayName: name,
modulePaths: [`${path}/src`],
testMatch: [`${path}/**/*${type}.test.[jt]s?(x)`],
transform: {
"^.+\\.[jt]sx?$": [
"ts-jest",
{
isolatedModules: true,
babelConfig: `${path}/.babelrc.js`,
diagnostics: false
}
]
},
transformIgnorePatterns: ["/node_modules/(?!(nanoid)/)"],
moduleDirectories: ["node_modules"],
moduleNameMapper: {
"~tests/(.*)": `${path}/__tests__/$1`,
"~/(.*)": `${path}/src/$1`
},
modulePathIgnorePatterns: [
"<rootDir>/.verdaccio",
"<rootDir>/.webiny",
"<rootDir>/apps",
"<rootDir>/packages/.*/dist"
],
globals: {
WEBINY_VERSION: version
}
}
});
]);

merged.setupFiles = [
...(merged.setupFiles || []),
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"babel-plugin-module-resolver": "^5.0.0",
"chalk": "^4.1.0",
"cross-env": "^5.2.0",
"deepmerge": "^4.3.1",
"env-ci": "2.0.1",
"eslint": "^8.56.0",
"eslint-config-standard": "^16.0.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-admin-rmwc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@emotion/babel-plugin": "^11.11.0",
"@types/react-helmet": "^6.1.5",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"babel-plugin-emotion": "^9.2.8",
"babel-plugin-named-asset-import": "^1.0.0-next.3e165448",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@emotion/babel-plugin": "^11.11.0",
"@types/bytes": "^3.1.1",
"@types/graphlib": "^2.1.8",
"@types/is-hotkey": "^0.1.7",
"@types/store": "^2.0.2",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"babel-plugin-emotion": "^9.2.8",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
"typescript": "4.7.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/app-apw/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@emotion/babel-plugin": "^11.11.0",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"babel-plugin-emotion": "^9.2.8",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
"typescript": "4.7.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/app-form-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@emotion/babel-plugin": "^11.11.0",
"@types/gtag.js": "^0.0.12",
"@types/json2csv": "^4.5.1",
"@types/react-google-recaptcha": "^1.1.2",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"babel-plugin-emotion": "^9.2.8",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
"typescript": "4.7.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/app-graphql-playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@emotion/babel-plugin": "^11.11.0",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"babel-plugin-emotion": "^9.2.8",
"rimraf": "^5.0.5",
"typescript": "4.7.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/app-headless-cms-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@emotion/babel-plugin": "^11.11.0",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"babel-plugin-emotion": "^9.2.8",
"babel-plugin-module-resolver": "^5.0.0",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-headless-cms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@emotion/babel-plugin": "^11.11.0",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"babel-plugin-emotion": "^9.2.8",
"babel-plugin-module-resolver": "^5.0.0",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-i18n-content/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@emotion/babel-plugin": "^11.11.0",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"babel-plugin-emotion": "^9.2.8",
"rimraf": "^5.0.5",
"typescript": "4.7.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/app-i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@emotion/babel-plugin": "^11.11.0",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"babel-plugin-emotion": "^9.2.8",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
"typescript": "4.7.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/app-mailer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@emotion/babel-plugin": "^11.11.0",
"@types/react": "17.0.39",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"babel-plugin-emotion": "^9.2.8",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
"typescript": "4.7.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/app-page-builder-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@emotion/babel-plugin": "^11.11.0",
"@types/medium-editor": "^5.0.3",
"@types/resize-observer-browser": "^0.1.4",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"babel-plugin-emotion": "^9.2.8",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
"typescript": "4.7.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/app-page-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@emotion/babel-plugin": "^11.11.0",
"@types/aos": "^3.0.4",
"@types/is-hotkey": "^0.1.7",
"@types/pako": "^2.0.3",
Expand All @@ -100,7 +101,6 @@
"@types/store": "^2.0.2",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"babel-plugin-emotion": "^9.2.8",
"execa": "^5.0.0",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-security-access-management/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@emotion/babel-plugin": "^11.11.0",
"@types/react-helmet": "^6.1.5",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"babel-plugin-emotion": "^9.2.8",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
"typescript": "4.7.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/app-security/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@emotion/babel-plugin": "^11.11.0",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"babel-plugin-emotion": "^9.2.8",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
"typescript": "4.7.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/app-serverless-cms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@emotion/babel-plugin": "^11.11.0",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"babel-plugin-emotion": "^9.2.8",
"babel-plugin-named-asset-import": "^1.0.0-next.3e165448",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-tenancy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@emotion/babel-plugin": "^11.11.0",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"babel-plugin-emotion": "^9.2.8",
"rimraf": "^5.0.5",
"ttypescript": "^1.3.2",
"typescript": "4.7.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/app-tenant-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@emotion/babel-plugin": "^11.11.0",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"babel-plugin-emotion": "^9.2.8",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
"typescript": "4.7.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/app-theme-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@emotion/babel-plugin": "^11.11.0",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"babel-plugin-emotion": "^9.2.8",
"babel-plugin-named-asset-import": "^1.0.0-next.3e165448",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@emotion/babel-plugin": "^11.11.0",
"@types/react": "17.0.39",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"babel-plugin-emotion": "^9.2.8",
"execa": "^5.0.0",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = ({ path, esm }) => ({
useESModules: false
}
],
["babel-plugin-emotion", { autoLabel: true }],
["@emotion/babel-plugin", { autoLabel: "dev-only" }],
[
"@babel/plugin-proposal-object-rest-spread",
{
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@emotion/babel-plugin": "^11.11.0",
"@types/react": "17.0.39",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"babel-plugin-emotion": "^9.2.8",
"execa": "^5.0.0",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/preset-env": "^7.23.9",
"@babel/preset-typescript": "^7.23.3",
"@emotion/babel-plugin": "^11.11.0",
"@testing-library/react": "^12.1.2",
"@types/nprogress": "^0.2.0",
"@types/rc-tooltip": "^3.7.2",
Expand All @@ -85,7 +86,6 @@
"@webiny/project-utils": "0.0.0",
"@webiny/validation": "0.0.0",
"babel-loader": "9.1.2",
"babel-plugin-emotion": "^9.2.8",
"execa": "^5.0.0",
"jest-dom": "^3.0.0",
"ncp": "^2.0.0",
Expand Down
Loading

0 comments on commit 59165fa

Please sign in to comment.