adminforth 1.1.81 → 1.1.83

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.
@@ -28,6 +28,11 @@ const execAsync = promisify(exec);
28
28
  function hashify(obj) {
29
29
  return crypto.createHash('sha256').update(JSON.stringify(obj)).digest('hex');
30
30
  }
31
+ function notifyWatcherIssue(limit) {
32
+ console.log('Ran out of file handles after watching %s files.', limit);
33
+ console.log('Falling back to polling which uses more CPU.');
34
+ console.log('Run ulimit -n 10000 to increase the limit for open files.');
35
+ }
31
36
  class CodeInjector {
32
37
  cleanup() {
33
38
  console.log('Cleaning up...');
@@ -425,6 +430,7 @@ class CodeInjector {
425
430
  console.log(`File ${file} changed ${x}, preparing sources...`);
426
431
  yield this.prepareSources({ filesUpdated: [file.replace(spaPath + '/', '')] });
427
432
  }));
433
+ watcher.on('fallback', notifyWatcherIssue);
428
434
  this.allWatchers.push(watcher);
429
435
  });
430
436
  }
@@ -488,6 +494,7 @@ class CodeInjector {
488
494
  // for now do nothing
489
495
  }
490
496
  }));
497
+ watcher.on('fallback', notifyWatcherIssue);
491
498
  this.allWatchers.push(watcher);
492
499
  });
493
500
  }
@@ -14,7 +14,7 @@ export async function callApi({path, method, body=undefined} ) {
14
14
  },
15
15
  body: JSON.stringify(body),
16
16
  };
17
- const fullPath = `${import.meta.env.VITE_ADMINFORTH_PUBLIC_PATH || ''}${path}`;
17
+ const fullPath = `${import.meta.env.VUE_APP_ADMINFORTH_PUBLIC_PATH || ''}${path}`;
18
18
  const r = await fetch(fullPath, options);
19
19
  if (r.status == 401 ) {
20
20
  useUserStore().unauthorize();
@@ -2,6 +2,7 @@ import { fileURLToPath, URL } from 'node:url'
2
2
 
3
3
  import { defineConfig } from 'vite'
4
4
  import vue from '@vitejs/plugin-vue'
5
+ import { clear, error } from 'node:console';
5
6
 
6
7
 
7
8
  const customLogger = {
@@ -26,12 +27,18 @@ const customLogger = {
26
27
  clear() {
27
28
  console.clear();
28
29
  },
30
+ clearScreen() {
31
+ console.clear();
32
+ },
29
33
  hasWarned: false,
34
+ hasErrorLogged: (error: any): boolean => {
35
+ return false;
36
+ }
30
37
  };
31
38
 
32
39
  // https://vitejs.dev/config/
33
40
  export default defineConfig({
34
- base: process.env.VITE_ADMINFORTH_PUBLIC_PATH || '/',
41
+ base: process.env.VUE_APP_ADMINFORTH_PUBLIC_PATH || '/',
35
42
  server: {
36
43
  port: 5173,
37
44
  strictPort: true, // better predictability
package/index.ts CHANGED
@@ -706,7 +706,7 @@ class AdminForth implements AdminForthClass {
706
706
  pk: userRecord[userResource.columns.find((col) => col.primaryKey).name],
707
707
  username
708
708
  };
709
- const beforeLoginConfirmation = this.config.auth.beforeLoginConfirmation as BeforeLoginConfirmationFunction[];
709
+ const beforeLoginConfirmation = this.config.auth.beforeLoginConfirmation as (BeforeLoginConfirmationFunction[] | undefined);
710
710
  if (beforeLoginConfirmation?.length){
711
711
  for (const hook of beforeLoginConfirmation) {
712
712
  const resp = await hook({ userRecord:adminUser});
@@ -30,6 +30,12 @@ function hashify(obj) {
30
30
  ('sha256').update(JSON.stringify(obj)).digest('hex');
31
31
  }
32
32
 
33
+ function notifyWatcherIssue(limit) {
34
+ console.log('Ran out of file handles after watching %s files.', limit);
35
+ console.log('Falling back to polling which uses more CPU.');
36
+ console.log('Run ulimit -n 10000 to increase the limit for open files.');
37
+ }
38
+
33
39
  class CodeInjector implements CodeInjectorType {
34
40
 
35
41
  allWatchers = [];
@@ -490,6 +496,7 @@ async watchForReprepare({ verbose }) {
490
496
  await this.prepareSources({ filesUpdated: [file.replace(spaPath + '/', '')] });
491
497
  }
492
498
  )
499
+ watcher.on('fallback', notifyWatcherIssue);
493
500
  this.allWatchers.push(watcher);
494
501
  }
495
502
 
@@ -561,7 +568,10 @@ async watchForReprepare({ verbose }) {
561
568
  // for now do nothing
562
569
  }
563
570
  }
564
- )
571
+ );
572
+
573
+ watcher.on('fallback', notifyWatcherIssue);
574
+
565
575
  this.allWatchers.push(watcher);
566
576
  }
567
577
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.1.81",
3
+ "version": "1.1.83",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/spa/src/utils.ts CHANGED
@@ -14,7 +14,7 @@ export async function callApi({path, method, body=undefined} ) {
14
14
  },
15
15
  body: JSON.stringify(body),
16
16
  };
17
- const fullPath = `${import.meta.env.VITE_ADMINFORTH_PUBLIC_PATH || ''}${path}`;
17
+ const fullPath = `${import.meta.env.VUE_APP_ADMINFORTH_PUBLIC_PATH || ''}${path}`;
18
18
  const r = await fetch(fullPath, options);
19
19
  if (r.status == 401 ) {
20
20
  useUserStore().unauthorize();
@@ -2,6 +2,7 @@ import { fileURLToPath, URL } from 'node:url'
2
2
 
3
3
  import { defineConfig } from 'vite'
4
4
  import vue from '@vitejs/plugin-vue'
5
+ import { clear, error } from 'node:console';
5
6
 
6
7
 
7
8
  const customLogger = {
@@ -26,12 +27,18 @@ const customLogger = {
26
27
  clear() {
27
28
  console.clear();
28
29
  },
30
+ clearScreen() {
31
+ console.clear();
32
+ },
29
33
  hasWarned: false,
34
+ hasErrorLogged: (error: any): boolean => {
35
+ return false;
36
+ }
30
37
  };
31
38
 
32
39
  // https://vitejs.dev/config/
33
40
  export default defineConfig({
34
- base: process.env.VITE_ADMINFORTH_PUBLIC_PATH || '/',
41
+ base: process.env.VUE_APP_ADMINFORTH_PUBLIC_PATH || '/',
35
42
  server: {
36
43
  port: 5173,
37
44
  strictPort: true, // better predictability