morghulis 1.0.37 → 1.0.39

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/README.md CHANGED
@@ -12,7 +12,7 @@ npm install morghulis
12
12
  npm install element-plus
13
13
  ```
14
14
 
15
- > **注意**:Morghulis依赖Element Plus。从1.0.37版本开始,我们添加了自动安装机制,但如果您发现Element Plus组件无法使用,请手动安装element-plus。
15
+ > **注意**:Morghulis依赖Element Plus。从1.0.39版本开始,我们通过bundleDependencies方式打包Element Plus,不再使用postinstall脚本,解决了各种安装环境下的兼容性问题。如果您仍然发现Element Plus组件无法使用,请手动安装element-plus。
16
16
 
17
17
  ## 使用方法
18
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "morghulis",
3
- "version": "1.0.37",
3
+ "version": "1.0.39",
4
4
  "description": "数据库模型",
5
5
  "private": false,
6
6
  "type": "module",
@@ -8,8 +8,7 @@
8
8
  "module": "dist/index.js",
9
9
  "types": "dist/index.d.ts",
10
10
  "files": [
11
- "dist",
12
- "postinstall.js"
11
+ "dist"
13
12
  ],
14
13
  "scripts": {
15
14
  "dev": "vite",
@@ -19,8 +18,7 @@
19
18
  "type-check": "vue-tsc --build",
20
19
  "prepare": "npm run build",
21
20
  "prepublishOnly": "npm run build",
22
- "generate-types": "node build-typings.js",
23
- "postinstall": "node postinstall.js"
21
+ "generate-types": "node build-typings.js"
24
22
  },
25
23
  "dependencies": {
26
24
  "@fortawesome/fontawesome-svg-core": "^6.7.2",
package/postinstall.js DELETED
@@ -1,65 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- 'use strict';
4
-
5
- const { execSync } = require('child_process');
6
- const fs = require('fs');
7
- const path = require('path');
8
-
9
- /**
10
- * 确保element-plus被安装
11
- */
12
- function ensureElementPlusInstalled() {
13
- try {
14
- // 尝试找到最近的package.json
15
- let packagePath = findPackageJson(process.cwd());
16
- if (!packagePath) {
17
- console.log('未找到package.json文件,无法安装element-plus');
18
- return;
19
- }
20
-
21
- // 检查package.json中是否已经有element-plus
22
- const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
23
- const deps = packageJson.dependencies || {};
24
- const devDeps = packageJson.devDependencies || {};
25
-
26
- // 如果已经安装了element-plus,则不需要再安装
27
- if (deps['element-plus'] || devDeps['element-plus']) {
28
- console.log('element-plus已经安装,跳过安装步骤');
29
- return;
30
- }
31
-
32
- console.log('正在安装element-plus...');
33
-
34
- // 使用npm安装element-plus
35
- execSync('npm install element-plus@^2.9.7 --save', {
36
- stdio: 'inherit',
37
- cwd: path.dirname(packagePath)
38
- });
39
-
40
- console.log('element-plus安装成功');
41
- } catch (error) {
42
- console.error('安装element-plus时出错:', error.message);
43
- }
44
- }
45
-
46
- /**
47
- * 递归查找package.json文件
48
- */
49
- function findPackageJson(dir) {
50
- const packagePath = path.join(dir, 'package.json');
51
- if (fs.existsSync(packagePath)) {
52
- return packagePath;
53
- }
54
-
55
- const parentDir = path.dirname(dir);
56
- // 到达根目录,停止查找
57
- if (parentDir === dir) {
58
- return null;
59
- }
60
-
61
- return findPackageJson(parentDir);
62
- }
63
-
64
- // 执行安装
65
- ensureElementPlusInstalled();