Skip to content

Commit

Permalink
Merge pull request #4593 from easyops-cn/steve/v3-prepear-react-19
Browse files Browse the repository at this point in the history
Steve/v3-prepear-react-19
  • Loading branch information
weareoutman authored Jan 12, 2025
2 parents 74a5372 + 43aca44 commit c4f8dc4
Show file tree
Hide file tree
Showing 28 changed files with 1,487 additions and 1,549 deletions.
3 changes: 1 addition & 2 deletions bricks/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
"inputs": [
"prod",
"^prod",
"global",
"{workspaceRoot}/shared/common-bricks/common-bricks.json"
"global"
],
"outputs": [
"{projectRoot}/dist",
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.8"
services:
e2e:
image: cypress/included:13.14.2
image: cypress/included:13.15.2
working_dir: /app
volumes:
- '.:/app'
Expand Down
22 changes: 10 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,10 @@
"trailingComma": "es5"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/types": "^7.25.6",
"@babel/core": "^7.26.0",
"@babel/types": "^7.26.5",
"@cypress/browserify-preprocessor": "^3.0.2",
"@next-core/brick-container": "*",
"@next-core/brick-playground": "*",
"@next-core/test-next": "*",
"@next-shared/common-bricks": "^0.53.1",
"@types/doctrine": "^0.0.9",
"@types/fs-extra": "^9.0.13",
"@types/history": "^4.7.11",
Expand All @@ -57,30 +55,30 @@
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"babel-jest": "^29.7.0",
"concurrently": "^9.0.1",
"concurrently": "^9.1.0",
"cross-env": "^7.0.3",
"cypress": "^13.14.2",
"cypress": "^13.15.2",
"eslint": "^8.57.1",
"eslint-plugin-react": "^7.36.1",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^4.6.2",
"husky": "^9.1.6",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-websocket-mock": "^2.5.0",
"lerna": "^8.1.8",
"lint-staged": "^15.2.10",
"prettier": "^3.3.3",
"prettier": "^3.4.2",
"rimraf": "^5.0.10",
"ts-jest-resolver": "^2.0.1",
"typescript": "^5.6.2"
"typescript": "^5.7.3"
},
"workspaces": [
"bricks/*",
"packages/*"
],
"resolutions": {
"@babel/parser": "^7.25.6",
"@babel/runtime": "^7.25.6",
"@babel/parser": "^7.26.5",
"@babel/runtime": "^7.26.0",
"@types/react": "^18.3.4",
"lodash": "^4.17.21",
"moment": "^2.30.1"
Expand Down
4 changes: 2 additions & 2 deletions packages/babel-preset-next/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = () => {
modules: false,
useBuiltIns: "entry",
corejs: {
version: "3.38",
version: "3.40",
},
},
],
Expand All @@ -49,7 +49,7 @@ module.exports = () => {
transformRuntime,
{
// https://github.com/babel/babel/issues/9454#issuecomment-460425922
version: "7.25.6",
version: "7.26.0",
},
],
],
Expand Down
12 changes: 6 additions & 6 deletions packages/babel-preset-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
},
"sideEffects": false,
"dependencies": {
"@babel/plugin-proposal-decorators": "^7.24.7",
"@babel/plugin-transform-runtime": "^7.25.4",
"@babel/preset-env": "^7.25.4",
"@babel/preset-react": "^7.24.7",
"@babel/preset-typescript": "^7.24.7",
"@babel/runtime": "^7.25.6"
"@babel/plugin-proposal-decorators": "^7.25.9",
"@babel/plugin-transform-runtime": "^7.25.9",
"@babel/preset-env": "^7.26.0",
"@babel/preset-react": "^7.26.3",
"@babel/preset-typescript": "^7.26.0",
"@babel/runtime": "^7.26.0"
}
}
8 changes: 4 additions & 4 deletions packages/brick-container/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"body-parser": "^1.20.3",
"chalk": "^4.1.2",
"chokidar": "^4.0.1",
"compression": "^1.7.4",
"express": "^4.21.0",
"compression": "^1.7.5",
"express": "^4.21.1",
"glob": "^8.1.0",
"http-proxy-middleware": "^3.0.3",
"js-yaml": "^3.14.1",
Expand All @@ -65,8 +65,8 @@
"@next-core/utils": "^1.7.28",
"broadcast-channel": "^7.0.0",
"copy-webpack-plugin": "^12.0.2",
"core-js": "^3.38.1",
"html-webpack-plugin": "^5.6.0",
"core-js": "^3.40.0",
"html-webpack-plugin": "^5.6.3",
"regenerator-runtime": "^0.14.1",
"webpack-dev-server": "^5.1.0"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/brick-playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"dependencies": {
"@next-core/doc-helpers": "^0.2.15",
"@next-core/serve-helpers": "^1.2.4",
"compression": "^1.7.4",
"express": "^4.21.0",
"compression": "^1.7.5",
"express": "^4.21.1",
"glob": "^8.1.0"
},
"devDependencies": {
Expand All @@ -35,7 +35,7 @@
"@next-core/preview": "^0.7.44",
"copy-to-clipboard": "^3.3.3",
"copy-webpack-plugin": "^12.0.2",
"html-webpack-plugin": "^5.6.0",
"html-webpack-plugin": "^5.6.3",
"monaco-editor": "^0.50.0",
"monaco-editor-webpack-plugin": "^7.1.0",
"webpack-dev-server": "^5.1.0"
Expand Down
2 changes: 2 additions & 0 deletions packages/build-next-bricks/bin/build-next-bricks.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ try {
console.error("Failed to build bricks:");
console.error(err || stats.toString());
} else {
console.log(stats.toString());
console.log("Build bricks done in watch mode");
}
});
Expand All @@ -93,6 +94,7 @@ try {
console.error("Failed to build bricks:");
reject(err || stats.toString());
} else {
console.log(stats.toString());
resolve();
}
});
Expand Down
19 changes: 11 additions & 8 deletions packages/build-next-bricks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"node": ">=16"
},
"dependencies": {
"@babel/parser": "^7.25.6",
"@babel/traverse": "^7.25.6",
"@babel/parser": "^7.26.5",
"@babel/traverse": "^7.26.5",
"@next-core/babel-preset-next": "^1.0.23",
"@svgr/webpack": "^8.1.0",
"babel-loader": "^9.2.1",
Expand All @@ -46,16 +46,19 @@
"less": "^4.2.0",
"less-loader": "^12.2.0",
"lodash": "^4.17.21",
"mini-css-extract-plugin": "^2.9.1",
"postcss": "^8.4.47",
"mini-css-extract-plugin": "^2.9.2",
"postcss": "^8.4.49",
"postcss-loader": "^8.1.1",
"postcss-preset-env": "^10.0.5",
"prettier": "^3.3.3",
"postcss-preset-env": "^10.1.3",
"prettier": "^3.4.2",
"style-loader": "^4.0.0",
"typescript": "^5.6.2",
"webpack": "^5.94.0"
"typescript": "^5.7.3",
"webpack": "^5.97.1"
},
"devDependencies": {
"@next-core/brick-manifest": "^0.7.1"
},
"peerDependencies": {
"@next-shared/common-bricks": "*"
}
}
31 changes: 9 additions & 22 deletions packages/build-next-bricks/src/build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import path from "node:path";
import { existsSync } from "node:fs";
import { readFile } from "node:fs/promises";
import { createRequire } from "node:module";
import webpack from "webpack";
Expand All @@ -8,6 +7,8 @@ import postcssPresetEnv from "postcss-preset-env";
import cssnano from "cssnano";
import cssnanoPresetLite from "cssnano-preset-lite";
import _ from "lodash";
import commonBricksJson from "@next-shared/common-bricks/common-bricks.json" assert { type: "json" };
import deprecatedBricksJson from "@next-shared/common-bricks/deprecated-bricks.json" assert { type: "json" };
import EmitBricksJsonPlugin from "./EmitBricksJsonPlugin.js";
import getCamelPackageName from "./getCamelPackageName.js";
import getSvgrLoaders from "./getSvgrLoaders.js";
Expand Down Expand Up @@ -74,25 +75,8 @@ async function getWebpackConfig(config) {

/** @type {string[]} */
let commonBricks;
const commonBricksJsonFile = path.join(
packageDir,
"../../shared/common-bricks/common-bricks.json"
);

const deprecatedBricksJsonFile = path.join(
packageDir,
"../../shared/common-bricks/deprecated-bricks.json"
);

const deprecatedBricksJson = existsSync(deprecatedBricksJsonFile)
? JSON.parse(await readFile(deprecatedBricksJsonFile, "utf-8"))
: {};

if (existsSync(commonBricksJsonFile)) {
const commonBricksJson = JSON.parse(
await readFile(commonBricksJsonFile, "utf-8")
);

if (commonBricksJson) {
/** @type {Map<string, string | string[]>} */
const commonBricksMap = new Map();
for (const [pkg, bricks] of Object.entries(commonBricksJson)) {
Expand Down Expand Up @@ -213,18 +197,21 @@ async function getWebpackConfig(config) {
packageJson.peerDependencies?.[dep] ??
packageJson.devDependencies?.[dep] ??
packageJson.dependencies?.[dep];
const singleton = sharedSingletonPackages.includes(dep);

return [
dep,
{
singleton: sharedSingletonPackages.includes(dep),
singleton,
version: depPackageJson.version,
requiredVersion:
getRequiredVersion(depPkgName) ??
// Use react required version for react-dom if it is not specified
(depPkgName === "react-dom"
? getRequiredVersion("react")
: undefined),
: singleton
? "*"
: undefined),
...customized,
},
];
Expand Down Expand Up @@ -265,7 +252,7 @@ async function getWebpackConfig(config) {
const invalidElements = _.difference(elements, commonBricks);
if (invalidElements.length > 0) {
throw new Error(
`Find common bricks in \`${packageName}\` which are not in common-bricks.json: ${invalidElements.join(
`Find common bricks in \`${packageName}\` which are not in @next-shared/common-bricks/common-bricks.json: ${invalidElements.join(
", "
)}`
);
Expand Down
4 changes: 2 additions & 2 deletions packages/build-next-libs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
},
"sideEffects": false,
"dependencies": {
"@babel/cli": "^7.25.6",
"@babel/core": "^7.25.2",
"@babel/cli": "^7.26.4",
"@babel/core": "^7.26.0",
"@next-core/babel-preset-next": "^1.0.23",
"execa": "^5.1.1",
"rimraf": "^5.0.10"
Expand Down
2 changes: 1 addition & 1 deletion packages/cook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
"sideEffects": false,
"dependencies": {
"@babel/parser": "^7.25.6"
"@babel/parser": "^7.26.5"
},
"devDependencies": {
"@next-core/build-next-libs": "^1.0.22",
Expand Down
4 changes: 2 additions & 2 deletions packages/create-api-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
"js-yaml": "^3.14.1",
"klaw-sync": "^6.0.0",
"meow": "^9.0.0",
"prettier": "^3.3.3",
"prettier": "^3.4.2",
"semver": "^7.6.3",
"tslib": "^2.7.0"
"tslib": "^2.8.1"
},
"devDependencies": {
"@next-core/build-next-libs": "^1.0.22",
Expand Down
2 changes: 1 addition & 1 deletion packages/doc-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
"@next-core/brick-manifest": "^0.7.1",
"fast-xml-parser": "^4.5.0",
"js-yaml": "^3.14.1",
"prettier": "^3.3.3"
"prettier": "^3.4.2"
}
}
2 changes: 1 addition & 1 deletion packages/eslint-config-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"peerDependencies": {
"@typescript-eslint/eslint-plugin": ">= 7.18.0",
"eslint": ">= 8.57.1",
"eslint-plugin-react": ">= 7.36.1",
"eslint-plugin-react": ">= 7.37.2",
"eslint-plugin-react-hooks": ">= 4.6.2"
},
"dependencies": {
Expand Down
14 changes: 11 additions & 3 deletions packages/i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,19 @@
"@next-core/types": "^1.14.0",
"@next-core/utils": "^1.7.28",
"i18next": "^22.5.1",
"i18next-browser-languagedetector": "^7.2.1",
"react-i18next": "^12.3.1"
"i18next-browser-languagedetector": "^7.2.2"
},
"devDependencies": {
"@next-core/build-next-libs": "^1.0.22",
"@next-core/test-next": "^1.1.7"
"@next-core/test-next": "^1.1.7",
"react-i18next": "^12.3.1"
},
"peerDependencies": {
"react-i18next": "^12.3.1"
},
"peerDependenciesMeta": {
"react-i18next": {
"optional": true
}
}
}
2 changes: 1 addition & 1 deletion packages/preview/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@next-core/theme": "^1.5.4",
"@next-core/types": "^1.14.0",
"@next-core/utils": "^1.7.28",
"html-webpack-plugin": "^5.6.0",
"html-webpack-plugin": "^5.6.3",
"js-yaml": "^3.14.1"
}
}
2 changes: 0 additions & 2 deletions packages/react-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@
"devDependencies": {
"@next-core/build-next-libs": "^1.0.22",
"@next-core/test-next": "^1.1.7",
"@testing-library/react": "^16.0.1",
"@testing-library/react-hooks": "^8.0.1",
"jest-fetch-mock": "^3.0.3"
}
}
Loading

0 comments on commit c4f8dc4

Please sign in to comment.