@shijiu/jsview 3.0.1-test.0 → 3.0.2-test.0

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@shijiu/jsview",
3
- "version": "3.0.1-test.0",
3
+ "version": "3.0.2-test.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "jsview-post-build": "./tools/jsview-post-build.mjs",
@@ -18,8 +18,8 @@ async function updateToFederationBase(options)
18
18
 
19
19
  const devDeps = '@originjs/vite-plugin-federation@1.3.4'
20
20
  Logger.Info('Installing ' + devDeps + ' ...');
21
- execCommand('npm install --save-dev ' + devDeps);
22
- execCommand('npm ci');
21
+ execCommand('npm install --force --save-dev ' + devDeps);
22
+ execCommand('npm ci --force');
23
23
  }
24
24
 
25
25
  function genFederationUrl(options)
@@ -170,11 +170,23 @@ function getPatchListRecursive(patchDir)
170
170
  return patchList;
171
171
  }
172
172
 
173
- function autoPatchPackages(options, pkgNeedPatchModules)
173
+ function autoPatchPackages(options, pkgNeedPatch)
174
174
  {
175
175
  const patchCacheDir = path.resolve(options.cacheJsViewDir, 'patches');
176
176
  fs.mkdirSync(patchCacheDir, { recursive: true, force: true });
177
- for (const file of pkgNeedPatchModules) {
177
+
178
+ const patchList = [...pkgNeedPatch.required];
179
+ console.log('pkgNeedPatch.optional', pkgNeedPatch.optional);
180
+ for (const [pkgName, file] of Object.entries(pkgNeedPatch.optional)) {
181
+ const pkgPath = path.resolve(options.modulesDir, pkgName);
182
+ console.log('pkgPath', pkgPath);
183
+ if(!fs.existsSync(pkgPath)) {
184
+ continue;
185
+ }
186
+ patchList.push(file);
187
+ }
188
+
189
+ for (const file of patchList) {
178
190
  if(file.endsWith('.patch') == false) {
179
191
  continue;
180
192
  }
@@ -231,7 +243,7 @@ async function printRevision(options)
231
243
  Logger.Info('**************************************************');
232
244
  }
233
245
 
234
- function doPostInstall(framework, pkgNeedPatches, skipCheckVersion, skipCheckNpmcmd)
246
+ function doPostInstall(framework, pkgNeedPatch, skipCheckVersion, skipCheckNpmcmd)
235
247
  {
236
248
  const options = getOptions(framework);
237
249
  options.projectDir = process.cwd();
@@ -259,7 +271,7 @@ function doPostInstall(framework, pkgNeedPatches, skipCheckVersion, skipCheckNpm
259
271
  checkNpmLinkForDebug(options, linkablePkgNames);
260
272
 
261
273
  Logger.Tip('Stage 2: Auto patching packages...');
262
- autoPatchPackages(options, pkgNeedPatches);
274
+ autoPatchPackages(options, pkgNeedPatch);
263
275
 
264
276
  printRevision(options);
265
277
  }
@@ -268,23 +280,28 @@ function main(argv)
268
280
  {
269
281
  checkNodeVersion();
270
282
 
271
- let pkgNeedPatches;
283
+ let pkgNeedPatch;
272
284
 
273
285
  switch (argv.framework) {
274
286
  case 'vue':
275
- pkgNeedPatches = [
276
- '@vitejs+plugin-vue+6.0.6.patch',
277
- '@vue+compiler-dom+3.6.0-beta.10.patch',
278
- '@vue+compiler-sfc+3.6.0-beta.10.patch',
279
- '@vue+runtime-core+3.6.0-beta.10.patch',
280
- '@vue+runtime-dom+3.6.0-beta.10.patch',
281
- 'postcss-js+5.1.0.patch',
282
- 'vite+8.0.9.patch',
283
- 'vue-router+5.0.6.patch',
284
- ]
287
+ pkgNeedPatch = {
288
+ required: [
289
+ '@vitejs+plugin-vue+6.0.6.patch',
290
+ '@vue+compiler-dom+3.6.0-beta.10.patch',
291
+ '@vue+compiler-sfc+3.6.0-beta.10.patch',
292
+ '@vue+runtime-core+3.6.0-beta.10.patch',
293
+ '@vue+runtime-dom+3.6.0-beta.10.patch',
294
+ 'postcss-js+5.1.0.patch',
295
+ 'vite+8.0.9.patch',
296
+ 'vue-router+5.0.6.patch',
297
+ ],
298
+ optional: {
299
+ '@originjs/vite-plugin-federation': '@originjs+vite-plugin-federation+1.3.4.patch',
300
+ }
301
+ }
285
302
  break;
286
303
  // case 'react':
287
- // pkgNeedPatches = [
304
+ // pkgNeedPatch = [
288
305
  // 'react-dev-utils',
289
306
  // 'react-dom',
290
307
  // 'react-scripts',
@@ -299,7 +316,7 @@ function main(argv)
299
316
  argv.skipCheckVersion = true;
300
317
  }
301
318
 
302
- doPostInstall(argv.framework, pkgNeedPatches, argv.skipCheckVersion, argv.skipCheckNpmcmd);
319
+ doPostInstall(argv.framework, pkgNeedPatch, argv.skipCheckVersion, argv.skipCheckNpmcmd);
303
320
  }
304
321
 
305
322
  const requiredUsages = {