@wiztivi/dana-cli 0.0.4 → 0.0.6

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 (72) hide show
  1. package/bin/dana.js +1 -1
  2. package/dist/commands/addComponent/addMenu/add-menu.js +20 -25
  3. package/dist/commands/addComponent/addMenu/addMenuDefinition.js +12 -17
  4. package/dist/commands/addComponent/addRail/add-rail.js +17 -22
  5. package/dist/commands/addComponent/addRail/addRailDefinition.js +19 -24
  6. package/dist/commands/addComponent/addScreen/add-screen.js +11 -49
  7. package/dist/commands/addComponent/addScreen/addScreenDefinition.js +9 -14
  8. package/dist/commands/addComponent/addScrollView/add-scrollView.js +17 -22
  9. package/dist/commands/addComponent/addScrollView/addScrollViewDefinition.js +11 -16
  10. package/dist/commands/addComponent/config/ComponentConfig.d.ts +2 -2
  11. package/dist/commands/addComponent/config/ComponentConfig.js +23 -61
  12. package/dist/commands/addComponent/config/componentTypes.js +1 -2
  13. package/dist/commands/addComponent/const/componentConst.js +8 -11
  14. package/dist/commands/addComponent/const/defaultConfig.d.ts +1 -1
  15. package/dist/commands/addComponent/const/defaultConfig.js +7 -10
  16. package/dist/commands/addComponent/const/navigationConst.d.ts +1 -1
  17. package/dist/commands/addComponent/const/navigationConst.js +7 -13
  18. package/dist/commands/addComponent/createComponent.d.ts +1 -1
  19. package/dist/commands/addComponent/createComponent.js +15 -54
  20. package/dist/commands/addComponent/helper/ComponentHelper.d.ts +2 -1
  21. package/dist/commands/addComponent/helper/ComponentHelper.js +22 -50
  22. package/dist/commands/addDevice/add-device.js +34 -72
  23. package/dist/commands/addDevice/addDeviceDefinition.js +9 -14
  24. package/dist/commands/addDevice/deviceConfig/androidtvConfig.d.ts +1 -1
  25. package/dist/commands/addDevice/deviceConfig/androidtvConfig.js +39 -77
  26. package/dist/commands/addDevice/deviceConfig/configTypes.js +1 -2
  27. package/dist/commands/addDevice/deviceConfig/deviceConfig.js +1 -3
  28. package/dist/commands/addDevice/deviceConfig/tizenConfig.d.ts +1 -1
  29. package/dist/commands/addDevice/deviceConfig/tizenConfig.js +10 -15
  30. package/dist/commands/addDevice/deviceConfig/tvosConfig.js +8 -13
  31. package/dist/commands/addDevice/deviceConfig/webosConfig.d.ts +1 -1
  32. package/dist/commands/addDevice/deviceConfig/webosConfig.js +25 -63
  33. package/dist/commands/addDevice/helper/addDeviceHelper.js +7 -12
  34. package/dist/commands/authentication/authDefinition.js +14 -19
  35. package/dist/commands/authentication/authHook.js +5 -9
  36. package/dist/commands/authentication/authentConst.js +4 -7
  37. package/dist/commands/authentication/commands/login.js +29 -67
  38. package/dist/commands/authentication/commands/status.js +12 -52
  39. package/dist/commands/authentication/helper/CodeArtifactHelper.d.ts +1 -1
  40. package/dist/commands/authentication/helper/CodeArtifactHelper.js +14 -20
  41. package/dist/commands/authentication/helper/CredentialsHelper.js +8 -15
  42. package/dist/commands/commandHelp/customHelp.js +6 -11
  43. package/dist/commands/completion/completion.js +15 -51
  44. package/dist/commands/completion/completionDefinition.js +8 -13
  45. package/dist/commands/createApp/const/setupConst.js +1 -5
  46. package/dist/commands/createApp/createApp.js +42 -80
  47. package/dist/commands/createApp/createAppDefinition.js +13 -18
  48. package/dist/commands/createApp/helpers/CreateAppHelper.d.ts +9 -9
  49. package/dist/commands/createApp/helpers/CreateAppHelper.js +20 -58
  50. package/dist/commands/createApp/helpers/SetupChecker.d.ts +1 -1
  51. package/dist/commands/createApp/helpers/SetupChecker.js +14 -52
  52. package/dist/common/commonConst.js +1 -4
  53. package/dist/common/const/deviceConst.js +1 -14
  54. package/dist/common/const/exitCodeConst.js +7 -10
  55. package/dist/common/helpers/CreateFileHelper.d.ts +1 -1
  56. package/dist/common/helpers/CreateFileHelper.js +22 -27
  57. package/dist/common/helpers/InputValidator.js +7 -15
  58. package/dist/common/helpers/InstallHelper.d.ts +1 -1
  59. package/dist/common/helpers/InstallHelper.js +13 -18
  60. package/dist/common/helpers/UpdateFileHelper.d.ts +1 -1
  61. package/dist/common/helpers/UpdateFileHelper.js +34 -39
  62. package/dist/common/helpers/UserInputGetter.d.ts +1 -1
  63. package/dist/common/helpers/UserInputGetter.js +20 -58
  64. package/dist/common/helpers/handlebarsHelper.js +12 -17
  65. package/dist/common/helpers/stringHelper.d.ts +1 -1
  66. package/dist/common/helpers/stringHelper.js +2 -7
  67. package/dist/common/translation/translation.js +3 -8
  68. package/dist/common/types/helperTypes.d.ts +2 -2
  69. package/dist/common/types/helperTypes.js +1 -3
  70. package/dist/index.js +2 -4
  71. package/dist/program.js +30 -35
  72. package/package.json +6 -2
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
4
3
  * All Rights Reserved
