@wiztivi/dana-cli 0.0.1 → 0.0.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/bin/dana.js +3 -0
- package/dana_completion.sh +153 -0
- package/dist/commands/add-device.d.ts +2 -0
- package/dist/commands/add-device.js +126 -0
- package/dist/commands/add-menu.d.ts +7 -0
- package/dist/commands/add-menu.js +51 -0
- package/dist/commands/add-rail.d.ts +10 -0
- package/dist/commands/add-rail.js +48 -0
- package/dist/commands/add-screen.d.ts +5 -0
- package/dist/commands/add-screen.js +71 -0
- package/dist/commands/add-scrollView.d.ts +7 -0
- package/dist/commands/add-scrollView.js +37 -0
- package/dist/commands/auth/login.d.ts +5 -0
- package/dist/commands/auth/login.js +141 -0
- package/dist/commands/auth/status.d.ts +11 -0
- package/dist/commands/auth/status.js +76 -0
- package/dist/commands/commandDefinitions/addDeviceDefinition.d.ts +3 -0
- package/dist/commands/commandDefinitions/addDeviceDefinition.js +16 -0
- package/dist/commands/commandDefinitions/addMenuDefinition.d.ts +3 -0
- package/dist/commands/commandDefinitions/addMenuDefinition.js +21 -0
- package/dist/commands/commandDefinitions/addRailDefinition.d.ts +3 -0
- package/dist/commands/commandDefinitions/addRailDefinition.js +31 -0
- package/dist/commands/commandDefinitions/addScreenDefinition.d.ts +3 -0
- package/dist/commands/commandDefinitions/addScreenDefinition.js +18 -0
- package/dist/commands/commandDefinitions/addScrollViewDefinition.d.ts +3 -0
- package/dist/commands/commandDefinitions/addScrollViewDefinition.js +18 -0
- package/dist/commands/commandDefinitions/authDefinition.d.ts +3 -0
- package/dist/commands/commandDefinitions/authDefinition.js +23 -0
- package/dist/commands/commandDefinitions/completionDefinition.d.ts +3 -0
- package/dist/commands/commandDefinitions/completionDefinition.js +17 -0
- package/dist/commands/commandDefinitions/createAppDefinition.d.ts +3 -0
- package/dist/commands/commandDefinitions/createAppDefinition.js +22 -0
- package/dist/commands/completion.d.ts +2 -0
- package/dist/commands/completion.js +84 -0
- package/dist/commands/createApp.d.ts +6 -0
- package/dist/commands/createApp.js +130 -0
- package/dist/commands/createComponent.d.ts +3 -0
- package/dist/commands/createComponent.js +81 -0
- package/dist/commands/help/customHelp.d.ts +3 -0
- package/dist/commands/help/customHelp.js +31 -0
- package/dist/commands/hooks/authHook.d.ts +1 -0
- package/dist/commands/hooks/authHook.js +23 -0
- package/dist/configs/ComponentConfig.d.ts +32 -0
- package/dist/configs/ComponentConfig.js +178 -0
- package/dist/configs/deviceConfig/androidtvConfig.d.ts +37 -0
- package/dist/configs/deviceConfig/androidtvConfig.js +186 -0
- package/dist/configs/deviceConfig/deviceConfig.d.ts +14 -0
- package/dist/configs/deviceConfig/deviceConfig.js +35 -0
- package/dist/configs/deviceConfig/tizenConfig.d.ts +31 -0
- package/dist/configs/deviceConfig/tizenConfig.js +56 -0
- package/dist/configs/deviceConfig/tvosConfig.d.ts +13 -0
- package/dist/configs/deviceConfig/tvosConfig.js +32 -0
- package/dist/configs/deviceConfig/webosConfig.d.ts +59 -0
- package/dist/configs/deviceConfig/webosConfig.js +179 -0
- package/dist/const/authentConst.d.ts +3 -0
- package/dist/const/authentConst.js +6 -0
- package/dist/const/componentConst.d.ts +8 -0
- package/dist/const/componentConst.js +22 -0
- package/dist/const/createApp/deviceConst.d.ts +23 -0
- package/dist/const/createApp/deviceConst.js +73 -0
- package/dist/const/createApp/setupConst.d.ts +3 -0
- package/dist/const/createApp/setupConst.js +18 -0
- package/dist/const/defaultConfig.d.ts +4 -0
- package/dist/const/defaultConfig.js +27 -0
- package/dist/const/exitCodeConst.d.ts +7 -0
- package/dist/const/exitCodeConst.js +10 -0
- package/dist/const/navigationConst.d.ts +3 -0
- package/dist/const/navigationConst.js +36 -0
- package/dist/dana_completion.sh +153 -0
- package/dist/helpers/CliHelper.d.ts +13 -0
- package/dist/helpers/CliHelper.js +39 -0
- package/dist/helpers/CodeArtifactHelper.d.ts +12 -0
- package/dist/helpers/CodeArtifactHelper.js +52 -0
- package/dist/helpers/ComponentHelper.d.ts +12 -0
- package/dist/helpers/ComponentHelper.js +105 -0
- package/dist/helpers/CredentialsHelper.d.ts +27 -0
- package/dist/helpers/CredentialsHelper.js +22 -0
- package/dist/helpers/createApp/CreateFileHelper.d.ts +31 -0
- package/dist/helpers/createApp/CreateFileHelper.js +84 -0
- package/dist/helpers/createApp/InputValidator.d.ts +5 -0
- package/dist/helpers/createApp/InputValidator.js +60 -0
- package/dist/helpers/createApp/InstallHelper.d.ts +30 -0
- package/dist/helpers/createApp/InstallHelper.js +112 -0
- package/dist/helpers/createApp/ScriptHelper.d.ts +116 -0
- package/dist/helpers/createApp/ScriptHelper.js +142 -0
- package/dist/helpers/createApp/SetupChecker.d.ts +25 -0
- package/dist/helpers/createApp/SetupChecker.js +128 -0
- package/dist/helpers/createApp/UpdateFileHelper.d.ts +40 -0
- package/dist/helpers/createApp/UpdateFileHelper.js +121 -0
- package/dist/helpers/createApp/UserInputGetter.d.ts +49 -0
- package/dist/helpers/createApp/UserInputGetter.js +145 -0
- package/dist/helpers/handlebarsHelper.d.ts +2 -0
- package/dist/helpers/handlebarsHelper.js +26 -0
- package/dist/helpers/stringHelper.d.ts +3 -0
- package/dist/helpers/stringHelper.js +11 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +16 -0
- package/dist/program.d.ts +2 -0
- package/dist/program.js +42 -0
- package/dist/translation/en.json +62 -0
- package/dist/translation/translation.d.ts +2 -0
- package/dist/translation/translation.js +8 -0
- package/dist/types/componentTypes.d.ts +31 -0
- package/dist/types/componentTypes.js +2 -0
- package/dist/types/createApp/configTypes.d.ts +27 -0
- package/dist/types/createApp/configTypes.js +13 -0
- package/dist/types/createApp/helperTypes.d.ts +35 -0
- package/dist/types/createApp/helperTypes.js +14 -0
- package/dist/types/genericTypes.d.ts +17 -0
- package/dist/types/genericTypes.js +2 -0
- package/package.json +41 -22
- package/README.md +0 -5
- package/index.js +0 -1
package/bin/dana.js
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
|
|
3
|
+
# Unified completion script for dana CLI
|
|
4
|
+
# Detects shell and loads appropriate completion
|
|
5
|
+
|
|
6
|
+
# Shared command list
|
|
7
|
+
dana_commands=(
|
|
8
|
+
'add-device'
|
|
9
|
+
'add-menu'
|
|
10
|
+
'add-rail'
|
|
11
|
+
'add-scrollView'
|
|
12
|
+
'add-screen'
|
|
13
|
+
'auth'
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
# Shared subcommand declarations
|
|
17
|
+
login_sub="login"
|
|
18
|
+
logout_sub="logout"
|
|
19
|
+
status_sub="status"
|
|
20
|
+
|
|
21
|
+
# Shared option declarations
|
|
22
|
+
direction_opts="-d --direction"
|
|
23
|
+
navigation_opts="-n --navigation"
|
|
24
|
+
cyclic_opts="-c --cyclic"
|
|
25
|
+
margin_opts="-m --itemMargin"
|
|
26
|
+
custom_opts="-cm --custom"
|
|
27
|
+
item_view_opts="-i --itemView"
|
|
28
|
+
org_opts="-o --org"
|
|
29
|
+
|
|
30
|
+
# Shared option values
|
|
31
|
+
direction_values="h v"
|
|
32
|
+
navigation_values="fixed lmr lr paginated"
|
|
33
|
+
org_values="preprod"
|
|
34
|
+
|
|
35
|
+
# Detect shell and load appropriate completion
|
|
36
|
+
if [ -n "$BASH_VERSION" ]; then
|
|
37
|
+
# Bash completion
|
|
38
|
+
_dana()
|
|
39
|
+
{
|
|
40
|
+
local cur prev opts
|
|
41
|
+
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
42
|
+
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
43
|
+
|
|
44
|
+
# Complete option values
|
|
45
|
+
case "$prev" in
|
|
46
|
+
-d|--direction)
|
|
47
|
+
COMPREPLY=($(compgen -W "$direction_values" -- "$cur"))
|
|
48
|
+
return 0
|
|
49
|
+
;;
|
|
50
|
+
-n|--navigation)
|
|
51
|
+
COMPREPLY=($(compgen -W "$navigation_values" -- "$cur"))
|
|
52
|
+
return 0
|
|
53
|
+
;;
|
|
54
|
+
-o|--org)
|
|
55
|
+
COMPREPLY=($(compgen -W "$org_values" -- "$cur"))
|
|
56
|
+
return 0
|
|
57
|
+
;;
|
|
58
|
+
esac
|
|
59
|
+
|
|
60
|
+
# If we're completing the first argument (command)
|
|
61
|
+
if [[ $COMP_CWORD -eq 1 ]]; then
|
|
62
|
+
COMPREPLY=($(compgen -W "${dana_commands[*]}" -- "$cur"))
|
|
63
|
+
return 0
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
# If we're completing options for specific commands
|
|
67
|
+
local cmd="${COMP_WORDS[1]}"
|
|
68
|
+
case "$cmd" in
|
|
69
|
+
add-rail)
|
|
70
|
+
opts="$navigation_opts $cyclic_opts $direction_opts $custom_opts $item_view_opts"
|
|
71
|
+
COMPREPLY=($(compgen -W "$opts" -- "$cur"))
|
|
72
|
+
;;
|
|
73
|
+
add-menu)
|
|
74
|
+
opts="$direction_opts $margin_opts $custom_opts $item_view_opts"
|
|
75
|
+
COMPREPLY=($(compgen -W "$opts" -- "$cur"))
|
|
76
|
+
;;
|
|
77
|
+
add-scrollView)
|
|
78
|
+
opts="$custom_opts $item_view_opts $margin_opts"
|
|
79
|
+
COMPREPLY=($(compgen -W "$opts" -- "$cur"))
|
|
80
|
+
;;
|
|
81
|
+
auth)
|
|
82
|
+
if [[ $COMP_CWORD -eq 2 ]]; then
|
|
83
|
+
opts="$login_sub $logout_sub $status_sub"
|
|
84
|
+
else
|
|
85
|
+
opts="$org_opts"
|
|
86
|
+
fi
|
|
87
|
+
COMPREPLY=($(compgen -W "$opts" -- "$cur"))
|
|
88
|
+
;;
|
|
89
|
+
*)
|
|
90
|
+
COMPREPLY=()
|
|
91
|
+
;;
|
|
92
|
+
esac
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
complete -F _dana dana
|
|
96
|
+
|
|
97
|
+
elif [ -n "$ZSH_VERSION" ]; then
|
|
98
|
+
# Zsh completion
|
|
99
|
+
_dana() {
|
|
100
|
+
# Main commands
|
|
101
|
+
if (( CURRENT == 2 )); then
|
|
102
|
+
local -a commands
|
|
103
|
+
commands=(${dana_commands[@]})
|
|
104
|
+
compadd -a commands
|
|
105
|
+
return
|
|
106
|
+
fi
|
|
107
|
+
|
|
108
|
+
# Complete option values
|
|
109
|
+
local prev=${words[CURRENT-1]}
|
|
110
|
+
case "$prev" in
|
|
111
|
+
-d|--direction)
|
|
112
|
+
compadd -- ${=direction_values}
|
|
113
|
+
return
|
|
114
|
+
;;
|
|
115
|
+
-n|--navigation)
|
|
116
|
+
compadd -- ${=navigation_values}
|
|
117
|
+
return
|
|
118
|
+
;;
|
|
119
|
+
-o|--org)
|
|
120
|
+
compadd -- ${=org_values}
|
|
121
|
+
return
|
|
122
|
+
;;
|
|
123
|
+
login|logout|status)
|
|
124
|
+
compadd -- ${=org_opts}
|
|
125
|
+
return
|
|
126
|
+
;;
|
|
127
|
+
esac
|
|
128
|
+
|
|
129
|
+
# Complete options for commands
|
|
130
|
+
local cmd=${words[2]}
|
|
131
|
+
case "$cmd" in
|
|
132
|
+
add-rail)
|
|
133
|
+
compadd -- ${=navigation_opts} ${=cyclic_opts} ${=direction_opts} ${=custom_opts} ${=item_view_opts}
|
|
134
|
+
;;
|
|
135
|
+
add-menu)
|
|
136
|
+
compadd -- ${=direction_opts} ${=margin_opts} ${=custom_opts} ${=item_view_opts}
|
|
137
|
+
;;
|
|
138
|
+
add-scrollView)
|
|
139
|
+
compadd -- ${=custom_opts} ${=item_view_opts} ${=margin_opts}
|
|
140
|
+
;;
|
|
141
|
+
auth)
|
|
142
|
+
if (( CURRENT == 3 )); then
|
|
143
|
+
compadd -- ${=login_sub} ${=logout_sub} ${=status_sub}
|
|
144
|
+
else
|
|
145
|
+
compadd -- ${=org_opts}
|
|
146
|
+
fi
|
|
147
|
+
;;
|
|
148
|
+
esac
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
# Register the completion
|
|
152
|
+
compdef _dana dana
|
|
153
|
+
fi
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
|
|
4
|
+
* All Rights Reserved
|
|
5
|
+
*
|
|
6
|
+
* All information contained herein is proprietary and confidential.
|
|
7
|
+
* Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
|
|
8
|
+
* prior written permission is obtained from Wiztivi.
|
|
9
|
+
* No warranty, explicit or implicit, provided.
|
|
10
|
+
* This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
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 UserInputGetter_1 = __importDefault(require("../helpers/createApp/UserInputGetter"));
|
|
51
|
+
const UpdateFileHelper_1 = __importDefault(require("../helpers/createApp/UpdateFileHelper"));
|
|
52
|
+
const InstallHelper_1 = __importDefault(require("../helpers/createApp/InstallHelper"));
|
|
53
|
+
const ScriptHelper_1 = __importDefault(require("../helpers/createApp/ScriptHelper"));
|
|
54
|
+
const CreateFileHelper_1 = __importDefault(require("../helpers/createApp/CreateFileHelper"));
|
|
55
|
+
const CliHelper_1 = __importDefault(require("../helpers/CliHelper"));
|
|
56
|
+
const prompts = __importStar(require("@clack/prompts"));
|
|
57
|
+
const path_1 = __importDefault(require("path"));
|
|
58
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
59
|
+
const exitCodeConst_1 = require("../const/exitCodeConst");
|
|
60
|
+
const node_process_1 = __importDefault(require("node:process"));
|
|
61
|
+
const translation_1 = __importDefault(require("../translation/translation"));
|
|
62
|
+
const CredentialsHelper_1 = require("../helpers/CredentialsHelper");
|
|
63
|
+
const addDevice = async () => {
|
|
64
|
+
prompts.intro(`Add device(s) to ${path_1.default.basename(node_process_1.default.cwd())} !`);
|
|
65
|
+
const data = {};
|
|
66
|
+
try {
|
|
67
|
+
data.directory = "./";
|
|
68
|
+
data.awsProfile = CredentialsHelper_1.CredentialsHelper.get().org;
|
|
69
|
+
const { availableDevices, unavailableDevices } = await UserInputGetter_1.default.getAvailableDevices();
|
|
70
|
+
const installedDevices = CliHelper_1.default.getInstalledDevices(data.directory);
|
|
71
|
+
const filteredAvailableDevices = availableDevices.filter((el) => !installedDevices.includes(el.value));
|
|
72
|
+
if (unavailableDevices.length) {
|
|
73
|
+
ScriptHelper_1.default.promptUnavailableDevices(unavailableDevices);
|
|
74
|
+
}
|
|
75
|
+
if (filteredAvailableDevices.length) {
|
|
76
|
+
data.selectedDevices = await ScriptHelper_1.default.promptSelectDevices(filteredAvailableDevices);
|
|
77
|
+
}
|
|
78
|
+
if (!data.selectedDevices?.length) {
|
|
79
|
+
prompts.outro(translation_1.default["command.device.no_selection"]);
|
|
80
|
+
return Promise.resolve();
|
|
81
|
+
}
|
|
82
|
+
data.config = await UserInputGetter_1.default.getDevicesConfig(data);
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
const message = e instanceof Error ? e.message : e;
|
|
86
|
+
prompts.outro(picocolors_1.default.red(`An issue occurred :` + message));
|
|
87
|
+
node_process_1.default.exit(exitCodeConst_1.DEVICE_ERROR);
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
await ScriptHelper_1.default.installation([
|
|
91
|
+
{
|
|
92
|
+
title: "Update package.json",
|
|
93
|
+
task: async () => UpdateFileHelper_1.default.updatePackageJson(data),
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
title: "Copy app.config files",
|
|
97
|
+
task: async () => CreateFileHelper_1.default.copyAppConfigFiles(data),
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
title: "Update app.config.json",
|
|
101
|
+
task: async () => UpdateFileHelper_1.default.updateAppConfigFile(data),
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
title: "Install dependencies with npm",
|
|
105
|
+
task: async () => InstallHelper_1.default.installDependencies(data),
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
title: "Execute grunt tasks",
|
|
109
|
+
task: async () => CreateFileHelper_1.default.executeGruntTasks(data),
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
title: "Execute devices config",
|
|
113
|
+
task: async () => UpdateFileHelper_1.default.setDevicesConfig(data),
|
|
114
|
+
},
|
|
115
|
+
]);
|
|
116
|
+
}
|
|
117
|
+
catch (e) {
|
|
118
|
+
CliHelper_1.default.cleanOnError();
|
|
119
|
+
const message = e instanceof Error ? e.message : e;
|
|
120
|
+
prompts.outro(picocolors_1.default.red(`${translation_1.default["error.common.start.message"]} ${message}`));
|
|
121
|
+
node_process_1.default.exit(exitCodeConst_1.DEVICE_ERROR);
|
|
122
|
+
}
|
|
123
|
+
prompts.outro("Everything is ready ! Don't forget to commit your change.");
|
|
124
|
+
return Promise.resolve();
|
|
125
|
+
};
|
|
126
|
+
exports.default = addDevice;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
|
|
4
|
+
* All Rights Reserved
|
|
5
|
+
*
|
|
6
|
+
* All information contained herein is proprietary and confidential.
|
|
7
|
+
* Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
|
|
8
|
+
* prior written permission is obtained from Wiztivi.
|
|
9
|
+
* No warranty, explicit or implicit, provided.
|
|
10
|
+
* This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const componentConst_1 = require("../const/componentConst");
|
|
18
|
+
const createComponent_1 = __importDefault(require("./createComponent"));
|
|
19
|
+
const node_process_1 = __importDefault(require("node:process"));
|
|
20
|
+
const node_module_1 = require("node:module");
|
|
21
|
+
const path_1 = __importDefault(require("path"));
|
|
22
|
+
const fs_1 = require("fs");
|
|
23
|
+
const ComponentConfig_1 = __importDefault(require("../configs/ComponentConfig"));
|
|
24
|
+
const defaultConfig_1 = require("../const/defaultConfig");
|
|
25
|
+
const addMenu = async (name, options) => {
|
|
26
|
+
const data = { ...options };
|
|
27
|
+
if (name) {
|
|
28
|
+
data.name = name;
|
|
29
|
+
}
|
|
30
|
+
const menuConfig = {
|
|
31
|
+
...data,
|
|
32
|
+
...(await ComponentConfig_1.default.menuConfig(data)),
|
|
33
|
+
};
|
|
34
|
+
const componentList = [menuConfig];
|
|
35
|
+
if (!data.custom) {
|
|
36
|
+
componentList.push({ type: componentConst_1.BUTTON_ITEM_VIEW, name: data.itemView ?? defaultConfig_1.MENU_DEFAULT_CONFIG.itemView });
|
|
37
|
+
}
|
|
38
|
+
(0, createComponent_1.default)(componentList);
|
|
39
|
+
if (!data.custom) {
|
|
40
|
+
const currentDirectory = node_process_1.default.cwd();
|
|
41
|
+
const require = (0, node_module_1.createRequire)(currentDirectory);
|
|
42
|
+
const modulePath = require.resolve("@wiztivi/dana-templates");
|
|
43
|
+
const mockPath = path_1.default.join(path_1.default.dirname(modulePath), "mocks", "menuMock.json");
|
|
44
|
+
const iconPath = path_1.default.join(path_1.default.dirname(modulePath), "icons");
|
|
45
|
+
const mockFinalPath = path_1.default.resolve(currentDirectory, "menuMock.json");
|
|
46
|
+
const iconFinalPath = path_1.default.resolve(currentDirectory, "./images/icons");
|
|
47
|
+
(0, fs_1.cpSync)(mockPath, mockFinalPath);
|
|
48
|
+
(0, fs_1.cpSync)(iconPath, iconFinalPath, { recursive: true });
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
exports.default = addMenu;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface CommandOptions {
|
|
2
|
+
navigation?: string;
|
|
3
|
+
direction?: string;
|
|
4
|
+
cyclic?: boolean;
|
|
5
|
+
custom?: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
itemView?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const addRail: (name?: string, options?: CommandOptions) => Promise<void>;
|
|
10
|
+
export default addRail;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
|
|
4
|
+
* All Rights Reserved
|
|
5
|
+
*
|
|
6
|
+
* All information contained herein is proprietary and confidential.
|
|
7
|
+
* Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
|
|
8
|
+
* prior written permission is obtained from Wiztivi.
|
|
9
|
+
* No warranty, explicit or implicit, provided.
|
|
10
|
+
* This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const componentConst_1 = require("../const/componentConst");
|
|
18
|
+
const createComponent_1 = __importDefault(require("./createComponent"));
|
|
19
|
+
const node_process_1 = __importDefault(require("node:process"));
|
|
20
|
+
const node_module_1 = require("node:module");
|
|
21
|
+
const path_1 = __importDefault(require("path"));
|
|
22
|
+
const fs_1 = require("fs");
|
|
23
|
+
const ComponentConfig_1 = __importDefault(require("../configs/ComponentConfig"));
|
|
24
|
+
const defaultConfig_1 = require("../const/defaultConfig");
|
|
25
|
+
const addRail = async (name, options) => {
|
|
26
|
+
const data = { ...options };
|
|
27
|
+
if (name) {
|
|
28
|
+
data.name = name;
|
|
29
|
+
}
|
|
30
|
+
const railConfig = {
|
|
31
|
+
...data,
|
|
32
|
+
...(await ComponentConfig_1.default.railConfig(data)),
|
|
33
|
+
};
|
|
34
|
+
const componentList = [railConfig];
|
|
35
|
+
if (!data.custom) {
|
|
36
|
+
componentList.push({ type: componentConst_1.TILE_VIEW, name: data.itemView ?? defaultConfig_1.RAIL_DEFAULT_CONFIG.itemView });
|
|
37
|
+
}
|
|
38
|
+
(0, createComponent_1.default)(componentList);
|
|
39
|
+
if (!data.custom) {
|
|
40
|
+
const currentDirectory = node_process_1.default.cwd();
|
|
41
|
+
const require = (0, node_module_1.createRequire)(currentDirectory);
|
|
42
|
+
const modulePath = require.resolve("@wiztivi/dana-templates");
|
|
43
|
+
const mockPath = path_1.default.join(path_1.default.dirname(modulePath), "mocks", "railMock.json");
|
|
44
|
+
const finalPath = path_1.default.resolve(currentDirectory, "railMock.json");
|
|
45
|
+
(0, fs_1.cpSync)(mockPath, finalPath);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
exports.default = addRail;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
|
|
4
|
+
* All Rights Reserved
|
|
5
|
+
*
|
|
6
|
+
* All information contained herein is proprietary and confidential.
|
|
7
|
+
* Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
|
|
8
|
+
* prior written permission is obtained from Wiztivi.
|
|
9
|
+
* No warranty, explicit or implicit, provided.
|
|
10
|
+
* This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
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("./add-menu"));
|
|
53
|
+
const add_scrollView_1 = __importDefault(require("./add-scrollView"));
|
|
54
|
+
const prompts = __importStar(require("@clack/prompts"));
|
|
55
|
+
const addScreen = async (name, options) => {
|
|
56
|
+
try {
|
|
57
|
+
const data = {
|
|
58
|
+
name: name ?? "Mock",
|
|
59
|
+
type: options?.screenType ?? componentConst_1.SCREEN,
|
|
60
|
+
};
|
|
61
|
+
if (options?.screenType === componentConst_1.VOD_SCREEN) {
|
|
62
|
+
await (0, add_menu_1.default)(componentConst_1.VOD_SCREEN, {});
|
|
63
|
+
await (0, add_scrollView_1.default)(componentConst_1.VOD_SCREEN, {});
|
|
64
|
+
}
|
|
65
|
+
(0, createComponent_1.default)([data]);
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
prompts.log.info("Error creating screen");
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
exports.default = addScreen;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const componentConst_1 = require("../const/componentConst");
|
|
7
|
+
const createComponent_1 = __importDefault(require("./createComponent"));
|
|
8
|
+
const node_process_1 = __importDefault(require("node:process"));
|
|
9
|
+
const node_module_1 = require("node:module");
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const fs_1 = require("fs");
|
|
12
|
+
const defaultConfig_1 = require("../const/defaultConfig");
|
|
13
|
+
const ComponentConfig_1 = __importDefault(require("../configs/ComponentConfig"));
|
|
14
|
+
const addScrollView = async (name, options) => {
|
|
15
|
+
const data = { ...options };
|
|
16
|
+
if (name) {
|
|
17
|
+
data.name = name;
|
|
18
|
+
}
|
|
19
|
+
const scrollViewConfig = {
|
|
20
|
+
...data,
|
|
21
|
+
...(await ComponentConfig_1.default.scrollViewConfig(data)),
|
|
22
|
+
};
|
|
23
|
+
const componentList = [scrollViewConfig];
|
|
24
|
+
if (!data.custom) {
|
|
25
|
+
componentList.push({ type: componentConst_1.SCROLL_ITEM, name: data.itemView ?? defaultConfig_1.SCROLLVIEW_DEFAULT_CONFIG.itemView }, { type: componentConst_1.TILE_VIEW, name: "mockTile" });
|
|
26
|
+
}
|
|
27
|
+
(0, createComponent_1.default)(componentList);
|
|
28
|
+
if (!data.custom) {
|
|
29
|
+
const currentDirectory = node_process_1.default.cwd();
|
|
30
|
+
const require = (0, node_module_1.createRequire)(currentDirectory);
|
|
31
|
+
const modulePath = require.resolve("@wiztivi/dana-templates");
|
|
32
|
+
const mockPath = path_1.default.join(path_1.default.dirname(modulePath), "mocks", "scrollViewMock.json");
|
|
33
|
+
const finalPath = path_1.default.resolve(currentDirectory, "scrollViewMock.json");
|
|
34
|
+
(0, fs_1.cpSync)(mockPath, finalPath);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
exports.default = addScrollView;
|