tnp-helpers 19.0.41 → 19.0.43

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 (91) hide show
  1. package/browser/README.md +24 -24
  2. package/browser/fesm2022/tnp-helpers.mjs +29 -74
  3. package/browser/fesm2022/tnp-helpers.mjs.map +1 -1
  4. package/browser/lib/base/classes/base-java-jdk.d.ts +9 -0
  5. package/browser/lib/base/classes/base-project.d.ts +2 -0
  6. package/browser/lib/base/core-project.d.ts +14 -1
  7. package/browser/lib/build-info._auto-generated_.d.ts +16 -1
  8. package/browser/lib/helpers/helpers.d.ts +0 -4
  9. package/browser/lib/index.d.ts +0 -1
  10. package/browser/package.json +1 -1
  11. package/lib/base/classes/base-cli-worker/base-cli-worker-terminal-ui.js +11 -9
  12. package/lib/base/classes/base-cli-worker/base-cli-worker-terminal-ui.js.map +1 -1
  13. package/lib/base/classes/base-cli-worker/base-cli-worker.js +11 -10
  14. package/lib/base/classes/base-cli-worker/base-cli-worker.js.map +1 -1
  15. package/lib/base/classes/base-global-command-line.backend.d.ts +2 -0
  16. package/lib/base/classes/base-global-command-line.backend.js +69 -200
  17. package/lib/base/classes/base-global-command-line.backend.js.map +1 -1
  18. package/lib/base/classes/base-java-jdk.d.ts +8 -0
  19. package/lib/base/classes/base-java-jdk.js +284 -0
  20. package/lib/base/classes/base-java-jdk.js.map +1 -0
  21. package/lib/base/classes/base-node-modules.js +3 -3
  22. package/lib/base/classes/base-node-modules.js.map +1 -1
  23. package/lib/base/classes/base-project.d.ts +2 -0
  24. package/lib/base/classes/base-project.js +3 -0
  25. package/lib/base/classes/base-project.js.map +1 -1
  26. package/lib/base/classes/base-vscode.js +1 -0
  27. package/lib/base/classes/base-vscode.js.map +1 -1
  28. package/lib/base/core-project.d.ts +14 -1
  29. package/lib/base/core-project.js +14 -1
  30. package/lib/base/core-project.js.map +1 -1
  31. package/lib/base/gh-temp-code.js +1 -1
  32. package/lib/base/gh-temp-code.js.map +1 -1
  33. package/lib/base/tcp-udp-ports/not-assignable-port.entity.js +2 -2
  34. package/lib/base/tcp-udp-ports/ports.entity.d.ts +1 -1
  35. package/lib/base/tcp-udp-ports/tcp-udp-ports.context.d.ts +2 -2
  36. package/lib/base/tcp-udp-ports/tcp-udp-ports.context.js +1 -1
  37. package/lib/base/tcp-udp-ports/tcp-udp-ports.context.js.map +1 -1
  38. package/lib/build-info._auto-generated_.d.ts +16 -1
  39. package/lib/build-info._auto-generated_.js +16 -1
  40. package/lib/build-info._auto-generated_.js.map +1 -1
  41. package/lib/env/env.angular-node-app.d.ts +1 -0
  42. package/lib/env/env.angular-node-app.js +3 -2
  43. package/lib/env/env.angular-node-app.js.map +1 -1
  44. package/lib/env/env.docs-webapp.d.ts +1 -0
  45. package/lib/env/env.docs-webapp.js +3 -2
  46. package/lib/env/env.docs-webapp.js.map +1 -1
  47. package/lib/env/env.electron-app.d.ts +1 -0
  48. package/lib/env/env.electron-app.js +3 -2
  49. package/lib/env/env.electron-app.js.map +1 -1
  50. package/lib/env/env.mobile-app.d.ts +1 -0
  51. package/lib/env/env.mobile-app.js +3 -2
  52. package/lib/env/env.mobile-app.js.map +1 -1
  53. package/lib/env/env.npm-lib-and-cli-tool.d.ts +1 -0
  54. package/lib/env/env.npm-lib-and-cli-tool.js +3 -2
  55. package/lib/env/env.npm-lib-and-cli-tool.js.map +1 -1
  56. package/lib/env/env.vscode-plugin.d.ts +1 -0
  57. package/lib/env/env.vscode-plugin.js +3 -2
  58. package/lib/env/env.vscode-plugin.js.map +1 -1
  59. package/lib/helpers/for-backend/helpers-git.backend.d.ts +1 -0
  60. package/lib/helpers/for-backend/helpers-git.backend.js +5 -0
  61. package/lib/helpers/for-backend/helpers-git.backend.js.map +1 -1
  62. package/lib/helpers/for-browser/angular.helper.js +2 -2
  63. package/lib/helpers/helpers-numbers.js.map +1 -1
  64. package/lib/helpers/helpers.d.ts +0 -4
  65. package/lib/helpers/helpers.js +1 -41
  66. package/lib/helpers/helpers.js.map +1 -1
  67. package/lib/index.d.ts +0 -1
  68. package/lib/index.js +2 -3
  69. package/lib/index.js.map +1 -1
  70. package/lib/old/base-component.js +2 -2
  71. package/lib/old/base-formly-component.js +2 -2
  72. package/lib/old/dual-component-ctrl.js +2 -2
  73. package/lib/validators/validators-git.js.map +1 -1
  74. package/package.json +1 -1
  75. package/tmp-environment.json +7 -3
  76. package/websql/README.md +24 -24
  77. package/websql/fesm2022/tnp-helpers.mjs +29 -74
  78. package/websql/fesm2022/tnp-helpers.mjs.map +1 -1
  79. package/websql/lib/base/classes/base-java-jdk.d.ts +9 -0
  80. package/websql/lib/base/classes/base-project.d.ts +2 -0
  81. package/websql/lib/base/core-project.d.ts +14 -1
  82. package/websql/lib/build-info._auto-generated_.d.ts +16 -1
  83. package/websql/lib/helpers/helpers.d.ts +0 -4
  84. package/websql/lib/index.d.ts +0 -1
  85. package/websql/package.json +1 -1
  86. package/browser/lib/validators/validators-git.d.ts +0 -4
  87. package/browser/lib/validators/validators-network.d.ts +0 -4
  88. package/browser/lib/validators/validators.d.ts +0 -7
  89. package/websql/lib/validators/validators-git.d.ts +0 -4
  90. package/websql/lib/validators/validators-network.d.ts +0 -4
  91. package/websql/lib/validators/validators.d.ts +0 -7
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BaseGlobalCommandLine = void 0;
4
- const child_process_1 = require("child_process"); // @backend
5
4
  const lib_1 = require("tnp-config/lib");
