@wiztivi/dana-cli 0.0.12 → 0.0.14-beta.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/dana_completion.sh +1 -1
- package/dist/commands/addComponent/addMenu/addMenuDefinition.js +1 -1
- package/dist/commands/addComponent/addRail/addRailDefinition.js +1 -1
- package/dist/commands/addComponent/addScrollView/addScrollViewDefinition.js +1 -1
- package/dist/commands/addDevice/add-device.js +0 -1
- package/dist/commands/addDevice/deviceConfig/androidtvConfig.js +8 -34
- package/dist/commands/addDevice/deviceConfig/configTypes.d.ts +14 -6
- package/dist/commands/addDevice/deviceConfig/titanosConfig.d.ts +9 -0
- package/dist/commands/addDevice/deviceConfig/titanosConfig.js +14 -0
- package/dist/commands/addDevice/deviceConfig/tizenConfig.js +3 -2
- package/dist/commands/addDevice/deviceConfig/tvosConfig.d.ts +6 -1
- package/dist/commands/addDevice/deviceConfig/tvosConfig.js +19 -1
- package/dist/commands/addDevice/deviceConfig/vidaaConfig.d.ts +9 -0
- package/dist/commands/addDevice/deviceConfig/vidaaConfig.js +14 -0
- package/dist/commands/addDevice/helper/addDeviceHelper.d.ts +7 -0
- package/dist/commands/addDevice/helper/addDeviceHelper.js +35 -0
- package/dist/commands/authentication/AuthenticationManager.d.ts +15 -3
- package/dist/commands/authentication/AuthenticationManager.js +29 -12
- package/dist/commands/authentication/authDefinition.js +2 -0
- package/dist/commands/authentication/authHook.js +2 -2
- package/dist/commands/authentication/authentConst.d.ts +2 -0
- package/dist/commands/authentication/authentConst.js +2 -0
- package/dist/commands/authentication/commands/login.d.ts +3 -1
- package/dist/commands/authentication/commands/login.js +2 -2
- package/dist/commands/authentication/commands/logout.js +1 -1
- package/dist/commands/authentication/helper/CredentialsHelper.d.ts +5 -1
- package/dist/commands/authentication/helper/CredentialsHelper.js +17 -2
- package/dist/commands/createApp/helpers/CreateAppHelper.d.ts +8 -1
- package/dist/commands/createApp/helpers/CreateAppHelper.js +6 -0
- package/dist/commands/createApp/helpers/SetupChecker.js +1 -1
- package/dist/common/const/deviceConst.d.ts +3 -1
- package/dist/common/const/deviceConst.js +9 -1
- package/dist/common/helpers/CreateFileHelper.d.ts +1 -0
- package/dist/common/helpers/CreateFileHelper.js +25 -9
- package/dist/common/helpers/InstallHelper.d.ts +1 -0
- package/dist/common/helpers/InstallHelper.js +56 -33
- package/dist/common/helpers/UserInputGetter.js +1 -1
- package/dist/common/translation/en.json +5 -1
- package/dist/common/types/helperTypes.d.ts +5 -3
- package/dist/common/types/helperTypes.js +1 -1
- package/package.json +17 -17
package/dana_completion.sh
CHANGED
|
@@ -23,7 +23,7 @@ direction_opts="-d --direction"
|
|
|
23
23
|
navigation_opts="-n --navigation"
|
|
24
24
|
cyclic_opts="-c --cyclic"
|
|
25
25
|
margin_opts="-m --itemMargin"
|
|
26
|
-
custom_opts="
|
|
26
|
+
custom_opts="--cm --custom"
|
|
27
27
|
item_view_opts="-i --itemView"
|
|
28
28
|
org_opts="-o --org"
|
|
29
29
|
device_opts="-d --device"
|
|
@@ -6,7 +6,7 @@ const addMenuDefinition = () => {
|
|
|
6
6
|
command
|
|
7
7
|
.description(translation["command.menu.description"])
|
|
8
8
|
.argument("[name]", translation["command.component.name"])
|
|
9
|
-
.option("
|
|
9
|
+
.option("--cm, --custom", translation["command.component.customization"])
|
|
10
10
|
.option("-i, --itemView <itemView>", translation["command.menu.option.itemView"])
|
|
11
11
|
.option("-m, --itemMargin <itemMargin>", translation["command.menu.option.itemMargin"])
|
|
12
12
|
.option("-d, --direction <direction>", translation["command.rail.option.direction"])
|
|
@@ -8,7 +8,7 @@ const addRailDefinition = () => {
|
|
|
8
8
|
command
|
|
9
9
|
.description(translation["command.rail.description"])
|
|
10
10
|
.argument("[name]", translation["command.component.name"])
|
|
11
|
-
.option("
|
|
11
|
+
.option("--cm, --custom", translation["command.component.customization"])
|
|
12
12
|
.option("-n, --navigation <navigation>", translation["command.rail.option.navigation"])
|
|
13
13
|
.option("-d, --direction <direction>", translation["command.rail.option.direction"])
|
|
14
14
|
.option("-c, --cyclic", translation["command.rail.option.cyclic"])
|
|
@@ -5,7 +5,7 @@ const addScrollViewDefinition = () => {
|
|
|
5
5
|
return new Command("add-scrollView")
|
|
6
6
|
.description(translation["command.scrollView.description"])
|
|
7
7
|
.argument("[name]", translation["command.component.name"])
|
|
8
|
-
.option("
|
|
8
|
+
.option("--cm, --custom", translation["command.component.customization"])
|
|
9
9
|
.option("-i, --itemView <itemView>", translation["command.menu.option.itemView"])
|
|
10
10
|
.option("-m, --itemMargin <itemMargin>", translation["command.menu.option.itemMargin"])
|
|
11
11
|
.action(addScrollView);
|
|
@@ -16,13 +16,7 @@ import ComponentHelper from "../../addComponent/helper/ComponentHelper.js";
|
|
|
16
16
|
import * as prompts from "@clack/prompts";
|
|
17
17
|
import colors from "picocolors";
|
|
18
18
|
import { clean } from "semver-ts";
|
|
19
|
-
import {
|
|
20
|
-
import { validInputLength, validAppId, validAppVersion, validAppVersionCode, } from "../../../common/helpers/InputValidator.js";
|
|
21
|
-
import translation from "../../../common/translation/translation.js";
|
|
22
|
-
import { CredentialsHelper } from "../../authentication/helper/CredentialsHelper.js";
|
|
23
|
-
import { ListPackageVersionsCommand } from "@aws-sdk/client-codeartifact";
|
|
24
|
-
import { createCodeArtifactClient } from "../../authentication/helper/CodeArtifactHelper.js";
|
|
25
|
-
import { DOMAIN, DOMAIN_OWNER } from "../../authentication/authentConst.js";
|
|
19
|
+
import { validAppId, validAppVersion, validAppVersionCode, validInputLength, } from "../../../common/helpers/InputValidator.js";
|
|
26
20
|
import addDeviceHelper from "../helper/addDeviceHelper.js";
|
|
27
21
|
const AndroidtvConfig = class extends DeviceConfig {
|
|
28
22
|
/**
|
|
@@ -80,33 +74,13 @@ const AndroidtvConfig = class extends DeviceConfig {
|
|
|
80
74
|
* Call aws to get latest android version
|
|
81
75
|
*/
|
|
82
76
|
static _getWtvAndroidVersion = async () => {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
domainOwner: DOMAIN_OWNER,
|
|
91
|
-
repository: "internal-android-repository",
|
|
92
|
-
format: "maven",
|
|
93
|
-
namespace: "com.dana.androidtv",
|
|
94
|
-
});
|
|
95
|
-
const response = await client.send(command);
|
|
96
|
-
const versionListArray = response.versions?.map((v) => v.version).filter(Boolean);
|
|
97
|
-
// need to use semver-ts to avoid this error
|
|
98
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-assignment
|
|
99
|
-
wtvAndroidVersion = maxSatisfying(versionListArray, "*");
|
|
100
|
-
if (wtvAndroidVersion) {
|
|
101
|
-
return wtvAndroidVersion;
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
throw new Error(translation["command.device.version.error"]);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
catch (error) {
|
|
108
|
-
throw new Error(error.message ?? translation["error.common.start.message"]);
|
|
109
|
-
}
|
|
77
|
+
const requestParams = {
|
|
78
|
+
packageName: "v8-runtime",
|
|
79
|
+
repository: "internal-android-repository",
|
|
80
|
+
format: "maven",
|
|
81
|
+
namespace: "com.dana.androidtv",
|
|
82
|
+
};
|
|
83
|
+
return await addDeviceHelper.getLatestPackageVersion(requestParams);
|
|
110
84
|
};
|
|
111
85
|
static getConfig = async () => {
|
|
112
86
|
prompts.log.info(colors.bold("Let's configure Android !"));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface AndroidDevice {
|
|
1
|
+
export interface AndroidDevice {
|
|
2
2
|
appId: string;
|
|
3
3
|
appName: string;
|
|
4
4
|
appVersion: string;
|
|
@@ -6,17 +6,17 @@ interface AndroidDevice {
|
|
|
6
6
|
icon: string;
|
|
7
7
|
wtvAndroidVersion: string;
|
|
8
8
|
}
|
|
9
|
-
interface AndroidConfig {
|
|
9
|
+
export interface AndroidConfig {
|
|
10
10
|
device: AndroidDevice;
|
|
11
11
|
}
|
|
12
|
-
interface TizenConf {
|
|
12
|
+
export interface TizenConf {
|
|
13
13
|
renderers: string[];
|
|
14
14
|
}
|
|
15
|
-
interface WebosConf {
|
|
15
|
+
export interface WebosConf {
|
|
16
16
|
device: WebosDevice;
|
|
17
17
|
renderers: string[];
|
|
18
18
|
}
|
|
19
|
-
interface WebosDevice {
|
|
19
|
+
export interface WebosDevice {
|
|
20
20
|
appId: string;
|
|
21
21
|
appVendor: string;
|
|
22
22
|
appTitle: string;
|
|
@@ -24,4 +24,12 @@ interface WebosDevice {
|
|
|
24
24
|
largeIcon: string;
|
|
25
25
|
disableBackHistoryAPI: boolean;
|
|
26
26
|
}
|
|
27
|
-
export
|
|
27
|
+
export interface TvosConf {
|
|
28
|
+
jscVersion: string;
|
|
29
|
+
}
|
|
30
|
+
export interface VidaaConf {
|
|
31
|
+
renderers: string[];
|
|
32
|
+
}
|
|
33
|
+
export interface TitanosConf {
|
|
34
|
+
renderers: string[];
|
|
35
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TitanosConf } from "./configTypes.js";
|
|
2
|
+
declare const TitanosConfig: {
|
|
3
|
+
new (): {};
|
|
4
|
+
readonly getConfig: () => Promise<TitanosConf>;
|
|
5
|
+
readonly setConfig: () => Promise<string>;
|
|
6
|
+
readonly appConfig: {};
|
|
7
|
+
updateProfileJsonWithRenderers(jsonData: Record<string, unknown>, renderers: string[]): object;
|
|
8
|
+
};
|
|
9
|
+
export default TitanosConfig;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import DeviceConfig from "./deviceConfig.js";
|
|
2
|
+
import { LIGHTNING, CSS } from "../../../common/const/deviceConst.js";
|
|
3
|
+
const TitanosConfig = class extends DeviceConfig {
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
5
|
+
static getConfig = async () => {
|
|
6
|
+
return {
|
|
7
|
+
renderers: [LIGHTNING, CSS],
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
static setConfig = () => {
|
|
11
|
+
return Promise.resolve("TitanOS configuration done");
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default TitanosConfig;
|
|
@@ -34,10 +34,11 @@ const TizenConfig = class extends DeviceConfig {
|
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
36
|
};
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
37
38
|
static getConfig = async () => {
|
|
38
|
-
return
|
|
39
|
+
return {
|
|
39
40
|
renderers: [LIGHTNING],
|
|
40
|
-
}
|
|
41
|
+
};
|
|
41
42
|
};
|
|
42
43
|
static setConfig = ({ directory, config }) => {
|
|
43
44
|
const filePath = path.join(directory, "profiles", "app.config.tizen.json");
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TvosConf } from "./configTypes.js";
|
|
1
2
|
declare const TvosConfig: {
|
|
2
3
|
new (): {};
|
|
3
4
|
/**
|
|
@@ -6,8 +7,12 @@ declare const TvosConfig: {
|
|
|
6
7
|
readonly setConfig: ({ directory }: {
|
|
7
8
|
directory: string;
|
|
8
9
|
}) => Promise<string>;
|
|
10
|
+
readonly getConfig: () => Promise<TvosConf>;
|
|
11
|
+
/**
|
|
12
|
+
* Call aws to get latest jsc version
|
|
13
|
+
*/
|
|
14
|
+
readonly getJscVersion: () => Promise<string>;
|
|
9
15
|
readonly appConfig: {};
|
|
10
|
-
getConfig(..._: string[]): Promise<unknown>;
|
|
11
16
|
updateProfileJsonWithRenderers(jsonData: Record<string, unknown>, renderers: string[]): object;
|
|
12
17
|
};
|
|
13
18
|
export default TvosConfig;
|
|
@@ -12,16 +12,34 @@
|
|
|
12
12
|
import fs from "node:fs";
|
|
13
13
|
import DeviceConfig from "./deviceConfig.js";
|
|
14
14
|
import path from "node:path";
|
|
15
|
+
import addDeviceHelper from "../helper/addDeviceHelper.js";
|
|
15
16
|
const TvosConfig = class extends DeviceConfig {
|
|
16
17
|
/**
|
|
17
18
|
* Set config for TVOS
|
|
18
19
|
*/
|
|
19
|
-
static setConfig = ({ directory }) => {
|
|
20
|
+
static setConfig = async ({ directory }) => {
|
|
20
21
|
const update = `\n# For TVOS\napp_tvos/build \napp_tvos/libs`;
|
|
21
22
|
const filePath = path.join(directory, ".gitignore");
|
|
22
23
|
const data = fs.readFileSync(filePath, { encoding: "utf8" });
|
|
23
24
|
fs.writeFileSync(filePath, data + update);
|
|
24
25
|
return Promise.resolve(".gitignore updated");
|
|
25
26
|
};
|
|
27
|
+
static getConfig = async () => {
|
|
28
|
+
return {
|
|
29
|
+
jscVersion: await TvosConfig.getJscVersion(),
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Call aws to get latest jsc version
|
|
34
|
+
*/
|
|
35
|
+
static getJscVersion = async () => {
|
|
36
|
+
const requestParams = {
|
|
37
|
+
packageName: "jscmodule",
|
|
38
|
+
repository: "internal-apple-repository",
|
|
39
|
+
format: "swift",
|
|
40
|
+
namespace: "dana",
|
|
41
|
+
};
|
|
42
|
+
return await addDeviceHelper.getLatestPackageVersion(requestParams);
|
|
43
|
+
};
|
|
26
44
|
};
|
|
27
45
|
export default TvosConfig;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { VidaaConf } from "./configTypes.js";
|
|
2
|
+
declare const VidaaConfig: {
|
|
3
|
+
new (): {};
|
|
4
|
+
readonly getConfig: () => Promise<VidaaConf>;
|
|
5
|
+
readonly setConfig: () => Promise<string>;
|
|
6
|
+
readonly appConfig: {};
|
|
7
|
+
updateProfileJsonWithRenderers(jsonData: Record<string, unknown>, renderers: string[]): object;
|
|
8
|
+
};
|
|
9
|
+
export default VidaaConfig;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import DeviceConfig from "./deviceConfig.js";
|
|
2
|
+
import { LIGHTNING, CSS } from "../../../common/const/deviceConst.js";
|
|
3
|
+
const VidaaConfig = class extends DeviceConfig {
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
5
|
+
static getConfig = async () => {
|
|
6
|
+
return {
|
|
7
|
+
renderers: [LIGHTNING, CSS],
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
static setConfig = () => {
|
|
11
|
+
return Promise.resolve("Vidaa configuration done");
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default VidaaConfig;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PackageFormat } from "@aws-sdk/client-codeartifact";
|
|
1
2
|
export interface PromptFactoryParams {
|
|
2
3
|
errorMessage?: string;
|
|
3
4
|
promptMessage: string;
|
|
@@ -21,5 +22,11 @@ declare const AddDeviceHelper: {
|
|
|
21
22
|
*/
|
|
22
23
|
readonly getAppIcon: () => Promise<string>;
|
|
23
24
|
readonly promptTextFactory: ({ errorMessage, promptMessage, validationFunction, placeholder, initialValue, }: PromptFactoryParams) => Promise<string>;
|
|
25
|
+
readonly getLatestPackageVersion: ({ packageName, repository, format, namespace, }: {
|
|
26
|
+
packageName: string;
|
|
27
|
+
repository: string;
|
|
28
|
+
format: PackageFormat;
|
|
29
|
+
namespace: string;
|
|
30
|
+
}) => Promise<string>;
|
|
24
31
|
};
|
|
25
32
|
export default AddDeviceHelper;
|
|
@@ -4,6 +4,12 @@ import path from "node:path";
|
|
|
4
4
|
import * as prompts from "@clack/prompts";
|
|
5
5
|
import { DEFAULT_IMAGE_URL } from "../../createApp/const/setupConst.js";
|
|
6
6
|
import ComponentHelper from "../../addComponent/helper/ComponentHelper.js";
|
|
7
|
+
import { CredentialsHelper } from "../../authentication/helper/CredentialsHelper.js";
|
|
8
|
+
import { createCodeArtifactClient } from "../../authentication/helper/CodeArtifactHelper.js";
|
|
9
|
+
import { ListPackageVersionsCommand } from "@aws-sdk/client-codeartifact";
|
|
10
|
+
import { DOMAIN, DOMAIN_OWNER } from "../../authentication/authentConst.js";
|
|
11
|
+
import translation from "../../../common/translation/translation.js";
|
|
12
|
+
import { maxSatisfying } from "semver";
|
|
7
13
|
const AddDeviceHelper = class {
|
|
8
14
|
/**
|
|
9
15
|
* clean on error
|
|
@@ -49,5 +55,34 @@ const AddDeviceHelper = class {
|
|
|
49
55
|
ComponentHelper.handleCancellation(result);
|
|
50
56
|
return result;
|
|
51
57
|
};
|
|
58
|
+
static getLatestPackageVersion = async ({ packageName, repository, format, namespace, }) => {
|
|
59
|
+
let packageVersion;
|
|
60
|
+
try {
|
|
61
|
+
const credentials = CredentialsHelper.get();
|
|
62
|
+
const client = createCodeArtifactClient(credentials.aws);
|
|
63
|
+
const command = new ListPackageVersionsCommand({
|
|
64
|
+
package: packageName,
|
|
65
|
+
domain: DOMAIN,
|
|
66
|
+
domainOwner: DOMAIN_OWNER,
|
|
67
|
+
repository,
|
|
68
|
+
format,
|
|
69
|
+
namespace,
|
|
70
|
+
});
|
|
71
|
+
const response = await client.send(command);
|
|
72
|
+
const versionListArray = response.versions?.map((v) => v.version).filter(Boolean);
|
|
73
|
+
// need to use semver-ts to avoid this error
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-assignment
|
|
75
|
+
packageVersion = maxSatisfying(versionListArray, "*");
|
|
76
|
+
if (packageVersion) {
|
|
77
|
+
return packageVersion;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
throw new Error(translation["command.device.version.error"]);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
throw new Error(error.message ?? translation["error.common.start.message"]);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
52
87
|
};
|
|
53
88
|
export default AddDeviceHelper;
|
|
@@ -9,12 +9,24 @@ export interface AuthCredentials {
|
|
|
9
9
|
aws: AwsCredentials;
|
|
10
10
|
dana: DanaToken;
|
|
11
11
|
org: string;
|
|
12
|
+
isRemote: boolean;
|
|
13
|
+
port?: number;
|
|
12
14
|
}
|
|
13
15
|
export declare class AuthenticationManager {
|
|
14
16
|
private static getAPIURL;
|
|
15
|
-
static login(organization: string): Promise<AuthCredentials>;
|
|
16
|
-
static logout(organization: string, creds?: Partial<DanaToken
|
|
17
|
-
static refresh(organization: string, token: string): Promise<
|
|
17
|
+
static login(organization: string, isRemote: boolean, userPort?: number): Promise<AuthCredentials>;
|
|
18
|
+
static logout(organization: string, creds?: Partial<DanaToken>, isRemote?: boolean): Promise<void>;
|
|
19
|
+
static refresh(organization: string, token: string, isRemote: boolean, port?: number): Promise<{
|
|
20
|
+
aws: AwsCredentials;
|
|
21
|
+
dana: {
|
|
22
|
+
refresh_token: string;
|
|
23
|
+
id_token: string;
|
|
24
|
+
access_token: string;
|
|
25
|
+
expires_in: number;
|
|
26
|
+
token_type: string;
|
|
27
|
+
};
|
|
28
|
+
org: string;
|
|
29
|
+
}>;
|
|
18
30
|
static isTokenExpired(token: string): boolean;
|
|
19
31
|
static loginNPM(organization: string, credentials: AwsCredentials): Promise<{
|
|
20
32
|
token: string;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import getPort from "get-port";
|
|
2
2
|
import express from "express";
|
|
3
3
|
import { CredentialsHelper } from "./helper/CredentialsHelper.js";
|
|
4
|
+
import { log } from "@clack/prompts";
|
|
5
|
+
import translation from "../../common/translation/translation.js";
|
|
4
6
|
import open from "open";
|
|
5
7
|
import jwt from "jsonwebtoken";
|
|
6
8
|
import { createCodeArtifactClient, formatRepositoryString, getRepositoryEndpoint, } from "./helper/CodeArtifactHelper.js";
|
|
7
9
|
import { GetAuthorizationTokenCommand } from "@aws-sdk/client-codeartifact";
|
|
8
|
-
import { DOMAIN, DOMAIN_OWNER } from "./authentConst.js";
|
|
10
|
+
import { DOMAIN, DOMAIN_OWNER, DEFAULT_PORT_1, DEFAULT_PORT_2 } from "./authentConst.js";
|
|
9
11
|
import { execSync } from "node:child_process";
|
|
10
12
|
import fs from "node:fs";
|
|
11
13
|
import path from "node:path";
|
|
@@ -13,7 +15,7 @@ export class AuthenticationManager {
|
|
|
13
15
|
static getAPIURL(organization) {
|
|
14
16
|
return `https://api.${organization}.dana-framework.com`; // Or http://localhost:3001
|
|
15
17
|
}
|
|
16
|
-
static async login(organization) {
|
|
18
|
+
static async login(organization, isRemote, userPort) {
|
|
17
19
|
const app = express();
|
|
18
20
|
app.disable("x-powered-by");
|
|
19
21
|
const promise = new Promise((resolve, reject) => {
|
|
@@ -29,9 +31,9 @@ export class AuthenticationManager {
|
|
|
29
31
|
}
|
|
30
32
|
const token = JSON.parse(req.query.token);
|
|
31
33
|
const awsCredentials = JSON.parse(req.query.aws);
|
|
32
|
-
const creds = { aws: awsCredentials, dana: token, org: organization };
|
|
34
|
+
const creds = { aws: awsCredentials, dana: token, org: organization, isRemote, port: userPort };
|
|
33
35
|
res.send("Login successful! You can close this window.");
|
|
34
|
-
CredentialsHelper.store(creds);
|
|
36
|
+
CredentialsHelper.store(creds, isRemote, userPort);
|
|
35
37
|
resolve(creds);
|
|
36
38
|
}
|
|
37
39
|
catch (err) {
|
|
@@ -40,15 +42,24 @@ export class AuthenticationManager {
|
|
|
40
42
|
}
|
|
41
43
|
});
|
|
42
44
|
});
|
|
43
|
-
const
|
|
45
|
+
const defaultPortList = [DEFAULT_PORT_1, DEFAULT_PORT_2];
|
|
46
|
+
const portList = userPort ? [userPort].concat(defaultPortList) : defaultPortList;
|
|
47
|
+
const port = await getPort({ port: portList });
|
|
44
48
|
const server = app.listen(port);
|
|
45
|
-
|
|
49
|
+
if (isRemote) {
|
|
50
|
+
log.info(translation["command.auth.remoteMode"] + `Port: ${port}`);
|
|
51
|
+
log.info(translation["command.auth.accessBrowserUrl"] +
|
|
52
|
+
` ${AuthenticationManager.getAPIURL(organization)}/login?port=${port}`);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
await open(`${AuthenticationManager.getAPIURL(organization)}/login?port=${port}`);
|
|
56
|
+
}
|
|
46
57
|
return promise.finally(() => {
|
|
47
58
|
server.closeAllConnections();
|
|
48
59
|
server.close();
|
|
49
60
|
});
|
|
50
61
|
}
|
|
51
|
-
static async logout(organization, creds) {
|
|
62
|
+
static async logout(organization, creds, isRemote) {
|
|
52
63
|
const url = new URL(`${AuthenticationManager.getAPIURL(organization)}/logout`);
|
|
53
64
|
if (creds?.id_token) {
|
|
54
65
|
url.searchParams.append("id_token", creds.id_token);
|
|
@@ -56,13 +67,19 @@ export class AuthenticationManager {
|
|
|
56
67
|
if (creds?.refresh_token) {
|
|
57
68
|
url.searchParams.append("refresh_token", creds.refresh_token);
|
|
58
69
|
}
|
|
59
|
-
|
|
70
|
+
if (isRemote) {
|
|
71
|
+
log.info(translation["command.auth.remoteMode"]);
|
|
72
|
+
log.info(translation["command.auth.accessBrowserUrl"] + `${url.toString()}`);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
await open(url.toString());
|
|
76
|
+
}
|
|
60
77
|
CredentialsHelper.delete(organization);
|
|
61
78
|
}
|
|
62
|
-
static async refresh(organization, token) {
|
|
63
|
-
const data = await fetch(`${AuthenticationManager.getAPIURL(organization)}/login?refresh_token
|
|
79
|
+
static async refresh(organization, token, isRemote, port) {
|
|
80
|
+
const data = await fetch(`${AuthenticationManager.getAPIURL(organization)} / login ? refresh_token = ${token}`);
|
|
64
81
|
if (!data.ok) {
|
|
65
|
-
return AuthenticationManager.login(organization);
|
|
82
|
+
return AuthenticationManager.login(organization, isRemote, port);
|
|
66
83
|
}
|
|
67
84
|
const refreshedCreds = (await data.json());
|
|
68
85
|
const creds = {
|
|
@@ -73,7 +90,7 @@ export class AuthenticationManager {
|
|
|
73
90
|
},
|
|
74
91
|
org: organization,
|
|
75
92
|
};
|
|
76
|
-
CredentialsHelper.store(creds);
|
|
93
|
+
CredentialsHelper.store(creds, isRemote, port);
|
|
77
94
|
return creds;
|
|
78
95
|
}
|
|
79
96
|
static isTokenExpired(token) {
|
|
@@ -10,6 +10,8 @@ const addAuthDefinition = () => {
|
|
|
10
10
|
const loginCmd = new Command("login")
|
|
11
11
|
.description(translation["command.auth.login.description"])
|
|
12
12
|
.option("-o, --org <organization>", translation["command.auth.login.option.org"])
|
|
13
|
+
.option("-r, --remote", translation["command.auth.login.option.remote"])
|
|
14
|
+
.option("-p, --port <port>", translation["command.auth.login.option.port"])
|
|
13
15
|
.action(login);
|
|
14
16
|
command.addCommand(loginCmd);
|
|
15
17
|
const logoutCmd = new Command("logout")
|
|
@@ -17,12 +17,12 @@ export const authHook = async () => {
|
|
|
17
17
|
const credentials = CredentialsHelper.get();
|
|
18
18
|
try {
|
|
19
19
|
if (!credentials.dana?.id_token || !credentials.dana?.refresh_token) {
|
|
20
|
-
await AuthenticationManager.login(credentials.org);
|
|
20
|
+
await AuthenticationManager.login(credentials.org, credentials.isRemote, credentials?.port);
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
if (AuthenticationManager.isTokenExpired(credentials.dana.id_token) ||
|
|
24
24
|
(credentials.aws && new Date(credentials.aws.expiration) < new Date())) {
|
|
25
|
-
await AuthenticationManager.refresh(credentials.org, credentials.dana.refresh_token);
|
|
25
|
+
await AuthenticationManager.refresh(credentials.org, credentials.dana.refresh_token, credentials.isRemote, credentials?.port);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
catch (error) {
|
|
@@ -2,3 +2,5 @@ export declare const DOMAIN = "dana";
|
|
|
2
2
|
export declare const DOMAIN_OWNER = "733912940672";
|
|
3
3
|
export declare const REGION = "eu-central-1";
|
|
4
4
|
export declare const DEFAULT_ORG = "public";
|
|
5
|
+
export declare const DEFAULT_PORT_1 = 10032;
|
|
6
|
+
export declare const DEFAULT_PORT_2 = 10064;
|
|
@@ -7,11 +7,11 @@ import { handleError } from "../helper/CommandHelper.js";
|
|
|
7
7
|
Login to DANA backend (with aws and cognito) and connect to npm codeartifact
|
|
8
8
|
More info: https://github.com/wiztivi-rd/dana-cli/wiki/Login
|
|
9
9
|
*/
|
|
10
|
-
const login = async ({ org }) => {
|
|
10
|
+
const login = async ({ org, port, remote = false }) => {
|
|
11
11
|
const credentials = CredentialsHelper.get(org);
|
|
12
12
|
try {
|
|
13
13
|
prompts.intro(`Login to organization ${credentials.org} ...`);
|
|
14
|
-
const validCredentials = await AuthenticationManager.login(credentials.org);
|
|
14
|
+
const validCredentials = await AuthenticationManager.login(credentials.org, remote, port);
|
|
15
15
|
prompts.outro(colors.green("✓") + ` Login successful`);
|
|
16
16
|
const npmToken = await AuthenticationManager.loginNPM(credentials.org, validCredentials.aws);
|
|
17
17
|
await AuthenticationManager.loginGradle(credentials.org, validCredentials.aws);
|
|
@@ -10,7 +10,7 @@ const logout = async ({ org }) => {
|
|
|
10
10
|
const credentials = CredentialsHelper.get(org);
|
|
11
11
|
try {
|
|
12
12
|
prompts.intro(`Logout from ${credentials.org}...`);
|
|
13
|
-
await AuthenticationManager.logout(credentials.org, credentials.dana);
|
|
13
|
+
await AuthenticationManager.logout(credentials.org, credentials.dana, credentials.isRemote);
|
|
14
14
|
prompts.outro(colors.green("✓") + ` Logout successful. You are now being logged out in your browser.`);
|
|
15
15
|
}
|
|
16
16
|
catch (error) {
|
|
@@ -20,6 +20,8 @@ export interface DanaConfig {
|
|
|
20
20
|
lastUsedOrg: string;
|
|
21
21
|
version: number;
|
|
22
22
|
credentials: Record<string, OrgCredentials>;
|
|
23
|
+
port?: number;
|
|
24
|
+
isRemote: boolean;
|
|
23
25
|
}
|
|
24
26
|
export declare const CURRENT_DANA_JSON_VERSION = 2;
|
|
25
27
|
export declare class CredentialsHelper {
|
|
@@ -30,11 +32,13 @@ export declare class CredentialsHelper {
|
|
|
30
32
|
aws: AwsCredentials;
|
|
31
33
|
dana: DanaToken;
|
|
32
34
|
org: string;
|
|
33
|
-
}): void;
|
|
35
|
+
}, isRemote: boolean, port?: number): void;
|
|
34
36
|
static get(org?: string): {
|
|
35
37
|
aws?: AwsCredentials;
|
|
36
38
|
dana?: DanaToken;
|
|
37
39
|
org: string;
|
|
40
|
+
isRemote: boolean;
|
|
41
|
+
port?: number;
|
|
38
42
|
};
|
|
39
43
|
static delete(org: string): void;
|
|
40
44
|
}
|
|
@@ -28,16 +28,26 @@ export class CredentialsHelper {
|
|
|
28
28
|
aws: v1.aws,
|
|
29
29
|
},
|
|
30
30
|
},
|
|
31
|
+
isRemote: false,
|
|
31
32
|
version: CURRENT_DANA_JSON_VERSION,
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
return config;
|
|
35
36
|
}
|
|
36
|
-
static store(credentials) {
|
|
37
|
+
static store(credentials, isRemote, port) {
|
|
37
38
|
let config = this.getConfig();
|
|
38
|
-
config ??= {
|
|
39
|
+
config ??= {
|
|
40
|
+
lastUsedOrg: credentials.org,
|
|
41
|
+
credentials: {},
|
|
42
|
+
version: CURRENT_DANA_JSON_VERSION,
|
|
43
|
+
isRemote: false,
|
|
44
|
+
};
|
|
39
45
|
config.credentials ??= {};
|
|
40
46
|
config.lastUsedOrg = credentials.org;
|
|
47
|
+
if (port) {
|
|
48
|
+
config.port = port;
|
|
49
|
+
}
|
|
50
|
+
config.isRemote = isRemote;
|
|
41
51
|
config.credentials[credentials.org] = { aws: credentials.aws, dana: credentials.dana };
|
|
42
52
|
writeFileSync(this.filePath, JSON.stringify(config, null, 4));
|
|
43
53
|
}
|
|
@@ -46,6 +56,7 @@ export class CredentialsHelper {
|
|
|
46
56
|
const organization = org ?? config?.lastUsedOrg ?? DEFAULT_ORG;
|
|
47
57
|
const creds = {
|
|
48
58
|
org: organization,
|
|
59
|
+
isRemote: false,
|
|
49
60
|
};
|
|
50
61
|
if (config?.credentials?.[organization]?.aws) {
|
|
51
62
|
creds.aws = config?.credentials[organization]?.aws;
|
|
@@ -53,6 +64,10 @@ export class CredentialsHelper {
|
|
|
53
64
|
if (config?.credentials?.[organization]?.dana) {
|
|
54
65
|
creds.dana = config?.credentials[organization]?.dana;
|
|
55
66
|
}
|
|
67
|
+
if (config?.port) {
|
|
68
|
+
creds.port = config.port;
|
|
69
|
+
}
|
|
70
|
+
creds.isRemote = !!config?.isRemote;
|
|
56
71
|
return creds;
|
|
57
72
|
}
|
|
58
73
|
static delete(org) {
|
|
@@ -84,8 +84,9 @@ declare const CreateAppHelper: {
|
|
|
84
84
|
readonly setConfig: ({ directory }: {
|
|
85
85
|
directory: string;
|
|
86
86
|
}) => Promise<string>;
|
|
87
|
+
readonly getConfig: () => Promise<import("../../addDevice/deviceConfig/configTypes.js").TvosConf>;
|
|
88
|
+
readonly getJscVersion: () => Promise<string>;
|
|
87
89
|
readonly appConfig: {};
|
|
88
|
-
getConfig(..._: string[]): Promise<unknown>;
|
|
89
90
|
updateProfileJsonWithRenderers(jsonData: Record<string, unknown>, renderers: string[]): object;
|
|
90
91
|
} | {
|
|
91
92
|
new (): {};
|
|
@@ -102,6 +103,12 @@ declare const CreateAppHelper: {
|
|
|
102
103
|
readonly updateProfileJson: (directory: string, config: import("../../addDevice/deviceConfig/configTypes.js").AndroidConfig) => Promise<string>;
|
|
103
104
|
readonly appConfig: {};
|
|
104
105
|
updateProfileJsonWithRenderers(jsonData: Record<string, unknown>, renderers: string[]): object;
|
|
106
|
+
} | {
|
|
107
|
+
new (): {};
|
|
108
|
+
readonly getConfig: () => Promise<import("../../addDevice/deviceConfig/configTypes.js").VidaaConf>;
|
|
109
|
+
readonly setConfig: () => Promise<string>;
|
|
110
|
+
readonly appConfig: {};
|
|
111
|
+
updateProfileJsonWithRenderers(jsonData: Record<string, unknown>, renderers: string[]): object;
|
|
105
112
|
};
|
|
106
113
|
readonly promptUnavailableDevices: (unavailableDevices: string[]) => void;
|
|
107
114
|
readonly promptSelectDevices: (devices: SelectionArray, required?: boolean) => Promise<string[]>;
|
|
@@ -18,6 +18,8 @@ import DeviceConfig from "../../addDevice/deviceConfig/deviceConfig.js";
|
|
|
18
18
|
import AndroidtvConfig from "../../addDevice/deviceConfig/androidtvConfig.js";
|
|
19
19
|
import colors from "picocolors";
|
|
20
20
|
import translation from "../../../common/translation/translation.js";
|
|
21
|
+
import VidaaConfig from "../../addDevice/deviceConfig/vidaaConfig.js";
|
|
22
|
+
import TitanosConfig from "../../addDevice/deviceConfig/titanosConfig.js";
|
|
21
23
|
const CreateAppHelper = class {
|
|
22
24
|
/**
|
|
23
25
|
* Manage cancellation with CTRL+C
|
|
@@ -53,6 +55,10 @@ const CreateAppHelper = class {
|
|
|
53
55
|
return TvosConfig;
|
|
54
56
|
case deviceConst.ANDROIDTV:
|
|
55
57
|
return AndroidtvConfig;
|
|
58
|
+
case deviceConst.VIDAA:
|
|
59
|
+
return VidaaConfig;
|
|
60
|
+
case deviceConst.TITANOS:
|
|
61
|
+
return TitanosConfig;
|
|
56
62
|
default:
|
|
57
63
|
return DeviceConfig;
|
|
58
64
|
}
|
|
@@ -52,7 +52,7 @@ class SetupChecker {
|
|
|
52
52
|
* @returns {Promise}
|
|
53
53
|
*/
|
|
54
54
|
static async validateNodeVersion() {
|
|
55
|
-
const minimalNodeVersion =
|
|
55
|
+
const minimalNodeVersion = 22;
|
|
56
56
|
const currentVersion = Number.parseInt(process.version.slice(1).split(".")[0], 10);
|
|
57
57
|
return currentVersion >= minimalNodeVersion
|
|
58
58
|
? Promise.resolve("Node version ok !")
|
|
@@ -4,6 +4,8 @@ declare const WEBOS = "webos";
|
|
|
4
4
|
declare const ANDROIDTV = "androidtv";
|
|
5
5
|
declare const CSS = "css";
|
|
6
6
|
declare const LIGHTNING = "lightning";
|
|
7
|
+
declare const VIDAA = "vidaa";
|
|
8
|
+
declare const TITANOS = "titanos";
|
|
7
9
|
declare const BASIC_DEPENDENCIES: string[];
|
|
8
10
|
/**
|
|
9
11
|
* @property {String} label - user-friendly displayed name
|
|
@@ -20,4 +22,4 @@ declare const BASIC_SETUP: Record<string, PlatformConfig>;
|
|
|
20
22
|
declare const EXTENDED_SETUP: Record<string, PlatformConfig>;
|
|
21
23
|
declare const PLATFORM_CONFIG: Record<string, PlatformConfig>;
|
|
22
24
|
declare const RENDERERS: string[];
|
|
23
|
-
export { TVOS, TIZEN, WEBOS, ANDROIDTV, BASIC_DEPENDENCIES, PLATFORM_CONFIG, RENDERERS, BASIC_SETUP, EXTENDED_SETUP, LIGHTNING, CSS, };
|
|
25
|
+
export { TVOS, TIZEN, WEBOS, ANDROIDTV, VIDAA, TITANOS, BASIC_DEPENDENCIES, PLATFORM_CONFIG, RENDERERS, BASIC_SETUP, EXTENDED_SETUP, LIGHTNING, CSS, };
|
|
@@ -15,6 +15,8 @@ const WEBOS = "webos";
|
|
|
15
15
|
const ANDROIDTV = "androidtv";
|
|
16
16
|
const CSS = "css";
|
|
17
17
|
const LIGHTNING = "lightning";
|
|
18
|
+
const VIDAA = "vidaa";
|
|
19
|
+
const TITANOS = "titanos";
|
|
18
20
|
const BASIC_DEPENDENCIES = [
|
|
19
21
|
"@dana/renderer-css",
|
|
20
22
|
"@dana/renderer-lightning-html5",
|
|
@@ -36,6 +38,7 @@ const BASIC_SETUP = {
|
|
|
36
38
|
},
|
|
37
39
|
};
|
|
38
40
|
//Devices that need a subscription to be added in project
|
|
41
|
+
//package is used to check if user is entitled to the device
|
|
39
42
|
const EXTENDED_SETUP = {
|
|
40
43
|
[TVOS]: {
|
|
41
44
|
label: "TV OS",
|
|
@@ -57,7 +60,12 @@ const EXTENDED_SETUP = {
|
|
|
57
60
|
package: "@dana/engine-android",
|
|
58
61
|
dependencies: ["@dana/engine-android", "@dana/renderer-android", "@dana/tools-android-grunt"],
|
|
59
62
|
},
|
|
63
|
+
[VIDAA]: {
|
|
64
|
+
label: "Vidaa",
|
|
65
|
+
package: "@dana/vendor-vidaa",
|
|
66
|
+
dependencies: ["@dana/vendor-vidaa", "@dana/tools-smarttv-grunt"],
|
|
67
|
+
},
|
|
60
68
|
};
|
|
61
69
|
const PLATFORM_CONFIG = { ...BASIC_SETUP, ...EXTENDED_SETUP };
|
|
62
70
|
const RENDERERS = [CSS, LIGHTNING];
|
|
63
|
-
export { TVOS, TIZEN, WEBOS, ANDROIDTV, BASIC_DEPENDENCIES, PLATFORM_CONFIG, RENDERERS, BASIC_SETUP, EXTENDED_SETUP, LIGHTNING, CSS, };
|
|
71
|
+
export { TVOS, TIZEN, WEBOS, ANDROIDTV, VIDAA, TITANOS, BASIC_DEPENDENCIES, PLATFORM_CONFIG, RENDERERS, BASIC_SETUP, EXTENDED_SETUP, LIGHTNING, CSS, };
|
|
@@ -11,9 +11,8 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import fs from "node:fs";
|
|
13
13
|
import path from "node:path";
|
|
14
|
-
import {
|
|
15
|
-
import { ANDROIDTV } from "../const/deviceConst.js";
|
|
16
|
-
import translation from "../translation/translation.js";
|
|
14
|
+
import { spawnSync } from "node:child_process";
|
|
15
|
+
import { ANDROIDTV, TVOS } from "../const/deviceConst.js";
|
|
17
16
|
import { CredentialsHelper } from "../../commands/authentication/helper/CredentialsHelper.js";
|
|
18
17
|
import { getRepositoryEndpoint } from "../../commands/authentication/helper/CodeArtifactHelper.js";
|
|
19
18
|
import ComponentHelper from "../../commands/addComponent/helper/ComponentHelper.js";
|
|
@@ -49,6 +48,15 @@ class CreateFileHelper {
|
|
|
49
48
|
}
|
|
50
49
|
return Promise.resolve("Config file(s) copied");
|
|
51
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
|
+
}
|
|
52
60
|
/**
|
|
53
61
|
* Execute grunt tasks
|
|
54
62
|
*/
|
|
@@ -60,17 +68,25 @@ class CreateFileHelper {
|
|
|
60
68
|
credentials: credentials?.aws,
|
|
61
69
|
format: "maven",
|
|
62
70
|
});
|
|
63
|
-
|
|
71
|
+
const args = ["copyProjectAndroidTv", `--appUrl=${registryAccount}`, `--organization=${credentials.org}`];
|
|
64
72
|
const optionsToAdd = ["appId", "appName", "appVersion", "appVersionCode", "wtvAndroidVersion"];
|
|
65
73
|
for (const option of optionsToAdd) {
|
|
66
|
-
|
|
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}`);
|
|
67
81
|
}
|
|
82
|
+
}
|
|
83
|
+
if (selectedDevices.includes(TVOS)) {
|
|
68
84
|
try {
|
|
69
|
-
|
|
85
|
+
const args = ["copyProjectTvos", `--jscVersion=${config.tvos?.jscVersion}`];
|
|
86
|
+
await CreateFileHelper.runGruntCommand(args, directory);
|
|
70
87
|
}
|
|
71
|
-
catch (
|
|
72
|
-
|
|
73
|
-
throw new Error(message);
|
|
88
|
+
catch (error) {
|
|
89
|
+
throw new Error(`Failed to execute grunt tasks: ${error.message}`);
|
|
74
90
|
}
|
|
75
91
|
}
|
|
76
92
|
return "Grunt task(s) done";
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
|
-
import { exec } from "node:child_process";
|
|
12
|
+
import { exec, spawn } from "node:child_process";
|
|
13
13
|
import { BASIC_DEPENDENCIES, PLATFORM_CONFIG } from "../const/deviceConst.js";
|
|
14
14
|
import translation from "../translation/translation.js";
|
|
15
15
|
import path from "node:path";
|
|
@@ -22,18 +22,26 @@ class InstallHelper {
|
|
|
22
22
|
static installDependencies = ({ directory, selectedDevices, config, }) => {
|
|
23
23
|
const devDependencies = InstallHelper.getDependenciesList(selectedDevices, config);
|
|
24
24
|
return new Promise((resolve, reject) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
const npmInstall = spawn("npm", ["i", "--silent"], { shell: true, cwd: directory });
|
|
26
|
+
npmInstall.on("close", (code) => {
|
|
27
|
+
if (code === 0) {
|
|
28
|
+
InstallHelper.installSingleDependency(devDependencies, directory)
|
|
29
|
+
.then(() => {
|
|
30
|
+
InstallHelper.updateSemver(directory);
|
|
31
|
+
resolve("Dependencies updated");
|
|
32
|
+
})
|
|
33
|
+
.catch((error) => {
|
|
34
|
+
reject(new Error("Dependencies update failed : " +
|
|
35
|
+
(error.message ?? translation["error.common.start.message"])));
|
|
36
|
+
});
|
|
31
37
|
}
|
|
32
|
-
|
|
33
|
-
reject(new Error("
|
|
34
|
-
(error.message ?? translation["error.common.start.message"])));
|
|
38
|
+
else {
|
|
39
|
+
reject(new Error("FAILURE during dependencies installation"));
|
|
35
40
|
}
|
|
36
|
-
})
|
|
41
|
+
});
|
|
42
|
+
npmInstall.on("error", (data) => {
|
|
43
|
+
reject(new Error(`FAILURE during dependency installation : ${data}`));
|
|
44
|
+
});
|
|
37
45
|
});
|
|
38
46
|
};
|
|
39
47
|
static getDependenciesList(selectedDevices, config) {
|
|
@@ -45,14 +53,21 @@ class InstallHelper {
|
|
|
45
53
|
}
|
|
46
54
|
static installSingleDependency = (depName, directory) => {
|
|
47
55
|
return new Promise((resolveInstall, rejectInstall) => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
const npmInstall = spawn("npm", ["i", ...depName, "--save-dev", "--save-exact"], {
|
|
57
|
+
cwd: directory,
|
|
58
|
+
shell: true,
|
|
59
|
+
});
|
|
60
|
+
npmInstall.on("close", (code) => {
|
|
61
|
+
if (code === 0) {
|
|
62
|
+
resolveInstall();
|
|
51
63
|
}
|
|
52
64
|
else {
|
|
53
|
-
|
|
65
|
+
rejectInstall(new Error(`FAILURE during dependency installation`));
|
|
54
66
|
}
|
|
55
67
|
});
|
|
68
|
+
npmInstall.on("error", (error) => {
|
|
69
|
+
rejectInstall(new Error(`FAILURE during dependency installation : ${error.message}`));
|
|
70
|
+
});
|
|
56
71
|
});
|
|
57
72
|
};
|
|
58
73
|
static updateSemver = (directory) => {
|
|
@@ -95,28 +110,36 @@ class InstallHelper {
|
|
|
95
110
|
});
|
|
96
111
|
});
|
|
97
112
|
};
|
|
113
|
+
static runGitCommand(args, directory) {
|
|
114
|
+
return new Promise((resolve, reject) => {
|
|
115
|
+
const gitProcess = spawn("git", args, { cwd: directory });
|
|
116
|
+
gitProcess.on("close", (code) => {
|
|
117
|
+
if (code === 0) {
|
|
118
|
+
resolve();
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
reject(new Error(`Git ${args[0]} failed`));
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
gitProcess.on("error", (error) => {
|
|
125
|
+
reject(new Error(`Git ${args[0]} failed: ${error.message}`));
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
}
|
|
98
129
|
/**
|
|
99
130
|
* Initialize git repository and do first commit
|
|
100
131
|
* @returns {Promise<String>}
|
|
101
132
|
*/
|
|
102
|
-
static initGit = function ({ directory }) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
catch (e) {
|
|
116
|
-
const message = e instanceof Error ? e.message : translation["error.common.start.message"];
|
|
117
|
-
reject(new Error("Git hasn't been initialised" + message));
|
|
118
|
-
}
|
|
119
|
-
});
|
|
133
|
+
static initGit = async function ({ directory }) {
|
|
134
|
+
try {
|
|
135
|
+
await InstallHelper.runGitCommand(["init"], directory);
|
|
136
|
+
await InstallHelper.runGitCommand(["add", "."], directory);
|
|
137
|
+
await InstallHelper.runGitCommand(["commit", "-m", "Initial commit from Create DANA App"], directory);
|
|
138
|
+
return "Git initialized";
|
|
139
|
+
}
|
|
140
|
+
catch (e) {
|
|
141
|
+
throw new Error("Git hasn't been initialised: " + e.message);
|
|
142
|
+
}
|
|
120
143
|
};
|
|
121
144
|
}
|
|
122
145
|
export default InstallHelper;
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
"command.auth.login.description": "Login to Dana",
|
|
25
25
|
"command.auth.logout.description": "Logout from Dana",
|
|
26
26
|
"command.auth.login.option.org": "Organization to login/logout",
|
|
27
|
+
"command.auth.login.option.remote": "Allow connexion to dana authentication stack when working on remote server. Display login url",
|
|
28
|
+
"command.auth.login.option.port": "Provide a port for login server",
|
|
29
|
+
"command.auth.remoteMode": "You are in remote mode. Verify you are forwarding the right port to the host machine.",
|
|
30
|
+
"command.auth.accessBrowserUrl": "You can complete the operation by accessing the following url in the browser.",
|
|
27
31
|
"command.auth.status.description": "Get login status",
|
|
28
32
|
"command.auth.get-packages-token.description": "Get token for packages repository",
|
|
29
33
|
"command.scrollView.description": "Add a scrollView of rails",
|
|
@@ -47,7 +51,7 @@
|
|
|
47
51
|
"setup.ok": "Configuration ok",
|
|
48
52
|
"setup.ko": "Prerequisite not met",
|
|
49
53
|
"device.unavailable": "Enhance your experience by adding device(s) to your subscription:",
|
|
50
|
-
"device.selection": "Press
|
|
54
|
+
"device.selection": "Press SPACE KEY to select additional device(s).",
|
|
51
55
|
"renderer.selection": "Select AT LEAST one renderer for",
|
|
52
56
|
"input.name": "What is your project's name ?",
|
|
53
57
|
"input.aws.error": "You need to have an AWS account.\nSee:https://dana-framework.com/guides/getting-started#configure-aws-connection",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ANDROIDTV, TIZEN, TVOS, WEBOS } from "../const/deviceConst.js";
|
|
2
|
-
import { AndroidConfig, AndroidDevice, TizenConf, WebosConf, WebosDevice } from "../../commands/addDevice/deviceConfig/configTypes.js";
|
|
1
|
+
import { ANDROIDTV, TITANOS, TIZEN, TVOS, VIDAA, WEBOS } from "../const/deviceConst.js";
|
|
2
|
+
import { AndroidConfig, AndroidDevice, TizenConf, WebosConf, WebosDevice, TvosConf, VidaaConf, TitanosConf } from "../../commands/addDevice/deviceConfig/configTypes.js";
|
|
3
3
|
interface Task {
|
|
4
4
|
title: string;
|
|
5
5
|
task: () => Promise<string>;
|
|
@@ -13,10 +13,12 @@ interface Data {
|
|
|
13
13
|
awsProfile: string;
|
|
14
14
|
}
|
|
15
15
|
interface Config {
|
|
16
|
-
[TVOS]?:
|
|
16
|
+
[TVOS]?: TvosConf;
|
|
17
17
|
[ANDROIDTV]?: AndroidConfig;
|
|
18
18
|
[WEBOS]?: WebosConf;
|
|
19
19
|
[TIZEN]?: TizenConf;
|
|
20
|
+
[VIDAA]?: VidaaConf;
|
|
21
|
+
[TITANOS]?: TitanosConf;
|
|
20
22
|
}
|
|
21
23
|
interface DeviceConf {
|
|
22
24
|
device?: WebosDevice | AndroidDevice;
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
* This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
|
-
import { ANDROIDTV, TIZEN, TVOS, WEBOS } from "../const/deviceConst.js";
|
|
12
|
+
import { ANDROIDTV, TITANOS, TIZEN, TVOS, VIDAA, WEBOS } from "../const/deviceConst.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wiztivi/dana-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14-beta.1",
|
|
4
4
|
"description": "Dana create app CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./dist/index.js",
|
|
@@ -26,25 +26,25 @@
|
|
|
26
26
|
"README.md"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@aws-sdk/client-codeartifact": "
|
|
30
|
-
"@clack/prompts": "0.
|
|
31
|
-
"@wiztivi/dana-templates": "^0.0.
|
|
29
|
+
"@aws-sdk/client-codeartifact": "3.940.0",
|
|
30
|
+
"@clack/prompts": "0.11.0",
|
|
31
|
+
"@wiztivi/dana-templates": "^0.0.14-beta.1",
|
|
32
32
|
"child_process": "1.0.x",
|
|
33
33
|
"command-exists": "1.2.9",
|
|
34
|
-
"commander": "
|
|
35
|
-
"express": "
|
|
36
|
-
"get-port": "
|
|
37
|
-
"grunt-cli": "1.
|
|
38
|
-
"handlebars": "
|
|
39
|
-
"jsonwebtoken": "
|
|
40
|
-
"open": "
|
|
41
|
-
"picocolors": "1.
|
|
42
|
-
"url": "
|
|
43
|
-
"semver": "
|
|
44
|
-
"semver-ts": "
|
|
34
|
+
"commander": "14.0.x",
|
|
35
|
+
"express": "5.1.0",
|
|
36
|
+
"get-port": "7.1.0",
|
|
37
|
+
"grunt-cli": "1.5.x",
|
|
38
|
+
"handlebars": "4.7.8",
|
|
39
|
+
"jsonwebtoken": "9.0.2",
|
|
40
|
+
"open": "11.0.0",
|
|
41
|
+
"picocolors": "1.1.x",
|
|
42
|
+
"url": "0.11.4",
|
|
43
|
+
"semver": "7.7.3",
|
|
44
|
+
"semver-ts": "1.0.3"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@types/express": "
|
|
48
|
-
"@types/jsonwebtoken": "
|
|
47
|
+
"@types/express": "5.0.5",
|
|
48
|
+
"@types/jsonwebtoken": "9.0.10"
|
|
49
49
|
}
|
|
50
50
|
}
|