bi-components-library 1.0.19 → 1.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bi-components-library",
3
3
  "private": false,
4
- "version": "1.0.19",
4
+ "version": "1.0.22",
5
5
  "type": "module",
6
6
  "description": "SealSeek BI 组件库 - 基于 Ant Design 的企业级 React 组件",
7
7
  "keywords": [
@@ -18,8 +18,7 @@
18
18
  "types": "./dist/index.d.ts",
19
19
  "files": [
20
20
  "dist",
21
- "README.md",
22
- "scripts"
21
+ "README.md"
23
22
  ],
24
23
  "exports": {
25
24
  ".": {
@@ -48,8 +47,7 @@
48
47
  "lint": "eslint .",
49
48
  "preview": "vite preview",
50
49
  "preview:demo": "vite preview --outDir dist-demo",
51
- "prepublishOnly": "npm run build",
52
- "postinstall": "node scripts/check-react-versions.cjs"
50
+ "prepublishOnly": "npm run build"
53
51
  },
54
52
  "devDependencies": {
55
53
  "@eslint/js": "^9.30.1",
@@ -1,74 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * 检查 React 和 React-DOM 版本是否一致
5
- * 如果不一致,提供修复建议
6
- */
7
-
8
- const fs = require('fs');
9
- const path = require('path');
10
-
11
- function findPackageJson(startPath) {
12
- let currentPath = startPath;
13
- while (currentPath !== path.dirname(currentPath)) {
14
- const packageJsonPath = path.join(currentPath, 'package.json');
15
- if (fs.existsSync(packageJsonPath)) {
16
- return packageJsonPath;
17
- }
18
- currentPath = path.dirname(currentPath);
19
- }
20
- return null;
21
- }
22
-
23
- function checkReactVersions() {
24
- try {
25
- // 查找项目根目录的 package.json
26
- const projectRoot = process.cwd();
27
- const packageJsonPath = findPackageJson(projectRoot);
28
-
29
- if (!packageJsonPath) {
30
- return; // 找不到 package.json,静默退出
31
- }
32
-
33
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
34
- const dependencies = { ...packageJson.dependencies, ...packageJson.devDependencies };
35
-
36
- const reactVersion = dependencies.react;
37
- const reactDomVersion = dependencies['react-dom'];
38
-
39
- // 如果两个版本都存在但不一致
40
- if (reactVersion && reactDomVersion && reactVersion !== reactDomVersion) {
41
- console.warn('\n⚠️ [bi-components-library] 检测到 React 版本不一致:');
42
- console.warn(` - react: ${reactVersion}`);
43
- console.warn(` - react-dom: ${reactDomVersion}`);
44
- console.warn('\n📝 解决方案:');
45
-
46
- // 检查是否使用 pnpm
47
- const isPnpm = fs.existsSync(path.join(path.dirname(packageJsonPath), 'pnpm-lock.yaml'));
48
-
49
- if (isPnpm) {
50
- console.warn(' 在 package.json 中添加 pnpm.overrides 配置:');
51
- console.warn(' {');
52
- console.warn(' "pnpm": {');
53
- console.warn(' "overrides": {');
54
- console.warn(` "react": "${reactDomVersion}",`);
55
- console.warn(` "react-dom": "${reactDomVersion}"`);
56
- console.warn(' }');
57
- console.warn(' }');
58
- console.warn(' }');
59
- console.warn('\n 然后运行: pnpm install\n');
60
- } else {
61
- console.warn(` 运行: npm install react@${reactDomVersion} react-dom@${reactDomVersion}`);
62
- console.warn(` 或: yarn add react@${reactDomVersion} react-dom@${reactDomVersion}\n`);
63
- }
64
- }
65
- } catch (error) {
66
- // 静默处理错误,不影响安装过程
67
- }
68
- }
69
-
70
- // 只在安装时运行,不在开发时运行
71
- if (process.env.npm_lifecycle_event === 'postinstall' || process.env.npm_lifecycle_event === 'install') {
72
- checkReactVersions();
73
- }
74
-