@@ -10,46 +9,42 @@
10
9
  * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
11
10
  *
12
11
  */
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- const node_fs_1 = __importDefault(require("node:fs"));
18
- const node_path_1 = __importDefault(require("node:path"));
19
- const node_child_process_1 = require("node:child_process");
20
- const deviceConst_1 = require("../const/deviceConst");
21
- const translation_1 = __importDefault(require("../translation/translation"));
22
- const CredentialsHelper_1 = require("../../commands/authentication/helper/CredentialsHelper");
23
- const CodeArtifactHelper_1 = require("../../commands/authentication/helper/CodeArtifactHelper");
24
- const commonConst_1 = require("../commonConst");
12
+ import fs from "node:fs";
13
+ import path from "node:path";
14
+ import { execSync } from "node:child_process";
15
+ import { ANDROIDTV } from "../const/deviceConst.js";
16
+ import translation from "../translation/translation.js";
17
+ import { CredentialsHelper } from "../../commands/authentication/helper/CredentialsHelper.js";
18
+ import { getRepositoryEndpoint } from "../../commands/authentication/helper/CodeArtifactHelper.js";
19
+ import ComponentHelper from "../../commands/addComponent/helper/ComponentHelper.js";
25
20
  class CreateFileHelper {
26
21
  /**
27
22
  * Copy the template
28
23
  */
29
24
  static copyTemplate = function ({ directory }) {
30
- const templateDir = node_path_1.default.resolve(node_path_1.default.dirname(require.resolve(commonConst_1.TEMPLATE_MODULE)), "app-template");
31
- node_fs_1.default.mkdirSync(directory, { recursive: true });
32
- node_fs_1.default.cpSync(templateDir, directory, { recursive: true });
25
+ const templateDir = path.resolve(path.dirname(ComponentHelper.getTemplatePath()), "app-template");
26
+ fs.mkdirSync(directory, { recursive: true });
27
+ fs.cpSync(templateDir, directory, { recursive: true });
33
28
  return Promise.resolve("Template copied");
34
29
  };
35
30
  /**
36
31
  * Copy made for extra tutorial files
37
32
  */
38
33
  static copyForTutorial = function ({ directory }) {
39
- const templateDir = node_path_1.default.resolve(node_path_1.default.dirname(require.resolve(commonConst_1.TEMPLATE_MODULE)), "tutorial");
40
- node_fs_1.default.cpSync(templateDir, directory, { recursive: true });
34
+ const templateDir = path.resolve(path.dirname(ComponentHelper.getTemplatePath()), "tutorial");
35
+ fs.cpSync(templateDir, directory, { recursive: true });
41
36
  return Promise.resolve("Tutorial files copied");
42
37
  };
43
38
  /**
44
39
  * Copy app.config files for selected devices
45
40
  */
46
41
  static copyAppConfigFiles = function ({ selectedDevices, directory, }) {
47
- const templateDir = node_path_1.default.resolve(node_path_1.default.dirname(require.resolve(commonConst_1.TEMPLATE_MODULE)), "profiles");
48
- const allFiles = node_fs_1.default.readdirSync(templateDir);
42
+ const templateDir = path.resolve(path.dirname(ComponentHelper.getTemplatePath()), "profiles");
43
+ const allFiles = fs.readdirSync(templateDir);
49
44
  for (const file of allFiles) {
50
45
  const shouldCopy = selectedDevices.includes(file.split(".")[2]);
51
46
  if (shouldCopy) {
52
- node_fs_1.default.cpSync(node_path_1.default.join(templateDir, file), node_path_1.default.join(directory, "profiles", file));
47
+ fs.cpSync(path.join(templateDir, file), path.join(directory, "profiles", file));
53
48
  }
54
49
  }
55
50
  return Promise.resolve("Config file(s) copied");
@@ -58,9 +53,9 @@ class CreateFileHelper {
58
53
  * Execute grunt tasks
59
54
  */
60
55
  static executeGruntTasks = async function ({ directory, selectedDevices, config, }) {
61
- if (selectedDevices.includes(deviceConst_1.ANDROIDTV)) {
62
- const credentials = CredentialsHelper_1.CredentialsHelper.get();
63
- const registryAccount = await (0, CodeArtifactHelper_1.getRepositoryEndpoint)({
56
+ if (selectedDevices.includes(ANDROIDTV)) {
57
+ const credentials = CredentialsHelper.get();
58
+ const registryAccount = await getRepositoryEndpoint({
64
59
  organization: credentials.org,
65
60
  credentials: credentials?.aws,
66
61
  format: "maven",
@@ -71,14 +66,14 @@ class CreateFileHelper {
71
66
  gruntOptions += `--${option}="${config.androidtv?.device[option]}" `;
72
67
  }
73
68
  try {
74
- (0, node_child_process_1.execSync)(`cd ${directory} && grunt copyProjectAndroidTv ${gruntOptions.trim()}`);
69
+ execSync(`cd ${directory} && grunt copyProjectAndroidTv ${gruntOptions.trim()}`);
75
70
  }
76
71
  catch (e) {
77
- const message = e instanceof Error ? e.message : translation_1.default["error.common.start.message"];
72
+ const message = e instanceof Error ? e.message : translation["error.common.start.message"];
78
73
  throw new Error(message);
79
74
  }
80
75
  }
81
76
  return "Grunt task(s) done";
82
77
  };
83
78
  }
84
- exports.default = CreateFileHelper;
79
+ export default CreateFileHelper;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
4
3
  * All Rights Reserved
@@ -10,27 +9,23 @@
10
9
  * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
11
10
  *
12
11
  */
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.validNumber = exports.validAppId = exports.validAppVersionCode = exports.validAppVersion = exports.validInputLength = void 0;
15
- const semver_ts_1 = require("semver-ts");
16
- const validInputLength = (value, errorMessage) => {
12
+ import { clean, valid } from "semver-ts";
13
+ export const validInputLength = (value, errorMessage) => {
17
14
  if (value?.trim().length) {
18
15
  return "";
19
16
  }
20
17
  return errorMessage;
21
18
  };
22
- exports.validInputLength = validInputLength;
23
- const validAppVersion = (value) => {
19
+ export const validAppVersion = (value) => {
24
20
  if (!value) {
25
21
  return "App version is required";
26
22
  }
27
- if (!(0, semver_ts_1.valid)((0, semver_ts_1.clean)(value) ?? "")) {
23
+ if (!valid(clean(value) ?? "")) {
28
24
  return "App version format should be x.x.x";
29
25
  }
30
26
  return "";
31
27
  };
32
- exports.validAppVersion = validAppVersion;
33
- const validAppVersionCode = (value) => {
28
+ export const validAppVersionCode = (value) => {
34
29
  if (!value) {
35
30
  return "App version code is required";
36
31
  }
@@ -39,8 +34,7 @@ const validAppVersionCode = (value) => {
39
34
  }
40
35
  return "";
41
36
  };
42
- exports.validAppVersionCode = validAppVersionCode;
43
- const validAppId = (value) => {
37
+ export const validAppId = (value) => {
44
38
  const regex = /^[a-zA-Z]\w*(\.[a-zA-Z]\w*)+$/;
45
39
  if (!value.length) {
46
40
  return `AppId is required !`;
@@ -50,11 +44,9 @@ const validAppId = (value) => {
50
44
  }
51
45
  return "";
52
46
  };
53
- exports.validAppId = validAppId;
54
- const validNumber = (value, errorMessage) => {
47
+ export const validNumber = (value, errorMessage) => {
55
48
  if (!Number.parseInt(value, 10)) {
56
49
  return errorMessage;
57
50
  }
58
51
  return "";
59
52
  };
60
- exports.validNumber = validNumber;
@@ -1,4 +1,4 @@
1
- import { Config } from "../types/helperTypes";
1
+ import { Config } from "../types/helperTypes.js";
2
2
  declare class InstallHelper {
3
3
  /**
4
4
  * Install dependencies with npm
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
4
3
  * All Rights Reserved
@@ -10,13 +9,9 @@
10
9
  * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
11
10
  *
12
11
  */
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- const node_child_process_1 = require("node:child_process");
18
- const deviceConst_1 = require("../const/deviceConst");
19
- const translation_1 = __importDefault(require("../translation/translation"));
12
+ import { exec } from "node:child_process";
13
+ import { BASIC_DEPENDENCIES, PLATFORM_CONFIG } from "../const/deviceConst.js";
14
+ import translation from "../translation/translation.js";
20
15
  class InstallHelper {
21
16
  /**
22
17
  * Install dependencies with npm
@@ -25,7 +20,7 @@ class InstallHelper {
25
20
  static installDependencies = ({ directory, selectedDevices, config, }) => {
26
21
  const devDependencies = InstallHelper.getDependenciesList(selectedDevices, config);
27
22
  return new Promise((resolve, reject) => {
28
- (0, node_child_process_1.exec)(`npm i --prefix ${directory} --silent`, {}, (async () => {
23
+ exec(`npm i --prefix ${directory} --silent`, {}, (async () => {
29
24
  try {
30
25
  for (const depName of devDependencies) {
31
26
  await InstallHelper.installSingleDependency(depName, directory);
@@ -34,13 +29,13 @@ class InstallHelper {
34
29
  }
35
30
  catch (error) {
36
31
  reject(new Error("Dependencies update failed : " +
37
- (error.message ?? translation_1.default["error.common.start.message"])));
32
+ (error.message ?? translation["error.common.start.message"])));
38
33
  }
39
34
  }));
40
35
  });
41
36
  };
42
37
  static getDependenciesList(selectedDevices, config) {
43
- let devDependencies = [...deviceConst_1.BASIC_DEPENDENCIES];
38
+ let devDependencies = [...BASIC_DEPENDENCIES];
44
39
  if (selectedDevices.length) {
45
40
  devDependencies = devDependencies.concat(this.getAllDependencies(selectedDevices, config));
46
41
  }
@@ -48,7 +43,7 @@ class InstallHelper {
48
43
  }
49
44
  static installSingleDependency = (depName, directory) => {
50
45
  return new Promise((resolveInstall, rejectInstall) => {
51
- (0, node_child_process_1.exec)(`npm i ${depName} --prefix '${directory}' --save-dev --save-exact`, {}, (error) => {
46
+ exec(`npm i ${depName} --prefix '${directory}' --save-dev --save-exact`, {}, (error) => {
52
47
  if (error) {
53
48
  rejectInstall(new Error(`FAILURE during ${depName} dependency installation ${error.message}`));
54
49
  }
@@ -64,14 +59,14 @@ class InstallHelper {
64
59
  static getAllDependencies = function (selectedDevices, config) {
65
60
  let allDep = [];
66
61
  for (const el of selectedDevices) {
67
- allDep = allDep.concat(deviceConst_1.PLATFORM_CONFIG[el].dependencies);
62
+ allDep = allDep.concat(PLATFORM_CONFIG[el].dependencies);
68
63
  }
69
64
  for (const key in config) {
70
65
  if (Object.hasOwn(config, key)) {
71
66
  const obj = config[key];
72
67
  const renderer = obj.renderers ?? [];
73
68
  for (const r of renderer) {
74
- allDep = allDep.concat(deviceConst_1.PLATFORM_CONFIG[key].renderers?.[r] ?? "");
69
+ allDep = allDep.concat(PLATFORM_CONFIG[key].renderers?.[r] ?? "");
75
70
  }
76
71
  }
77
72
  }
@@ -83,7 +78,7 @@ class InstallHelper {
83
78
  */
84
79
  static installGrunt = function () {
85
80
  return new Promise((resolve) => {
86
- (0, node_child_process_1.exec)("npm i -g grunt-cli", {}, () => {
81
+ exec("npm i -g grunt-cli", {}, () => {
87
82
  resolve("Grunt installed");
88
83
  });
89
84
  });
@@ -95,7 +90,7 @@ class InstallHelper {
95
90
  static initGit = function ({ directory }) {
96
91
  return new Promise((resolve, reject) => {
97
92
  try {
98
- (0, node_child_process_1.exec)(`cd ${directory} && git init && git add -A && git commit -m "Initial commit from Create DANA App"`, { maxBuffer: 1024 * 1024 * 64 }, // 64MB
93
+ exec(`cd ${directory} && git init && git add -A && git commit -m "Initial commit from Create DANA App"`, { maxBuffer: 1024 * 1024 * 64 }, // 64MB
99
94
  (error) => {
100
95
  if (error) {
101
96
  reject(error);
@@ -106,10 +101,10 @@ class InstallHelper {
106
101
  });
107
102
  }
108
103
  catch (e) {
109
- const message = e instanceof Error ? e.message : translation_1.default["error.common.start.message"];
104
+ const message = e instanceof Error ? e.message : translation["error.common.start.message"];
110
105
  reject(new Error("Git hasn't been initialised" + message));
111
106
  }
112
107
  });
113
108
  };
114
109
  }
115
- exports.default = InstallHelper;
110
+ export default InstallHelper;
@@ -1,4 +1,4 @@
1
- import { Config } from "../types/helperTypes";
1
+ import { Config } from "../types/helperTypes.js";
2
2
  declare class UpdateFileHelper {
3
3
  /**
4
4
  * Update app.Config files with mandatory Data
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
4
3
  * All Rights Reserved
@@ -10,54 +9,50 @@
10
9
  * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
11
10
  *
12
11
  */
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- const node_fs_1 = __importDefault(require("node:fs"));
18
- const node_path_1 = __importDefault(require("node:path"));
19
- const CreateAppHelper_1 = __importDefault(require("../../commands/createApp/helpers/CreateAppHelper"));
20
- const handlebarsHelper_1 = require("./handlebarsHelper");
21
- const CredentialsHelper_1 = require("../../commands/authentication/helper/CredentialsHelper");
22
- const CodeArtifactHelper_1 = require("../../commands/authentication/helper/CodeArtifactHelper");
23
- const setupConst_1 = require("../../commands/createApp/const/setupConst");
12
+ import fs from "node:fs";
13
+ import path from "node:path";
14
+ import CreateAppHelper from "../../commands/createApp/helpers/CreateAppHelper.js";
15
+ import { templateGenerator } from "./handlebarsHelper.js";
16
+ import { CredentialsHelper } from "../../commands/authentication/helper/CredentialsHelper.js";
17
+ import { getRepositoryEndpoint } from "../../commands/authentication/helper/CodeArtifactHelper.js";
18
+ import { REGISTRY_KEY } from "../../commands/createApp/const/setupConst.js";
24
19
  class UpdateFileHelper {
25
20
  /**
26
21
  * Update app.Config files with mandatory Data
27
22
  * @returns {Promise}
28
23
  */
29
24
  static updateAppConfigFile = function ({ directory }) {
30
- const dirPath = node_path_1.default.join(directory, "profiles");
31
- const filePath = node_path_1.default.join(directory, "app.config.json");
32
- const profileList = node_fs_1.default
25
+ const dirPath = path.join(directory, "profiles");
26
+ const filePath = path.join(directory, "app.config.json");
27
+ const profileList = fs
33
28
  .readdirSync(dirPath, { withFileTypes: true })
34
29
  .filter((item) => !item.isDirectory())
35
- .map((item) => node_path_1.default.join("profiles", item.name));
36
- const jsonData = JSON.parse(node_fs_1.default.readFileSync(filePath).toString());
30
+ .map((item) => path.join("profiles", item.name));
31
+ const jsonData = JSON.parse(fs.readFileSync(filePath).toString());
37
32
  jsonData.includes = profileList;
38
- node_fs_1.default.writeFileSync(filePath, JSON.stringify(jsonData, null, 4));
33
+ fs.writeFileSync(filePath, JSON.stringify(jsonData, null, 4));
39
34
  return Promise.resolve("Config file(s) updated");
40
35
  };
41
36
  /**
42
37
  * Update .npmrc with proper registry key
43
38
  */
44
39
  static updateNpmrcFile = async function ({ directory }) {
45
- const credentials = CredentialsHelper_1.CredentialsHelper.get();
46
- const registryAccount = await (0, CodeArtifactHelper_1.getRepositoryEndpoint)({
40
+ const credentials = CredentialsHelper.get();
41
+ const registryAccount = await getRepositoryEndpoint({
47
42
  organization: credentials.org,
48
43
  credentials: credentials?.aws,
49
44
  format: "npm",
50
45
  });
51
- const filePath = node_path_1.default.join(directory, ".npmrc");
52
- node_fs_1.default.writeFileSync(filePath, `${setupConst_1.REGISTRY_KEY}=${registryAccount}`);
46
+ const filePath = path.join(directory, ".npmrc");
47
+ fs.writeFileSync(filePath, `${REGISTRY_KEY}=${registryAccount}`);
53
48
  return "AWS profile updated";
54
49
  };
55
50
  /**
56
51
  * Update package.json with the right project name and add scripts if necessary
57
52
  */
58
53
  static updatePackageJson = ({ name, directory, selectedDevices, config, }) => {
59
- const filePath = node_path_1.default.join(directory, "package.json");
60
- const packageJson = JSON.parse(node_fs_1.default.readFileSync(filePath).toString());
54
+ const filePath = path.join(directory, "package.json");
55
+ const packageJson = JSON.parse(fs.readFileSync(filePath).toString());
61
56
  if (name) {
62
57
  packageJson.name = name;
63
58
  }
@@ -73,7 +68,7 @@ class UpdateFileHelper {
73
68
  packageJson.scripts[`start:${device}`] = this.setScriptValue(device);
74
69
  }
75
70
  }
76
- node_fs_1.default.writeFileSync(filePath, JSON.stringify(packageJson, null, 4));
71
+ fs.writeFileSync(filePath, JSON.stringify(packageJson, null, 4));
77
72
  return Promise.resolve("Package updated");
78
73
  };
79
74
  /**
@@ -83,7 +78,7 @@ class UpdateFileHelper {
83
78
  for (const device of selectedDevices) {
84
79
  const obj = config[device];
85
80
  //@ts-expect-error @typescript-eslint/ban-ts-comment
86
- await CreateAppHelper_1.default.getDeviceConfig(device).setConfig({ directory, awsProfile, config: obj });
81
+ await CreateAppHelper.getDeviceConfig(device).setConfig({ directory, awsProfile, config: obj });
87
82
  }
88
83
  return "Configuration done";
89
84
  };
@@ -91,34 +86,34 @@ class UpdateFileHelper {
91
86
  return `grunt serve --profile=template-${value}`;
92
87
  };
93
88
  static applyTemplatesToFiles = function ({ directory, name, }) {
94
- const routesFilePath = node_path_1.default.join(directory, "scripts", "app");
89
+ const routesFilePath = path.join(directory, "scripts", "app");
95
90
  const appName = `${name[0].toUpperCase()}${name.substring(1)}`;
96
91
  const filesToUpdate = [
97
92
  {
98
- fromPath: node_path_1.default.join(routesFilePath, "TemplateAppRoutes.js.hbs"),
93
+ fromPath: path.join(routesFilePath, "TemplateAppRoutes.js.hbs"),
99
94
  config: { appName },
100
- toPath: node_path_1.default.join(routesFilePath, `${appName}AppRoutes.js`),
95
+ toPath: path.join(routesFilePath, `${appName}AppRoutes.js`),
101
96
  },
102
97
  {
103
- fromPath: node_path_1.default.join(routesFilePath, "app.js.hbs"),
98
+ fromPath: path.join(routesFilePath, "app.js.hbs"),
104
99
  config: { appName },
105
- toPath: node_path_1.default.join(routesFilePath, "app.js"),
100
+ toPath: path.join(routesFilePath, "app.js"),
106
101
  },
107
102
  {
108
- fromPath: node_path_1.default.join(directory, "tests", "unit", "app", "TemplateAppRoutes.js.hbs"),
103
+ fromPath: path.join(directory, "tests", "unit", "app", "TemplateAppRoutes.js.hbs"),
109
104
  config: { appName },
110
- toPath: node_path_1.default.join(directory, "tests", "unit", "app", `${appName}AppRoutes.js`),
105
+ toPath: path.join(directory, "tests", "unit", "app", `${appName}AppRoutes.js`),
111
106
  },
112
107
  {
113
- fromPath: node_path_1.default.join(directory, "gitignoreTemplate.hbs"),
108
+ fromPath: path.join(directory, "gitignoreTemplate.hbs"),
114
109
  config: {},
115
- toPath: node_path_1.default.join(directory, `.gitignore`),
110
+ toPath: path.join(directory, `.gitignore`),
116
111
  },
117
112
  ];
118
113
  for (const file of filesToUpdate) {
119
- const updatedContent = (0, handlebarsHelper_1.templateGenerator)(file.fromPath, file.config);
120
- node_fs_1.default.writeFileSync(file.toPath, updatedContent);
121
- node_fs_1.default.unlink(file.fromPath, (err) => {
114
+ const updatedContent = templateGenerator(file.fromPath, file.config);
115
+ fs.writeFileSync(file.toPath, updatedContent);
116
+ fs.unlink(file.fromPath, (err) => {
122
117
  if (err)
123
118
  console.error(err);
124
119
  });
@@ -126,4 +121,4 @@ class UpdateFileHelper {
126
121
  return Promise.resolve("Files templated");
127
122
  };
128
123
  }
129
- exports.default = UpdateFileHelper;
124
+ export default UpdateFileHelper;
@@ -1,4 +1,4 @@
1
- import { Config } from "../types/helperTypes";
1
+ import { Config } from "../types/helperTypes.js";
2
2
  type SelectionArray = {
3
3
  value: string;
4
4
  label: string;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
4
3
  * All Rights Reserved
@@ -10,50 +9,13 @@
10
9
  * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
11
10
  *
12
11
  */
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 prompts = __importStar(require("@clack/prompts"));
51
- const node_child_process_1 = require("node:child_process");
52
- const CreateAppHelper_1 = __importDefault(require("../../commands/createApp/helpers/CreateAppHelper"));
53
- const deviceConst_1 = require("../const/deviceConst");
54
- const InputValidator_1 = require("./InputValidator");
55
- const translation_1 = __importDefault(require("../translation/translation"));
56
- const stringHelper_1 = require("./stringHelper");
12
+ import * as prompts from "@clack/prompts";
13
+ import { execSync } from "node:child_process";
14
+ import CreateAppHelper from "../../commands/createApp/helpers/CreateAppHelper.js";
15
+ import { EXTENDED_SETUP, BASIC_SETUP } from "../const/deviceConst.js";
16
+ import { validInputLength } from "./InputValidator.js";
17
+ import translation from "../translation/translation.js";
18
+ import { capitalizeFirstLetter } from "./stringHelper.js";
57
19
  class UserInputGetter {
58
20
  /**
59
21
  * Get project Data from user
@@ -74,11 +36,11 @@ class UserInputGetter {
74
36
  }
75
37
  const errorMessage = "Project name is mandatory !";
76
38
  name = (await prompts.text({
77
- message: translation_1.default["input.name"],
39
+ message: translation["input.name"],
78
40
  placeholder: "Placeholder Name",
79
- validate: (value) => (0, InputValidator_1.validInputLength)(value, errorMessage),
41
+ validate: (value) => validInputLength(value, errorMessage),
80
42
  }));
81
- CreateAppHelper_1.default.handleCancellation(name);
43
+ CreateAppHelper.handleCancellation(name);
82
44
  return UserInputGetter.formatAppName(name);
83
45
  }
84
46
  static formatAppName(input) {
@@ -86,7 +48,7 @@ class UserInputGetter {
86
48
  return input
87
49
  .trim()
88
50
  .split(separatorRegex)
89
- .map((el, index) => (index === 0 ? el : (0, stringHelper_1.capitalizeFirstLetter)(el)))
51
+ .map((el, index) => (index === 0 ? el : capitalizeFirstLetter(el)))
90
52
  .join("");
91
53
  }
92
54
  static async getProjectDirectory(projectName) {
@@ -98,13 +60,13 @@ class UserInputGetter {
98
60
  static getAvailableDevices() {
99
61
  const availableDevices = [];
100
62
  const unavailableDevices = [];
101
- for (const [key, value] of Object.entries(deviceConst_1.EXTENDED_SETUP)) {
63
+ for (const [key, value] of Object.entries(EXTENDED_SETUP)) {
102
64
  try {
103
- (0, node_child_process_1.execSync)(`npm view ${value.package} --silent`, { encoding: "utf-8" });
104
- availableDevices.push({ value: key, label: deviceConst_1.EXTENDED_SETUP[key].label });
65
+ execSync(`npm view ${value.package} --silent`, { encoding: "utf-8" });
66
+ availableDevices.push({ value: key, label: EXTENDED_SETUP[key].label });
105
67
  }
106
68
  catch {
107
- unavailableDevices.push(deviceConst_1.EXTENDED_SETUP[key].label);
69
+ unavailableDevices.push(EXTENDED_SETUP[key].label);
108
70
  }
109
71
  }
110
72
  return Promise.resolve({ availableDevices, unavailableDevices });
@@ -119,7 +81,7 @@ class UserInputGetter {
119
81
  }
120
82
  const { availableDevices, unavailableDevices } = await this.getAvailableDevices();
121
83
  if (unavailableDevices.length) {
122
- CreateAppHelper_1.default.promptUnavailableDevices(unavailableDevices);
84
+ CreateAppHelper.promptUnavailableDevices(unavailableDevices);
123
85
  }
124
86
  if (availableDevices.length) {
125
87
  const selectObject = {
@@ -129,14 +91,14 @@ class UserInputGetter {
129
91
  };
130
92
  selectedDevices = selectedDevices.concat((await prompts.multiselect(selectObject)));
131
93
  }
132
- CreateAppHelper_1.default.handleCancellation(selectedDevices);
94
+ CreateAppHelper.handleCancellation(selectedDevices);
133
95
  return selectedDevices;
134
96
  }
135
97
  /**
136
98
  * Get devices natively included in user subscription
137
99
  */
138
100
  static getBasicDevices() {
139
- return Object.keys(deviceConst_1.BASIC_SETUP);
101
+ return Object.keys(BASIC_SETUP);
140
102
  }
141
103
  /**
142
104
  * get specific configuration for selected devices
@@ -145,9 +107,9 @@ class UserInputGetter {
145
107
  static async getDevicesConfig({ selectedDevices, awsProfile, }) {
146
108
  const config = {};
147
109
  for (const device of selectedDevices) {
148
- config[device] = (await CreateAppHelper_1.default.getDeviceConfig(device).getConfig(awsProfile));
110
+ config[device] = (await CreateAppHelper.getDeviceConfig(device).getConfig(awsProfile));
149
111
  }
150
112
  return config;
151
113
  }
152
114
  }
153
- exports.default = UserInputGetter;
115
+ export default UserInputGetter;
@@ -1,26 +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
- exports.templateGenerator = templateGenerator;
7
- const handlebars_1 = __importDefault(require("handlebars"));
8
- const node_fs_1 = require("node:fs");
9
- const stringHelper_1 = require("./stringHelper");
10
- handlebars_1.default.registerHelper("ifEqTo", (arg1, arg2) => {
1
+ import Handlebars from "handlebars";
2
+ import { readFileSync } from "node:fs";
3
+ import { capitalizeFirstLetter } from "./stringHelper.js";
4
+ Handlebars.registerHelper("ifEqTo", (arg1, arg2) => {
11
5
  return arg1 === arg2;
12
6
  });
13
- handlebars_1.default.registerHelper("ifNotEqTo", (arg1, arg2) => {
7
+ Handlebars.registerHelper("ifNotEqTo", (arg1, arg2) => {
14
8
  return arg1 !== arg2;
15
9
  });
16
- handlebars_1.default.registerHelper("normalizeName", (arg1, arg2) => {
17
- return `${(0, stringHelper_1.capitalizeFirstLetter)(arg1)}${arg2}`;
10
+ Handlebars.registerHelper("normalizeName", (arg1, arg2) => {
11
+ return `${capitalizeFirstLetter(arg1)}${arg2}`;
18
12
  });
19
- handlebars_1.default.registerHelper("capitalize", (arg1) => {
20
- return (0, stringHelper_1.capitalizeFirstLetter)(arg1);
13
+ Handlebars.registerHelper("capitalize", (arg1) => {
14
+ return capitalizeFirstLetter(arg1);
21
15
  });
22
16
  function templateGenerator(templatePath, config) {
23
- const templateString = (0, node_fs_1.readFileSync)(templatePath, "utf-8");
24
- const template = handlebars_1.default.compile(templateString);
17
+ const templateString = readFileSync(templatePath, "utf-8");
18
+ const template = Handlebars.compile(templateString);
25
19
  return template(config);
26
20
  }
21
+ export { templateGenerator };
@@ -1,3 +1,3 @@
1
- import { OptionList } from "../types/helperTypes";
1
+ import { OptionList } from "../types/helperTypes.js";
2
2
  export declare const capitalizeFirstLetter: (input: string) => string;
3
3
  export declare const optionsListString: (input: OptionList) => string;
@@ -1,11 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.optionsListString = exports.capitalizeFirstLetter = void 0;
4
- const capitalizeFirstLetter = (input) => {
1
+ export const capitalizeFirstLetter = (input) => {
5
2
  return `${input[0].toUpperCase()}${input.substring(1)}`;
6
3
  };
7
- exports.capitalizeFirstLetter = capitalizeFirstLetter;
8
- const optionsListString = (input) => {
4
+ export const optionsListString = (input) => {
9
5
  return input.map((option) => option.command).join(", ");
10
6
  };
11
- exports.optionsListString = optionsListString;