@wiztivi/dana-cli 0.0.4 → 0.0.6
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/bin/dana.js +1 -1
- package/dist/commands/addComponent/addMenu/add-menu.js +20 -25
- package/dist/commands/addComponent/addMenu/addMenuDefinition.js +12 -17
- package/dist/commands/addComponent/addRail/add-rail.js +17 -22
- package/dist/commands/addComponent/addRail/addRailDefinition.js +19 -24
- package/dist/commands/addComponent/addScreen/add-screen.js +11 -49
- package/dist/commands/addComponent/addScreen/addScreenDefinition.js +9 -14
- package/dist/commands/addComponent/addScrollView/add-scrollView.js +17 -22
- package/dist/commands/addComponent/addScrollView/addScrollViewDefinition.js +11 -16
- package/dist/commands/addComponent/config/ComponentConfig.d.ts +2 -2
- package/dist/commands/addComponent/config/ComponentConfig.js +23 -61
- package/dist/commands/addComponent/config/componentTypes.js +1 -2
- package/dist/commands/addComponent/const/componentConst.js +8 -11
- package/dist/commands/addComponent/const/defaultConfig.d.ts +1 -1
- package/dist/commands/addComponent/const/defaultConfig.js +7 -10
- package/dist/commands/addComponent/const/navigationConst.d.ts +1 -1
- package/dist/commands/addComponent/const/navigationConst.js +7 -13
- package/dist/commands/addComponent/createComponent.d.ts +1 -1
- package/dist/commands/addComponent/createComponent.js +15 -54
- package/dist/commands/addComponent/helper/ComponentHelper.d.ts +2 -1
- package/dist/commands/addComponent/helper/ComponentHelper.js +22 -50
- package/dist/commands/addDevice/add-device.js +34 -72
- package/dist/commands/addDevice/addDeviceDefinition.js +9 -14
- package/dist/commands/addDevice/deviceConfig/androidtvConfig.d.ts +1 -1
- package/dist/commands/addDevice/deviceConfig/androidtvConfig.js +39 -77
- package/dist/commands/addDevice/deviceConfig/configTypes.js +1 -2
- package/dist/commands/addDevice/deviceConfig/deviceConfig.js +1 -3
- package/dist/commands/addDevice/deviceConfig/tizenConfig.d.ts +1 -1
- package/dist/commands/addDevice/deviceConfig/tizenConfig.js +10 -15
- package/dist/commands/addDevice/deviceConfig/tvosConfig.js +8 -13
- package/dist/commands/addDevice/deviceConfig/webosConfig.d.ts +1 -1
- package/dist/commands/addDevice/deviceConfig/webosConfig.js +25 -63
- package/dist/commands/addDevice/helper/addDeviceHelper.js +7 -12
- package/dist/commands/authentication/authDefinition.js +14 -19
- package/dist/commands/authentication/authHook.js +5 -9
- package/dist/commands/authentication/authentConst.js +4 -7
- package/dist/commands/authentication/commands/login.js +29 -67
- package/dist/commands/authentication/commands/status.js +12 -52
- package/dist/commands/authentication/helper/CodeArtifactHelper.d.ts +1 -1
- package/dist/commands/authentication/helper/CodeArtifactHelper.js +14 -20
- package/dist/commands/authentication/helper/CredentialsHelper.js +8 -15
- package/dist/commands/commandHelp/customHelp.js +6 -11
- package/dist/commands/completion/completion.js +15 -51
- package/dist/commands/completion/completionDefinition.js +8 -13
- package/dist/commands/createApp/const/setupConst.js +1 -5
- package/dist/commands/createApp/createApp.js +42 -80
- package/dist/commands/createApp/createAppDefinition.js +13 -18
- package/dist/commands/createApp/helpers/CreateAppHelper.d.ts +9 -9
- package/dist/commands/createApp/helpers/CreateAppHelper.js +20 -58
- package/dist/commands/createApp/helpers/SetupChecker.d.ts +1 -1
- package/dist/commands/createApp/helpers/SetupChecker.js +14 -52
- package/dist/common/commonConst.js +1 -4
- package/dist/common/const/deviceConst.js +1 -14
- package/dist/common/const/exitCodeConst.js +7 -10
- package/dist/common/helpers/CreateFileHelper.d.ts +1 -1
- package/dist/common/helpers/CreateFileHelper.js +22 -27
- package/dist/common/helpers/InputValidator.js +7 -15
- package/dist/common/helpers/InstallHelper.d.ts +1 -1
- package/dist/common/helpers/InstallHelper.js +13 -18
- package/dist/common/helpers/UpdateFileHelper.d.ts +1 -1
- package/dist/common/helpers/UpdateFileHelper.js +34 -39
- package/dist/common/helpers/UserInputGetter.d.ts +1 -1
- package/dist/common/helpers/UserInputGetter.js +20 -58
- package/dist/common/helpers/handlebarsHelper.js +12 -17
- package/dist/common/helpers/stringHelper.d.ts +1 -1
- package/dist/common/helpers/stringHelper.js +2 -7
- package/dist/common/translation/translation.js +3 -8
- package/dist/common/types/helperTypes.d.ts +2 -2
- package/dist/common/types/helperTypes.js +1 -3
- package/dist/index.js +2 -4
- package/dist/program.js +30 -35
- package/package.json +6 -2
package/bin/dana.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
|
|
4
3
|
* All Rights Reserved
|
|
@@ -10,18 +9,14 @@
|
|
|
10
9
|
* This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
|
|
11
10
|
*
|
|
12
11
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const node_fs_1 = require("node:fs");
|
|
22
|
-
const ComponentConfig_1 = __importDefault(require("../config/ComponentConfig"));
|
|
23
|
-
const defaultConfig_1 = require("../const/defaultConfig");
|
|
24
|
-
const commonConst_1 = require("../../../common/commonConst");
|
|
12
|
+
import { BUTTON_ITEM_VIEW } from "../const/componentConst.js";
|
|
13
|
+
import createComponent from "../createComponent.js";
|
|
14
|
+
import process from "node:process";
|
|
15
|
+
import path from "node:path";
|
|
16
|
+
import { cpSync } from "node:fs";
|
|
17
|
+
import ComponentConfig from "../config/ComponentConfig.js";
|
|
18
|
+
import { MENU_DEFAULT_CONFIG } from "../const/defaultConfig.js";
|
|
19
|
+
import ComponentHelper from "../helper/ComponentHelper.js";
|
|
25
20
|
const addMenu = async (name, options) => {
|
|
26
21
|
const data = { ...options };
|
|
27
22
|
if (name) {
|
|
@@ -29,22 +24,22 @@ const addMenu = async (name, options) => {
|
|
|
29
24
|
}
|
|
30
25
|
const menuConfig = {
|
|
31
26
|
...data,
|
|
32
|
-
...(await
|
|
27
|
+
...(await ComponentConfig.menuConfig(data)),
|
|
33
28
|
};
|
|
34
29
|
const componentList = [menuConfig];
|
|
35
30
|
if (!data.custom) {
|
|
36
|
-
componentList.push({ type:
|
|
31
|
+
componentList.push({ type: BUTTON_ITEM_VIEW, name: data.itemView ?? MENU_DEFAULT_CONFIG.itemView });
|
|
37
32
|
}
|
|
38
|
-
(
|
|
33
|
+
createComponent(componentList);
|
|
39
34
|
if (!data.custom) {
|
|
40
|
-
const currentDirectory =
|
|
41
|
-
const modulePath =
|
|
42
|
-
const mockPath =
|
|
43
|
-
const iconPath =
|
|
44
|
-
const mockFinalPath =
|
|
45
|
-
const iconFinalPath =
|
|
46
|
-
|
|
47
|
-
|
|
35
|
+
const currentDirectory = process.cwd();
|
|
36
|
+
const modulePath = ComponentHelper.getTemplatePath();
|
|
37
|
+
const mockPath = path.join(path.dirname(modulePath), "mocks", "menuMock.json");
|
|
38
|
+
const iconPath = path.join(path.dirname(modulePath), "icons");
|
|
39
|
+
const mockFinalPath = path.resolve(currentDirectory, "menuMock.json");
|
|
40
|
+
const iconFinalPath = path.resolve(currentDirectory, "./images/icons");
|
|
41
|
+
cpSync(mockPath, mockFinalPath);
|
|
42
|
+
cpSync(iconPath, iconFinalPath, { recursive: true });
|
|
48
43
|
}
|
|
49
44
|
};
|
|
50
|
-
|
|
45
|
+
export default addMenu;
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const commander_1 = require("commander");
|
|
7
|
-
const add_menu_1 = __importDefault(require("./add-menu"));
|
|
8
|
-
const translation_1 = __importDefault(require("../../../common/translation/translation"));
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import addMenu from "./add-menu.js";
|
|
3
|
+
import translation from "../../../common/translation/translation.js";
|
|
9
4
|
const addMenuDefinition = () => {
|
|
10
|
-
const command = new
|
|
5
|
+
const command = new Command("add-menu");
|
|
11
6
|
command
|
|
12
|
-
.description(
|
|
13
|
-
.argument("[name]",
|
|
14
|
-
.option("-cm, --custom",
|
|
15
|
-
.option("-i, --itemView <itemView>",
|
|
16
|
-
.option("-m, --itemMargin <itemMargin>",
|
|
17
|
-
.option("-d, --direction <direction>",
|
|
18
|
-
.action(
|
|
7
|
+
.description(translation["command.menu.description"])
|
|
8
|
+
.argument("[name]", translation["command.component.name"])
|
|
9
|
+
.option("-cm, --custom", translation["command.component.customization"])
|
|
10
|
+
.option("-i, --itemView <itemView>", translation["command.menu.option.itemView"])
|
|
11
|
+
.option("-m, --itemMargin <itemMargin>", translation["command.menu.option.itemMargin"])
|
|
12
|
+
.option("-d, --direction <direction>", translation["command.rail.option.direction"])
|
|
13
|
+
.action(addMenu);
|
|
19
14
|
return command;
|
|
20
15
|
};
|
|
21
|
-
|
|
16
|
+
export default addMenuDefinition;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
|
|
4
3
|
* All Rights Reserved
|
|
@@ -10,18 +9,14 @@
|
|
|
10
9
|
* This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
|
|
11
10
|
*
|
|
12
11
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const node_fs_1 = require("node:fs");
|
|
22
|
-
const ComponentConfig_1 = __importDefault(require("../config/ComponentConfig"));
|
|
23
|
-
const defaultConfig_1 = require("../const/defaultConfig");
|
|
24
|
-
const commonConst_1 = require("../../../common/commonConst");
|
|
12
|
+
import { TILE_VIEW } from "../const/componentConst.js";
|
|
13
|
+
import createComponent from "../createComponent.js";
|
|
14
|
+
import process from "node:process";
|
|
15
|
+
import path from "node:path";
|
|
16
|
+
import { cpSync } from "node:fs";
|
|
17
|
+
import ComponentConfig from "../config/ComponentConfig.js";
|
|
18
|
+
import { RAIL_DEFAULT_CONFIG } from "../const/defaultConfig.js";
|
|
19
|
+
import ComponentHelper from "../helper/ComponentHelper.js";
|
|
25
20
|
const addRail = async (name, options) => {
|
|
26
21
|
const data = { ...options };
|
|
27
22
|
if (name) {
|
|
@@ -29,19 +24,19 @@ const addRail = async (name, options) => {
|
|
|
29
24
|
}
|
|
30
25
|
const railConfig = {
|
|
31
26
|
...data,
|
|
32
|
-
...(await
|
|
27
|
+
...(await ComponentConfig.railConfig(data)),
|
|
33
28
|
};
|
|
34
29
|
const componentList = [railConfig];
|
|
35
30
|
if (!data.custom) {
|
|
36
|
-
componentList.push({ type:
|
|
31
|
+
componentList.push({ type: TILE_VIEW, name: data.itemView ?? RAIL_DEFAULT_CONFIG.itemView });
|
|
37
32
|
}
|
|
38
|
-
(
|
|
33
|
+
createComponent(componentList);
|
|
39
34
|
if (!data.custom) {
|
|
40
|
-
const currentDirectory =
|
|
41
|
-
const modulePath =
|
|
42
|
-
const mockPath =
|
|
43
|
-
const finalPath =
|
|
44
|
-
|
|
35
|
+
const currentDirectory = process.cwd();
|
|
36
|
+
const modulePath = ComponentHelper.getTemplatePath();
|
|
37
|
+
const mockPath = path.join(path.dirname(modulePath), "mocks", "railMock.json");
|
|
38
|
+
const finalPath = path.resolve(currentDirectory, "railMock.json");
|
|
39
|
+
cpSync(mockPath, finalPath);
|
|
45
40
|
}
|
|
46
41
|
};
|
|
47
|
-
|
|
42
|
+
export default addRail;
|
|
@@ -1,31 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const commander_1 = require("commander");
|
|
7
|
-
const add_rail_1 = __importDefault(require("./add-rail"));
|
|
8
|
-
const navigationConst_1 = require("../const/navigationConst");
|
|
9
|
-
const translation_1 = __importDefault(require("../../../common/translation/translation"));
|
|
10
|
-
const stringHelper_1 = require("../../../common/helpers/stringHelper");
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import addRail from "./add-rail.js";
|
|
3
|
+
import { NAVIGATION_TYPES, DIRECTION_TYPES } from "../const/navigationConst.js";
|
|
4
|
+
import translation from "../../../common/translation/translation.js";
|
|
5
|
+
import { optionsListString } from "../../../common/helpers/stringHelper.js";
|
|
11
6
|
const addRailDefinition = () => {
|
|
12
|
-
const command = new
|
|
7
|
+
const command = new Command("add-rail");
|
|
13
8
|
command
|
|
14
|
-
.description(
|
|
15
|
-
.argument("[name]",
|
|
16
|
-
.option("-cm, --custom",
|
|
17
|
-
.option("-n, --navigation <navigation>",
|
|
18
|
-
.option("-d, --direction <direction>",
|
|
19
|
-
.option("-c, --cyclic",
|
|
20
|
-
.option("-i, --itemView <itemView>",
|
|
9
|
+
.description(translation["command.rail.description"])
|
|
10
|
+
.argument("[name]", translation["command.component.name"])
|
|
11
|
+
.option("-cm, --custom", translation["command.component.customization"])
|
|
12
|
+
.option("-n, --navigation <navigation>", translation["command.rail.option.navigation"])
|
|
13
|
+
.option("-d, --direction <direction>", translation["command.rail.option.direction"])
|
|
14
|
+
.option("-c, --cyclic", translation["command.rail.option.cyclic"])
|
|
15
|
+
.option("-i, --itemView <itemView>", translation["command.menu.option.itemView"])
|
|
21
16
|
.addHelpText("after", `
|
|
22
|
-
${
|
|
23
|
-
-navigation: ${
|
|
24
|
-
-direction: ${
|
|
17
|
+
${translation["help.option.title"]}
|
|
18
|
+
-navigation: ${optionsListString(NAVIGATION_TYPES)}
|
|
19
|
+
-direction: ${optionsListString(DIRECTION_TYPES)}
|
|
25
20
|
|
|
26
|
-
More about rail feature, ${
|
|
21
|
+
More about rail feature, ${translation["help.option.check"]} https://doc.dana-framework.com/docs/vendorcomponents/recycling-listview
|
|
27
22
|
`)
|
|
28
|
-
.action(
|
|
23
|
+
.action(addRail);
|
|
29
24
|
return command;
|
|
30
25
|
};
|
|
31
|
-
|
|
26
|
+
export default addRailDefinition;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
|
|
4
3
|
* All Rights Reserved
|
|
@@ -10,62 +9,25 @@
|
|
|
10
9
|
* This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
|
|
11
10
|
*
|
|
12
11
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
-
var ownKeys = function(o) {
|
|
31
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
-
var ar = [];
|
|
33
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
-
return ar;
|
|
35
|
-
};
|
|
36
|
-
return ownKeys(o);
|
|
37
|
-
};
|
|
38
|
-
return function (mod) {
|
|
39
|
-
if (mod && mod.__esModule) return mod;
|
|
40
|
-
var result = {};
|
|
41
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
-
__setModuleDefault(result, mod);
|
|
43
|
-
return result;
|
|
44
|
-
};
|
|
45
|
-
})();
|
|
46
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
47
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
48
|
-
};
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
const componentConst_1 = require("../const/componentConst");
|
|
51
|
-
const createComponent_1 = __importDefault(require("../createComponent"));
|
|
52
|
-
const add_menu_1 = __importDefault(require("../addMenu/add-menu"));
|
|
53
|
-
const add_scrollView_1 = __importDefault(require("../addScrollView/add-scrollView"));
|
|
54
|
-
const prompts = __importStar(require("@clack/prompts"));
|
|
12
|
+
import { SCREEN, VOD_SCREEN } from "../const/componentConst.js";
|
|
13
|
+
import createComponent from "../createComponent.js";
|
|
14
|
+
import addMenu from "../addMenu/add-menu.js";
|
|
15
|
+
import addScrollView from "../addScrollView/add-scrollView.js";
|
|
16
|
+
import * as prompts from "@clack/prompts";
|
|
55
17
|
const addScreen = async (name, options) => {
|
|
56
18
|
try {
|
|
57
19
|
const data = {
|
|
58
20
|
name: name ?? "Mock",
|
|
59
|
-
type: options?.screenType ??
|
|
21
|
+
type: options?.screenType ?? SCREEN,
|
|
60
22
|
};
|
|
61
|
-
if (options?.screenType ===
|
|
62
|
-
await (
|
|
63
|
-
await (
|
|
23
|
+
if (options?.screenType === VOD_SCREEN) {
|
|
24
|
+
await addMenu(VOD_SCREEN, {});
|
|
25
|
+
await addScrollView(VOD_SCREEN, {});
|
|
64
26
|
}
|
|
65
|
-
(
|
|
27
|
+
createComponent([data]);
|
|
66
28
|
}
|
|
67
29
|
catch (e) {
|
|
68
30
|
prompts.log.info(`Error creating screen: ${e.message}`);
|
|
69
31
|
}
|
|
70
32
|
};
|
|
71
|
-
|
|
33
|
+
export default addScreen;
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const commander_1 = require("commander");
|
|
7
|
-
const translation_1 = __importDefault(require("../../../common/translation/translation"));
|
|
8
|
-
const add_screen_1 = __importDefault(require("./add-screen"));
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import translation from "../../../common/translation/translation.js";
|
|
3
|
+
import addScreen from "./add-screen.js";
|
|
9
4
|
const addScreenDefinition = () => {
|
|
10
|
-
const command = new
|
|
5
|
+
const command = new Command("add-screen");
|
|
11
6
|
command
|
|
12
|
-
.description(
|
|
13
|
-
.argument("[name]",
|
|
14
|
-
.option("-s, --screenType [screenType]",
|
|
15
|
-
.action(
|
|
7
|
+
.description(translation["command.screen.description"])
|
|
8
|
+
.argument("[name]", translation["command.component.name"])
|
|
9
|
+
.option("-s, --screenType [screenType]", translation["command.screen.option.type"])
|
|
10
|
+
.action(addScreen);
|
|
16
11
|
return command;
|
|
17
12
|
};
|
|
18
|
-
|
|
13
|
+
export default addScreenDefinition;
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
-
const node_fs_1 = require("node:fs");
|
|
11
|
-
const defaultConfig_1 = require("../const/defaultConfig");
|
|
12
|
-
const ComponentConfig_1 = __importDefault(require("../config/ComponentConfig"));
|
|
13
|
-
const commonConst_1 = require("../../../common/commonConst");
|
|
1
|
+
import { SCROLL_ITEM, TILE_VIEW } from "../const/componentConst.js";
|
|
2
|
+
import createComponent from "../createComponent.js";
|
|
3
|
+
import process from "node:process";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { cpSync } from "node:fs";
|
|
6
|
+
import { SCROLLVIEW_DEFAULT_CONFIG } from "../const/defaultConfig.js";
|
|
7
|
+
import ComponentConfig from "../config/ComponentConfig.js";
|
|
8
|
+
import ComponentHelper from "../helper/ComponentHelper.js";
|
|
14
9
|
const addScrollView = async (name, options) => {
|
|
15
10
|
const data = { ...options };
|
|
16
11
|
if (name) {
|
|
@@ -18,19 +13,19 @@ const addScrollView = async (name, options) => {
|
|
|
18
13
|
}
|
|
19
14
|
const scrollViewConfig = {
|
|
20
15
|
...data,
|
|
21
|
-
...(await
|
|
16
|
+
...(await ComponentConfig.scrollViewConfig(data)),
|
|
22
17
|
};
|
|
23
18
|
const componentList = [scrollViewConfig];
|
|
24
19
|
if (!data.custom) {
|
|
25
|
-
componentList.push({ type:
|
|
20
|
+
componentList.push({ type: SCROLL_ITEM, name: data.itemView ?? SCROLLVIEW_DEFAULT_CONFIG.itemView }, { type: TILE_VIEW, name: "mockTile" });
|
|
26
21
|
}
|
|
27
|
-
(
|
|
22
|
+
createComponent(componentList);
|
|
28
23
|
if (!data.custom) {
|
|
29
|
-
const currentDirectory =
|
|
30
|
-
const modulePath =
|
|
31
|
-
const mockPath =
|
|
32
|
-
const finalPath =
|
|
33
|
-
|
|
24
|
+
const currentDirectory = process.cwd();
|
|
25
|
+
const modulePath = ComponentHelper.getTemplatePath();
|
|
26
|
+
const mockPath = path.join(path.dirname(modulePath), "mocks", "scrollViewMock.json");
|
|
27
|
+
const finalPath = path.resolve(currentDirectory, "scrollViewMock.json");
|
|
28
|
+
cpSync(mockPath, finalPath);
|
|
34
29
|
}
|
|
35
30
|
};
|
|
36
|
-
|
|
31
|
+
export default addScrollView;
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const commander_1 = require("commander");
|
|
7
|
-
const add_scrollView_1 = __importDefault(require("./add-scrollView"));
|
|
8
|
-
const translation_1 = __importDefault(require("../../../common/translation/translation"));
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import addScrollView from "./add-scrollView.js";
|
|
3
|
+
import translation from "../../../common/translation/translation.js";
|
|
9
4
|
const addScrollViewDefinition = () => {
|
|
10
|
-
return new
|
|
11
|
-
.description(
|
|
12
|
-
.argument("[name]",
|
|
13
|
-
.option("-cm, --custom",
|
|
14
|
-
.option("-i, --itemView <itemView>",
|
|
15
|
-
.option("-m, --itemMargin <itemMargin>",
|
|
16
|
-
.action(
|
|
5
|
+
return new Command("add-scrollView")
|
|
6
|
+
.description(translation["command.scrollView.description"])
|
|
7
|
+
.argument("[name]", translation["command.component.name"])
|
|
8
|
+
.option("-cm, --custom", translation["command.component.customization"])
|
|
9
|
+
.option("-i, --itemView <itemView>", translation["command.menu.option.itemView"])
|
|
10
|
+
.option("-m, --itemMargin <itemMargin>", translation["command.menu.option.itemMargin"])
|
|
11
|
+
.action(addScrollView);
|
|
17
12
|
};
|
|
18
|
-
|
|
13
|
+
export default addScrollViewDefinition;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RailConfig, MenuConfig, ScreenConfig, ScrollViewConfig } from "./componentTypes";
|
|
2
|
-
import { ConfigOptions, OptionList } from "../../../common/types/helperTypes";
|
|
1
|
+
import { RailConfig, MenuConfig, ScreenConfig, ScrollViewConfig } from "./componentTypes.js";
|
|
2
|
+
import { ConfigOptions, OptionList } from "../../../common/types/helperTypes.js";
|
|
3
3
|
interface AskComponentParam {
|
|
4
4
|
componentOption: string;
|
|
5
5
|
optionList: OptionList;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
|
|
4
3
|
* All Rights Reserved
|
|
@@ -10,50 +9,13 @@
|
|
|
10
9
|
* This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
|
|
11
10
|
*
|
|
12
11
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
-
var ownKeys = function(o) {
|
|
31
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
-
var ar = [];
|
|
33
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
-
return ar;
|
|
35
|
-
};
|
|
36
|
-
return ownKeys(o);
|
|
37
|
-
};
|
|
38
|
-
return function (mod) {
|
|
39
|
-
if (mod && mod.__esModule) return mod;
|
|
40
|
-
var result = {};
|
|
41
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
-
__setModuleDefault(result, mod);
|
|
43
|
-
return result;
|
|
44
|
-
};
|
|
45
|
-
})();
|
|
46
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
47
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
48
|
-
};
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
const prompts = __importStar(require("@clack/prompts"));
|
|
51
|
-
const ComponentHelper_1 = __importDefault(require("../helper/ComponentHelper"));
|
|
52
|
-
const navigationConst_1 = require("../const/navigationConst");
|
|
53
|
-
const exitCodeConst_1 = require("../../../common/const/exitCodeConst");
|
|
54
|
-
const InputValidator_1 = require("../../../common/helpers/InputValidator");
|
|
55
|
-
const defaultConfig_1 = require("../const/defaultConfig");
|
|
56
|
-
const stringHelper_1 = require("../../../common/helpers/stringHelper");
|
|
12
|
+
import * as prompts from "@clack/prompts";
|
|
13
|
+
import ComponentHelper from "../helper/ComponentHelper.js";
|
|
14
|
+
import { DIRECTION_TYPES, NAVIGATION_TYPES } from "../const/navigationConst.js";
|
|
15
|
+
import { CANCEL } from "../../../common/const/exitCodeConst.js";
|
|
16
|
+
import { validInputLength, validNumber } from "../../../common/helpers/InputValidator.js";
|
|
17
|
+
import { RAIL_DEFAULT_CONFIG, MENU_DEFAULT_CONFIG, SCROLLVIEW_DEFAULT_CONFIG } from "../const/defaultConfig.js";
|
|
18
|
+
import { capitalizeFirstLetter } from "../../../common/helpers/stringHelper.js";
|
|
57
19
|
const ComponentConfig = class {
|
|
58
20
|
/**
|
|
59
21
|
* Get component or element name from user
|
|
@@ -64,9 +26,9 @@ const ComponentConfig = class {
|
|
|
64
26
|
name = (await prompts.text({
|
|
65
27
|
message: `${componentType} name`,
|
|
66
28
|
placeholder: "Placeholder Name",
|
|
67
|
-
validate: (value) =>
|
|
29
|
+
validate: (value) => validInputLength(value, errorMessage),
|
|
68
30
|
}));
|
|
69
|
-
|
|
31
|
+
ComponentHelper.handleCancellation(name);
|
|
70
32
|
}
|
|
71
33
|
return name.trim();
|
|
72
34
|
};
|
|
@@ -78,9 +40,9 @@ const ComponentConfig = class {
|
|
|
78
40
|
const numberValue = (await prompts.text({
|
|
79
41
|
message,
|
|
80
42
|
placeholder: "00",
|
|
81
|
-
validate: (value) =>
|
|
43
|
+
validate: (value) => validNumber(value, errorMessage),
|
|
82
44
|
}));
|
|
83
|
-
|
|
45
|
+
ComponentHelper.handleCancellation(numberValue);
|
|
84
46
|
return +numberValue;
|
|
85
47
|
}
|
|
86
48
|
return numberValue;
|
|
@@ -94,10 +56,10 @@ const ComponentConfig = class {
|
|
|
94
56
|
*/
|
|
95
57
|
static askComponentOption = async (dataOption) => {
|
|
96
58
|
const { componentOption, optionList, optionType } = dataOption;
|
|
97
|
-
let finalOption =
|
|
59
|
+
let finalOption = ComponentHelper.checkOption(componentOption, optionList, optionType);
|
|
98
60
|
if (!finalOption) {
|
|
99
|
-
const selectionMessage = `${
|
|
100
|
-
finalOption = await
|
|
61
|
+
const selectionMessage = `${capitalizeFirstLetter(optionType)} option`;
|
|
62
|
+
finalOption = await ComponentHelper.selectionFactory(optionType, optionList, selectionMessage);
|
|
101
63
|
}
|
|
102
64
|
return finalOption;
|
|
103
65
|
};
|
|
@@ -106,31 +68,31 @@ const ComponentConfig = class {
|
|
|
106
68
|
const cyclic = (await prompts.confirm({
|
|
107
69
|
message: "Cyclic list ?",
|
|
108
70
|
}));
|
|
109
|
-
|
|
71
|
+
ComponentHelper.handleCancellation(cyclic);
|
|
110
72
|
return cyclic;
|
|
111
73
|
}
|
|
112
74
|
return data.cyclic;
|
|
113
75
|
};
|
|
114
76
|
static handlePromptCancel = () => {
|
|
115
77
|
prompts.cancel("Operation cancelled.");
|
|
116
|
-
process.exit(
|
|
78
|
+
process.exit(CANCEL);
|
|
117
79
|
};
|
|
118
80
|
static getDefaultConfig = (data, defaultConfig) => {
|
|
119
81
|
return { ...defaultConfig, ...data, addMock: !data.custom };
|
|
120
82
|
};
|
|
121
83
|
static railConfig = async (data) => {
|
|
122
|
-
const config = ComponentConfig.getDefaultConfig(data,
|
|
84
|
+
const config = ComponentConfig.getDefaultConfig(data, RAIL_DEFAULT_CONFIG);
|
|
123
85
|
if (data.custom) {
|
|
124
86
|
const customConfig = await prompts.group({
|
|
125
87
|
name: async () => await this.askName("rail", data.name),
|
|
126
88
|
navigation: async () => await this.askComponentOption({
|
|
127
89
|
componentOption: data.navigation,
|
|
128
|
-
optionList:
|
|
90
|
+
optionList: NAVIGATION_TYPES,
|
|
129
91
|
optionType: "navigation",
|
|
130
92
|
}),
|
|
131
93
|
direction: async () => await this.askComponentOption({
|
|
132
94
|
componentOption: data.direction,
|
|
133
|
-
optionList:
|
|
95
|
+
optionList: DIRECTION_TYPES,
|
|
134
96
|
optionType: "direction",
|
|
135
97
|
}),
|
|
136
98
|
isCyclic: async () => await this.askCyclic(data),
|
|
@@ -141,7 +103,7 @@ const ComponentConfig = class {
|
|
|
141
103
|
return config;
|
|
142
104
|
};
|
|
143
105
|
static menuConfig = async (data) => {
|
|
144
|
-
const config = ComponentConfig.getDefaultConfig(data,
|
|
106
|
+
const config = ComponentConfig.getDefaultConfig(data, MENU_DEFAULT_CONFIG);
|
|
145
107
|
if (data.custom) {
|
|
146
108
|
const customConfig = await prompts.group({
|
|
147
109
|
name: async () => await this.askName("menu", data.name),
|
|
@@ -149,7 +111,7 @@ const ComponentConfig = class {
|
|
|
149
111
|
itemMargin: async () => await this.askNumber("item margin", data.itemMargin),
|
|
150
112
|
direction: async () => await this.askComponentOption({
|
|
151
113
|
componentOption: data.direction,
|
|
152
|
-
optionList:
|
|
114
|
+
optionList: DIRECTION_TYPES,
|
|
153
115
|
optionType: "direction",
|
|
154
116
|
}),
|
|
155
117
|
}, { onCancel: () => ComponentConfig.handlePromptCancel() });
|
|
@@ -158,7 +120,7 @@ const ComponentConfig = class {
|
|
|
158
120
|
return config;
|
|
159
121
|
};
|
|
160
122
|
static scrollViewConfig = async (data) => {
|
|
161
|
-
const config = ComponentConfig.getDefaultConfig(data,
|
|
123
|
+
const config = ComponentConfig.getDefaultConfig(data, SCROLLVIEW_DEFAULT_CONFIG);
|
|
162
124
|
if (data.custom) {
|
|
163
125
|
const customConfig = await prompts.group({
|
|
164
126
|
name: async () => await this.askName("scrollView", data.name),
|
|
@@ -175,4 +137,4 @@ const ComponentConfig = class {
|
|
|
175
137
|
};
|
|
176
138
|
};
|
|
177
139
|
};
|
|
178
|
-
|
|
140
|
+
export default ComponentConfig;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
|
|
4
3
|
* All Rights Reserved
|
|
@@ -10,13 +9,11 @@
|
|
|
10
9
|
* This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
|
|
11
10
|
*
|
|
12
11
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
exports.SCREEN = "screen";
|
|
22
|
-
exports.VOD_SCREEN = "vod";
|
|
12
|
+
export const MENU = "wtvMenuListView";
|
|
13
|
+
export const RAIL = "wtvRailListView";
|
|
14
|
+
export const TILE_VIEW = "tileView";
|
|
15
|
+
export const SCROLL_VIEW = "scrollView";
|
|
16
|
+
export const SCROLL_ITEM = "scrollItemView";
|
|
17
|
+
export const BUTTON_ITEM_VIEW = "ButtonItemView";
|
|
18
|
+
export const SCREEN = "screen";
|
|
19
|
+
export const VOD_SCREEN = "vod";
|