adminforth 1.2.11 → 1.2.12

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.
@@ -359,9 +359,9 @@ class CodeInjector {
359
359
  /* customPackageLock */
360
360
  let usersLockHash = '';
361
361
  let usersLock = null;
362
+ let usersPackage = null;
362
363
  if ((_m = this.adminforth.config.customization) === null || _m === void 0 ? void 0 : _m.customComponentsDir) {
363
364
  const usersPackagePath = path.join(this.adminforth.config.customization.customComponentsDir, 'package.json');
364
- let usersPackage = null;
365
365
  try {
366
366
  usersPackage = JSON.parse(yield fs.promises.readFile(usersPackagePath, 'utf-8'));
367
367
  }
@@ -379,41 +379,41 @@ class CodeInjector {
379
379
  }
380
380
  usersLockHash = hashify(usersLock);
381
381
  }
382
- const iconPackagesNamesHash = hashify(iconPackageNames);
383
- const fullHash = `${spaLockHash}::${iconPackagesNamesHash}::${usersLockHash}`;
384
- const hashPath = path.join(CodeInjector.SPA_TMP_PATH, 'node_modules', '.adminforth_hash');
385
- try {
386
- const existingHash = yield fs.promises.readFile(hashPath, 'utf-8');
387
- if (existingHash === fullHash) {
388
- process.env.HEAVY_DEBUG && console.log(`🪲Hashes match, skipping npm ci/install, from file: ${existingHash}, actual: ${fullHash}`);
389
- return;
390
- }
391
- else {
392
- process.env.HEAVY_DEBUG && console.log(`🪲 Hashes do not match: from file: ${existingHash} actual: ${fullHash}, proceeding with npm ci/install`);
393
- }
394
- }
395
- catch (e) {
396
- // ignore
397
- process.env.HEAVY_DEBUG && console.log('🪲Hash file does not exist, proceeding with npm ci/install');
398
- }
399
- yield this.runNpmShell({ command: 'ci', cwd: CodeInjector.SPA_TMP_PATH });
400
- let customPackgeNames = [];
401
- if (usersPackage && usersLock) {
402
- customPackgeNames = [
403
- ...Object.keys(usersPackage.dependencies || []),
404
- ...Object.keys(usersPackage.devDependencies || [])
405
- ].reduce((acc, packageName) => {
406
- const version = usersLock.packages[`node_modules/${packageName}`].version;
407
- acc.push(`${packageName}@${version}`);
408
- return acc;
409
- }, []);
382
+ }
383
+ const iconPackagesNamesHash = hashify(iconPackageNames);
384
+ const fullHash = `${spaLockHash}::${iconPackagesNamesHash}::${usersLockHash}`;
385
+ const hashPath = path.join(CodeInjector.SPA_TMP_PATH, 'node_modules', '.adminforth_hash');
386
+ try {
387
+ const existingHash = yield fs.promises.readFile(hashPath, 'utf-8');
388
+ if (existingHash === fullHash) {
389
+ process.env.HEAVY_DEBUG && console.log(`🪲Hashes match, skipping npm ci/install, from file: ${existingHash}, actual: ${fullHash}`);
390
+ return;
410
391
  }
411
- if (iconPackageNames.length) {
412
- const npmInstallCommand = `install ${[...iconPackageNames, ...customPackgeNames].join(' ')}`;
413
- yield this.runNpmShell({ command: npmInstallCommand, cwd: CodeInjector.SPA_TMP_PATH });
392
+ else {
393
+ process.env.HEAVY_DEBUG && console.log(`🪲 Hashes do not match: from file: ${existingHash} actual: ${fullHash}, proceeding with npm ci/install`);
414
394
  }
415
- yield fs.promises.writeFile(hashPath, fullHash);
416
395
  }
396
+ catch (e) {
397
+ // ignore
398
+ process.env.HEAVY_DEBUG && console.log('🪲Hash file does not exist, proceeding with npm ci/install');
399
+ }
400
+ yield this.runNpmShell({ command: 'ci', cwd: CodeInjector.SPA_TMP_PATH });
401
+ let customPackgeNames = [];
402
+ if (usersPackage && usersLock) {
403
+ customPackgeNames = [
404
+ ...Object.keys(usersPackage.dependencies || []),
405
+ ...Object.keys(usersPackage.devDependencies || [])
406
+ ].reduce((acc, packageName) => {
407
+ const version = usersLock.packages[`node_modules/${packageName}`].version;
408
+ acc.push(`${packageName}@${version}`);
409
+ return acc;
410
+ }, []);
411
+ }
412
+ if (iconPackageNames.length) {
413
+ const npmInstallCommand = `install ${[...iconPackageNames, ...customPackgeNames].join(' ')}`;
414
+ yield this.runNpmShell({ command: npmInstallCommand, cwd: CodeInjector.SPA_TMP_PATH });
415
+ }
416
+ yield fs.promises.writeFile(hashPath, fullHash);
417
417
  });
418
418
  }
419
419
  watchForReprepare(_a) {
@@ -411,9 +411,10 @@ class CodeInjector implements ICodeInjector {
411
411
  /* customPackageLock */
412
412
  let usersLockHash = '';
413
413
  let usersLock = null;
414
+ let usersPackage = null;
415
+
414
416
  if (this.adminforth.config.customization?.customComponentsDir) {
415
417
  const usersPackagePath = path.join(this.adminforth.config.customization.customComponentsDir, 'package.json');
416
- let usersPackage = null;
417
418
  try {
418
419
  usersPackage = JSON.parse(await fs.promises.readFile(usersPackagePath, 'utf-8'));
419
420
  } catch (e) {
@@ -429,6 +430,7 @@ class CodeInjector implements ICodeInjector {
429
430
  }
430
431
  usersLockHash = hashify(usersLock);
431
432
  }
433
+ }
432
434
 
433
435
  const iconPackagesNamesHash = hashify(iconPackageNames);
434
436
 
@@ -470,9 +472,7 @@ class CodeInjector implements ICodeInjector {
470
472
  }
471
473
 
472
474
  await fs.promises.writeFile(hashPath, fullHash);
473
-
474
475
  }
475
- }
476
476
 
477
477
  async watchForReprepare({}) {
478
478
  const spaPath = path.join(ADMIN_FORTH_ABSOLUTE_PATH, 'spa');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.2.11",
3
+ "version": "1.2.12",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",