@giteeteam/apps-cli 0.2.7 → 0.2.8

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.
Files changed (2) hide show
  1. package/dist/index.js +67 -8
  2. package/package.json +3 -4
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ var execa__default = /*#__PURE__*/_interopDefaultLegacy(execa);
31
31
  var child_process__default = /*#__PURE__*/_interopDefaultLegacy(child_process);
32
32
  var chokidar__default = /*#__PURE__*/_interopDefaultLegacy(chokidar);
33
33
 
34
- var version = "0.2.7";
34
+ var version = "0.2.8";
35
35
 
36
36
  const packageApp = async ({ outputDir, manifest, copyFiles }) => {
37
37
  const { resources } = manifest;
@@ -118,8 +118,9 @@ const execActionWithSpinner = async (message, action) => {
118
118
  };
119
119
 
120
120
  class Manifest {
121
- constructor(manifestStr) {
122
- this.manifest = yaml.parse(manifestStr);
121
+ constructor(manifestString) {
122
+ this.manifest = yaml.parse(manifestString);
123
+ this.manifestString = manifestString;
123
124
  }
124
125
  get resources() {
125
126
  return this.manifest.resources;
@@ -127,13 +128,63 @@ class Manifest {
127
128
  get app() {
128
129
  return this.manifest.app;
129
130
  }
131
+ get tables() {
132
+ return this.manifest.tables;
133
+ }
134
+ getManifest() {
135
+ return this.manifest;
136
+ }
137
+ getManifestString() {
138
+ return this.manifestString;
139
+ }
140
+ /**
141
+ * 获取所有自定义事项类型
142
+ */
143
+ getCustomItemType() {
144
+ const { modules } = this.manifest;
145
+ return modules.customItemType || [];
146
+ }
130
147
  /**
131
- * 根据key获取执行的function名称
148
+ * 获取所有自定义字段类型
149
+ */
150
+ getCustomFieldType() {
151
+ const { modules } = this.manifest;
152
+ return modules.customFieldType || [];
153
+ }
154
+ /**
155
+ * 获取所有自定义字段
156
+ */
157
+ getCustomField() {
158
+ const { modules } = this.manifest;
159
+ return modules.customField || [];
160
+ }
161
+ /**
162
+ * 根据key获取执行的function
132
163
  * @param key
133
164
  * @returns
134
165
  */
135
166
  getFunctionByKey(key) {
136
- var _a, _b, _c, _d, _e;
167
+ const functionKey = this.getFunctionKeyByKey(key);
168
+ if (functionKey) {
169
+ return this.getFunctionByFunctionKey(functionKey);
170
+ }
171
+ }
172
+ /**
173
+ * 根据functionKey获取执行的function
174
+ * @param functionKey
175
+ * @returns
176
+ */
177
+ getFunctionByFunctionKey(functionKey) {
178
+ var _a, _b;
179
+ return (_b = (_a = this.manifest.modules) === null || _a === void 0 ? void 0 : _a.function) === null || _b === void 0 ? void 0 : _b.find(f => f.key === functionKey);
180
+ }
181
+ /**
182
+ * 根据key获取执行的functionKey
183
+ * @param key
184
+ * @returns
185
+ */
186
+ getFunctionKeyByKey(key) {
187
+ var _a, _b, _c;
137
188
  const { modules } = this.manifest;
138
189
  for (const k in modules) {
139
190
  if (k === 'function') {
@@ -142,13 +193,13 @@ class Manifest {
142
193
  else if (k === 'importer') {
143
194
  // importer扩展点需要判断function和validate
144
195
  if (key === ((_a = modules[k]) === null || _a === void 0 ? void 0 : _a.function) || key === ((_b = modules[k]) === null || _b === void 0 ? void 0 : _b.validate)) {
145
- return (_c = modules === null || modules === void 0 ? void 0 : modules.function) === null || _c === void 0 ? void 0 : _c.find(v => v.key === key);
196
+ return key;
146
197
  }
147
198
  }
148
199
  else if (Array.isArray(modules[k])) {
149
- const targetModule = (_d = modules[k]) === null || _d === void 0 ? void 0 : _d.find(v => v.key === key);
200
+ const targetModule = (_c = modules[k]) === null || _c === void 0 ? void 0 : _c.find(v => v.key === key);
150
201
  if (targetModule) {
151
- return (_e = modules === null || modules === void 0 ? void 0 : modules.function) === null || _e === void 0 ? void 0 : _e.find(v => v.key === targetModule.function);
202
+ return targetModule.function;
152
203
  }
153
204
  }
154
205
  }
@@ -168,6 +219,14 @@ class Manifest {
168
219
  }
169
220
  }
170
221
 
222
+ var Triggers;
223
+ (function (Triggers) {
224
+ Triggers["appInstall"] = "proxima:app:install";
225
+ Triggers["appUninstall"] = "proxima:app:uninstall";
226
+ Triggers["appUpdate"] = "proxima:app:update";
227
+ Triggers["itemChange"] = "proxima:item:change";
228
+ })(Triggers || (Triggers = {}));
229
+
171
230
  const getManifest = async () => {
172
231
  const manifestFile = path__default["default"].resolve('manifest.yml');
173
232
  const strBuffer = await fse__default["default"].readFile(manifestFile);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giteeteam/apps-cli",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "Giteeteam Apps cli",
5
5
  "keywords": [
6
6
  "typescript",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@giteeteam/apps-bundler": "^0.1.7",
42
- "@giteeteam/apps-manifest": "^0.1.0",
42
+ "@giteeteam/apps-manifest": "^0.1.1",
43
43
  "archiver": "^5.3.1",
44
44
  "chalk": "^4.1.2",
45
45
  "chokidar": "^3.5.3",
@@ -58,6 +58,5 @@
58
58
  "@types/fs-extra": "^9.0.13",
59
59
  "@types/inquirer": "^8.2.1",
60
60
  "@types/uuid": "^8.3.4"
61
- },
62
- "gitHead": "3c1344d0154b4671d9477d491c514f02385a1f0d"
61
+ }
63
62
  }