verteilen-core 1.4.13 → 1.4.15
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,20 +28,22 @@ export interface PluginNode {
|
|
|
28
28
|
export interface PluginWithToken extends Plugin {
|
|
29
29
|
token: Array<string>;
|
|
30
30
|
}
|
|
31
|
-
export interface
|
|
31
|
+
export interface PluginBase {
|
|
32
32
|
thumbnail?: string;
|
|
33
33
|
icon?: string;
|
|
34
34
|
owner?: string;
|
|
35
35
|
title?: string;
|
|
36
36
|
description?: string;
|
|
37
|
+
version: string;
|
|
38
|
+
i18n: Array<PluginI18N>;
|
|
39
|
+
}
|
|
40
|
+
export interface PluginContainer extends DataTime, PluginBase {
|
|
37
41
|
url?: string;
|
|
38
42
|
plugins: Array<Plugin>;
|
|
39
43
|
projects: Array<TemplateData_Project>;
|
|
40
44
|
databases: Array<TemplateData_Database>;
|
|
41
45
|
gen_projects?: Array<TemplateGroup_Project>;
|
|
42
46
|
gen_databases?: Array<TemplateGroup_Database>;
|
|
43
|
-
version: string;
|
|
44
|
-
i18n: Array<PluginI18N>;
|
|
45
47
|
permission?: LocalPermission;
|
|
46
48
|
acl?: ACLType;
|
|
47
49
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const PluginBuild: (root: string, plugins: PluginNode, templates: PluginGenData,
|
|
1
|
+
import { PluginBase, PluginGenData, PluginNode } from '../interface';
|
|
2
|
+
export declare const PluginBuild: (root: string, plugins: PluginNode, templates: PluginGenData, data: PluginBase) => void;
|
|
@@ -37,7 +37,7 @@ exports.PluginBuild = void 0;
|
|
|
37
37
|
const fs = __importStar(require("fs"));
|
|
38
38
|
const path = __importStar(require("path"));
|
|
39
39
|
const interface_1 = require("../interface");
|
|
40
|
-
const PluginBuild = (root, plugins, templates,
|
|
40
|
+
const PluginBuild = (root, plugins, templates, data) => {
|
|
41
41
|
console.log("Activate Plugin Build Process...");
|
|
42
42
|
const root_p = path.join(root, 'project');
|
|
43
43
|
const root_d = path.join(root, 'database');
|
|
@@ -50,12 +50,7 @@ const PluginBuild = (root, plugins, templates, version = "1.0.0", language = [])
|
|
|
50
50
|
if (!fs.existsSync(root_d))
|
|
51
51
|
fs.mkdirSync(root_d, { recursive: true });
|
|
52
52
|
let manifest = {
|
|
53
|
-
|
|
54
|
-
icon: "",
|
|
55
|
-
owner: "",
|
|
56
|
-
title: "",
|
|
57
|
-
version: version,
|
|
58
|
-
i18n: language,
|
|
53
|
+
...data,
|
|
59
54
|
plugins: [],
|
|
60
55
|
projects: [],
|
|
61
56
|
databases: []
|
|
@@ -80,16 +75,25 @@ const PluginBuild = (root, plugins, templates, version = "1.0.0", language = [])
|
|
|
80
75
|
delete manifest.acl;
|
|
81
76
|
delete manifest.permission;
|
|
82
77
|
console.log("Output manifest.json");
|
|
78
|
+
if (fs.existsSync(m_path))
|
|
79
|
+
fs.unlinkSync(m_path);
|
|
83
80
|
fs.writeFileSync(m_path, JSON.stringify(manifest, null, 4));
|
|
84
81
|
console.log("Output project templates");
|
|
85
82
|
templates.projects.forEach(item => {
|
|
86
83
|
const result = item.template((0, interface_1.CreateDefaultProject)());
|
|
87
|
-
|
|
84
|
+
const n_patn = path.join(root_p, `${item.filename}.json`);
|
|
85
|
+
if (fs.existsSync(n_patn))
|
|
86
|
+
fs.unlinkSync(n_patn);
|
|
87
|
+
fs.writeFileSync(n_patn, JSON.stringify(result, null, 4), 'utf-8');
|
|
88
88
|
});
|
|
89
89
|
console.log("Output database templates");
|
|
90
90
|
templates.databases.forEach(item => {
|
|
91
91
|
const result = item.template();
|
|
92
|
-
|
|
92
|
+
const n_patn = path.join(root_d, `${item.filename}.json`);
|
|
93
|
+
if (fs.existsSync(n_patn))
|
|
94
|
+
fs.unlinkSync(n_patn);
|
|
95
|
+
fs.writeFileSync(n_patn, JSON.stringify(result, null, 4), 'utf-8');
|
|
93
96
|
});
|
|
97
|
+
console.log("Finish build");
|
|
94
98
|
};
|
|
95
99
|
exports.PluginBuild = PluginBuild;
|
package/package.json
CHANGED
package/src/interface/plugin.ts
CHANGED
|
@@ -98,11 +98,7 @@ export interface PluginWithToken extends Plugin {
|
|
|
98
98
|
token: Array<string>
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
* **Plugin Group**\
|
|
103
|
-
* User can upload a group of plugin with author and thumbnail etc...\
|
|
104
|
-
*/
|
|
105
|
-
export interface PluginContainer extends DataTime {
|
|
101
|
+
export interface PluginBase {
|
|
106
102
|
/**
|
|
107
103
|
* **Thumbnail URL**\
|
|
108
104
|
* The relative link for the thumbnail
|
|
@@ -127,6 +123,36 @@ export interface PluginContainer extends DataTime {
|
|
|
127
123
|
* **Plugin Group Description**
|
|
128
124
|
*/
|
|
129
125
|
description?: string
|
|
126
|
+
/**
|
|
127
|
+
* **Version label**
|
|
128
|
+
*/
|
|
129
|
+
version: string
|
|
130
|
+
/**
|
|
131
|
+
* **Language key value set**\
|
|
132
|
+
* @example
|
|
133
|
+
* [
|
|
134
|
+
* {
|
|
135
|
+
* key: "en",
|
|
136
|
+
* value: {
|
|
137
|
+
* "Key1": "KEY ONE"
|
|
138
|
+
* }
|
|
139
|
+
* },
|
|
140
|
+
* {
|
|
141
|
+
* key: "zh-TW",
|
|
142
|
+
* value: {
|
|
143
|
+
* "Key1": "金鑰一"
|
|
144
|
+
* }
|
|
145
|
+
* }
|
|
146
|
+
* ]
|
|
147
|
+
*/
|
|
148
|
+
i18n: Array<PluginI18N>
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* **Plugin Group**\
|
|
153
|
+
* User can upload a group of plugin with author and thumbnail etc...\
|
|
154
|
+
*/
|
|
155
|
+
export interface PluginContainer extends DataTime, PluginBase {
|
|
130
156
|
/**
|
|
131
157
|
* **Plugin Header URL**
|
|
132
158
|
*/
|
|
@@ -155,29 +181,6 @@ export interface PluginContainer extends DataTime {
|
|
|
155
181
|
* Only exist in server side
|
|
156
182
|
*/
|
|
157
183
|
gen_databases?: Array<TemplateGroup_Database>
|
|
158
|
-
/**
|
|
159
|
-
* **Version label**
|
|
160
|
-
*/
|
|
161
|
-
version: string
|
|
162
|
-
/**
|
|
163
|
-
* **Language key value set**\
|
|
164
|
-
* @example
|
|
165
|
-
* [
|
|
166
|
-
* {
|
|
167
|
-
* key: "en",
|
|
168
|
-
* value: [
|
|
169
|
-
* "Key1": "KEY ONE"
|
|
170
|
-
* ]
|
|
171
|
-
* },
|
|
172
|
-
* {
|
|
173
|
-
* key: "zh-TW",
|
|
174
|
-
* value: [
|
|
175
|
-
* "Key1": "金鑰一"
|
|
176
|
-
* ]
|
|
177
|
-
* }
|
|
178
|
-
* ]
|
|
179
|
-
*/
|
|
180
|
-
i18n: Array<PluginI18N>
|
|
181
184
|
/**
|
|
182
185
|
* **Local Permission**\
|
|
183
186
|
* Client-side only permission field\
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as fs from 'fs'
|
|
2
2
|
import * as path from 'path'
|
|
3
|
-
import { CreateDefaultProject, DatabaseContainer,
|
|
3
|
+
import { CreateDefaultProject, DatabaseContainer, PluginBase, PluginContainer, PluginGenData, PluginNode, Project } from '../interface'
|
|
4
4
|
|
|
5
|
-
export const PluginBuild = (root:string, plugins:PluginNode, templates:PluginGenData,
|
|
5
|
+
export const PluginBuild = (root:string, plugins:PluginNode, templates:PluginGenData, data:PluginBase) => {
|
|
6
6
|
console.log("Activate Plugin Build Process...")
|
|
7
7
|
const root_p = path.join(root, 'project')
|
|
8
8
|
const root_d = path.join(root, 'database')
|
|
@@ -13,12 +13,7 @@ export const PluginBuild = (root:string, plugins:PluginNode, templates:PluginGen
|
|
|
13
13
|
if(!fs.existsSync(root_d)) fs.mkdirSync(root_d, { recursive: true })
|
|
14
14
|
|
|
15
15
|
let manifest:PluginContainer = {
|
|
16
|
-
|
|
17
|
-
icon: "",
|
|
18
|
-
owner: "",
|
|
19
|
-
title: "",
|
|
20
|
-
version: version,
|
|
21
|
-
i18n: language,
|
|
16
|
+
...data,
|
|
22
17
|
plugins: [],
|
|
23
18
|
projects: [],
|
|
24
19
|
databases: []
|
|
@@ -46,21 +41,27 @@ export const PluginBuild = (root:string, plugins:PluginNode, templates:PluginGen
|
|
|
46
41
|
delete manifest.acl
|
|
47
42
|
delete manifest.permission
|
|
48
43
|
console.log("Output manifest.json")
|
|
44
|
+
if(fs.existsSync(m_path)) fs.unlinkSync(m_path)
|
|
49
45
|
fs.writeFileSync(m_path, JSON.stringify(manifest, null, 4))
|
|
50
46
|
|
|
51
47
|
console.log("Output project templates")
|
|
52
48
|
templates.projects.forEach(item => {
|
|
53
49
|
const result:Project = item.template(CreateDefaultProject())
|
|
50
|
+
const n_patn = path.join(root_p, `${item.filename}.json`)
|
|
51
|
+
if(fs.existsSync(n_patn)) fs.unlinkSync(n_patn)
|
|
54
52
|
fs.writeFileSync(
|
|
55
|
-
|
|
53
|
+
n_patn,
|
|
56
54
|
JSON.stringify(result, null, 4), 'utf-8')
|
|
57
55
|
})
|
|
58
56
|
|
|
59
57
|
console.log("Output database templates")
|
|
60
58
|
templates.databases.forEach(item => {
|
|
61
59
|
const result:Array<DatabaseContainer> = item.template()
|
|
60
|
+
const n_patn = path.join(root_d, `${item.filename}.json`)
|
|
61
|
+
if(fs.existsSync(n_patn)) fs.unlinkSync(n_patn)
|
|
62
62
|
fs.writeFileSync(
|
|
63
|
-
|
|
63
|
+
n_patn,
|
|
64
64
|
JSON.stringify(result, null, 4), 'utf-8')
|
|
65
65
|
})
|
|
66
|
+
console.log("Finish build")
|
|
66
67
|
}
|