@nocobase/preset-nocobase 0.9.0-alpha.2 → 0.9.1-alpha.2
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/lib/index.d.ts +3 -0
- package/lib/index.js +27 -22
- package/package.json +32 -29
- package/src/index.ts +54 -36
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Plugin } from '@nocobase/server';
|
|
2
2
|
export declare class PresetNocoBase extends Plugin {
|
|
3
|
+
builtInPlugins: string[];
|
|
4
|
+
localPlugins: string[];
|
|
5
|
+
splitNames(name: string): string[];
|
|
3
6
|
getBuiltInPlugins(): string[];
|
|
4
7
|
getLocalPlugins(): string[];
|
|
5
8
|
addBuiltInPlugins(options?: any): Promise<void>;
|
package/lib/index.js
CHANGED
|
@@ -42,14 +42,26 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
42
42
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
43
43
|
|
|
44
44
|
class PresetNocoBase extends _server().Plugin {
|
|
45
|
+
constructor(...args) {
|
|
46
|
+
super(...args);
|
|
47
|
+
this.builtInPlugins = ['error-handler', 'collection-manager', 'ui-schema-storage', 'ui-routes-storage', 'file-manager', 'system-settings', 'sequence-field', 'verification', 'users', 'acl', 'china-region', 'workflow', 'client', 'export', 'import', 'audit-logs', 'duplicator', 'iframe-block', 'formula-field', 'charts'];
|
|
48
|
+
this.localPlugins = ['sample-hello', 'multi-app-manager', 'oidc', 'saml', 'map', 'snapshot-field', 'graph-collection-manager'];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
splitNames(name) {
|
|
52
|
+
return (name || '').split(',').filter(Boolean);
|
|
53
|
+
}
|
|
54
|
+
|
|
45
55
|
getBuiltInPlugins() {
|
|
46
|
-
const
|
|
47
|
-
|
|
56
|
+
const _process$env = process.env,
|
|
57
|
+
PRESET_NOCOBASE_PLUGINS = _process$env.PRESET_NOCOBASE_PLUGINS,
|
|
58
|
+
APPEND_PRESET_BUILT_IN_PLUGINS = _process$env.APPEND_PRESET_BUILT_IN_PLUGINS;
|
|
59
|
+
return _lodash().default.uniq(this.splitNames(APPEND_PRESET_BUILT_IN_PLUGINS || PRESET_NOCOBASE_PLUGINS).concat(this.builtInPlugins));
|
|
48
60
|
}
|
|
49
61
|
|
|
50
62
|
getLocalPlugins() {
|
|
51
|
-
const
|
|
52
|
-
return localPlugins;
|
|
63
|
+
const APPEND_PRESET_LOCAL_PLUGINS = process.env.APPEND_PRESET_LOCAL_PLUGINS;
|
|
64
|
+
return _lodash().default.uniq(this.splitNames(APPEND_PRESET_LOCAL_PLUGINS).concat(this.localPlugins));
|
|
53
65
|
}
|
|
54
66
|
|
|
55
67
|
addBuiltInPlugins(options) {
|
|
@@ -83,22 +95,15 @@ class PresetNocoBase extends _server().Plugin {
|
|
|
83
95
|
}
|
|
84
96
|
|
|
85
97
|
const version = yield _this2.app.version.get();
|
|
86
|
-
console.log(`The version number before upgrade is ${version}`);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
truncate: true
|
|
96
|
-
});
|
|
97
|
-
yield _this2.app.reload({
|
|
98
|
-
method: options.method
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}
|
|
98
|
+
console.log(`The version number before upgrade is ${version}`); // const result = await this.app.version.satisfies('<0.8.0-alpha.1');
|
|
99
|
+
// if (result) {
|
|
100
|
+
// const r = await this.db.collectionExistsInDb('applicationPlugins');
|
|
101
|
+
// if (r) {
|
|
102
|
+
// console.log(`Clear the installed application plugins`);
|
|
103
|
+
// await this.db.getRepository('applicationPlugins').destroy({ truncate: true });
|
|
104
|
+
// await this.app.reload({ method: options.method });
|
|
105
|
+
// }
|
|
106
|
+
// }
|
|
102
107
|
});
|
|
103
108
|
|
|
104
109
|
return function (_x, _x2) {
|
|
@@ -110,7 +115,7 @@ class PresetNocoBase extends _server().Plugin {
|
|
|
110
115
|
const result = yield _this2.app.version.satisfies('<0.8.0-alpha.1');
|
|
111
116
|
|
|
112
117
|
if (result) {
|
|
113
|
-
console.log(`Initialize all built-in plugins`);
|
|
118
|
+
console.log(`Initialize all built-in plugins beforeUpgrade`);
|
|
114
119
|
yield _this2.addBuiltInPlugins({
|
|
115
120
|
method: 'upgrade'
|
|
116
121
|
});
|
|
@@ -141,7 +146,7 @@ class PresetNocoBase extends _server().Plugin {
|
|
|
141
146
|
}());
|
|
142
147
|
this.app.on('beforeInstall', /*#__PURE__*/function () {
|
|
143
148
|
var _ref3 = _asyncToGenerator(function* (options) {
|
|
144
|
-
console.log(`Initialize all built-in plugins`);
|
|
149
|
+
console.log(`Initialize all built-in plugins beforeInstall`);
|
|
145
150
|
yield _this2.addBuiltInPlugins({
|
|
146
151
|
method: 'install'
|
|
147
152
|
});
|
package/package.json
CHANGED
|
@@ -1,42 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/preset-nocobase",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1-alpha.2",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@nocobase/plugin-acl": "0.9.
|
|
9
|
-
"@nocobase/plugin-audit-logs": "0.9.
|
|
10
|
-
"@nocobase/plugin-
|
|
11
|
-
"@nocobase/plugin-
|
|
12
|
-
"@nocobase/plugin-
|
|
13
|
-
"@nocobase/plugin-
|
|
14
|
-
"@nocobase/plugin-
|
|
15
|
-
"@nocobase/plugin-
|
|
16
|
-
"@nocobase/plugin-
|
|
17
|
-
"@nocobase/plugin-
|
|
18
|
-
"@nocobase/plugin-
|
|
19
|
-
"@nocobase/plugin-
|
|
20
|
-
"@nocobase/plugin-
|
|
21
|
-
"@nocobase/plugin-
|
|
22
|
-
"@nocobase/plugin-
|
|
23
|
-
"@nocobase/plugin-
|
|
24
|
-
"@nocobase/plugin-
|
|
25
|
-
"@nocobase/plugin-
|
|
26
|
-
"@nocobase/plugin-
|
|
27
|
-
"@nocobase/plugin-
|
|
28
|
-
"@nocobase/plugin-
|
|
29
|
-
"@nocobase/plugin-
|
|
30
|
-
"@nocobase/plugin-
|
|
31
|
-
"@nocobase/plugin-
|
|
32
|
-
"@nocobase/plugin-
|
|
33
|
-
"@nocobase/plugin-
|
|
34
|
-
"@nocobase/
|
|
8
|
+
"@nocobase/plugin-acl": "0.9.1-alpha.2",
|
|
9
|
+
"@nocobase/plugin-audit-logs": "0.9.1-alpha.2",
|
|
10
|
+
"@nocobase/plugin-charts": "0.9.1-alpha.2",
|
|
11
|
+
"@nocobase/plugin-china-region": "0.9.1-alpha.2",
|
|
12
|
+
"@nocobase/plugin-client": "0.9.1-alpha.2",
|
|
13
|
+
"@nocobase/plugin-collection-manager": "0.9.1-alpha.2",
|
|
14
|
+
"@nocobase/plugin-duplicator": "0.9.1-alpha.2",
|
|
15
|
+
"@nocobase/plugin-error-handler": "0.9.1-alpha.2",
|
|
16
|
+
"@nocobase/plugin-excel-formula-field": "0.9.1-alpha.2",
|
|
17
|
+
"@nocobase/plugin-export": "0.9.1-alpha.2",
|
|
18
|
+
"@nocobase/plugin-file-manager": "0.9.1-alpha.2",
|
|
19
|
+
"@nocobase/plugin-formula-field": "0.9.1-alpha.2",
|
|
20
|
+
"@nocobase/plugin-graph-collection-manager": "0.9.1-alpha.2",
|
|
21
|
+
"@nocobase/plugin-iframe-block": "0.9.1-alpha.2",
|
|
22
|
+
"@nocobase/plugin-import": "0.9.1-alpha.2",
|
|
23
|
+
"@nocobase/plugin-map": "0.9.1-alpha.2",
|
|
24
|
+
"@nocobase/plugin-math-formula-field": "0.9.1-alpha.2",
|
|
25
|
+
"@nocobase/plugin-multi-app-manager": "0.9.1-alpha.2",
|
|
26
|
+
"@nocobase/plugin-oidc": "0.9.1-alpha.2",
|
|
27
|
+
"@nocobase/plugin-saml": "0.9.1-alpha.2",
|
|
28
|
+
"@nocobase/plugin-sample-hello": "0.9.1-alpha.2",
|
|
29
|
+
"@nocobase/plugin-sequence-field": "0.9.1-alpha.2",
|
|
30
|
+
"@nocobase/plugin-snapshot-field": "0.9.1-alpha.2",
|
|
31
|
+
"@nocobase/plugin-system-settings": "0.9.1-alpha.2",
|
|
32
|
+
"@nocobase/plugin-ui-routes-storage": "0.9.1-alpha.2",
|
|
33
|
+
"@nocobase/plugin-ui-schema-storage": "0.9.1-alpha.2",
|
|
34
|
+
"@nocobase/plugin-users": "0.9.1-alpha.2",
|
|
35
|
+
"@nocobase/plugin-verification": "0.9.1-alpha.2",
|
|
36
|
+
"@nocobase/plugin-workflow": "0.9.1-alpha.2",
|
|
37
|
+
"@nocobase/server": "0.9.1-alpha.2"
|
|
35
38
|
},
|
|
36
39
|
"repository": {
|
|
37
40
|
"type": "git",
|
|
38
41
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
39
42
|
"directory": "packages/presets/nocobase"
|
|
40
43
|
},
|
|
41
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "d588a68eca4feed4642a4cb317301011266fe5c9"
|
|
42
45
|
}
|
package/src/index.ts
CHANGED
|
@@ -3,37 +3,53 @@ import _ from 'lodash';
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
|
|
5
5
|
export class PresetNocoBase extends Plugin {
|
|
6
|
+
builtInPlugins = [
|
|
7
|
+
'error-handler',
|
|
8
|
+
'collection-manager',
|
|
9
|
+
'ui-schema-storage',
|
|
10
|
+
'ui-routes-storage',
|
|
11
|
+
'file-manager',
|
|
12
|
+
'system-settings',
|
|
13
|
+
'sequence-field',
|
|
14
|
+
'verification',
|
|
15
|
+
'users',
|
|
16
|
+
'acl',
|
|
17
|
+
'china-region',
|
|
18
|
+
'workflow',
|
|
19
|
+
'client',
|
|
20
|
+
'export',
|
|
21
|
+
'import',
|
|
22
|
+
'audit-logs',
|
|
23
|
+
'duplicator',
|
|
24
|
+
'iframe-block',
|
|
25
|
+
'formula-field',
|
|
26
|
+
'charts',
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
localPlugins = [
|
|
30
|
+
'sample-hello',
|
|
31
|
+
'multi-app-manager',
|
|
32
|
+
'oidc',
|
|
33
|
+
'saml',
|
|
34
|
+
'map',
|
|
35
|
+
'snapshot-field',
|
|
36
|
+
'graph-collection-manager',
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
splitNames(name: string) {
|
|
40
|
+
return (name || '').split(',').filter(Boolean);
|
|
41
|
+
}
|
|
42
|
+
|
|
6
43
|
getBuiltInPlugins() {
|
|
7
|
-
const
|
|
44
|
+
const { PRESET_NOCOBASE_PLUGINS, APPEND_PRESET_BUILT_IN_PLUGINS } = process.env;
|
|
8
45
|
return _.uniq(
|
|
9
|
-
|
|
10
|
-
'error-handler',
|
|
11
|
-
'collection-manager',
|
|
12
|
-
'ui-schema-storage',
|
|
13
|
-
'ui-routes-storage',
|
|
14
|
-
'file-manager',
|
|
15
|
-
'system-settings',
|
|
16
|
-
'sequence-field',
|
|
17
|
-
'verification',
|
|
18
|
-
'users',
|
|
19
|
-
'acl',
|
|
20
|
-
'china-region',
|
|
21
|
-
'workflow',
|
|
22
|
-
'client',
|
|
23
|
-
'export',
|
|
24
|
-
'import',
|
|
25
|
-
'audit-logs',
|
|
26
|
-
'duplicator',
|
|
27
|
-
'iframe-block',
|
|
28
|
-
'math-formula-field',
|
|
29
|
-
'excel-formula-field',
|
|
30
|
-
].concat(plugins),
|
|
46
|
+
this.splitNames(APPEND_PRESET_BUILT_IN_PLUGINS || PRESET_NOCOBASE_PLUGINS).concat(this.builtInPlugins),
|
|
31
47
|
);
|
|
32
48
|
}
|
|
33
49
|
|
|
34
50
|
getLocalPlugins() {
|
|
35
|
-
const
|
|
36
|
-
return localPlugins;
|
|
51
|
+
const { APPEND_PRESET_LOCAL_PLUGINS } = process.env;
|
|
52
|
+
return _.uniq(this.splitNames(APPEND_PRESET_LOCAL_PLUGINS).concat(this.localPlugins));
|
|
37
53
|
}
|
|
38
54
|
|
|
39
55
|
async addBuiltInPlugins(options?: any) {
|
|
@@ -55,20 +71,21 @@ export class PresetNocoBase extends Plugin {
|
|
|
55
71
|
}
|
|
56
72
|
const version = await this.app.version.get();
|
|
57
73
|
console.log(`The version number before upgrade is ${version}`);
|
|
58
|
-
const result = await this.app.version.satisfies('<0.8.0-alpha.1');
|
|
59
|
-
if (result) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
74
|
+
// const result = await this.app.version.satisfies('<0.8.0-alpha.1');
|
|
75
|
+
// if (result) {
|
|
76
|
+
// const r = await this.db.collectionExistsInDb('applicationPlugins');
|
|
77
|
+
// if (r) {
|
|
78
|
+
// console.log(`Clear the installed application plugins`);
|
|
79
|
+
// await this.db.getRepository('applicationPlugins').destroy({ truncate: true });
|
|
80
|
+
// await this.app.reload({ method: options.method });
|
|
81
|
+
// }
|
|
82
|
+
// }
|
|
67
83
|
});
|
|
84
|
+
|
|
68
85
|
this.app.on('beforeUpgrade', async (options) => {
|
|
69
86
|
const result = await this.app.version.satisfies('<0.8.0-alpha.1');
|
|
70
87
|
if (result) {
|
|
71
|
-
console.log(`Initialize all built-in plugins`);
|
|
88
|
+
console.log(`Initialize all built-in plugins beforeUpgrade`);
|
|
72
89
|
await this.addBuiltInPlugins({ method: 'upgrade' });
|
|
73
90
|
}
|
|
74
91
|
const builtInPlugins = this.getBuiltInPlugins();
|
|
@@ -90,8 +107,9 @@ export class PresetNocoBase extends Plugin {
|
|
|
90
107
|
await this.app.reload({ method: 'upgrade' });
|
|
91
108
|
await this.app.db.sync();
|
|
92
109
|
});
|
|
110
|
+
|
|
93
111
|
this.app.on('beforeInstall', async (options) => {
|
|
94
|
-
console.log(`Initialize all built-in plugins`);
|
|
112
|
+
console.log(`Initialize all built-in plugins beforeInstall`);
|
|
95
113
|
await this.addBuiltInPlugins({ method: 'install' });
|
|
96
114
|
});
|
|
97
115
|
}
|