@wiztivi/dana-cli 0.0.1-beta-10 → 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/dist/commands/add-device.js +2 -1
- package/dist/commands/auth/login.js +6 -24
- package/dist/commands/auth/status.d.ts +11 -2
- package/dist/commands/auth/status.js +19 -4
- package/dist/commands/commandDefinitions/authDefinition.js +4 -2
- package/dist/commands/commandDefinitions/createAppDefinition.js +0 -2
- package/dist/commands/createApp.d.ts +0 -2
- package/dist/commands/createApp.js +4 -10
- package/dist/commands/hooks/authHook.js +8 -5
- package/dist/configs/deviceConfig/androidtvConfig.d.ts +2 -2
- package/dist/configs/deviceConfig/androidtvConfig.js +21 -10
- package/dist/const/authentConst.d.ts +3 -0
- package/dist/const/authentConst.js +6 -0
- package/dist/helpers/CliHelper.d.ts +0 -2
- package/dist/helpers/CliHelper.js +2 -12
- package/dist/helpers/CodeArtifactHelper.d.ts +12 -0
- package/dist/helpers/CodeArtifactHelper.js +52 -0
- package/dist/helpers/CredentialsHelper.js +1 -2
- package/dist/helpers/createApp/CreateFileHelper.d.ts +2 -10
- package/dist/helpers/createApp/CreateFileHelper.js +11 -13
- package/dist/helpers/createApp/ScriptHelper.d.ts +2 -2
- package/dist/helpers/createApp/SetupChecker.js +1 -1
- package/dist/helpers/createApp/UpdateFileHelper.d.ts +4 -5
- package/dist/helpers/createApp/UpdateFileHelper.js +11 -6
- package/dist/helpers/createApp/UserInputGetter.d.ts +4 -20
- package/dist/helpers/createApp/UserInputGetter.js +4 -74
- package/dist/translation/en.json +1 -0
- package/dist/types/createApp/helperTypes.d.ts +2 -6
- package/package.json +1 -1
- package/dist/types/createApp/createAppTypes.d.ts +0 -39
- package/dist/types/createApp/createAppTypes.js +0 -14
|
@@ -59,12 +59,13 @@ const picocolors_1 = __importDefault(require("picocolors"));
|
|
|
59
59
|
const exitCodeConst_1 = require("../const/exitCodeConst");
|
|
60
60
|
const node_process_1 = __importDefault(require("node:process"));
|
|
61
61
|
const translation_1 = __importDefault(require("../translation/translation"));
|
|
62
|
+
const CredentialsHelper_1 = require("../helpers/CredentialsHelper");
|
|
62
63
|
const addDevice = async () => {
|
|
63
64
|
prompts.intro(`Add device(s) to ${path_1.default.basename(node_process_1.default.cwd())} !`);
|
|
64
65
|
const data = {};
|
|
65
66
|
try {
|
|
66
67
|
data.directory = "./";
|
|
67
|
-
data.
|
|
68
|
+
data.awsProfile = CredentialsHelper_1.CredentialsHelper.get().org;
|
|
68
69
|
const { availableDevices, unavailableDevices } = await UserInputGetter_1.default.getAvailableDevices();
|
|
69
70
|
const installedDevices = CliHelper_1.default.getInstalledDevices(data.directory);
|
|
70
71
|
const filteredAvailableDevices = availableDevices.filter((el) => !installedDevices.includes(el.value));
|
|
@@ -45,6 +45,8 @@ const open_1 = __importDefault(require("open"));
|
|
|
45
45
|
const picocolors_1 = __importDefault(require("picocolors"));
|
|
46
46
|
const exitCodeConst_1 = require("../../const/exitCodeConst");
|
|
47
47
|
const CredentialsHelper_1 = require("../../helpers/CredentialsHelper");
|
|
48
|
+
const authentConst_1 = require("../../const/authentConst");
|
|
49
|
+
const CodeArtifactHelper_1 = require("../../helpers/CodeArtifactHelper");
|
|
48
50
|
/*
|
|
49
51
|
Login to DANA backend (with aws and cognito) and connect to npm codeartifact
|
|
50
52
|
More info: https://github.com/wiztivi-rd/dana-cli/wiki/Login
|
|
@@ -117,39 +119,19 @@ const handleError = (error) => {
|
|
|
117
119
|
process.exit(exitCodeConst_1.LOGIN_ERROR);
|
|
118
120
|
};
|
|
119
121
|
const codeartifactLogin = async (organization, credentials) => {
|
|
120
|
-
const domain = "dana";
|
|
121
|
-
const domainOwner = "733912940672";
|
|
122
|
-
const repository = `dana-${organization}-repository`;
|
|
123
|
-
const region = "eu-central-1";
|
|
124
122
|
// Create CodeArtifact client with credentials
|
|
125
|
-
const client =
|
|
126
|
-
region,
|
|
127
|
-
credentials: {
|
|
128
|
-
accessKeyId: credentials.accessKeyId,
|
|
129
|
-
secretAccessKey: credentials.secretAccessKey,
|
|
130
|
-
sessionToken: credentials.sessionToken,
|
|
131
|
-
},
|
|
132
|
-
});
|
|
123
|
+
const client = (0, CodeArtifactHelper_1.createCodeArtifactClient)(credentials);
|
|
133
124
|
// Get authorization token
|
|
134
125
|
const tokenCommand = new client_codeartifact_1.GetAuthorizationTokenCommand({
|
|
135
|
-
domain,
|
|
136
|
-
domainOwner,
|
|
126
|
+
domain: authentConst_1.DOMAIN,
|
|
127
|
+
domainOwner: authentConst_1.DOMAIN_OWNER,
|
|
137
128
|
});
|
|
138
129
|
const { authorizationToken, expiration } = await client.send(tokenCommand);
|
|
139
130
|
if (!authorizationToken) {
|
|
140
131
|
throw new Error("Authorization token not found");
|
|
141
132
|
}
|
|
142
133
|
// Get repository endpoint
|
|
143
|
-
const
|
|
144
|
-
domain,
|
|
145
|
-
domainOwner,
|
|
146
|
-
repository,
|
|
147
|
-
format: "npm",
|
|
148
|
-
});
|
|
149
|
-
const { repositoryEndpoint } = await client.send(endpointCommand);
|
|
150
|
-
if (!repositoryEndpoint) {
|
|
151
|
-
throw new Error("Repository endpoint not found");
|
|
152
|
-
}
|
|
134
|
+
const repositoryEndpoint = await (0, CodeArtifactHelper_1.getRepositoryEndpoint)({ organization, credentials, client, format: "npm" });
|
|
153
135
|
// Configure npm with the repository and token
|
|
154
136
|
(0, child_process_1.execSync)(`npm config set @dana:registry=${repositoryEndpoint}`);
|
|
155
137
|
(0, child_process_1.execSync)(`npm config set //${repositoryEndpoint.replace(/^https?:\/\//, "")}:_authToken=${authorizationToken}`);
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
1
|
+
declare enum LOGIN_STATUS {
|
|
2
|
+
LOGGED = 1,
|
|
3
|
+
NOT_LOGGED = 2,
|
|
4
|
+
TOKEN_EXPIRED = 3
|
|
5
|
+
}
|
|
6
|
+
declare const status: () => LOGIN_STATUS;
|
|
7
|
+
/**
|
|
8
|
+
* Sends void intentionally to be used a Commander acceptable command
|
|
9
|
+
*/
|
|
10
|
+
declare const statusAction: () => void;
|
|
11
|
+
export { LOGIN_STATUS, status, statusAction };
|
|
@@ -36,26 +36,41 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.statusAction = exports.status = exports.LOGIN_STATUS = void 0;
|
|
39
40
|
const prompts = __importStar(require("@clack/prompts"));
|
|
40
41
|
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
41
42
|
const picocolors_1 = __importDefault(require("picocolors"));
|
|
42
43
|
const CredentialsHelper_1 = require("../../helpers/CredentialsHelper");
|
|
43
44
|
const translation_1 = __importDefault(require("../../translation/translation"));
|
|
45
|
+
var LOGIN_STATUS;
|
|
46
|
+
(function (LOGIN_STATUS) {
|
|
47
|
+
LOGIN_STATUS[LOGIN_STATUS["LOGGED"] = 1] = "LOGGED";
|
|
48
|
+
LOGIN_STATUS[LOGIN_STATUS["NOT_LOGGED"] = 2] = "NOT_LOGGED";
|
|
49
|
+
LOGIN_STATUS[LOGIN_STATUS["TOKEN_EXPIRED"] = 3] = "TOKEN_EXPIRED";
|
|
50
|
+
})(LOGIN_STATUS || (exports.LOGIN_STATUS = LOGIN_STATUS = {}));
|
|
44
51
|
const status = () => {
|
|
45
52
|
const credentials = CredentialsHelper_1.CredentialsHelper.get();
|
|
46
|
-
if (!credentials) {
|
|
53
|
+
if (!credentials?.dana?.id_token) {
|
|
47
54
|
prompts.log.error(`${translation_1.default["login.error.not_logged"]} ${translation_1.default["login.info.please_login"]}`);
|
|
48
|
-
return;
|
|
55
|
+
return LOGIN_STATUS.NOT_LOGGED;
|
|
49
56
|
}
|
|
50
57
|
const id_token = credentials.dana.id_token;
|
|
51
58
|
const { given_name, family_name, email, exp } = jsonwebtoken_1.default.decode(id_token);
|
|
52
59
|
const expiration = exp && new Date(exp * 1000);
|
|
53
60
|
if (expiration && new Date() > expiration) {
|
|
54
61
|
prompts.log.error(`${translation_1.default["login.info.token_expired"]} ${translation_1.default["login.info.please_login"]}`);
|
|
55
|
-
return;
|
|
62
|
+
return LOGIN_STATUS.TOKEN_EXPIRED;
|
|
56
63
|
}
|
|
57
64
|
const expStr = expiration ? `\nToken expires on ${expiration.toUTCString()}` : "";
|
|
58
65
|
prompts.log.success(`${translation_1.default["login.info.logged"]} ${picocolors_1.default.bold(credentials.org)}: ${picocolors_1.default.bold(given_name + " " + family_name)} (${email})${expStr}
|
|
59
66
|
`);
|
|
67
|
+
return LOGIN_STATUS.LOGGED;
|
|
60
68
|
};
|
|
61
|
-
exports.
|
|
69
|
+
exports.status = status;
|
|
70
|
+
/**
|
|
71
|
+
* Sends void intentionally to be used a Commander acceptable command
|
|
72
|
+
*/
|
|
73
|
+
const statusAction = () => {
|
|
74
|
+
status();
|
|
75
|
+
};
|
|
76
|
+
exports.statusAction = statusAction;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const commander_1 = require("commander");
|
|
7
7
|
const translation_1 = __importDefault(require("../../translation/translation"));
|
|
8
8
|
const login_1 = __importDefault(require("../auth/login"));
|
|
9
|
-
const status_1 =
|
|
9
|
+
const status_1 = require("../auth/status");
|
|
10
10
|
const addAuthDefinition = () => {
|
|
11
11
|
const command = new commander_1.Command("auth").description(translation_1.default["command.auth.description"]);
|
|
12
12
|
const loginCmd = new commander_1.Command("login")
|
|
@@ -14,7 +14,9 @@ const addAuthDefinition = () => {
|
|
|
14
14
|
.option("-o, --org <organization>", translation_1.default["command.auth.login.option.org"], "preprod")
|
|
15
15
|
.action(login_1.default);
|
|
16
16
|
command.addCommand(loginCmd);
|
|
17
|
-
const statusCmd = new commander_1.Command("status")
|
|
17
|
+
const statusCmd = new commander_1.Command("status")
|
|
18
|
+
.description(translation_1.default["command.auth.status.description"])
|
|
19
|
+
.action(status_1.statusAction);
|
|
18
20
|
command.addCommand(statusCmd);
|
|
19
21
|
return command;
|
|
20
22
|
};
|
|
@@ -15,8 +15,6 @@ const createAppDefinition = () => {
|
|
|
15
15
|
.argument("[projectDirectory]", translation_1.default["command.create_app.directory"])
|
|
16
16
|
.option("-t, --tutorial", translation_1.default["command.create_app.tutorial"])
|
|
17
17
|
.option("-d, --devices", translation_1.default["command.create_app.devices"])
|
|
18
|
-
.option("-p, --profile <awsProfile>", translation_1.default["command.create_app.aws_profile"])
|
|
19
|
-
.option("-r, --repository <awsRepository>", translation_1.default["command.create_app.aws_repository"])
|
|
20
18
|
.hook("preAction", authHook_1.authHook)
|
|
21
19
|
.action(createApp_1.default);
|
|
22
20
|
return command;
|
|
@@ -48,18 +48,16 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
48
48
|
const ComponentConfig_1 = __importDefault(require("../configs/ComponentConfig"));
|
|
49
49
|
const translation_1 = __importDefault(require("../translation/translation"));
|
|
50
50
|
const exitCodeConst_1 = require("../const/exitCodeConst");
|
|
51
|
+
const CredentialsHelper_1 = require("../helpers/CredentialsHelper");
|
|
51
52
|
const createApp = async (projectName, programDirectory, options) => {
|
|
52
|
-
const {
|
|
53
|
-
const awsConfig = {
|
|
54
|
-
awsProfile: profile,
|
|
55
|
-
awsRepository: repository,
|
|
56
|
-
};
|
|
53
|
+
const { devices, tutorial } = options;
|
|
57
54
|
prompts.intro(picocolors_1.default.inverse(`Let's create a${tutorial ? " tutorial " : " "}Dana application !`));
|
|
58
55
|
await SetupChecker_1.default.checkSetup();
|
|
59
|
-
const data = (await prompts.group(UserInputGetter_1.default.getPrompts(projectName, devices
|
|
56
|
+
const data = (await prompts.group(UserInputGetter_1.default.getPrompts(projectName, devices), {
|
|
60
57
|
onCancel: () => ComponentConfig_1.default.handlePromptCancel(),
|
|
61
58
|
}));
|
|
62
59
|
data.config = await UserInputGetter_1.default.getDevicesConfig(data);
|
|
60
|
+
data.awsProfile = CredentialsHelper_1.CredentialsHelper.get().org;
|
|
63
61
|
const s = prompts.spinner();
|
|
64
62
|
try {
|
|
65
63
|
s.start(translation_1.default["task.installation.start"]);
|
|
@@ -81,10 +79,6 @@ const createApp = async (projectName, programDirectory, options) => {
|
|
|
81
79
|
task: async () => CreateFileHelper_1.default.copyForTutorial(data),
|
|
82
80
|
condition: tutorial,
|
|
83
81
|
},
|
|
84
|
-
{
|
|
85
|
-
title: "Create Dana config file",
|
|
86
|
-
task: async () => CreateFileHelper_1.default.createDanaConfigFile(data),
|
|
87
|
-
},
|
|
88
82
|
{
|
|
89
83
|
title: "Update package.json",
|
|
90
84
|
task: async () => UpdateFileHelper_1.default.updatePackageJson(data),
|
|
@@ -10,11 +10,14 @@
|
|
|
10
10
|
* This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
14
|
exports.authHook = void 0;
|
|
18
|
-
const status_1 =
|
|
19
|
-
const
|
|
15
|
+
const status_1 = require("../auth/status");
|
|
16
|
+
const exitCodeConst_1 = require("../../const/exitCodeConst");
|
|
17
|
+
const authHook = () => {
|
|
18
|
+
const isLogged = (0, status_1.status)() === status_1.LOGIN_STATUS.LOGGED;
|
|
19
|
+
if (!isLogged) {
|
|
20
|
+
process.exit(exitCodeConst_1.LOGIN_ERROR);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
20
23
|
exports.authHook = authHook;
|
|
@@ -24,8 +24,8 @@ declare const AndroidtvConfig: {
|
|
|
24
24
|
/**
|
|
25
25
|
* Call aws to get latest android version
|
|
26
26
|
*/
|
|
27
|
-
readonly _getWtvAndroidVersion: (
|
|
28
|
-
readonly getConfig: (
|
|
27
|
+
readonly _getWtvAndroidVersion: () => Promise<string>;
|
|
28
|
+
readonly getConfig: () => Promise<AndroidConfig>;
|
|
29
29
|
readonly setConfig: ({ directory, config, }: {
|
|
30
30
|
directory: string;
|
|
31
31
|
config: AndroidConfig;
|
|
@@ -54,11 +54,14 @@ const setupConst_1 = require("../../const/createApp/setupConst");
|
|
|
54
54
|
const ComponentHelper_1 = __importDefault(require("../../helpers/ComponentHelper"));
|
|
55
55
|
const prompts = __importStar(require("@clack/prompts"));
|
|
56
56
|
const picocolors_1 = __importDefault(require("picocolors"));
|
|
57
|
-
const child_process_1 = require("child_process");
|
|
58
57
|
const semver_ts_1 = require("semver-ts");
|
|
59
58
|
const semver_1 = require("semver");
|
|
60
59
|
const InputValidator_1 = require("../../helpers/createApp/InputValidator");
|
|
61
60
|
const translation_1 = __importDefault(require("../../translation/translation"));
|
|
61
|
+
const CredentialsHelper_1 = require("../../helpers/CredentialsHelper");
|
|
62
|
+
const client_codeartifact_1 = require("@aws-sdk/client-codeartifact");
|
|
63
|
+
const CodeArtifactHelper_1 = require("../../helpers/CodeArtifactHelper");
|
|
64
|
+
const authentConst_1 = require("../../const/authentConst");
|
|
62
65
|
const AndroidtvConfig = class extends deviceConfig_1.default {
|
|
63
66
|
/**
|
|
64
67
|
* Get the app icon url
|
|
@@ -120,12 +123,21 @@ const AndroidtvConfig = class extends deviceConfig_1.default {
|
|
|
120
123
|
/**
|
|
121
124
|
* Call aws to get latest android version
|
|
122
125
|
*/
|
|
123
|
-
static _getWtvAndroidVersion = async (
|
|
126
|
+
static _getWtvAndroidVersion = async () => {
|
|
124
127
|
let wtvAndroidVersion;
|
|
125
128
|
try {
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
+
const credentials = CredentialsHelper_1.CredentialsHelper.get();
|
|
130
|
+
const client = (0, CodeArtifactHelper_1.createCodeArtifactClient)(credentials.aws);
|
|
131
|
+
const command = new client_codeartifact_1.ListPackageVersionsCommand({
|
|
132
|
+
package: "v8-runtime",
|
|
133
|
+
domain: authentConst_1.DOMAIN,
|
|
134
|
+
domainOwner: authentConst_1.DOMAIN_OWNER,
|
|
135
|
+
repository: (0, CodeArtifactHelper_1.formatRepositoryString)(credentials.org),
|
|
136
|
+
format: "maven",
|
|
137
|
+
namespace: "com.dana.androidtv",
|
|
138
|
+
});
|
|
139
|
+
const response = await client.send(command);
|
|
140
|
+
const versionListArray = response.versions?.map((v) => v.version).filter(Boolean);
|
|
129
141
|
// need to use semver-ts to avoid this error
|
|
130
142
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-assignment
|
|
131
143
|
wtvAndroidVersion = (0, semver_1.maxSatisfying)(versionListArray, "*");
|
|
@@ -133,15 +145,14 @@ const AndroidtvConfig = class extends deviceConfig_1.default {
|
|
|
133
145
|
return Promise.resolve(wtvAndroidVersion);
|
|
134
146
|
}
|
|
135
147
|
else {
|
|
136
|
-
throw new Error("
|
|
148
|
+
throw new Error(translation_1.default["command.device.version.error"]);
|
|
137
149
|
}
|
|
138
150
|
}
|
|
139
151
|
catch (error) {
|
|
140
|
-
|
|
141
|
-
return Promise.reject(new Error(message));
|
|
152
|
+
return Promise.reject(new Error(error.message ?? translation_1.default["error.common.start.message"]));
|
|
142
153
|
}
|
|
143
154
|
};
|
|
144
|
-
static getConfig = async (
|
|
155
|
+
static getConfig = async () => {
|
|
145
156
|
prompts.log.info(picocolors_1.default.bold("Let's configure Android !"));
|
|
146
157
|
const config = {
|
|
147
158
|
device: await prompts.group({
|
|
@@ -150,7 +161,7 @@ const AndroidtvConfig = class extends deviceConfig_1.default {
|
|
|
150
161
|
appVersion: () => this._askAppVersion(),
|
|
151
162
|
appVersionCode: () => this._askAppVersionCode(),
|
|
152
163
|
icon: () => this._getAppIcon(),
|
|
153
|
-
wtvAndroidVersion: () => this._getWtvAndroidVersion(
|
|
164
|
+
wtvAndroidVersion: () => this._getWtvAndroidVersion(),
|
|
154
165
|
}, {
|
|
155
166
|
onCancel: () => {
|
|
156
167
|
prompts.cancel("Android configuration cancelled.");
|
|
@@ -3,26 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const node_child_process_1 = require("node:child_process");
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const CliHelper = class {
|
|
10
|
-
static getAwsConfig = () => {
|
|
11
|
-
let awsConfig;
|
|
12
|
-
try {
|
|
13
|
-
awsConfig = JSON.parse((0, fs_1.readFileSync)(".dana-env").toString());
|
|
14
|
-
}
|
|
15
|
-
catch {
|
|
16
|
-
throw new Error(`Failed to parse AWS config`);
|
|
17
|
-
}
|
|
18
|
-
return awsConfig;
|
|
19
|
-
};
|
|
20
10
|
/**
|
|
21
11
|
* clean on error
|
|
22
12
|
*/
|
|
23
13
|
static cleanOnError = () => {
|
|
24
14
|
try {
|
|
25
|
-
(0,
|
|
15
|
+
(0, node_child_process_1.execSync)(`git clean -d -f && git reset --hard head`);
|
|
26
16
|
}
|
|
27
17
|
catch {
|
|
28
18
|
throw new Error("Files deletion failed. Delete changes manually.");
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CodeartifactClient } from "@aws-sdk/client-codeartifact";
|
|
2
|
+
import { AwsCredentials } from "./CredentialsHelper";
|
|
3
|
+
interface GetRepositoryEndpointOptions {
|
|
4
|
+
organization: string;
|
|
5
|
+
credentials?: AwsCredentials;
|
|
6
|
+
client?: CodeartifactClient;
|
|
7
|
+
format: "npm" | "maven";
|
|
8
|
+
}
|
|
9
|
+
export declare const getRepositoryEndpoint: ({ organization, credentials, client, format, }: GetRepositoryEndpointOptions) => Promise<string>;
|
|
10
|
+
export declare const createCodeArtifactClient: (credentials: AwsCredentials) => CodeartifactClient;
|
|
11
|
+
export declare const formatRepositoryString: (org: string) => string;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.formatRepositoryString = exports.createCodeArtifactClient = exports.getRepositoryEndpoint = void 0;
|
|
15
|
+
const client_codeartifact_1 = require("@aws-sdk/client-codeartifact");
|
|
16
|
+
const CredentialsHelper_1 = require("./CredentialsHelper");
|
|
17
|
+
const authentConst_1 = require("../const/authentConst");
|
|
18
|
+
const getRepositoryEndpoint = async ({ organization, credentials, client, format = "npm", }) => {
|
|
19
|
+
const actualCredentials = credentials ?? CredentialsHelper_1.CredentialsHelper.get()?.aws;
|
|
20
|
+
if (!actualCredentials) {
|
|
21
|
+
throw Error("No valid credentials available.");
|
|
22
|
+
}
|
|
23
|
+
const actualClient = client ?? (0, exports.createCodeArtifactClient)(actualCredentials);
|
|
24
|
+
const repository = (0, exports.formatRepositoryString)(organization);
|
|
25
|
+
const endpointCommand = new client_codeartifact_1.GetRepositoryEndpointCommand({
|
|
26
|
+
domain: authentConst_1.DOMAIN,
|
|
27
|
+
domainOwner: authentConst_1.DOMAIN_OWNER,
|
|
28
|
+
repository,
|
|
29
|
+
format,
|
|
30
|
+
});
|
|
31
|
+
const { repositoryEndpoint } = await actualClient.send(endpointCommand);
|
|
32
|
+
if (!repositoryEndpoint) {
|
|
33
|
+
throw new Error("Repository endpoint not found");
|
|
34
|
+
}
|
|
35
|
+
return repositoryEndpoint;
|
|
36
|
+
};
|
|
37
|
+
exports.getRepositoryEndpoint = getRepositoryEndpoint;
|
|
38
|
+
const createCodeArtifactClient = (credentials) => {
|
|
39
|
+
return new client_codeartifact_1.CodeartifactClient({
|
|
40
|
+
region: authentConst_1.REGION,
|
|
41
|
+
credentials: {
|
|
42
|
+
accessKeyId: credentials.accessKeyId,
|
|
43
|
+
secretAccessKey: credentials.secretAccessKey,
|
|
44
|
+
sessionToken: credentials.sessionToken,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
exports.createCodeArtifactClient = createCodeArtifactClient;
|
|
49
|
+
const formatRepositoryString = (org) => {
|
|
50
|
+
return `dana-${org}-repository`;
|
|
51
|
+
};
|
|
52
|
+
exports.formatRepositoryString = formatRepositoryString;
|
|
@@ -16,8 +16,7 @@ class CredentialsHelper {
|
|
|
16
16
|
if (!(0, node_fs_1.existsSync)(this.filePath)) {
|
|
17
17
|
return null;
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
return credentials;
|
|
19
|
+
return JSON.parse((0, node_fs_1.readFileSync)(this.filePath).toString());
|
|
21
20
|
}
|
|
22
21
|
}
|
|
23
22
|
exports.CredentialsHelper = CredentialsHelper;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Config } from "../../types/createApp/helperTypes";
|
|
2
2
|
declare class CreateFileHelper {
|
|
3
3
|
/**
|
|
4
4
|
* Copy the template
|
|
@@ -22,18 +22,10 @@ declare class CreateFileHelper {
|
|
|
22
22
|
/**
|
|
23
23
|
* Execute grunt tasks
|
|
24
24
|
*/
|
|
25
|
-
static readonly executeGruntTasks: ({ directory, selectedDevices, config,
|
|
25
|
+
static readonly executeGruntTasks: ({ directory, selectedDevices, config, }: {
|
|
26
26
|
selectedDevices: string[];
|
|
27
27
|
directory: string;
|
|
28
28
|
config: Config;
|
|
29
|
-
awsConfig: AwsConfig;
|
|
30
|
-
}) => Promise<string>;
|
|
31
|
-
/**
|
|
32
|
-
* Store aws config into .dana-env file
|
|
33
|
-
*/
|
|
34
|
-
static readonly createDanaConfigFile: ({ directory, awsConfig, }: {
|
|
35
|
-
directory: string;
|
|
36
|
-
awsConfig: AwsConfig;
|
|
37
29
|
}) => Promise<string>;
|
|
38
30
|
}
|
|
39
31
|
export default CreateFileHelper;
|
|
@@ -16,10 +16,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
const fs_1 = __importDefault(require("fs"));
|
|
18
18
|
const path_1 = __importDefault(require("path"));
|
|
19
|
-
const
|
|
19
|
+
const node_child_process_1 = require("node:child_process");
|
|
20
20
|
const deviceConst_1 = require("../../const/createApp/deviceConst");
|
|
21
|
-
const setupConst_1 = require("../../const/createApp/setupConst");
|
|
22
21
|
const translation_1 = __importDefault(require("../../translation/translation"));
|
|
22
|
+
const CredentialsHelper_1 = require("../CredentialsHelper");
|
|
23
|
+
const CodeArtifactHelper_1 = require("../CodeArtifactHelper");
|
|
23
24
|
const templateModule = "@wiztivi/dana-templates";
|
|
24
25
|
class CreateFileHelper {
|
|
25
26
|
/**
|
|
@@ -56,16 +57,21 @@ class CreateFileHelper {
|
|
|
56
57
|
/**
|
|
57
58
|
* Execute grunt tasks
|
|
58
59
|
*/
|
|
59
|
-
static executeGruntTasks = async function ({ directory, selectedDevices, config,
|
|
60
|
+
static executeGruntTasks = async function ({ directory, selectedDevices, config, }) {
|
|
60
61
|
if (selectedDevices.includes(deviceConst_1.ANDROIDTV)) {
|
|
61
|
-
const
|
|
62
|
+
const credentials = CredentialsHelper_1.CredentialsHelper.get();
|
|
63
|
+
const registryAccount = await (0, CodeArtifactHelper_1.getRepositoryEndpoint)({
|
|
64
|
+
organization: credentials.org,
|
|
65
|
+
credentials: credentials?.aws,
|
|
66
|
+
format: "maven",
|
|
67
|
+
});
|
|
62
68
|
let gruntOptions = `--appUrl="${registryAccount}" `;
|
|
63
69
|
const optionsToAdd = ["appId", "appName", "appVersion", "appVersionCode", "wtvAndroidVersion"];
|
|
64
70
|
for (const option of optionsToAdd) {
|
|
65
71
|
gruntOptions += `--${option}="${config.androidtv?.device[option]}" `;
|
|
66
72
|
}
|
|
67
73
|
try {
|
|
68
|
-
(0,
|
|
74
|
+
(0, node_child_process_1.execSync)(`cd ${directory} && grunt copyProjectAndroidTv ${gruntOptions.trim()}`);
|
|
69
75
|
}
|
|
70
76
|
catch (e) {
|
|
71
77
|
const message = e instanceof Error ? e.message : translation_1.default["error.common.start.message"];
|
|
@@ -74,13 +80,5 @@ class CreateFileHelper {
|
|
|
74
80
|
}
|
|
75
81
|
return Promise.resolve("Grunt task(s) done");
|
|
76
82
|
};
|
|
77
|
-
/**
|
|
78
|
-
* Store aws config into .dana-env file
|
|
79
|
-
*/
|
|
80
|
-
static createDanaConfigFile = async function ({ directory, awsConfig, }) {
|
|
81
|
-
const filePath = path_1.default.join(directory, ".dana-env");
|
|
82
|
-
fs_1.default.writeFileSync(filePath, JSON.stringify(awsConfig, null, 4));
|
|
83
|
-
return Promise.resolve("Dana config file created");
|
|
84
|
-
};
|
|
85
83
|
}
|
|
86
84
|
exports.default = CreateFileHelper;
|
|
@@ -92,8 +92,8 @@ declare const ScriptHelper: {
|
|
|
92
92
|
readonly _askAppName: () => Promise<string>;
|
|
93
93
|
readonly _askAppVersion: () => Promise<string>;
|
|
94
94
|
readonly _askAppVersionCode: () => Promise<number>;
|
|
95
|
-
readonly _getWtvAndroidVersion: (
|
|
96
|
-
readonly getConfig: (
|
|
95
|
+
readonly _getWtvAndroidVersion: () => Promise<string>;
|
|
96
|
+
readonly getConfig: () => Promise<import("../../types/createApp/configTypes").AndroidConfig>;
|
|
97
97
|
readonly setConfig: ({ directory, config, }: {
|
|
98
98
|
directory: string;
|
|
99
99
|
config: import("../../types/createApp/configTypes").AndroidConfig;
|
|
@@ -90,7 +90,7 @@ class SetupChecker {
|
|
|
90
90
|
* @returns {Promise}
|
|
91
91
|
*/
|
|
92
92
|
static async validateNodeVersion() {
|
|
93
|
-
const minimalNodeVersion =
|
|
93
|
+
const minimalNodeVersion = 20;
|
|
94
94
|
const currentVersion = parseInt(process.version.slice(1).split(".")[0], 10);
|
|
95
95
|
return currentVersion >= minimalNodeVersion
|
|
96
96
|
? Promise.resolve("Node version ok !")
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Config } from "../../types/createApp/helperTypes";
|
|
2
2
|
declare class UpdateFileHelper {
|
|
3
3
|
/**
|
|
4
4
|
* Update app.Config files with mandatory Data
|
|
@@ -10,8 +10,7 @@ declare class UpdateFileHelper {
|
|
|
10
10
|
/**
|
|
11
11
|
* Update .npmrc with proper registry key
|
|
12
12
|
*/
|
|
13
|
-
static readonly updateNpmrcFile: ({
|
|
14
|
-
awsConfig: AwsConfig;
|
|
13
|
+
static readonly updateNpmrcFile: ({ directory }: {
|
|
15
14
|
directory: string;
|
|
16
15
|
}) => Promise<string>;
|
|
17
16
|
/**
|
|
@@ -26,11 +25,11 @@ declare class UpdateFileHelper {
|
|
|
26
25
|
/**
|
|
27
26
|
* set specific configuration for selected devices
|
|
28
27
|
*/
|
|
29
|
-
static readonly setDevicesConfig: ({ directory, config, selectedDevices,
|
|
28
|
+
static readonly setDevicesConfig: ({ directory, config, selectedDevices, awsProfile, }: {
|
|
30
29
|
directory: string;
|
|
31
30
|
config: Config;
|
|
32
31
|
selectedDevices: string[];
|
|
33
|
-
|
|
32
|
+
awsProfile: string;
|
|
34
33
|
}) => Promise<string>;
|
|
35
34
|
static readonly setScriptValue: (value: string) => string;
|
|
36
35
|
static readonly applyTemplatesToFiles: ({ directory, name, }: {
|
|
@@ -16,9 +16,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
const fs_1 = __importDefault(require("fs"));
|
|
18
18
|
const path_1 = __importDefault(require("path"));
|
|
19
|
-
const setupConst_1 = require("../../const/createApp/setupConst");
|
|
20
19
|
const ScriptHelper_1 = __importDefault(require("../../helpers/createApp/ScriptHelper"));
|
|
21
20
|
const handlebarsHelper_1 = require("../../helpers/handlebarsHelper");
|
|
21
|
+
const CredentialsHelper_1 = require("../CredentialsHelper");
|
|
22
|
+
const CodeArtifactHelper_1 = require("../CodeArtifactHelper");
|
|
22
23
|
class UpdateFileHelper {
|
|
23
24
|
/**
|
|
24
25
|
* Update app.Config files with mandatory Data
|
|
@@ -39,8 +40,13 @@ class UpdateFileHelper {
|
|
|
39
40
|
/**
|
|
40
41
|
* Update .npmrc with proper registry key
|
|
41
42
|
*/
|
|
42
|
-
static updateNpmrcFile = function ({
|
|
43
|
-
const
|
|
43
|
+
static updateNpmrcFile = async function ({ directory }) {
|
|
44
|
+
const credentials = CredentialsHelper_1.CredentialsHelper.get();
|
|
45
|
+
const registryAccount = await (0, CodeArtifactHelper_1.getRepositoryEndpoint)({
|
|
46
|
+
organization: credentials.org,
|
|
47
|
+
credentials: credentials?.aws,
|
|
48
|
+
format: "npm",
|
|
49
|
+
});
|
|
44
50
|
const filePath = path_1.default.join(directory, ".npmrc");
|
|
45
51
|
fs_1.default.writeFileSync(filePath, registryAccount);
|
|
46
52
|
return Promise.resolve("AWS profile updated");
|
|
@@ -70,12 +76,11 @@ class UpdateFileHelper {
|
|
|
70
76
|
/**
|
|
71
77
|
* set specific configuration for selected devices
|
|
72
78
|
*/
|
|
73
|
-
static setDevicesConfig = async function ({ directory, config, selectedDevices,
|
|
74
|
-
const awsRepository = awsConfig.awsRepository;
|
|
79
|
+
static setDevicesConfig = async function ({ directory, config, selectedDevices, awsProfile, }) {
|
|
75
80
|
for (const device of selectedDevices) {
|
|
76
81
|
const obj = config[device];
|
|
77
82
|
//@ts-expect-error @typescript-eslint/ban-ts-comment
|
|
78
|
-
await ScriptHelper_1.default.getDeviceConfig(device).setConfig({ directory,
|
|
83
|
+
await ScriptHelper_1.default.getDeviceConfig(device).setConfig({ directory, awsProfile, config: obj });
|
|
79
84
|
}
|
|
80
85
|
return Promise.resolve("Configuration done");
|
|
81
86
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Config } from "../../types/createApp/helperTypes";
|
|
2
2
|
type SelectionArray = {
|
|
3
3
|
value: string;
|
|
4
4
|
label: string;
|
|
@@ -10,34 +10,18 @@ declare class UserInputGetter {
|
|
|
10
10
|
/**
|
|
11
11
|
* Get project Data from user
|
|
12
12
|
*/
|
|
13
|
-
static getPrompts(argsName: string, shouldAddDevices: boolean
|
|
13
|
+
static getPrompts(argsName: string, shouldAddDevices: boolean): {
|
|
14
14
|
name: () => Promise<string>;
|
|
15
15
|
directory: ({ results }: {
|
|
16
16
|
results: DataResults;
|
|
17
17
|
}) => Promise<string>;
|
|
18
|
-
awsConfig: () => Promise<AwsConfig>;
|
|
19
18
|
selectedDevices: () => Promise<string[]>;
|
|
20
19
|
};
|
|
21
|
-
static getAwsConfig(awsConfig: AwsConfig): Promise<AwsConfig>;
|
|
22
20
|
/**
|
|
23
21
|
* Ask the project name
|
|
24
22
|
*/
|
|
25
23
|
static askProjectName(name?: string): Promise<string>;
|
|
26
24
|
static getProjectDirectory(projectName: string): Promise<string>;
|
|
27
|
-
/**
|
|
28
|
-
* Get AWS profile
|
|
29
|
-
*/
|
|
30
|
-
static getAwsProfiles(): Promise<SelectionArray>;
|
|
31
|
-
/**
|
|
32
|
-
* Ask AWS repository name and check connection
|
|
33
|
-
* @returns {Promise<string>}
|
|
34
|
-
*/
|
|
35
|
-
static askAwsProfile(): Promise<string>;
|
|
36
|
-
/**
|
|
37
|
-
* Ask AWS repository name
|
|
38
|
-
* @returns {Promise<string>}
|
|
39
|
-
*/
|
|
40
|
-
static askAwsRepository(): Promise<string>;
|
|
41
25
|
/**
|
|
42
26
|
* Get a list of subscribed and non subscribed devices
|
|
43
27
|
*/
|
|
@@ -57,9 +41,9 @@ declare class UserInputGetter {
|
|
|
57
41
|
* get specific configuration for selected devices
|
|
58
42
|
* @returns {Promise<any>}
|
|
59
43
|
*/
|
|
60
|
-
static getDevicesConfig({ selectedDevices,
|
|
44
|
+
static getDevicesConfig({ selectedDevices, awsProfile, }: {
|
|
61
45
|
selectedDevices: string[];
|
|
62
|
-
|
|
46
|
+
awsProfile: string;
|
|
63
47
|
}): Promise<Config>;
|
|
64
48
|
}
|
|
65
49
|
export default UserInputGetter;
|
|
@@ -57,19 +57,13 @@ class UserInputGetter {
|
|
|
57
57
|
/**
|
|
58
58
|
* Get project Data from user
|
|
59
59
|
*/
|
|
60
|
-
static getPrompts(argsName, shouldAddDevices
|
|
60
|
+
static getPrompts(argsName, shouldAddDevices) {
|
|
61
61
|
return {
|
|
62
62
|
name: () => this.askProjectName(argsName),
|
|
63
63
|
directory: ({ results }) => this.getProjectDirectory(results.name),
|
|
64
|
-
awsConfig: () => this.getAwsConfig(awsConfig),
|
|
65
64
|
selectedDevices: () => this.askDevices(shouldAddDevices),
|
|
66
65
|
};
|
|
67
66
|
}
|
|
68
|
-
static async getAwsConfig(awsConfig) {
|
|
69
|
-
awsConfig.awsProfile ??= await this.askAwsProfile();
|
|
70
|
-
awsConfig.awsRepository ??= await this.askAwsRepository();
|
|
71
|
-
return awsConfig;
|
|
72
|
-
}
|
|
73
67
|
/**
|
|
74
68
|
* Ask the project name
|
|
75
69
|
*/
|
|
@@ -89,71 +83,6 @@ class UserInputGetter {
|
|
|
89
83
|
static async getProjectDirectory(projectName) {
|
|
90
84
|
return Promise.resolve(`./${projectName}`);
|
|
91
85
|
}
|
|
92
|
-
/**
|
|
93
|
-
* Get AWS profile
|
|
94
|
-
*/
|
|
95
|
-
static async getAwsProfiles() {
|
|
96
|
-
try {
|
|
97
|
-
const profileString = (0, child_process_1.execSync)("aws configure list-profiles", { encoding: "utf8" });
|
|
98
|
-
if (profileString) {
|
|
99
|
-
const profiles = profileString
|
|
100
|
-
.split("\n")
|
|
101
|
-
.filter((el) => el.length)
|
|
102
|
-
.map((el) => {
|
|
103
|
-
return { value: el, label: el };
|
|
104
|
-
});
|
|
105
|
-
return Promise.resolve(profiles);
|
|
106
|
-
}
|
|
107
|
-
return Promise.reject(new Error(translation_1.default["input.aws.error"]));
|
|
108
|
-
}
|
|
109
|
-
catch (error) {
|
|
110
|
-
const message = error instanceof Error ? error.message : translation_1.default["input.aws.error"];
|
|
111
|
-
return Promise.reject(new Error(message));
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Ask AWS repository name and check connection
|
|
116
|
-
* @returns {Promise<string>}
|
|
117
|
-
*/
|
|
118
|
-
static async askAwsProfile() {
|
|
119
|
-
const profileList = await this.getAwsProfiles();
|
|
120
|
-
let shouldAskProfile = true;
|
|
121
|
-
let profile;
|
|
122
|
-
const selectObject = {
|
|
123
|
-
message: translation_1.default["input.aws.profile"],
|
|
124
|
-
options: profileList,
|
|
125
|
-
required: true,
|
|
126
|
-
};
|
|
127
|
-
do {
|
|
128
|
-
profile = (await prompts.select(selectObject));
|
|
129
|
-
ScriptHelper_1.default.handleCancellation(profile);
|
|
130
|
-
try {
|
|
131
|
-
shouldAskProfile = !(0, child_process_1.execSync)(`aws sts get-caller-identity --profile ${profile}`, {
|
|
132
|
-
encoding: "utf8",
|
|
133
|
-
}).includes("UserId");
|
|
134
|
-
}
|
|
135
|
-
catch {
|
|
136
|
-
prompts.log.error(translation_1.default["aws.login.error"]);
|
|
137
|
-
}
|
|
138
|
-
} while (shouldAskProfile);
|
|
139
|
-
return Promise.resolve(profile);
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Ask AWS repository name
|
|
143
|
-
* @returns {Promise<string>}
|
|
144
|
-
*/
|
|
145
|
-
static async askAwsRepository() {
|
|
146
|
-
const errorMessage = "AWS repository name is mandatory!";
|
|
147
|
-
const repo = (await prompts.text({
|
|
148
|
-
message: 'Please enter AWS repository name provided during registration.\nName is XXX in "dana-XXX-repository".',
|
|
149
|
-
placeholder: "XXX",
|
|
150
|
-
initialValue: "internal",
|
|
151
|
-
validate: (value) => (0, InputValidator_1.validInputLength)(value, errorMessage),
|
|
152
|
-
}));
|
|
153
|
-
ScriptHelper_1.default.handleCancellation(repo);
|
|
154
|
-
const name = `dana-${repo.trim()}-repository`;
|
|
155
|
-
return Promise.resolve(name);
|
|
156
|
-
}
|
|
157
86
|
/**
|
|
158
87
|
* Get a list of subscribed and non subscribed devices
|
|
159
88
|
*/
|
|
@@ -162,6 +91,7 @@ class UserInputGetter {
|
|
|
162
91
|
const unavailableDevices = [];
|
|
163
92
|
for (const [key, value] of Object.entries(deviceConst_1.EXTENDED_SETUP)) {
|
|
164
93
|
try {
|
|
94
|
+
console.info(`npm view ${value.package} --silent`);
|
|
165
95
|
(0, child_process_1.execSync)(`npm view ${value.package} --silent`, { encoding: "utf-8" });
|
|
166
96
|
availableDevices.push({ value: key, label: deviceConst_1.EXTENDED_SETUP[key].label });
|
|
167
97
|
}
|
|
@@ -204,10 +134,10 @@ class UserInputGetter {
|
|
|
204
134
|
* get specific configuration for selected devices
|
|
205
135
|
* @returns {Promise<any>}
|
|
206
136
|
*/
|
|
207
|
-
static async getDevicesConfig({ selectedDevices,
|
|
137
|
+
static async getDevicesConfig({ selectedDevices, awsProfile, }) {
|
|
208
138
|
const config = {};
|
|
209
139
|
for (const device of selectedDevices) {
|
|
210
|
-
config[device] = (await ScriptHelper_1.default.getDeviceConfig(device).getConfig(
|
|
140
|
+
config[device] = (await ScriptHelper_1.default.getDeviceConfig(device).getConfig(awsProfile));
|
|
211
141
|
}
|
|
212
142
|
return Promise.resolve(config);
|
|
213
143
|
}
|
package/dist/translation/en.json
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"command.rail.option.direction": "Navigation direction. Default: horizontal",
|
|
11
11
|
"command.rail.option.cyclic": "True if cyclic. Default: false",
|
|
12
12
|
"command.device.description": "Add device(s) to your Dana app",
|
|
13
|
+
"command.device.version.error": "No version found.",
|
|
13
14
|
"command.device.no_selection": "Nothing selected or no device available. Exit",
|
|
14
15
|
"help.custom.devices": "Use the CLI to add the following devices:",
|
|
15
16
|
"help.custom.commands": "Add devices and built-in components to your DANA app:",
|
|
@@ -5,16 +5,12 @@ interface Task {
|
|
|
5
5
|
task: () => Promise<string>;
|
|
6
6
|
condition?: boolean;
|
|
7
7
|
}
|
|
8
|
-
interface AwsConfig {
|
|
9
|
-
awsRepository?: string;
|
|
10
|
-
awsProfile?: string;
|
|
11
|
-
}
|
|
12
8
|
interface Data {
|
|
13
9
|
name: string;
|
|
14
10
|
config: Config;
|
|
15
11
|
directory: string;
|
|
16
12
|
selectedDevices: string[];
|
|
17
|
-
|
|
13
|
+
awsProfile: string;
|
|
18
14
|
}
|
|
19
15
|
interface Config {
|
|
20
16
|
[TVOS]?: never;
|
|
@@ -36,4 +32,4 @@ interface SelectObject {
|
|
|
36
32
|
options: SelectionArray;
|
|
37
33
|
required: boolean;
|
|
38
34
|
}
|
|
39
|
-
export { Task, Data, Config,
|
|
35
|
+
export { Task, Data, Config, DeviceConf, JsonType, SelectObject, SelectionArray };
|
package/package.json
CHANGED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ANDROIDTV, TIZEN, TVOS, WEBOS } from "../../const/createApp/deviceConst";
|
|
2
|
-
import { AndroidConfig, AndroidDevice, TizenConf, WebosConf, WebosDevice } from "./configTypes";
|
|
3
|
-
interface Task {
|
|
4
|
-
title: string;
|
|
5
|
-
task: () => Promise<string>;
|
|
6
|
-
condition?: boolean;
|
|
7
|
-
}
|
|
8
|
-
interface AwsConfig {
|
|
9
|
-
awsRepository?: string;
|
|
10
|
-
awsProfile?: string;
|
|
11
|
-
}
|
|
12
|
-
interface Data {
|
|
13
|
-
name: string;
|
|
14
|
-
config: Config;
|
|
15
|
-
directory: string;
|
|
16
|
-
selectedDevices: string[];
|
|
17
|
-
awsConfig: AwsConfig;
|
|
18
|
-
}
|
|
19
|
-
interface Config {
|
|
20
|
-
[TVOS]?: never;
|
|
21
|
-
[ANDROIDTV]?: AndroidConfig;
|
|
22
|
-
[WEBOS]?: WebosConf;
|
|
23
|
-
[TIZEN]?: TizenConf;
|
|
24
|
-
}
|
|
25
|
-
interface DeviceConfig {
|
|
26
|
-
device?: WebosDevice | AndroidDevice;
|
|
27
|
-
renderers?: string[];
|
|
28
|
-
}
|
|
29
|
-
type JsonType = Record<string, unknown>;
|
|
30
|
-
type SelectionArray = {
|
|
31
|
-
value: string;
|
|
32
|
-
label: string;
|
|
33
|
-
}[];
|
|
34
|
-
interface SelectObject {
|
|
35
|
-
message: string;
|
|
36
|
-
options: SelectionArray;
|
|
37
|
-
required: boolean;
|
|
38
|
-
}
|
|
39
|
-
export { Task, Data, Config, AwsConfig, DeviceConfig, JsonType, SelectObject, SelectionArray };
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
const deviceConst_1 = require("../../const/createApp/deviceConst");
|