adminforth 1.1.7 → 1.1.9
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.js +6 -3
- package/dist/modules/codeInjector.js +4 -11
- package/index.ts +7 -5
- package/modules/codeInjector.ts +5 -13
- package/package.json +1 -1
- package/types/AdminForthConfig.ts +4 -2
package/dist/index.js
CHANGED
|
@@ -67,11 +67,14 @@ class AdminForth {
|
|
|
67
67
|
if (!component) {
|
|
68
68
|
return component;
|
|
69
69
|
}
|
|
70
|
-
let obj
|
|
71
|
-
if (typeof
|
|
70
|
+
let obj;
|
|
71
|
+
if (typeof component === 'string') {
|
|
72
72
|
obj = { file: component, meta: {} };
|
|
73
73
|
}
|
|
74
|
-
|
|
74
|
+
else {
|
|
75
|
+
obj = component;
|
|
76
|
+
}
|
|
77
|
+
errors.push(...this.checkCustomFileExists(obj.file));
|
|
75
78
|
return obj;
|
|
76
79
|
}
|
|
77
80
|
validateConfig() {
|
|
@@ -41,18 +41,11 @@ class CodeInjector {
|
|
|
41
41
|
this.allComponentNames = {};
|
|
42
42
|
this.srcFoldersToSync = {};
|
|
43
43
|
this.adminforth = adminforth;
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
['SIGINT', 'SIGTERM', 'SIGQUIT']
|
|
45
|
+
.forEach(signal => process.on(signal, () => {
|
|
46
46
|
this.cleanup();
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
console.log('Received SIGTERM.');
|
|
50
|
-
this.cleanup();
|
|
51
|
-
});
|
|
52
|
-
process.on('exit', () => {
|
|
53
|
-
console.log('Exiting.');
|
|
54
|
-
this.cleanup();
|
|
55
|
-
});
|
|
47
|
+
process.exit();
|
|
48
|
+
}));
|
|
56
49
|
}
|
|
57
50
|
// async runShell({command, verbose = false}) {
|
|
58
51
|
// console.log(`⚙️ Running shell ${command}...`);
|
package/index.ts
CHANGED
|
@@ -9,7 +9,7 @@ import ExpressServer from './servers/express.js';
|
|
|
9
9
|
import {v1 as uuid} from 'uuid';
|
|
10
10
|
import fs from 'fs';
|
|
11
11
|
import { ADMINFORTH_VERSION } from './modules/utils.js';
|
|
12
|
-
import { AdminForthConfig, AdminForthClass, AdminForthComponentDeclaration,
|
|
12
|
+
import { AdminForthConfig, AdminForthClass, AdminForthComponentDeclaration, AdminForthComponentDeclarationFull,
|
|
13
13
|
AdminForthFilterOperators, AdminForthDataTypes, AdminForthResourcePages } from './types/AdminForthConfig.js';
|
|
14
14
|
import { getFunctionList } from './modules/utils.js';
|
|
15
15
|
import path from 'path';
|
|
@@ -87,11 +87,13 @@ class AdminForth implements AdminForthClass {
|
|
|
87
87
|
if (!component) {
|
|
88
88
|
return component;
|
|
89
89
|
}
|
|
90
|
-
let obj:
|
|
91
|
-
if (typeof
|
|
92
|
-
obj = { file: component, meta: {} }
|
|
90
|
+
let obj: AdminForthComponentDeclarationFull;
|
|
91
|
+
if (typeof component === 'string') {
|
|
92
|
+
obj = { file: component, meta: {} };
|
|
93
|
+
} else {
|
|
94
|
+
obj = component;
|
|
93
95
|
}
|
|
94
|
-
errors.push(...this.checkCustomFileExists(
|
|
96
|
+
errors.push(...this.checkCustomFileExists(obj.file));
|
|
95
97
|
|
|
96
98
|
return obj;
|
|
97
99
|
}
|
package/modules/codeInjector.ts
CHANGED
|
@@ -48,20 +48,12 @@ class CodeInjector implements CodeInjectorType {
|
|
|
48
48
|
constructor(adminforth) {
|
|
49
49
|
this.adminforth = adminforth;
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
process.on('SIGTERM', () => {
|
|
57
|
-
console.log('Received SIGTERM.');
|
|
58
|
-
this.cleanup();
|
|
59
|
-
});
|
|
51
|
+
['SIGINT', 'SIGTERM', 'SIGQUIT']
|
|
52
|
+
.forEach(signal => process.on(signal, () => {
|
|
53
|
+
this.cleanup();
|
|
54
|
+
process.exit();
|
|
55
|
+
}));
|
|
60
56
|
|
|
61
|
-
process.on('exit', () => {
|
|
62
|
-
console.log('Exiting.');
|
|
63
|
-
this.cleanup();
|
|
64
|
-
});
|
|
65
57
|
}
|
|
66
58
|
|
|
67
59
|
// async runShell({command, verbose = false}) {
|
package/package.json
CHANGED
|
@@ -802,7 +802,7 @@ export type ValidationObject = {
|
|
|
802
802
|
message: string,
|
|
803
803
|
}
|
|
804
804
|
|
|
805
|
-
export type
|
|
805
|
+
export type AdminForthComponentDeclarationFull = {
|
|
806
806
|
/**
|
|
807
807
|
* Path to custom component which will be used to render field in the admin panel.
|
|
808
808
|
* e.g. `@@/MyCustomComponent.vue`
|
|
@@ -858,7 +858,9 @@ export type AdminForthComponentDeclaration = {
|
|
|
858
858
|
*
|
|
859
859
|
*/
|
|
860
860
|
meta?: any,
|
|
861
|
-
}
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
export type AdminForthComponentDeclaration = AdminForthComponentDeclarationFull | string;
|
|
862
864
|
|
|
863
865
|
export type AdminForthFieldComponents = {
|
|
864
866
|
/**
|