morghulis 1.0.49 → 1.0.50
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/dist/index.css +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/install-deps.cjs +89 -1
- package/package.json +2 -1
package/install-deps.cjs
CHANGED
@@ -43,7 +43,42 @@ function ensureElementPlusInstalled() {
|
|
43
43
|
|
44
44
|
// 如果已经安装了element-plus,则不需要再安装
|
45
45
|
if (deps['element-plus'] || devDeps['element-plus']) {
|
46
|
-
console.log('element-plus已经在package.json
|
46
|
+
console.log('element-plus已经在package.json中,现在添加类型声明');
|
47
|
+
|
48
|
+
// 检查是否有tsconfig.json,如果有则添加类型声明配置
|
49
|
+
const tsconfigPath = path.join(rootDir, 'tsconfig.json');
|
50
|
+
if (fs.existsSync(tsconfigPath)) {
|
51
|
+
try {
|
52
|
+
console.log('找到tsconfig.json,添加element-plus类型声明');
|
53
|
+
|
54
|
+
// 读取tsconfig.json
|
55
|
+
const tsconfig = JSON.parse(fs.readFileSync(tsconfigPath, 'utf8'));
|
56
|
+
|
57
|
+
// 修改compilerOptions.types,确保包含element-plus
|
58
|
+
if (!tsconfig.compilerOptions) {
|
59
|
+
tsconfig.compilerOptions = {};
|
60
|
+
}
|
61
|
+
|
62
|
+
if (!tsconfig.compilerOptions.types) {
|
63
|
+
tsconfig.compilerOptions.types = [];
|
64
|
+
}
|
65
|
+
|
66
|
+
// 如果没有element-plus,添加它
|
67
|
+
if (!tsconfig.compilerOptions.types.includes('element-plus')) {
|
68
|
+
tsconfig.compilerOptions.types.push('element-plus');
|
69
|
+
console.log('向tsconfig.json中添加element-plus类型');
|
70
|
+
|
71
|
+
// 写回文件
|
72
|
+
fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 2), 'utf8');
|
73
|
+
console.log('tsconfig.json已更新,添加了element-plus类型声明');
|
74
|
+
} else {
|
75
|
+
console.log('element-plus类型声明已存在于tsconfig.json中');
|
76
|
+
}
|
77
|
+
} catch (error) {
|
78
|
+
console.error('修改tsconfig.json时出错:', error.message);
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
47
82
|
return;
|
48
83
|
}
|
49
84
|
|
@@ -60,6 +95,38 @@ function ensureElementPlusInstalled() {
|
|
60
95
|
});
|
61
96
|
|
62
97
|
console.log('element-plus安装成功');
|
98
|
+
|
99
|
+
// 安装成功后,尝试配置tsconfig.json
|
100
|
+
const tsconfigPath = path.join(rootDir, 'tsconfig.json');
|
101
|
+
if (fs.existsSync(tsconfigPath)) {
|
102
|
+
try {
|
103
|
+
console.log('找到tsconfig.json,添加element-plus类型声明');
|
104
|
+
|
105
|
+
// 读取tsconfig.json
|
106
|
+
const tsconfig = JSON.parse(fs.readFileSync(tsconfigPath, 'utf8'));
|
107
|
+
|
108
|
+
// 修改compilerOptions.types,确保包含element-plus
|
109
|
+
if (!tsconfig.compilerOptions) {
|
110
|
+
tsconfig.compilerOptions = {};
|
111
|
+
}
|
112
|
+
|
113
|
+
if (!tsconfig.compilerOptions.types) {
|
114
|
+
tsconfig.compilerOptions.types = [];
|
115
|
+
}
|
116
|
+
|
117
|
+
// 如果没有element-plus,添加它
|
118
|
+
if (!tsconfig.compilerOptions.types.includes('element-plus')) {
|
119
|
+
tsconfig.compilerOptions.types.push('element-plus');
|
120
|
+
console.log('向tsconfig.json中添加element-plus类型');
|
121
|
+
|
122
|
+
// 写回文件
|
123
|
+
fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 2), 'utf8');
|
124
|
+
console.log('tsconfig.json已更新,添加了element-plus类型声明');
|
125
|
+
}
|
126
|
+
} catch (error) {
|
127
|
+
console.error('修改tsconfig.json时出错:', error.message);
|
128
|
+
}
|
129
|
+
}
|
63
130
|
} catch (npmError) {
|
64
131
|
console.error('npm安装失败,尝试使用yarn:', npmError.message);
|
65
132
|
// 如果npm不可用,尝试使用yarn
|
@@ -72,6 +139,27 @@ function ensureElementPlusInstalled() {
|
|
72
139
|
});
|
73
140
|
|
74
141
|
console.log('使用yarn安装element-plus成功');
|
142
|
+
|
143
|
+
// 配置tsconfig.json
|
144
|
+
const tsconfigPath = path.join(rootDir, 'tsconfig.json');
|
145
|
+
if (fs.existsSync(tsconfigPath)) {
|
146
|
+
try {
|
147
|
+
const tsconfig = JSON.parse(fs.readFileSync(tsconfigPath, 'utf8'));
|
148
|
+
if (!tsconfig.compilerOptions) {
|
149
|
+
tsconfig.compilerOptions = {};
|
150
|
+
}
|
151
|
+
if (!tsconfig.compilerOptions.types) {
|
152
|
+
tsconfig.compilerOptions.types = [];
|
153
|
+
}
|
154
|
+
if (!tsconfig.compilerOptions.types.includes('element-plus')) {
|
155
|
+
tsconfig.compilerOptions.types.push('element-plus');
|
156
|
+
fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 2), 'utf8');
|
157
|
+
console.log('tsconfig.json已更新,添加了element-plus类型声明');
|
158
|
+
}
|
159
|
+
} catch (error) {
|
160
|
+
console.error('修改tsconfig.json时出错:', error.message);
|
161
|
+
}
|
162
|
+
}
|
75
163
|
} catch (yarnError) {
|
76
164
|
console.error('yarn安装失败:', yarnError.message);
|
77
165
|
console.error('无法使用npm或yarn安装element-plus');
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "morghulis",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.50",
|
4
4
|
"description": "数据库模型",
|
5
5
|
"private": false,
|
6
6
|
"type": "module",
|
@@ -8,6 +8,7 @@
|
|
8
8
|
"module": "dist/index.js",
|
9
9
|
"types": "types/morghulis.d.ts",
|
10
10
|
"typings": "types/morghulis.d.ts",
|
11
|
+
"style": "dist/index.css",
|
11
12
|
"bin": {
|
12
13
|
"install-element-plus": "install-deps.cjs"
|
13
14
|
},
|