@wiztivi/dana-cli 0.0.14 → 0.0.16
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/README.md +4 -0
- package/bin/dana.js +1 -1
- package/dana_completion.sh +2 -0
- package/dist/bundle.min.js +2 -0
- package/dist/commands/addComponent/config/ComponentConfig.d.ts +1 -1
- package/dist/commands/addComponent/const/defaultConfig.d.ts +1 -1
- package/dist/commands/addComponent/const/navigationConst.d.ts +1 -1
- package/dist/commands/addComponent/createComponent.d.ts +1 -1
- package/dist/commands/addComponent/helper/ComponentHelper.d.ts +1 -1
- package/dist/commands/addDevice/deviceConfig/configTypes.d.ts +0 -9
- package/dist/commands/addDevice/deviceConfig/webosConfig.d.ts +1 -29
- package/dist/commands/addModule/add-module.d.ts +2 -0
- package/dist/commands/addModule/addModuleDefinition.d.ts +3 -0
- package/dist/commands/addModule/moduleConst.d.ts +10 -0
- package/dist/commands/authentication/AuthenticationManager.d.ts +9 -10
- package/dist/commands/authentication/helper/CodeArtifactHelper.d.ts +1 -1
- package/dist/commands/authentication/helper/CredentialsHelper.d.ts +7 -0
- package/dist/commands/authentication/helper/SPM.d.ts +17 -0
- package/dist/commands/createApp/const/createAppTasks.d.ts +3 -0
- package/dist/commands/createApp/const/templateConst.d.ts +9 -0
- package/dist/commands/createApp/createApp.d.ts +4 -3
- package/dist/commands/createApp/helpers/CreateAppHelper.d.ts +10 -13
- package/dist/commands/createApp/helpers/SetupChecker.d.ts +1 -1
- package/dist/commands/hooks/checkDanaProjectHook.d.ts +2 -0
- package/dist/commands/package/package.d.ts +2 -0
- package/dist/commands/package/packageDefinition.d.ts +3 -0
- package/dist/common/const/exitCodeConst.d.ts +4 -0
- package/dist/common/helpers/CreateArchiveHelper.d.ts +1 -0
- package/dist/common/helpers/CreateFileHelper.d.ts +7 -1
- package/dist/common/helpers/InputValidator.d.ts +1 -1
- package/dist/common/helpers/InstallHelper.d.ts +1 -1
- package/dist/common/helpers/UpdateFileHelper.d.ts +10 -1
- package/dist/common/helpers/UserInputGetter.d.ts +1 -1
- package/dist/common/helpers/stringHelper.d.ts +1 -1
- package/dist/common/types/helperTypes.d.ts +3 -3
- package/package.json +24 -13
- package/dist/commands/addComponent/addMenu/add-menu.js +0 -45
- package/dist/commands/addComponent/addMenu/addMenuDefinition.js +0 -16
- package/dist/commands/addComponent/addRail/add-rail.js +0 -42
- package/dist/commands/addComponent/addRail/addRailDefinition.js +0 -26
- package/dist/commands/addComponent/addScreen/add-screen.js +0 -33
- package/dist/commands/addComponent/addScreen/addScreenDefinition.js +0 -13
- package/dist/commands/addComponent/addScrollView/add-scrollView.js +0 -31
- package/dist/commands/addComponent/addScrollView/addScrollViewDefinition.js +0 -13
- package/dist/commands/addComponent/config/ComponentConfig.js +0 -140
- package/dist/commands/addComponent/config/componentTypes.js +0 -1
- package/dist/commands/addComponent/const/componentConst.js +0 -19
- package/dist/commands/addComponent/const/defaultConfig.js +0 -24
- package/dist/commands/addComponent/const/navigationConst.js +0 -30
- package/dist/commands/addComponent/createComponent.js +0 -41
- package/dist/commands/addComponent/helper/ComponentHelper.js +0 -77
- package/dist/commands/addDevice/add-device.js +0 -90
- package/dist/commands/addDevice/addDeviceDefinition.js +0 -11
- package/dist/commands/addDevice/deviceConfig/androidtvConfig.js +0 -116
- package/dist/commands/addDevice/deviceConfig/configTypes.js +0 -12
- package/dist/commands/addDevice/deviceConfig/deviceConfig.js +0 -33
- package/dist/commands/addDevice/deviceConfig/titanosConfig.js +0 -14
- package/dist/commands/addDevice/deviceConfig/tizenConfig.js +0 -51
- package/dist/commands/addDevice/deviceConfig/tvosConfig.js +0 -45
- package/dist/commands/addDevice/deviceConfig/vidaaConfig.js +0 -14
- package/dist/commands/addDevice/deviceConfig/webosConfig.js +0 -140
- package/dist/commands/addDevice/helper/addDeviceHelper.js +0 -88
- package/dist/commands/authentication/AuthenticationManager.js +0 -167
- package/dist/commands/authentication/authDefinition.js +0 -35
- package/dist/commands/authentication/authHook.js +0 -32
- package/dist/commands/authentication/authentConst.js +0 -6
- package/dist/commands/authentication/commands/get-packages-token.js +0 -30
- package/dist/commands/authentication/commands/login.js +0 -28
- package/dist/commands/authentication/commands/logout.js +0 -20
- package/dist/commands/authentication/commands/status.js +0 -36
- package/dist/commands/authentication/helper/CodeArtifactHelper.js +0 -46
- package/dist/commands/authentication/helper/CommandHelper.js +0 -8
- package/dist/commands/authentication/helper/CredentialsHelper.js +0 -80
- package/dist/commands/commandHelp/customHelp.js +0 -26
- package/dist/commands/completion/completion.js +0 -48
- package/dist/commands/completion/completionDefinition.js +0 -12
- package/dist/commands/createApp/const/setupConst.js +0 -14
- package/dist/commands/createApp/createApp.js +0 -92
- package/dist/commands/createApp/createAppDefinition.js +0 -17
- package/dist/commands/createApp/helpers/CreateAppHelper.js +0 -114
- package/dist/commands/createApp/helpers/SetupChecker.js +0 -90
- package/dist/common/commonConst.js +0 -1
- package/dist/common/const/deviceConst.js +0 -71
- package/dist/common/const/exitCodeConst.js +0 -8
- package/dist/common/helpers/CreateFileHelper.js +0 -95
- package/dist/common/helpers/InputValidator.js +0 -52
- package/dist/common/helpers/InstallHelper.js +0 -145
- package/dist/common/helpers/UpdateFileHelper.js +0 -140
- package/dist/common/helpers/UserInputGetter.js +0 -118
- package/dist/common/helpers/handlebarsHelper.js +0 -21
- package/dist/common/helpers/stringHelper.js +0 -18
- package/dist/common/translation/en.json +0 -68
- package/dist/common/translation/translation.js +0 -3
- package/dist/common/types/helperTypes.js +0 -12
- package/dist/index.js +0 -14
- package/dist/program.js +0 -37
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
import completion from "./completion.js";
|
|
3
|
-
import translation from "../../common/translation/translation.js";
|
|
4
|
-
const completionDefinition = () => {
|
|
5
|
-
const command = new Command("completion");
|
|
6
|
-
command
|
|
7
|
-
.description(translation["command.completion.description"])
|
|
8
|
-
.argument("<shell>", translation["command.completion.argument"])
|
|
9
|
-
.action(completion);
|
|
10
|
-
return command;
|
|
11
|
-
};
|
|
12
|
-
export default completionDefinition;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
|
|
3
|
-
* All Rights Reserved
|
|
4
|
-
*
|
|
5
|
-
* All information contained herein is proprietary and confidential.
|
|
6
|
-
* Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
|
|
7
|
-
* prior written permission is obtained from Wiztivi.
|
|
8
|
-
* No warranty, explicit or implicit, provided.
|
|
9
|
-
* This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
const REGISTRY_KEY = "@dana:registry";
|
|
13
|
-
const DEFAULT_IMAGE_URL = "images/dana.png";
|
|
14
|
-
export { REGISTRY_KEY, DEFAULT_IMAGE_URL };
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import * as prompts from "@clack/prompts";
|
|
2
|
-
import colors from "picocolors";
|
|
3
|
-
import SetupChecker from "./helpers/SetupChecker.js";
|
|
4
|
-
import UserInputGetter from "../../common/helpers/UserInputGetter.js";
|
|
5
|
-
import CreateAppHelper from "./helpers/CreateAppHelper.js";
|
|
6
|
-
import CreateFileHelper from "../../common/helpers/CreateFileHelper.js";
|
|
7
|
-
import UpdateFileHelper from "../../common/helpers/UpdateFileHelper.js";
|
|
8
|
-
import InstallHelper from "../../common/helpers/InstallHelper.js";
|
|
9
|
-
import fs from "node:fs";
|
|
10
|
-
import ComponentConfig from "../addComponent/config/ComponentConfig.js";
|
|
11
|
-
import translation from "../../common/translation/translation.js";
|
|
12
|
-
import { APP_CREATION_ERROR } from "../../common/const/exitCodeConst.js";
|
|
13
|
-
import { CredentialsHelper } from "../authentication/helper/CredentialsHelper.js";
|
|
14
|
-
const createApp = async (projectName, programDirectory, options) => {
|
|
15
|
-
const { devices, tutorial } = options;
|
|
16
|
-
prompts.intro(colors.inverse(`Let's create a${tutorial ? " tutorial " : " "}Dana application !`));
|
|
17
|
-
await SetupChecker.checkSetup();
|
|
18
|
-
const data = (await prompts.group(UserInputGetter.getPrompts(projectName, devices), {
|
|
19
|
-
onCancel: () => ComponentConfig.handlePromptCancel(),
|
|
20
|
-
}));
|
|
21
|
-
data.config = await UserInputGetter.getDevicesConfig(data);
|
|
22
|
-
data.awsProfile = CredentialsHelper.get().org;
|
|
23
|
-
const spinner = prompts.spinner();
|
|
24
|
-
try {
|
|
25
|
-
spinner.start(translation["task.installation.start"]);
|
|
26
|
-
await CreateAppHelper.installation([
|
|
27
|
-
{
|
|
28
|
-
title: "Copy template",
|
|
29
|
-
task: async () => CreateFileHelper.copyTemplate(data),
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
title: "Update templated files",
|
|
33
|
-
task: async () => UpdateFileHelper.applyTemplatesToFiles(data),
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
title: "Update npmrc",
|
|
37
|
-
task: async () => UpdateFileHelper.updateNpmrcFile(data),
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
title: "Copy for tutorial",
|
|
41
|
-
task: async () => CreateFileHelper.copyForTutorial(data),
|
|
42
|
-
condition: tutorial,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
title: "Update package.json",
|
|
46
|
-
task: async () => UpdateFileHelper.updatePackageJson(data),
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
title: "Copy app.config files",
|
|
50
|
-
task: async () => CreateFileHelper.copyAppConfigFiles(data),
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
title: "Update app.config.json",
|
|
54
|
-
task: async () => UpdateFileHelper.updateAppConfigFile(data),
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
title: "Install dependencies with npm",
|
|
58
|
-
task: async () => InstallHelper.installDependencies(data),
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
title: "Install grunt globally",
|
|
62
|
-
task: async () => InstallHelper.installGrunt(),
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
title: "Execute grunt tasks",
|
|
66
|
-
task: async () => CreateFileHelper.executeGruntTasks(data),
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
title: "Execute devices config",
|
|
70
|
-
task: async () => UpdateFileHelper.setDevicesConfig(data),
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
title: "Initialize git",
|
|
74
|
-
task: async () => InstallHelper.initGit(data),
|
|
75
|
-
},
|
|
76
|
-
], spinner);
|
|
77
|
-
spinner.stop(translation["task.installation.end"]);
|
|
78
|
-
}
|
|
79
|
-
catch (error) {
|
|
80
|
-
const message = error instanceof Error ? error.message : "Error";
|
|
81
|
-
spinner.stop(message);
|
|
82
|
-
fs.rmSync(`./${data.directory}`, { recursive: true, force: true });
|
|
83
|
-
prompts.outro(colors.red(`${translation["error.common.start.message"]}: `) +
|
|
84
|
-
colors.yellow(`\n${data.directory} folder has been removed.`));
|
|
85
|
-
process.exit(APP_CREATION_ERROR);
|
|
86
|
-
}
|
|
87
|
-
prompts.outro(translation["creation.final"]);
|
|
88
|
-
prompts.intro(colors.inverse(translation["script.run.title"]));
|
|
89
|
-
CreateAppHelper.printNpmCommandForUser(data);
|
|
90
|
-
prompts.outro("---");
|
|
91
|
-
};
|
|
92
|
-
export default createApp;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
import createApp from "./createApp.js";
|
|
3
|
-
import translation from "../../common/translation/translation.js";
|
|
4
|
-
import { authHook } from "../authentication/authHook.js";
|
|
5
|
-
const createAppDefinition = () => {
|
|
6
|
-
const command = new Command("create-app");
|
|
7
|
-
command
|
|
8
|
-
.description(translation["command.create_app.description"])
|
|
9
|
-
.argument("[projectName]", translation["command.create_app.name"])
|
|
10
|
-
.argument("[projectDirectory]", translation["command.create_app.directory"])
|
|
11
|
-
.option("-t, --tutorial", translation["command.create_app.tutorial"])
|
|
12
|
-
.option("-d, --devices", translation["command.create_app.devices"])
|
|
13
|
-
.hook("preAction", authHook)
|
|
14
|
-
.action(createApp);
|
|
15
|
-
return command;
|
|
16
|
-
};
|
|
17
|
-
export default createAppDefinition;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
|
|
3
|
-
* All Rights Reserved
|
|
4
|
-
*
|
|
5
|
-
* All information contained herein is proprietary and confidential.
|
|
6
|
-
* Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
|
|
7
|
-
* prior written permission is obtained from Wiztivi.
|
|
8
|
-
* No warranty, explicit or implicit, provided.
|
|
9
|
-
* This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
import * as prompts from "@clack/prompts";
|
|
13
|
-
import * as deviceConst from "../../../common/const/deviceConst.js";
|
|
14
|
-
import WebosConfig from "../../addDevice/deviceConfig/webosConfig.js";
|
|
15
|
-
import TizenConfig from "../../addDevice/deviceConfig/tizenConfig.js";
|
|
16
|
-
import TvosConfig from "../../addDevice/deviceConfig/tvosConfig.js";
|
|
17
|
-
import DeviceConfig from "../../addDevice/deviceConfig/deviceConfig.js";
|
|
18
|
-
import AndroidtvConfig from "../../addDevice/deviceConfig/androidtvConfig.js";
|
|
19
|
-
import colors from "picocolors";
|
|
20
|
-
import translation from "../../../common/translation/translation.js";
|
|
21
|
-
import VidaaConfig from "../../addDevice/deviceConfig/vidaaConfig.js";
|
|
22
|
-
import TitanosConfig from "../../addDevice/deviceConfig/titanosConfig.js";
|
|
23
|
-
const CreateAppHelper = class {
|
|
24
|
-
/**
|
|
25
|
-
* Manage cancellation with CTRL+C
|
|
26
|
-
*/
|
|
27
|
-
static handleCancellation = function (value) {
|
|
28
|
-
if (prompts.isCancel(value)) {
|
|
29
|
-
prompts.cancel("Operation cancelled.");
|
|
30
|
-
process.exit(0);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Get selected renderers for smartTV
|
|
35
|
-
*/
|
|
36
|
-
static askHtmlRenderers = async (device) => {
|
|
37
|
-
const options = deviceConst.RENDERERS.map((el) => {
|
|
38
|
-
return { value: el, label: el };
|
|
39
|
-
});
|
|
40
|
-
const selection = (await prompts.multiselect({
|
|
41
|
-
message: `${translation["renderer.selection"]} ${device}`,
|
|
42
|
-
required: true,
|
|
43
|
-
options,
|
|
44
|
-
}));
|
|
45
|
-
this.handleCancellation(selection);
|
|
46
|
-
return selection;
|
|
47
|
-
};
|
|
48
|
-
static getDeviceConfig = (device) => {
|
|
49
|
-
switch (device) {
|
|
50
|
-
case deviceConst.WEBOS:
|
|
51
|
-
return WebosConfig;
|
|
52
|
-
case deviceConst.TIZEN:
|
|
53
|
-
return TizenConfig;
|
|
54
|
-
case deviceConst.TVOS:
|
|
55
|
-
return TvosConfig;
|
|
56
|
-
case deviceConst.ANDROIDTV:
|
|
57
|
-
return AndroidtvConfig;
|
|
58
|
-
case deviceConst.VIDAA:
|
|
59
|
-
return VidaaConfig;
|
|
60
|
-
case deviceConst.TITANOS:
|
|
61
|
-
return TitanosConfig;
|
|
62
|
-
default:
|
|
63
|
-
return DeviceConfig;
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
static promptUnavailableDevices = (unavailableDevices) => {
|
|
67
|
-
prompts.log.warn(colors.bold(colors.yellow(translation["device.unavailable"]) + "\n" + colors.magenta(unavailableDevices.join(", "))));
|
|
68
|
-
};
|
|
69
|
-
static promptSelectDevices = async (devices, required = false) => {
|
|
70
|
-
const selectObject = {
|
|
71
|
-
message: translation["device.selection"],
|
|
72
|
-
options: devices,
|
|
73
|
-
required,
|
|
74
|
-
};
|
|
75
|
-
const selectedDevices = await prompts.multiselect(selectObject);
|
|
76
|
-
this.handleCancellation(selectedDevices);
|
|
77
|
-
return selectedDevices;
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Iterate on a list of tasks
|
|
81
|
-
*/
|
|
82
|
-
static installation = async function (tasks, s) {
|
|
83
|
-
for (const item of tasks) {
|
|
84
|
-
if (item.condition == null || item.condition) {
|
|
85
|
-
s?.message(item.title);
|
|
86
|
-
await item.task();
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* Prompt all script commands to launch subscribed devices
|
|
92
|
-
*/
|
|
93
|
-
static printNpmCommandForUser = function (data) {
|
|
94
|
-
const commandLine = `cd ${data.directory} && npm run`;
|
|
95
|
-
prompts.log.info(colors.bold(`For browser:`));
|
|
96
|
-
prompts.log.message(`${commandLine} start`);
|
|
97
|
-
for (const device of data.selectedDevices) {
|
|
98
|
-
prompts.log.info(colors.bold(`For ${device}: `));
|
|
99
|
-
if (device === deviceConst.TIZEN) {
|
|
100
|
-
prompts.log.warn(`You MUST update app.config.tizen.json with your own parameters`);
|
|
101
|
-
}
|
|
102
|
-
const deviceConfig = data.config[device];
|
|
103
|
-
if (deviceConfig?.renderers) {
|
|
104
|
-
for (const renderer of deviceConfig.renderers) {
|
|
105
|
-
prompts.log.message(`${commandLine} start:${device}_${renderer}`);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
prompts.log.message(`${commandLine} start:${device}`);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
export default CreateAppHelper;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
|
|
3
|
-
* All Rights Reserved
|
|
4
|
-
*
|
|
5
|
-
* All information contained herein is proprietary and confidential.
|
|
6
|
-
* Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
|
|
7
|
-
* prior written permission is obtained from Wiztivi.
|
|
8
|
-
* No warranty, explicit or implicit, provided.
|
|
9
|
-
* This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
import * as prompts from "@clack/prompts";
|
|
13
|
-
import colors from "picocolors";
|
|
14
|
-
import { exec } from "node:child_process";
|
|
15
|
-
import translation from "../../../common/translation/translation.js";
|
|
16
|
-
import { SETUP_ERROR } from "../../../common/const/exitCodeConst.js";
|
|
17
|
-
class SetupChecker {
|
|
18
|
-
static checkSetup = async () => {
|
|
19
|
-
try {
|
|
20
|
-
await this.executeCheck([
|
|
21
|
-
{
|
|
22
|
-
title: "Node version validation",
|
|
23
|
-
task: async () => this.validateNodeVersion(),
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
title: "Git install validation",
|
|
27
|
-
task: async () => this.validateGitInstallation(),
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
title: "AWS install validation",
|
|
31
|
-
task: async () => this.validateAwsInstallation(),
|
|
32
|
-
},
|
|
33
|
-
]);
|
|
34
|
-
prompts.log.success(colors.green("✔ ") + translation["setup.ok"]);
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
prompts.outro(`${colors.red(translation["setup.ko"])}: ${error.message ?? ""}`);
|
|
38
|
-
process.exit(SETUP_ERROR);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Iterate on a list of setup tasks
|
|
43
|
-
* @param {Array} tasks
|
|
44
|
-
*/
|
|
45
|
-
static async executeCheck(tasks) {
|
|
46
|
-
for (const item of tasks) {
|
|
47
|
-
await item.task();
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Check if everything is set up correctly for the installation
|
|
52
|
-
* @returns {Promise}
|
|
53
|
-
*/
|
|
54
|
-
static async validateNodeVersion() {
|
|
55
|
-
const minimalNodeVersion = 22;
|
|
56
|
-
const currentVersion = Number.parseInt(process.version.slice(1).split(".")[0], 10);
|
|
57
|
-
return currentVersion >= minimalNodeVersion
|
|
58
|
-
? Promise.resolve("Node version ok !")
|
|
59
|
-
: Promise.reject(new Error(`${translation["node.error"]} ${minimalNodeVersion}`));
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Check if git cli is installed
|
|
63
|
-
* @returns {Promise<String>}
|
|
64
|
-
*/
|
|
65
|
-
static async validateGitInstallation() {
|
|
66
|
-
return new Promise((resolve, reject) => {
|
|
67
|
-
exec("git --version", {}, (error) => {
|
|
68
|
-
if (error != null) {
|
|
69
|
-
reject(new Error(translation["git.error"]));
|
|
70
|
-
}
|
|
71
|
-
resolve("Git installation ok !");
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Check if aws cli is installed
|
|
77
|
-
* @returns {Promise<String>}
|
|
78
|
-
*/
|
|
79
|
-
static async validateAwsInstallation() {
|
|
80
|
-
return new Promise((resolve, reject) => {
|
|
81
|
-
exec("aws --version", {}, (error) => {
|
|
82
|
-
if (error != null) {
|
|
83
|
-
reject(new Error(translation["aws.cli.error"]));
|
|
84
|
-
}
|
|
85
|
-
resolve("AWS installation ok !");
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
export default SetupChecker;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const TEMPLATE_MODULE = "@wiztivi/dana-templates";
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
|
|
3
|
-
* All Rights Reserved
|
|
4
|
-
*
|
|
5
|
-
* All information contained herein is proprietary and confidential.
|
|
6
|
-
* Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
|
|
7
|
-
* prior written permission is obtained from Wiztivi.
|
|
8
|
-
* No warranty, explicit or implicit, provided.
|
|
9
|
-
* This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
const TVOS = "tvos";
|
|
13
|
-
const TIZEN = "tizen";
|
|
14
|
-
const WEBOS = "webos";
|
|
15
|
-
const ANDROIDTV = "androidtv";
|
|
16
|
-
const CSS = "css";
|
|
17
|
-
const LIGHTNING = "lightning";
|
|
18
|
-
const VIDAA = "vidaa";
|
|
19
|
-
const TITANOS = "titanos";
|
|
20
|
-
const BASIC_DEPENDENCIES = [
|
|
21
|
-
"@dana/renderer-css",
|
|
22
|
-
"@dana/renderer-lightning-html5",
|
|
23
|
-
"@dana/tools-grunt",
|
|
24
|
-
"@dana/vendor-test",
|
|
25
|
-
"@dana/engine-nodejs",
|
|
26
|
-
"@dana/vendor-components",
|
|
27
|
-
"@wiztivi/dana-templates",
|
|
28
|
-
"@dana/core",
|
|
29
|
-
"@dana/renderer-lightning",
|
|
30
|
-
"@dana/engine-html5",
|
|
31
|
-
];
|
|
32
|
-
//Devices included by default in subscription
|
|
33
|
-
const BASIC_SETUP = {
|
|
34
|
-
[TIZEN]: {
|
|
35
|
-
label: "Samsung",
|
|
36
|
-
package: "@dana/vendor-tizen",
|
|
37
|
-
dependencies: ["@dana/vendor-tizen", "@dana/vendor-shaka", "@dana/tools-smarttv-grunt"],
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
//Devices that need a subscription to be added in project
|
|
41
|
-
//package is used to check if user is entitled to the device
|
|
42
|
-
const EXTENDED_SETUP = {
|
|
43
|
-
[TVOS]: {
|
|
44
|
-
label: "TV OS",
|
|
45
|
-
package: "@dana/engine-tvos",
|
|
46
|
-
dependencies: ["@dana/engine-tvos", "@dana/renderer-tvos", "@dana/tools-apple-grunt"],
|
|
47
|
-
},
|
|
48
|
-
[WEBOS]: {
|
|
49
|
-
label: "LG",
|
|
50
|
-
package: "@dana/vendor-webos",
|
|
51
|
-
dependencies: [
|
|
52
|
-
"@dana/vendor-webos",
|
|
53
|
-
"@dana/vendor-shaka",
|
|
54
|
-
"@dana/tools-smarttv-grunt",
|
|
55
|
-
"@dana/vendor-webos-css",
|
|
56
|
-
],
|
|
57
|
-
},
|
|
58
|
-
[ANDROIDTV]: {
|
|
59
|
-
label: "Android",
|
|
60
|
-
package: "@dana/engine-android",
|
|
61
|
-
dependencies: ["@dana/engine-android", "@dana/renderer-android", "@dana/tools-android-grunt"],
|
|
62
|
-
},
|
|
63
|
-
[VIDAA]: {
|
|
64
|
-
label: "Vidaa",
|
|
65
|
-
package: "@dana/vendor-vidaa",
|
|
66
|
-
dependencies: ["@dana/vendor-vidaa", "@dana/tools-smarttv-grunt"],
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
const PLATFORM_CONFIG = { ...BASIC_SETUP, ...EXTENDED_SETUP };
|
|
70
|
-
const RENDERERS = [CSS, LIGHTNING];
|
|
71
|
-
export { TVOS, TIZEN, WEBOS, ANDROIDTV, VIDAA, TITANOS, BASIC_DEPENDENCIES, PLATFORM_CONFIG, RENDERERS, BASIC_SETUP, EXTENDED_SETUP, LIGHTNING, CSS, };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export const APP_CREATION_ERROR = 1;
|
|
2
|
-
export const COMPONENT_ERROR = 3;
|
|
3
|
-
export const CANCEL = 4;
|
|
4
|
-
export const DEVICE_ERROR = 5;
|
|
5
|
-
export const LOGIN_ERROR = 6;
|
|
6
|
-
export const COMMAND_ERROR = 7;
|
|
7
|
-
export const SETUP_ERROR = 8;
|
|
8
|
-
export const GET_PACKAGES_TOKEN_ERROR = 9;
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
|
|
3
|
-
* All Rights Reserved
|
|
4
|
-
*
|
|
5
|
-
* All information contained herein is proprietary and confidential.
|
|
6
|
-
* Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
|
|
7
|
-
* prior written permission is obtained from Wiztivi.
|
|
8
|
-
* No warranty, explicit or implicit, provided.
|
|
9
|
-
* This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
import fs from "node:fs";
|
|
13
|
-
import path from "node:path";
|
|
14
|
-
import { spawnSync } from "node:child_process";
|
|
15
|
-
import { ANDROIDTV, TVOS } from "../const/deviceConst.js";
|
|
16
|
-
import { CredentialsHelper } from "../../commands/authentication/helper/CredentialsHelper.js";
|
|
17
|
-
import { getRepositoryEndpoint } from "../../commands/authentication/helper/CodeArtifactHelper.js";
|
|
18
|
-
import ComponentHelper from "../../commands/addComponent/helper/ComponentHelper.js";
|
|
19
|
-
class CreateFileHelper {
|
|
20
|
-
/**
|
|
21
|
-
* Copy the template
|
|
22
|
-
*/
|
|
23
|
-
static copyTemplate = function ({ directory }) {
|
|
24
|
-
const templateDir = path.resolve(path.dirname(ComponentHelper.getTemplatePath()), "app-template");
|
|
25
|
-
fs.mkdirSync(directory, { recursive: true });
|
|
26
|
-
fs.cpSync(templateDir, directory, { recursive: true });
|
|
27
|
-
return Promise.resolve("Template copied");
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Copy made for extra tutorial files
|
|
31
|
-
*/
|
|
32
|
-
static copyForTutorial = function ({ directory }) {
|
|
33
|
-
const templateDir = path.resolve(path.dirname(ComponentHelper.getTemplatePath()), "tutorial");
|
|
34
|
-
fs.cpSync(templateDir, directory, { recursive: true });
|
|
35
|
-
return Promise.resolve("Tutorial files copied");
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Copy app.config files for selected devices
|
|
39
|
-
*/
|
|
40
|
-
static copyAppConfigFiles = function ({ selectedDevices, directory, }) {
|
|
41
|
-
const templateDir = path.resolve(path.dirname(ComponentHelper.getTemplatePath()), "profiles");
|
|
42
|
-
const allFiles = fs.readdirSync(templateDir);
|
|
43
|
-
for (const file of allFiles) {
|
|
44
|
-
const shouldCopy = selectedDevices.includes(file.split(".")[2]);
|
|
45
|
-
if (shouldCopy) {
|
|
46
|
-
fs.cpSync(path.join(templateDir, file), path.join(directory, "profiles", file));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return Promise.resolve("Config file(s) copied");
|
|
50
|
-
};
|
|
51
|
-
static runGruntCommand(args, directory) {
|
|
52
|
-
const gruntAndroid = spawnSync("grunt", args, { shell: true, cwd: directory });
|
|
53
|
-
if (gruntAndroid.status === 0) {
|
|
54
|
-
return Promise.resolve("Grunt task(s) done");
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
throw new Error("Grunt task(s) failed");
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Execute grunt tasks
|
|
62
|
-
*/
|
|
63
|
-
static executeGruntTasks = async function ({ directory, selectedDevices, config, }) {
|
|
64
|
-
if (selectedDevices.includes(ANDROIDTV)) {
|
|
65
|
-
const credentials = CredentialsHelper.get();
|
|
66
|
-
const registryAccount = await getRepositoryEndpoint({
|
|
67
|
-
organization: credentials.org,
|
|
68
|
-
credentials: credentials?.aws,
|
|
69
|
-
format: "maven",
|
|
70
|
-
});
|
|
71
|
-
const args = ["copyProjectAndroidTv", `--appUrl=${registryAccount}`, `--organization=${credentials.org}`];
|
|
72
|
-
const optionsToAdd = ["appId", "appName", "appVersion", "appVersionCode", "wtvAndroidVersion"];
|
|
73
|
-
for (const option of optionsToAdd) {
|
|
74
|
-
args.push(`--${option}=${config.androidtv?.device[option]}`);
|
|
75
|
-
}
|
|
76
|
-
try {
|
|
77
|
-
await CreateFileHelper.runGruntCommand(args, directory);
|
|
78
|
-
}
|
|
79
|
-
catch (error) {
|
|
80
|
-
throw new Error(`Failed to execute grunt tasks: ${error.message}`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (selectedDevices.includes(TVOS)) {
|
|
84
|
-
try {
|
|
85
|
-
const args = ["copyProjectTvos", `--jscVersion=${config.tvos?.jscVersion}`];
|
|
86
|
-
await CreateFileHelper.runGruntCommand(args, directory);
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
throw new Error(`Failed to execute grunt tasks: ${error.message}`);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return "Grunt task(s) done";
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
export default CreateFileHelper;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
|
|
3
|
-
* All Rights Reserved
|
|
4
|
-
*
|
|
5
|
-
* All information contained herein is proprietary and confidential.
|
|
6
|
-
* Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
|
|
7
|
-
* prior written permission is obtained from Wiztivi.
|
|
8
|
-
* No warranty, explicit or implicit, provided.
|
|
9
|
-
* This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
import { clean, valid } from "semver-ts";
|
|
13
|
-
export const validInputLength = (value, errorMessage) => {
|
|
14
|
-
if (value?.trim().length) {
|
|
15
|
-
return "";
|
|
16
|
-
}
|
|
17
|
-
return errorMessage;
|
|
18
|
-
};
|
|
19
|
-
export const validAppVersion = (value) => {
|
|
20
|
-
if (!value) {
|
|
21
|
-
return "App version is required";
|
|
22
|
-
}
|
|
23
|
-
if (!valid(clean(value) ?? "")) {
|
|
24
|
-
return "App version format should be x.x.x";
|
|
25
|
-
}
|
|
26
|
-
return "";
|
|
27
|
-
};
|
|
28
|
-
export const validAppVersionCode = (value) => {
|
|
29
|
-
if (!value) {
|
|
30
|
-
return "App version code is required";
|
|
31
|
-
}
|
|
32
|
-
if (!Number.isInteger(+value)) {
|
|
33
|
-
return "App version code has to be an Integer";
|
|
34
|
-
}
|
|
35
|
-
return "";
|
|
36
|
-
};
|
|
37
|
-
export const validAppId = (value) => {
|
|
38
|
-
const regex = /^[a-zA-Z]\w*(\.[a-zA-Z]\w*)+$/;
|
|
39
|
-
if (!value.length) {
|
|
40
|
-
return `AppId is required !`;
|
|
41
|
-
}
|
|
42
|
-
if (!regex.test(value)) {
|
|
43
|
-
return "AppId should be in the following format: com.example.myapp !";
|
|
44
|
-
}
|
|
45
|
-
return "";
|
|
46
|
-
};
|
|
47
|
-
export const validNumber = (value, errorMessage) => {
|
|
48
|
-
if (!Number.parseInt(value, 10)) {
|
|
49
|
-
return errorMessage;
|
|
50
|
-
}
|
|
51
|
-
return "";
|
|
52
|
-
};
|