@taole/deploy-helper 0.7.0 → 0.7.1

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.
Files changed (2) hide show
  1. package/lib/offlinePkg.mjs +18 -11
  2. package/package.json +1 -1
@@ -120,6 +120,7 @@ export async function syncApi(userDeployHelperConfig, mode, offlineConfig, packa
120
120
  }
121
121
 
122
122
  /**
123
+ * @deprecated 不再需要这个函数, 如果插件使用的是@taole/vite-plugin-dynamic-base, 则不需要这个函数
123
124
  * hack
124
125
  * 由于vite-plugin-dynamic-base插件和legacy插件同时使用, 生存的入口文件中代码有点问题,这里直接修改有问题的代码
125
126
  */
@@ -166,6 +167,11 @@ export function checkOfflinePkg(config) {
166
167
  const packageJson = getJsonConfig(config.workDir, "package.json");
167
168
  const userDeployHelperConfig = getUserDeployHelperConfig();
168
169
  const distPath = join(config.workDir, offlineConfig && offlineConfig.distDir ? offlineConfig.distDir : "dist");
170
+ const allDeps = {
171
+ ...packageJson.devDependencies,
172
+ ...packageJson.dependencies,
173
+ };
174
+ const useOldPDB = !!allDeps['vite-plugin-dynamic-base'];
169
175
 
170
176
  // 如果offlineConfig.remove为true,则不构建离线包
171
177
  const willRemovePkg = offlineConfig && offlineConfig.name && offlineConfig.remove === true && offlineConfig.skip !== true;
@@ -175,7 +181,9 @@ export function checkOfflinePkg(config) {
175
181
  canBuild: true,
176
182
  errorMsg: "",
177
183
  hookPostBuild: async () => {
178
- fixEntryHtml(config, offlineConfig);
184
+ if (useOldPDB) {
185
+ fixEntryHtml(config, offlineConfig);
186
+ }
179
187
  log(`开始删除离线包${offlineConfig.name}`);
180
188
  await syncApi(userDeployHelperConfig, config.mode, offlineConfig, null);
181
189
  }
@@ -194,13 +202,8 @@ export function checkOfflinePkg(config) {
194
202
  errorMsg = "啊没有package.json?";
195
203
  canBuildOfflinePkg = false;
196
204
  } else {
197
- // 暂时不检查这个
198
- const allDeps = {
199
- ...packageJson.devDependencies,
200
- ...packageJson.dependencies,
201
- };
202
- if (!allDeps['@vitejs/plugin-legacy'] || !allDeps['vite-plugin-dynamic-base']) {
203
- errorMsg = "检查到项目中未安装依赖@vitejs/plugin-legacy和vite-plugin-dynamic-base, 请先安装依赖并调整构建代码以支持离线化,相关文档:https://alidocs.dingtalk.com/i/nodes/ydxXB52LJqexwD71F9K5XNMrJqjMp697?doc_type=wiki_doc";
205
+ if (!allDeps['@vitejs/plugin-legacy'] || (!allDeps['vite-plugin-dynamic-base'] && !allDeps['@taole/vite-plugin-dynamic-base'])) {
206
+ errorMsg = "检查到项目中未安装依赖@vitejs/plugin-legacy和@taole/vite-plugin-dynamic-base, 请先安装依赖并调整构建代码以支持离线化,相关文档:https://alidocs.dingtalk.com/i/nodes/ydxXB52LJqexwD71F9K5XNMrJqjMp697?doc_type=wiki_doc";
204
207
  canBuildOfflinePkg = false;
205
208
  }
206
209
  }
@@ -223,7 +226,9 @@ export function checkOfflinePkg(config) {
223
226
  canBuild: true,
224
227
  errorMsg: "",
225
228
  hookPostBuild: async () => {
226
- fixEntryHtml(config, offlineConfig);
229
+ if (useOldPDB) {
230
+ fixEntryHtml(config, offlineConfig);
231
+ }
227
232
  }
228
233
  }
229
234
  }
@@ -234,9 +239,11 @@ export function checkOfflinePkg(config) {
234
239
  }
235
240
  }
236
241
  const hookPostBuild = async () => {
237
- if(!offlineConfig || !config) return;
242
+ if (!offlineConfig || !config) return;
238
243
  // 在构建完成后,执行一些操作
239
- fixEntryHtml(config, offlineConfig);
244
+ if (useOldPDB) {
245
+ fixEntryHtml(config, offlineConfig);
246
+ }
240
247
  // 开始进行打包流程
241
248
  const offlinePkgDir = join(config.workDir, "./offlinepkgDist");
242
249
  if (fs.existsSync(offlinePkgDir)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taole/deploy-helper",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "脚本部署工具,用于将项目部署到测试环境或生产环境",
5
5
  "main": "index.mjs",
6
6
  "type": "module",