6
- const lib_2 = require("tnp-config/lib");
5
+ const lib_2 = require("tnp-core/lib");
7
6
  const lib_3 = require("tnp-core/lib");
8
7
  const lib_4 = require("tnp-core/lib");
9
8
  const lib_5 = require("tnp-core/lib");
@@ -30,7 +29,7 @@ class BaseGlobalCommandLine extends base_command_line_feature_1.BaseCommandLineF
30
29
  index_1.Helpers.info(`
31
30
  Current folder (${this.cwd})
32
31
  is not a git root folder, but nearest project with
33
- git root has been found in: ${lib_3.chalk.bold(proj.genericName)}
32
+ git root has been found in: ${lib_2.chalk.bold(proj.genericName)}
34
33
 
35
34
  `);
36
35
  const useRoot = await index_1.Helpers.questionYesNo('Would you like to use this project ?');
@@ -40,11 +39,11 @@ class BaseGlobalCommandLine extends base_command_line_feature_1.BaseCommandLineF
40
39
  return true;
41
40
  }
42
41
  else {
43
- index_1.Helpers.error(`[${lib_2.config.frameworkName}] This is not git root project folder`, true, true);
42
+ index_1.Helpers.error(`[${lib_1.config.frameworkName}] This is not git root project folder`, true, true);
44
43
  }
45
44
  }
46
45
  else {
47
- index_1.Helpers.error(`[${lib_2.config.frameworkName}] This folder is not project folder`, false, true);
46
+ index_1.Helpers.error(`[${lib_1.config.frameworkName}] This folder is not project folder`, false, true);
48
47
  }
49
48
  }
50
49
  return true;
@@ -52,7 +51,7 @@ class BaseGlobalCommandLine extends base_command_line_feature_1.BaseCommandLineF
52
51
  //#endregion
53
52
  //#region commands / hosts
