@appstrata/cli 0.1.0 → 0.1.1
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 +4 -1
- package/dist/schema-generator.d.ts.map +1 -1
- package/dist/schema-generator.js +13 -2
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -4,15 +4,18 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @packageDocumentation
|
|
6
6
|
*/
|
|
7
|
+
import { createRequire } from "node:module";
|
|
7
8
|
import { Command } from "commander";
|
|
8
9
|
import { devCommand } from "./commands/dev.js";
|
|
9
10
|
import { devHttpPlayerCommand } from "./commands/dev-http-player.js";
|
|
10
11
|
import { packageCommand } from "./commands/package.js";
|
|
12
|
+
const require = createRequire(import.meta.url);
|
|
13
|
+
const pkg = require("../package.json");
|
|
11
14
|
const program = new Command();
|
|
12
15
|
program
|
|
13
16
|
.name("appstrata")
|
|
14
17
|
.description("AppStrata Development Tools CLI")
|
|
15
|
-
.version(
|
|
18
|
+
.version(pkg.version);
|
|
16
19
|
program
|
|
17
20
|
.command("dev")
|
|
18
21
|
.description("Start development player with iframe")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-generator.d.ts","sourceRoot":"","sources":["../src/schema-generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,SAAS,
|
|
1
|
+
{"version":3,"file":"schema-generator.d.ts","sourceRoot":"","sources":["../src/schema-generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,SAAS,EAWV,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE;QACJ,gBAAgB,EAAE,MAAM,CAAC;QACzB,mBAAmB,EAAE,MAAM,CAAC;QAC5B,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IACF,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,aAAa,EAAE,OAAO,EAAE,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;IAC9C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC1C;AA6MD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,SAAS,GAAG,YAAY,CAiDvE"}
|
package/dist/schema-generator.js
CHANGED
|
@@ -158,6 +158,10 @@ function transformImageInput(input) {
|
|
|
158
158
|
field.validators = validators;
|
|
159
159
|
return field;
|
|
160
160
|
}
|
|
161
|
+
const KNOWN_INPUT_TYPES = ["text", "color", "boolean", "number", "select", "range", "font", "image"];
|
|
162
|
+
function isKnownInput(input) {
|
|
163
|
+
return KNOWN_INPUT_TYPES.includes(input.type);
|
|
164
|
+
}
|
|
161
165
|
function transformInput(input) {
|
|
162
166
|
switch (input.type) {
|
|
163
167
|
case "text": return transformTextInput(input);
|
|
@@ -204,12 +208,19 @@ function deepMerge(base, override) {
|
|
|
204
208
|
*/
|
|
205
209
|
export function generateYodeckSchema(appConfig) {
|
|
206
210
|
const inputs = appConfig.configuration?.inputs ?? {};
|
|
207
|
-
const keys = Object.keys(inputs);
|
|
208
211
|
const data = {};
|
|
209
212
|
const schema = {};
|
|
210
213
|
const fieldKeys = [];
|
|
211
|
-
for (const key of keys) {
|
|
214
|
+
for (const key of Object.keys(inputs)) {
|
|
212
215
|
const input = inputs[key];
|
|
216
|
+
if (!isKnownInput(input)) {
|
|
217
|
+
const { default: defaultVal, ...rest } = input;
|
|
218
|
+
fieldKeys.push(key);
|
|
219
|
+
schema[key] = rest;
|
|
220
|
+
if (defaultVal !== undefined)
|
|
221
|
+
data[key] = defaultVal;
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
213
224
|
const schemaKey = input.type === "image" ? `${key}__file` : key;
|
|
214
225
|
fieldKeys.push(schemaKey);
|
|
215
226
|
schema[schemaKey] = transformInput(input);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appstrata/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "AppStrata CLI - Command-line tools for digital signage app development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"archiver": "^7.0.1",
|
|
33
33
|
"commander": "^12.1.0",
|
|
34
34
|
"vite": "^6.0.0",
|
|
35
|
-
"@appstrata/
|
|
36
|
-
"@appstrata/
|
|
37
|
-
"@appstrata/
|
|
38
|
-
"@appstrata/protocol": "0.1.
|
|
35
|
+
"@appstrata/dev": "0.1.1",
|
|
36
|
+
"@appstrata/core": "0.1.1",
|
|
37
|
+
"@appstrata/player-lib": "0.1.1",
|
|
38
|
+
"@appstrata/protocol": "0.1.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/archiver": "^7.0.0",
|