@wiztivi/dana-cli 0.0.1 → 0.0.2-beta-3

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.
Files changed (113) hide show
  1. package/bin/dana.js +3 -0
  2. package/dana_completion.sh +153 -0
  3. package/dist/commands/add-device.d.ts +2 -0
  4. package/dist/commands/add-device.js +126 -0
  5. package/dist/commands/add-menu.d.ts +7 -0
  6. package/dist/commands/add-menu.js +51 -0
  7. package/dist/commands/add-rail.d.ts +10 -0
  8. package/dist/commands/add-rail.js +48 -0
  9. package/dist/commands/add-screen.d.ts +5 -0
  10. package/dist/commands/add-screen.js +71 -0
  11. package/dist/commands/add-scrollView.d.ts +7 -0
  12. package/dist/commands/add-scrollView.js +37 -0
  13. package/dist/commands/auth/login.d.ts +5 -0
  14. package/dist/commands/auth/login.js +141 -0
  15. package/dist/commands/auth/status.d.ts +11 -0
  16. package/dist/commands/auth/status.js +76 -0
  17. package/dist/commands/commandDefinitions/addDeviceDefinition.d.ts +3 -0
  18. package/dist/commands/commandDefinitions/addDeviceDefinition.js +16 -0
  19. package/dist/commands/commandDefinitions/addMenuDefinition.d.ts +3 -0
  20. package/dist/commands/commandDefinitions/addMenuDefinition.js +21 -0
  21. package/dist/commands/commandDefinitions/addRailDefinition.d.ts +3 -0
  22. package/dist/commands/commandDefinitions/addRailDefinition.js +31 -0
  23. package/dist/commands/commandDefinitions/addScreenDefinition.d.ts +3 -0
  24. package/dist/commands/commandDefinitions/addScreenDefinition.js +18 -0
  25. package/dist/commands/commandDefinitions/addScrollViewDefinition.d.ts +3 -0
  26. package/dist/commands/commandDefinitions/addScrollViewDefinition.js +18 -0
  27. package/dist/commands/commandDefinitions/authDefinition.d.ts +3 -0
  28. package/dist/commands/commandDefinitions/authDefinition.js +23 -0
  29. package/dist/commands/commandDefinitions/completionDefinition.d.ts +3 -0
  30. package/dist/commands/commandDefinitions/completionDefinition.js +17 -0
  31. package/dist/commands/commandDefinitions/createAppDefinition.d.ts +3 -0
  32. package/dist/commands/commandDefinitions/createAppDefinition.js +22 -0
  33. package/dist/commands/completion.d.ts +2 -0
  34. package/dist/commands/completion.js +84 -0
  35. package/dist/commands/createApp.d.ts +6 -0
  36. package/dist/commands/createApp.js +130 -0
  37. package/dist/commands/createComponent.d.ts +3 -0
  38. package/dist/commands/createComponent.js +81 -0
  39. package/dist/commands/help/customHelp.d.ts +3 -0
  40. package/dist/commands/help/customHelp.js +31 -0
  41. package/dist/commands/hooks/authHook.d.ts +1 -0
  42. package/dist/commands/hooks/authHook.js +23 -0
  43. package/dist/configs/ComponentConfig.d.ts +32 -0
  44. package/dist/configs/ComponentConfig.js +178 -0
  45. package/dist/configs/deviceConfig/androidtvConfig.d.ts +37 -0
  46. package/dist/configs/deviceConfig/androidtvConfig.js +186 -0
  47. package/dist/configs/deviceConfig/deviceConfig.d.ts +14 -0
  48. package/dist/configs/deviceConfig/deviceConfig.js +35 -0
  49. package/dist/configs/deviceConfig/tizenConfig.d.ts +31 -0
  50. package/dist/configs/deviceConfig/tizenConfig.js +56 -0
  51. package/dist/configs/deviceConfig/tvosConfig.d.ts +13 -0
  52. package/dist/configs/deviceConfig/tvosConfig.js +32 -0
  53. package/dist/configs/deviceConfig/webosConfig.d.ts +59 -0
  54. package/dist/configs/deviceConfig/webosConfig.js +179 -0
  55. package/dist/const/authentConst.d.ts +3 -0
  56. package/dist/const/authentConst.js +6 -0
  57. package/dist/const/componentConst.d.ts +8 -0
  58. package/dist/const/componentConst.js +22 -0
  59. package/dist/const/createApp/deviceConst.d.ts +23 -0
  60. package/dist/const/createApp/deviceConst.js +73 -0
  61. package/dist/const/createApp/setupConst.d.ts +3 -0
  62. package/dist/const/createApp/setupConst.js +18 -0
  63. package/dist/const/defaultConfig.d.ts +4 -0
  64. package/dist/const/defaultConfig.js +27 -0
  65. package/dist/const/exitCodeConst.d.ts +7 -0
  66. package/dist/const/exitCodeConst.js +10 -0
  67. package/dist/const/navigationConst.d.ts +3 -0
  68. package/dist/const/navigationConst.js +36 -0
  69. package/dist/dana_completion.sh +153 -0
  70. package/dist/helpers/CliHelper.d.ts +13 -0
  71. package/dist/helpers/CliHelper.js +39 -0
  72. package/dist/helpers/CodeArtifactHelper.d.ts +12 -0
  73. package/dist/helpers/CodeArtifactHelper.js +52 -0
  74. package/dist/helpers/ComponentHelper.d.ts +12 -0
  75. package/dist/helpers/ComponentHelper.js +105 -0
  76. package/dist/helpers/CredentialsHelper.d.ts +27 -0
  77. package/dist/helpers/CredentialsHelper.js +22 -0
  78. package/dist/helpers/createApp/CreateFileHelper.d.ts +31 -0
  79. package/dist/helpers/createApp/CreateFileHelper.js +84 -0
  80. package/dist/helpers/createApp/InputValidator.d.ts +5 -0
  81. package/dist/helpers/createApp/InputValidator.js +60 -0
  82. package/dist/helpers/createApp/InstallHelper.d.ts +30 -0
  83. package/dist/helpers/createApp/InstallHelper.js +113 -0
  84. package/dist/helpers/createApp/ScriptHelper.d.ts +116 -0
  85. package/dist/helpers/createApp/ScriptHelper.js +142 -0
  86. package/dist/helpers/createApp/SetupChecker.d.ts +25 -0
  87. package/dist/helpers/createApp/SetupChecker.js +128 -0
  88. package/dist/helpers/createApp/UpdateFileHelper.d.ts +40 -0
  89. package/dist/helpers/createApp/UpdateFileHelper.js +121 -0
  90. package/dist/helpers/createApp/UserInputGetter.d.ts +49 -0
  91. package/dist/helpers/createApp/UserInputGetter.js +144 -0
  92. package/dist/helpers/handlebarsHelper.d.ts +2 -0
  93. package/dist/helpers/handlebarsHelper.js +26 -0
  94. package/dist/helpers/stringHelper.d.ts +3 -0
  95. package/dist/helpers/stringHelper.js +11 -0
  96. package/dist/index.d.ts +2 -0
  97. package/dist/index.js +16 -0
  98. package/dist/program.d.ts +2 -0
  99. package/dist/program.js +42 -0
  100. package/dist/translation/en.json +62 -0
  101. package/dist/translation/translation.d.ts +2 -0
  102. package/dist/translation/translation.js +8 -0
  103. package/dist/types/componentTypes.d.ts +31 -0
  104. package/dist/types/componentTypes.js +2 -0
  105. package/dist/types/createApp/configTypes.d.ts +27 -0
  106. package/dist/types/createApp/configTypes.js +13 -0
  107. package/dist/types/createApp/helperTypes.d.ts +35 -0
  108. package/dist/types/createApp/helperTypes.js +14 -0
  109. package/dist/types/genericTypes.d.ts +17 -0
  110. package/dist/types/genericTypes.js +2 -0
  111. package/package.json +41 -22
  112. package/README.md +0 -5
  113. package/index.js +0 -1
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ const client_codeartifact_1 = require("@aws-sdk/client-codeartifact");
40
+ const prompts = __importStar(require("@clack/prompts"));
41
+ const child_process_1 = require("child_process");
42
+ const express_1 = __importDefault(require("express"));
43
+ const get_port_1 = __importDefault(require("get-port"));
44
+ const open_1 = __importDefault(require("open"));
45
+ const picocolors_1 = __importDefault(require("picocolors"));
46
+ const exitCodeConst_1 = require("../../const/exitCodeConst");
47
+ const CredentialsHelper_1 = require("../../helpers/CredentialsHelper");
48
+ const authentConst_1 = require("../../const/authentConst");
49
+ const CodeArtifactHelper_1 = require("../../helpers/CodeArtifactHelper");
50
+ /*
51
+ Login to DANA backend (with aws and cognito) and connect to npm codeartifact
52
+ More info: https://github.com/wiztivi-rd/dana-cli/wiki/Login
53
+ */
54
+ const login = async ({ org = "preprod" }) => {
55
+ const apiUrl = `https://api.${org}.dana-framework.com`; // Or http://localhost:3001
56
+ const credentials = CredentialsHelper_1.CredentialsHelper.get();
57
+ if (credentials) {
58
+ try {
59
+ if (new Date(credentials.aws.expiration) < new Date()) {
60
+ const data = await fetch(`${apiUrl}/login?refresh_token=${credentials.dana.refresh_token}`);
61
+ if (!data.ok) {
62
+ throw new Error("Unable to refresh token");
63
+ }
64
+ const refreshedCreds = (await data.json());
65
+ credentials.aws = refreshedCreds.aws;
66
+ credentials.dana = {
67
+ ...refreshedCreds.token,
68
+ refresh_token: credentials.dana.refresh_token,
69
+ };
70
+ CredentialsHelper_1.CredentialsHelper.store(credentials);
71
+ }
72
+ prompts.log.info(`Retrieved credentials for ${org} from local cache`);
73
+ await codeartifactLogin(org, credentials.aws);
74
+ return;
75
+ }
76
+ catch (error) {
77
+ // Log message and start nominal login process
78
+ prompts.log.error(error.message);
79
+ }
80
+ }
81
+ prompts.intro(`Login to ${org}...`);
82
+ try {
83
+ const port = await (0, get_port_1.default)();
84
+ const app = (0, express_1.default)();
85
+ app.disable("x-powered-by");
86
+ const server = app.listen(port);
87
+ app.get("/callback", async (req, res) => {
88
+ try {
89
+ if (req.query.error) {
90
+ throw new Error(req.query.error);
91
+ }
92
+ const token = JSON.parse(req.query.token);
93
+ const awsCredentials = JSON.parse(req.query.aws);
94
+ CredentialsHelper_1.CredentialsHelper.store({ aws: awsCredentials, dana: token, org });
95
+ // Login to codeartifact repository
96
+ await codeartifactLogin(org, awsCredentials);
97
+ prompts.outro(picocolors_1.default.green("✓") + ` Login successfull`);
98
+ res.send("Login successful! You can close this window.");
99
+ }
100
+ catch (err) {
101
+ console.error(err);
102
+ res.send("Login failed. Check the CLI for details.");
103
+ handleError(err);
104
+ }
105
+ finally {
106
+ server.close();
107
+ }
108
+ });
109
+ await (0, open_1.default)(`${apiUrl}/login?port=${port}`);
110
+ }
111
+ catch (error) {
112
+ console.error(error);
113
+ handleError(error);
114
+ }
115
+ };
116
+ const handleError = (error) => {
117
+ const message = error instanceof Error ? error.message : error;
118
+ prompts.outro(picocolors_1.default.red(`An issue occurred :` + message));
119
+ process.exit(exitCodeConst_1.LOGIN_ERROR);
120
+ };
121
+ const codeartifactLogin = async (organization, credentials) => {
122
+ // Create CodeArtifact client with credentials
123
+ const client = (0, CodeArtifactHelper_1.createCodeArtifactClient)(credentials);
124
+ // Get authorization token
125
+ const tokenCommand = new client_codeartifact_1.GetAuthorizationTokenCommand({
126
+ domain: authentConst_1.DOMAIN,
127
+ domainOwner: authentConst_1.DOMAIN_OWNER,
128
+ });
129
+ const { authorizationToken, expiration } = await client.send(tokenCommand);
130
+ if (!authorizationToken) {
131
+ throw new Error("Authorization token not found");
132
+ }
133
+ // Get repository endpoint
134
+ const repositoryEndpoint = await (0, CodeArtifactHelper_1.getRepositoryEndpoint)({ organization, credentials, client, format: "npm" });
135
+ // Configure npm with the repository and token
136
+ (0, child_process_1.execSync)(`npm config set @dana:registry=${repositoryEndpoint}`);
137
+ (0, child_process_1.execSync)(`npm config set //${repositoryEndpoint.replace(/^https?:\/\//, "")}:_authToken=${authorizationToken}`);
138
+ const expiresAt = expiration ? new Date(expiration).toLocaleString() : "unknown";
139
+ prompts.log.step(`Successfully configured npm to use AWS CodeArtifact repository ${repositoryEndpoint}. \nLogin expires in 12 hours at: ${expiresAt}`);
140
+ };
141
+ exports.default = login;
@@ -0,0 +1,11 @@
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 };
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.statusAction = exports.status = exports.LOGIN_STATUS = void 0;
40
+ const prompts = __importStar(require("@clack/prompts"));
41
+ const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
42
+ const picocolors_1 = __importDefault(require("picocolors"));
43
+ const CredentialsHelper_1 = require("../../helpers/CredentialsHelper");
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 = {}));
51
+ const status = () => {
52
+ const credentials = CredentialsHelper_1.CredentialsHelper.get();
53
+ if (!credentials?.dana?.id_token) {
54
+ prompts.log.error(`${translation_1.default["login.error.not_logged"]} ${translation_1.default["login.info.please_login"]}`);
55
+ return LOGIN_STATUS.NOT_LOGGED;
56
+ }
57
+ const id_token = credentials.dana.id_token;
58
+ const { given_name, family_name, email, exp } = jsonwebtoken_1.default.decode(id_token);
59
+ const expiration = exp && new Date(exp * 1000);
60
+ if (expiration && new Date() > expiration) {
61
+ prompts.log.error(`${translation_1.default["login.info.token_expired"]} ${translation_1.default["login.info.please_login"]}`);
62
+ return LOGIN_STATUS.TOKEN_EXPIRED;
63
+ }
64
+ const expStr = expiration ? `\nToken expires on ${expiration.toUTCString()}` : "";
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}
66
+ `);
67
+ return LOGIN_STATUS.LOGGED;
68
+ };
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;
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ declare const addDeviceDefinition: () => Command;
3
+ export default addDeviceDefinition;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const commander_1 = require("commander");
7
+ const add_device_1 = __importDefault(require("../add-device"));
8
+ const translation_1 = __importDefault(require("../../translation/translation"));
9
+ const authHook_1 = require("../hooks/authHook");
10
+ const addDeviceDefinition = () => {
11
+ return new commander_1.Command("add-device")
12
+ .description(translation_1.default["command.device.description"])
13
+ .hook("preAction", authHook_1.authHook)
14
+ .action(add_device_1.default);
15
+ };
16
+ exports.default = addDeviceDefinition;
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ declare const addMenuDefinition: () => Command;
3
+ export default addMenuDefinition;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const commander_1 = require("commander");
7
+ const add_menu_1 = __importDefault(require("../add-menu"));
8
+ const translation_1 = __importDefault(require("../../translation/translation"));
9
+ const addMenuDefinition = () => {
10
+ const command = new commander_1.Command("add-menu");
11
+ command
12
+ .description(translation_1.default["command.menu.description"])
13
+ .argument("[name]", translation_1.default["command.component.name"])
14
+ .option("-cm, --custom", translation_1.default["command.component.customization"])
15
+ .option("-i, --itemView <itemView>", translation_1.default["command.menu.option.itemView"])
16
+ .option("-m, --itemMargin <itemMargin>", translation_1.default["command.menu.option.itemMargin"])
17
+ .option("-d, --direction <direction>", translation_1.default["command.rail.option.direction"])
18
+ .action(add_menu_1.default);
19
+ return command;
20
+ };
21
+ exports.default = addMenuDefinition;
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ declare const addRailDefinition: () => Command;
3
+ export default addRailDefinition;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const commander_1 = require("commander");
7
+ const add_rail_1 = __importDefault(require("../add-rail"));
8
+ const navigationConst_1 = require("../../const/navigationConst");
9
+ const translation_1 = __importDefault(require("../../translation/translation"));
10
+ const stringHelper_1 = require("../../helpers/stringHelper");
11
+ const addRailDefinition = () => {
12
+ const command = new commander_1.Command("add-rail");
13
+ command
14
+ .description(translation_1.default["command.rail.description"])
15
+ .argument("[name]", translation_1.default["command.component.name"])
16
+ .option("-cm, --custom", translation_1.default["command.component.customization"])
17
+ .option("-n, --navigation <navigation>", translation_1.default["command.rail.option.navigation"])
18
+ .option("-d, --direction <direction>", translation_1.default["command.rail.option.direction"])
19
+ .option("-c, --cyclic", translation_1.default["command.rail.option.cyclic"])
20
+ .option("-i, --itemView <itemView>", translation_1.default["command.menu.option.itemView"])
21
+ .addHelpText("after", `
22
+ ${translation_1.default["help.option.title"]}
23
+ -navigation: ${(0, stringHelper_1.optionsListString)(navigationConst_1.NAVIGATION_TYPES)}
24
+ -direction: ${(0, stringHelper_1.optionsListString)(navigationConst_1.DIRECTION_TYPES)}
25
+
26
+ More about rail feature, ${translation_1.default["help.option.check"]} https://doc.dana-framework.com/docs/vendorcomponents/recycling-listview
27
+ `)
28
+ .action(add_rail_1.default);
29
+ return command;
30
+ };
31
+ exports.default = addRailDefinition;
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ declare const addScreenDefinition: () => Command;
3
+ export default addScreenDefinition;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const commander_1 = require("commander");
7
+ const translation_1 = __importDefault(require("../../translation/translation"));
8
+ const add_screen_1 = __importDefault(require("../add-screen"));
9
+ const addScreenDefinition = () => {
10
+ const command = new commander_1.Command("add-screen");
11
+ command
12
+ .description(translation_1.default["command.screen.description"])
13
+ .argument("[name]", translation_1.default["command.component.name"])
14
+ .option("-s, --screenType [screenType]", translation_1.default["command.screen.option.type"])
15
+ .action(add_screen_1.default);
16
+ return command;
17
+ };
18
+ exports.default = addScreenDefinition;
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ declare const addScrollViewDefinition: () => Command;
3
+ export default addScrollViewDefinition;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const commander_1 = require("commander");
7
+ const add_scrollView_1 = __importDefault(require("../add-scrollView"));
8
+ const translation_1 = __importDefault(require("../../translation/translation"));
9
+ const addScrollViewDefinition = () => {
10
+ return new commander_1.Command("add-scroll")
11
+ .description(translation_1.default["command.scrollView.description"])
12
+ .argument("[name]", translation_1.default["command.component.name"])
13
+ .option("-cm, --custom", translation_1.default["command.component.customization"])
14
+ .option("-i, --itemView <itemView>", translation_1.default["command.menu.option.itemView"])
15
+ .option("-m, --itemMargin <itemMargin>", translation_1.default["command.menu.option.itemMargin"])
16
+ .action(add_scrollView_1.default);
17
+ };
18
+ exports.default = addScrollViewDefinition;
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ declare const addAuthDefinition: () => Command;
3
+ export default addAuthDefinition;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const commander_1 = require("commander");
7
+ const translation_1 = __importDefault(require("../../translation/translation"));
8
+ const login_1 = __importDefault(require("../auth/login"));
9
+ const status_1 = require("../auth/status");
10
+ const addAuthDefinition = () => {
11
+ const command = new commander_1.Command("auth").description(translation_1.default["command.auth.description"]);
12
+ const loginCmd = new commander_1.Command("login")
13
+ .description(translation_1.default["command.auth.login.description"])
14
+ .option("-o, --org <organization>", translation_1.default["command.auth.login.option.org"], "preprod")
15
+ .action(login_1.default);
16
+ command.addCommand(loginCmd);
17
+ const statusCmd = new commander_1.Command("status")
18
+ .description(translation_1.default["command.auth.status.description"])
19
+ .action(status_1.statusAction);
20
+ command.addCommand(statusCmd);
21
+ return command;
22
+ };
23
+ exports.default = addAuthDefinition;
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ declare const completionDefinition: () => Command;
3
+ export default completionDefinition;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const commander_1 = require("commander");
7
+ const completion_1 = __importDefault(require("../completion"));
8
+ const translation_1 = __importDefault(require("../../translation/translation"));
9
+ const completionDefinition = () => {
10
+ const command = new commander_1.Command("completion");
11
+ command
12
+ .description(translation_1.default["command.completion.description"])
13
+ .argument("<shell>", translation_1.default["command.completion.argument"])
14
+ .action(completion_1.default);
15
+ return command;
16
+ };
17
+ exports.default = completionDefinition;
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ declare const createAppDefinition: () => Command;
3
+ export default createAppDefinition;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const commander_1 = require("commander");
7
+ const createApp_1 = __importDefault(require("../createApp"));
8
+ const translation_1 = __importDefault(require("../../translation/translation"));
9
+ const authHook_1 = require("../hooks/authHook");
10
+ const createAppDefinition = () => {
11
+ const command = new commander_1.Command("create-app");
12
+ command
13
+ .description(translation_1.default["command.create_app.description"])
14
+ .argument("[projectName]", translation_1.default["command.create_app.name"])
15
+ .argument("[projectDirectory]", translation_1.default["command.create_app.directory"])
16
+ .option("-t, --tutorial", translation_1.default["command.create_app.tutorial"])
17
+ .option("-d, --devices", translation_1.default["command.create_app.devices"])
18
+ .hook("preAction", authHook_1.authHook)
19
+ .action(createApp_1.default);
20
+ return command;
21
+ };
22
+ exports.default = createAppDefinition;
@@ -0,0 +1,2 @@
1
+ declare const completion: (shell: string) => void;
2
+ export default completion;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
4
+ * All Rights Reserved
5
+ *
6
+ * All information contained herein is proprietary and confidential.
7
+ * Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
8
+ * prior written permission is obtained from Wiztivi.
9
+ * No warranty, explicit or implicit, provided.
10
+ * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
11
+ *
12
+ */
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
46
+ var __importDefault = (this && this.__importDefault) || function (mod) {
47
+ return (mod && mod.__esModule) ? mod : { "default": mod };
48
+ };
49
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ const fs_1 = require("fs");
51
+ const path_1 = require("path");
52
+ const node_os_1 = require("node:os");
53
+ const translation_1 = __importDefault(require("../translation/translation"));
54
+ const exitCodeConst_1 = require("../const/exitCodeConst");
55
+ const prompts = __importStar(require("@clack/prompts"));
56
+ const picocolors_1 = __importDefault(require("picocolors"));
57
+ const BASH = "bash";
58
+ const ZSH = "zsh";
59
+ const completion = (shell) => {
60
+ if (![BASH, ZSH].includes(shell)) {
61
+ handleError(`Error: Shell must be either ${BASH} or ${ZSH}`);
62
+ }
63
+ const completionPath = (0, path_1.join)(__dirname, "../dana_completion.sh");
64
+ const configFile = `.${shell}rc`;
65
+ const configPath = (0, path_1.join)((0, node_os_1.homedir)(), configFile);
66
+ const headerString = `\n#${"=".repeat(25)}\n# Dana CLI completion`;
67
+ const sourceString = `\nsource "${completionPath}"\n`;
68
+ const sourceCommand = shell === ZSH
69
+ ? `${headerString}\nautoload -U compinit\ncompinit ${sourceString}`
70
+ : `${headerString}${sourceString}`;
71
+ try {
72
+ (0, fs_1.appendFileSync)(configPath, sourceCommand);
73
+ prompts.log.success(picocolors_1.default.green("✓") + translation_1.default["command.completion.success"] + ` ${configFile}`);
74
+ prompts.log.info(`Run 'source ~/${configFile}' or restart your terminal`);
75
+ }
76
+ catch (error) {
77
+ handleError(`Failed to install completion: ${error}`);
78
+ }
79
+ };
80
+ const handleError = (message) => {
81
+ prompts.log.error(message);
82
+ process.exit(exitCodeConst_1.COMMAND_ERROR);
83
+ };
84
+ exports.default = completion;
@@ -0,0 +1,6 @@
1
+ interface ProgramOptions {
2
+ devices: boolean;
3
+ tutorial: boolean;
4
+ }
5
+ declare const createApp: (projectName: string, programDirectory: string, options?: ProgramOptions) => Promise<void>;
6
+ export default createApp;