54
53
  hosts() {
55
- index_1.Helpers.run(`code ${(0, lib_4.crossPlatformPath)(lib_1.HOST_FILE_PATH)}`).sync();
54
+ index_1.Helpers.run(`code ${(0, lib_3.crossPlatformPath)(lib_5.UtilsNetwork.getEtcHostsPath())}`).sync();
56
55
  process.exit(0);
57
56
  }
58
57
  //#endregion
@@ -68,9 +67,9 @@ class BaseGlobalCommandLine extends base_command_line_feature_1.BaseCommandLineF
68
67
  for (const folderAbsPath of index_1.Helpers.foldersFrom(this.cwd, {
69
68
  recursive: false,
70
69
  })) {
71
- if (index_1.Helpers.exists((0, lib_4.crossPlatformPath)([folderAbsPath, '.git']))) {
70
+ if (index_1.Helpers.exists((0, lib_3.crossPlatformPath)([folderAbsPath, '.git']))) {
72
71
  try {
73
- index_1.Helpers.run(`git rm --cached ${lib_3.path.basename(folderAbsPath)}`).sync();
72
+ index_1.Helpers.run(`git rm --cached ${lib_2.path.basename(folderAbsPath)}`).sync();
74
73
  }
75
74
  catch (error) { }
76
75
  }
@@ -80,7 +79,7 @@ class BaseGlobalCommandLine extends base_command_line_feature_1.BaseCommandLineF
80
79
  }
81
80
  removeSubmodule() {
82
81
  index_1.Helpers.taskStarted(`Removing submodules.. ${this.firstArg}`);
83
- if (index_1.Helpers.exists((0, lib_4.crossPlatformPath)([this.cwd, this.firstArg || '', '.git']))) {
82
+ if (index_1.Helpers.exists((0, lib_3.crossPlatformPath)([this.cwd, this.firstArg || '', '.git']))) {
84
83
  try {
85
84
  index_1.Helpers.run(`git rm --cached ${this.firstArg}`).sync();
86
85
  }
@@ -109,8 +108,8 @@ class BaseGlobalCommandLine extends base_command_line_feature_1.BaseCommandLineF
109
108
  * Generate or update .vscode/settings.json file color settings
110
109
  */
111
110
  settingsVscode() {
112
- const vscodePath = (0, lib_4.crossPlatformPath)([this.cwd, '.vscode']);
113
- const settingsAbsPath = (0, lib_4.crossPlatformPath)([vscodePath, 'settings.json']);
111
+ const vscodePath = (0, lib_3.crossPlatformPath)([this.cwd, '.vscode']);
112
+ const settingsAbsPath = (0, lib_3.crossPlatformPath)([vscodePath, 'settings.json']);
114
113
  if (!index_1.Helpers.exists(settingsAbsPath)) {
115
114
  index_1.Helpers.writeFile(settingsAbsPath, '{}');
116
115
  }
@@ -251,7 +250,7 @@ class BaseGlobalCommandLine extends base_command_line_feature_1.BaseCommandLineF
251
250
  index_1.Helpers.run(`${editor} ${locaitonFolderToOpen}`).sync();
252
251
  };
253
252
  if (results.length === 1) {
254
- await openInEditor(lib_3._.first(results));
253
+ await openInEditor(lib_2._.first(results));
255
254
  }
256
255
  else if (results.length === 0) {
257
256
  index_1.Helpers.error(`No project found by name: "${this.args.join(' ')}"`, false, true);
@@ -324,14 +323,14 @@ class BaseGlobalCommandLine extends base_command_line_feature_1.BaseCommandLineF
324
323
  index_1.Helpers.info(`
325
324
 
326
325
  YOU ARE RESETING ${withChildren ? 'EVERYTHING' : 'PROJECT'} ` +
327
- `TO BRANCH: ${lib_3.chalk.bold(branchToReset)}
326
+ `TO BRANCH: ${lib_2.chalk.bold(branchToReset)}
328
327
 
329
328
  - curret project (${this.project.name})
330
329
  ${withChildren &&
331
- lib_3._.isArray(this.project.children) &&
330
+ lib_2._.isArray(this.project.children) &&
332
331
  this.project.children.length > 0
333
332
  ? `- modules:\n${this.project.children
334
- .map(c => `\t${c.basename} (${lib_3.chalk.yellow(c.name)})`)
333
+ .map(c => `\t${c.basename} (${lib_2.chalk.yellow(c.name)})`)
335
334
  .join('\n')}`
336
335
  : ''}
337
336
  `);
@@ -350,7 +349,7 @@ ${withChildren &&
350
349
  }
351
350
  const parent = this.project.parent;
352
351
  const branchFromLinkedProjectConfig = parent?.linkedProjects?.linkedProjects.find(l => {
353
- return ((0, lib_4.crossPlatformPath)([parent.location, l.relativeClonePath]) ===
352
+ return ((0, lib_3.crossPlatformPath)([parent.location, l.relativeClonePath]) ===
354
353
  this.project.location);
355
354
  })?.defaultBranch;
356
355
  let overrideBranchToReset = this.firstArg ||
@@ -389,10 +388,10 @@ ${withChildren &&
389
388
  let resetProject = this.project;
390
389
  if (this.project.git.isInsideGitRepo && !this.project.git.isGitRoot) {
391
390
  index_1.Helpers.warn(`You are not in root of git repo...`, false);
392
- resetProject = this.ins.nearestTo((0, lib_4.crossPlatformPath)([this.project.location, '..']), {
391
+ resetProject = this.ins.nearestTo((0, lib_3.crossPlatformPath)([this.project.location, '..']), {
393
392
  findGitRoot: true,
394
393
  });
395
- if (!(await index_1.Helpers.questionYesNo(`Would you like to reset root repo instead (project=${lib_3.chalk.bold.red(resetProject.genericName)}) ?`))) {
394
+ if (!(await index_1.Helpers.questionYesNo(`Would you like to reset root repo instead (project=${lib_2.chalk.bold.red(resetProject.genericName)}) ?`))) {
396
395
  index_1.Helpers.error(`Aborted`, false, true);
397
396
  }
398
397
  }
@@ -411,7 +410,7 @@ ${withChildren &&
411
410
  return;
412
411
  }
413
412
  const howManyCommits = Number(this.firstArg) || 1;
414
- lib_3._.times(howManyCommits, n => {
413
+ lib_2._.times(howManyCommits, n => {
415
414
  console.log(`Resetting soft ${n + 1} commit "${this.project.git.lastCommitMessage()}"`);
416
415
  this.project.git.resetSoftHEAD(1);
417
416
  });
@@ -431,7 +430,7 @@ ${withChildren &&
431
430
  rebaseBranch = await this.__selectBrach(branches, 'rebase');
432
431
  }
433
432
  else if (branches.length === 1) {
434
- rebaseBranch = lib_3._.first(branches);
433
+ rebaseBranch = lib_2._.first(branches);
435
434
  }
436
435
  else {
437
436
  index_1.Helpers.error(`No rebase branch found by name "${rebaseBranch}"`, false, true);
@@ -441,14 +440,14 @@ ${withChildren &&
441
440
 
442
441
  Files from last commit:
443
442
 
444
- "${lib_3.chalk.gray(await this.project.git.getCommitMessageByHash(this.project.git.lastCommitHash()))}"
445
- (hash: ${lib_3.chalk.gray(this.project.git.lastCommitHash())})
443
+ "${lib_2.chalk.gray(await this.project.git.getCommitMessageByHash(this.project.git.lastCommitHash()))}"
444
+ (hash: ${lib_2.chalk.gray(this.project.git.lastCommitHash())})
446
445
 
447
446
  are going to be applied after rebase.
448
447
 
449
448
 
450
449
  `);
451
- if (!(await lib_5.UtilsTerminal.confirm({
450
+ if (!(await lib_4.UtilsTerminal.confirm({
452
451
  message: `Do you want to continue ?`,
453
452
  defaultValue: true,
454
453
  }))) {
@@ -543,7 +542,7 @@ ${remotes.map((r, i) => `${i + 1}. ${r.origin} ${r.url}`).join('\n')}
543
542
  `);
544
543
  for (let index = 0; index < remotes.length; index++) {
545
544
  const { origin, url } = remotes[index];
546
- index_1.Helpers.taskStarted(`Pushing to ${lib_3.chalk.bold(origin)} (${url})...`);
545
+ index_1.Helpers.taskStarted(`Pushing to ${lib_2.chalk.bold(origin)} (${url})...`);
547
546
  await this.push({ force, origin, noExit: true });
548
547
  index_1.Helpers.taskDone(`Pushed to ${origin}`);
549
548
  }
@@ -644,7 +643,7 @@ ${remotes.map((r, i) => `${i + 1}. ${r.origin} ${r.url}`).join('\n')}
644
643
  ${lastCommitMessage}
645
644
 
646
645
  ...`);
647
- await lib_5.UtilsTerminal.pressAnyKeyToContinueAsync({
646
+ await lib_4.UtilsTerminal.pressAnyKeyToContinueAsync({
648
647
  message: `Press any key to force push`,
649
648
  });
650
649
  }
@@ -730,7 +729,7 @@ ${lastCommitMessage}
730
729
  await this.push({
731
730
  typeofCommit: 'release',
732
731
  commitMessageRequired: true,
733
- overrideCommitMessage: `${lib_3._.first(this.project.releaseProcess.getReleaseWords())} ` +
732
+ overrideCommitMessage: `${lib_2._.first(this.project.releaseProcess.getReleaseWords())} ` +
734
733
  `version ${this.project.packageJson.version}`,
735
734
  });
736
735
  }
@@ -1031,13 +1030,13 @@ ${lastCommitMessage}
1031
1030
  const libs = proj.children.filter(child => {
1032
1031
  process.stdout.write('.');
1033
1032
  return child.git.thereAreSomeUncommitedChangeExcept([
1034
- lib_2.config.file.package_json,
1033
+ lib_1.config.file.package_json,
1035
1034
  ]);
1036
1035
  });
1037
1036
  console.log('\n' + index_1.Helpers.terminalLine());
1038
1037
  index_1.Helpers.info(libs.length
1039
1038
  ? libs
1040
- .map(c => `${lib_3.chalk.bold(c.name)} (${c.git.uncommitedFiles.map(p => lib_3.chalk.black(lib_3.path.basename(p))).join(', ')})`)
1039
+ .map(c => `${lib_2.chalk.bold(c.name)} (${c.git.uncommitedFiles.map(p => lib_2.chalk.black(lib_2.path.basename(p))).join(', ')})`)
1041
1040
  .join('\n')
1042
1041
  : 'Nothing modifed');
1043
1042
  this._exit();
@@ -1090,7 +1089,7 @@ Would you like to update current project configuration?`)) {
1090
1089
  let tagToRemove = this.firstArg;
1091
1090
  if (!tagToRemove) {
1092
1091
  const allTags = await index_1.Helpers.git.getAllTags(this.cwd);
1093
- tagToRemove = await lib_5.UtilsTerminal.select({
1092
+ tagToRemove = await lib_4.UtilsTerminal.select({
1094
1093
  question: `Select tag to remove`,
1095
1094
  autocomplete: true,
1096
1095
  choices: allTags.map(t => {
@@ -1160,7 +1159,7 @@ Would you like to update current project configuration?`)) {
1160
1159
  //#region commands / git config
1161
1160
  gitConfig() {
1162
1161
  const root = index_1.Helpers.git.findGitRoot(this.cwd);
1163
- index_1.Helpers.run(`code ${(0, lib_4.crossPlatformPath)([root, '.git', 'config'])}`).sync();
1162
+ index_1.Helpers.run(`code ${(0, lib_3.crossPlatformPath)([root, '.git', 'config'])}`).sync();
1164
1163
  this._exit();
1165
1164
  }
1166
1165
  //#endregion
@@ -1189,12 +1188,12 @@ Would you like to update current project configuration?`)) {
1189
1188
  //#region commands / update deps from
1190
1189
  async updateDepsFrom() {
1191
1190
  let locations = this.args.join(' ').trim() === '' ? [] : this.args;
1192
- if (lib_3._.isArray(locations)) {
1191
+ if (lib_2._.isArray(locations)) {
1193
1192
  locations = locations.map(l => {
1194
- if (lib_3.path.isAbsolute(l)) {
1195
- return lib_3.path.resolve(l);
1193
+ if (lib_2.path.isAbsolute(l)) {
1194
+ return lib_2.path.resolve(l);
1196
1195
  }
1197
- return lib_3.path.resolve(lib_3.path.join(this.cwd, l));
1196
+ return lib_2.path.resolve(lib_2.path.join(this.cwd, l));
1198
1197
  });
1199
1198
  }
1200
1199
  this.project.packageJson.updateDepsFrom(locations);
@@ -1209,13 +1208,13 @@ Would you like to update current project configuration?`)) {
1209
1208
  //#endregion
1210
1209
  //#region is terminal running inside cmd
1211
1210
  isRunningInWindowsCmd() {
1212
- console.log(`Is terminal running insdie cmd.exe: ${lib_3.UtilsOs.isRunningInWindowsCmd()}`);
1211
+ console.log(`Is terminal running insdie cmd.exe: ${lib_2.UtilsOs.isRunningInWindowsCmd()}`);
1213
1212
  this._exit();
1214
1213
  }
1215
1214
  //#endregion
1216
1215
  //#region is running inside powershell
1217
1216
  isRunningInWindowsPowerShell() {
1218
- console.log(`Is terminal running insdie powershell: ${lib_3.UtilsOs.isRunningInWindowsPowerShell()}`);
1217
+ console.log(`Is terminal running insdie powershell: ${lib_2.UtilsOs.isRunningInWindowsPowerShell()}`);
1219
1218
  this._exit();
1220
1219
  }
1221
1220
  //#endregion
@@ -1336,7 +1335,7 @@ Would you like to update current project configuration?`)) {
1336
1335
  //#region commands / is port in use
1337
1336
  async isPortInUse() {
1338
1337
  const port = parseInt(this.firstArg);
1339
- console.log(`Port ${port} is in use: ${await lib_3.UtilsOs.isPortInUse(port)}`);
1338
+ console.log(`Port ${port} is in use: ${await lib_2.UtilsOs.isPortInUse(port)}`);
1340
1339
  this._exit();
1341
1340
  }
1342
1341
  //#endregion
@@ -1407,16 +1406,16 @@ Would you like to update current project configuration?`)) {
1407
1406
  processInfo() {
1408
1407
  index_1.Helpers.info(`
1409
1408
 
1410
- Is running in CLI mode: ${lib_3.UtilsOs.isRunningInCliMode()}
1411
- Is running in Mocha test: ${lib_3.UtilsOs.isRunningInMochaTest()}
1412
- Is running in VSCode extension: ${lib_3.UtilsOs.isRunningInVscodeExtension()}
1413
- Is running in Electron: ${lib_3.UtilsOs.isRunningInElectron()}
1414
- Is running in Docker: ${lib_3.UtilsOs.isRunningInDocker()}
1415
- Is running in WebSQL: ${lib_3.UtilsOs.isRunningInWebSQL()}
1416
- Is running in WSL: ${lib_3.UtilsOs.isRunningInWsl()}
1417
- Is running in Linux graphics capable environment: ${lib_3.UtilsOs.isRunningInLinuxGraphicsCapableEnvironment()}
1418
- Is running in Node: ${lib_3.UtilsOs.isRunningInNode()}
1419
- Is running in Browser: ${lib_3.UtilsOs.isRunningInBrowser()}
1409
+ Is running in CLI mode: ${lib_2.UtilsOs.isRunningInCliMode()}
1410
+ Is running in Mocha test: ${lib_2.UtilsOs.isRunningInMochaTest()}
1411
+ Is running in VSCode extension: ${lib_2.UtilsOs.isRunningInVscodeExtension()}
1412
+ Is running in Electron: ${lib_2.UtilsOs.isRunningInElectron()}
1413
+ Is running in Docker: ${lib_2.UtilsOs.isRunningInDocker()}
1414
+ Is running in WebSQL: ${lib_2.UtilsOs.isRunningInWebSQL()}
1415
+ Is running in WSL: ${lib_2.UtilsOs.isRunningInWsl()}
1416
+ Is running in Linux graphics capable environment: ${lib_2.UtilsOs.isRunningInLinuxGraphicsCapableEnvironment()}
1417
+ Is running in Node: ${lib_2.UtilsOs.isRunningInNode()}
1418
+ Is running in Browser: ${lib_2.UtilsOs.isRunningInBrowser()}
1420
1419
 
1421
1420
  `);
1422
1421
  this._exit();
@@ -1429,6 +1428,7 @@ Would you like to update current project configuration?`)) {
1429
1428
  this._exit();
1430
1429
  }
1431
1430
  //#endregion
1431
+ //#region commands / check ports
1432
1432
  async checkPorts() {
1433
1433
  const ports = this.args
1434
1434
  .join(' ')
@@ -1442,169 +1442,38 @@ Would you like to update current project configuration?`)) {
1442
1442
  index_1.Helpers.error(`No ports provided`, false, true);
1443
1443
  }
1444
1444
  for (const port of ports) {
1445
- const isPortInUse = await lib_3.UtilsOs.isPortInUse(port);
1446
- console.log(`Port ${port} is in use: ${isPortInUse ? lib_3.chalk.red('YES') : lib_3.chalk.green('NO')}`);
1445
+ const isPortInUse = await lib_2.UtilsOs.isPortInUse(port);
1446
+ console.log(`Port ${port} is in use: ${isPortInUse ? lib_2.chalk.red('YES') : lib_2.chalk.green('NO')}`);
1447
1447
  }
1448
1448
  this._exit();
1449
1449
  }
1450
+ //#endregion
1451
+ //#region commands / remove symlinks
1450
1452
  removeSymlinksDryRun() {
1451
1453
  index_1.Helpers.removeSymlinks(this.project.nodeModules.path, {
1452
1454
  dryRun: true,
1453
1455
  });
1454
1456
  }
1457
+ //#endregion
1458
+ //#region commands / select java
1455
1459
  async selectJava() {
1460
+ const selectedJava = await this.project.javaJdk.selectJdkVersion();
1461
+ this.project.javaJdk.updateJavaHomePath(selectedJava);
1462
+ }
1463
+ //#endregion
1464
+ //#region commands / select tomcat
1465
+ async selectTomcat() {
1466
+ const selectedTomcat = await this.project.javaJdk.selectTomcatVersion();
1467
+ this.project.javaJdk.updateTomcatHomePath(selectedTomcat);
1468
+ this._exit();
1469
+ }
1470
+ //#endregion
1471
+ async simulateDomain() {
1456
1472
  //#region @backendFunc
1457
- const platform = lib_3.os.platform();
1458
- let currentJava = '';
1459
- let currentJavaLocation = '';
1460
- try {
1461
- currentJava = (0, child_process_1.execSync)('java -version 2>&1').toString().split('\n')[0];
1462
- currentJavaLocation = (0, child_process_1.execSync)('which java').toString().trim();
1463
- }
1464
- catch {
1465
- currentJava = '-- no selected --';
1466
- currentJavaLocation = '--';
1467
- }
1468
- console.log(`\nCURRENT JAVA GLOBAL VERSION: ${currentJava}`);
1469
- if (currentJavaLocation && currentJavaLocation !== '--') {
1470
- console.log(`FROM: ${currentJavaLocation}\n`);
1471
- }
1472
- let javaVersions = [];
1473
- if (platform === 'darwin') {
1474
- try {
1475
- const result = (0, child_process_1.execSync)('/usr/libexec/java_home -V 2>&1')
1476
- .toString()
1477
- .split('\n')
1478
- .filter(l => l.trim().startsWith('/Library'))
1479
- .map(l => {
1480
- const match = l.match(/(\/Library\/.*\/Contents\/Home)/);
1481
- if (match) {
1482
- const version = l.match(/(?:jdk-|JDK )([\d._]+)/)?.[1] ?? 'unknown';
1483
- return { version, path: match[1] };
1484
- }
1485
- })
1486
- .filter(Boolean);
1487
- javaVersions = result;
1488
- }
1489
- catch (err) {
1490
- console.warn('No Java versions found via /usr/libexec/java_home');
1491
- }
1492
- }
1493
- else if (platform === 'linux') {
1494
- try {
1495
- const output = (0, child_process_1.execSync)('update-java-alternatives -l || ls /usr/lib/jvm', { shell: '/bin/bash' }).toString();
1496
- javaVersions = output
1497
- .split('\n')
1498
- .filter(Boolean)
1499
- .map(line => {
1500
- const segments = line.trim().split(/\s+/);
1501
- const version = segments[0];
1502
- const pathGuess = segments[2] || `/usr/lib/jvm/${segments[0]}`;
1503
- return { version, path: pathGuess };
1504
- });
1505
- }
1506
- catch {
1507
- // Fallback using /usr/lib/jvm
1508
- javaVersions = (0, child_process_1.execSync)('ls /usr/lib/jvm')
1509
- .toString()
1510
- .split('\n')
1511
- .filter(Boolean)
1512
- .map(dir => ({
1513
- version: dir,
1514
- path: `/usr/lib/jvm/${dir}`,
1515
- }));
1516
- }
1517
- }
1518
- else if (platform === 'win32') {
1519
- try {
1520
- const output = (0, child_process_1.execSync)('reg query "HKLM\\SOFTWARE\\JavaSoft\\Java Development Kit"', {
1521
- encoding: 'utf8',
1522
- });
1523
- const lines = output
1524
- .split('\n')
1525
- .filter(line => line.trim().length > 0 && line.includes('HKLM'));
1526
- javaVersions = lines.map(l => {
1527
- const version = l.split('\\').pop();
1528
- const pathOutput = (0, child_process_1.execSync)(`reg query "${l.trim()}" /v JavaHome`, {
1529
- encoding: 'utf8',
1530
- });
1531
- const match = pathOutput.match(/JavaHome\s+REG_SZ\s+(.+)/);
1532
- return {
1533
- version,
1534
- path: match?.[1].trim() ?? '',
1535
- };
1536
- });
1537
- }
1538
- catch {
1539
- javaVersions = [];
1540
- }
1541
- // ✅ Fallback to checking typical install folders
1542
- const fallbackDirs = [
1543
- 'C:\\Program Files\\Amazon Corretto',
1544
- 'C:\\Program Files\\Java',
1545
- ];
1546
- for (const baseDir of fallbackDirs) {
1547
- try {
1548
- const subdirs = lib_3.fse.readdirSync(baseDir, { withFileTypes: true });
1549
- for (const dir of subdirs) {
1550
- if (dir.isDirectory() &&
1551
- (dir.name.startsWith('jdk') ||
1552
- dir.name.toLowerCase().includes('corretto'))) {
1553
- javaVersions.push({
1554
- version: dir.name,
1555
- path: lib_3.path.join(baseDir, dir.name),
1556
- });
1557
- }
1558
- }
1559
- }
1560
- catch {
1561
- // ignore
1562
- }
1563
- }
1564
- }
1565
- if (javaVersions.length === 0) {
1566
- console.log('❌ No installed Java versions found.');
1567
- return;
1568
- }
1569
- const selected = await lib_5.UtilsTerminal.select({
1570
- question: 'Select Java version to use globally:',
1571
- choices: javaVersions.map(j => ({
1572
- name: `${j.version} — ${j.path}`,
1573
- value: j,
1574
- })),
1575
- });
1576
- const selectedPath = selected.path;
1577
- if (platform === 'darwin') {
1578
- try {
1579
- const shellPath = lib_3.path.resolve(lib_3.os.homedir(), '.zshrc'); // or .bash_profile
1580
- (0, child_process_1.execSync)(`export JAVA_HOME="${selectedPath}"`);
1581
- console.log(`✅ JAVA_HOME set to ${selectedPath} (only in current session).`);
1582
- console.log(`To make permanent, add to your shell profile:\n\nexport JAVA_HOME="${selectedPath}"\n`);
1583
- }
1584
- catch (err) {
1585
- console.error('❌ Failed to set JAVA_HOME on macOS.');
1586
- }
1587
- }
1588
- else if (platform === 'linux') {
1589
- try {
1590
- (0, child_process_1.execSync)(`export JAVA_HOME="${selectedPath}"`);
1591
- (0, child_process_1.execSync)(`sudo update-alternatives --set java "${selectedPath}/bin/java"`);
1592
- console.log(`✅ Set global Java to ${selectedPath}`);
1593
- }
1594
- catch {
1595
- console.log(`⚠️ Could not update alternatives. Try manually:\nexport JAVA_HOME="${selectedPath}"`);
1596
- }
1597
- }
1598
- else if (platform === 'win32') {
1599
- try {
1600
- (0, child_process_1.execSync)(`setx JAVA_HOME "${selectedPath}"`);
1601
- console.log(`✅ JAVA_HOME set globally to ${selectedPath}`);
1602
- console.log(`⚠️ Restart your terminal or computer to apply changes.`);
1603
- }
1604
- catch {
1605
- console.error('❌ Failed to set JAVA_HOME on Windows.');
1606
- }
1607
- }
1473
+ lib_4.UtilsTerminal.clearConsole();
1474
+ let domain = this.firstArg || '';
1475
+ await lib_5.UtilsNetwork.simulateDomain(domain);
1476
+ this._exit();
1608
1477
  //#endregion
1609
1478
  }
1610
1479
  }