@aptos-labs/aptos-cli 1.1.0 → 2.0.0

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 (57) hide show
  1. package/README.md +117 -0
  2. package/dist/aptos.js +31 -0
  3. package/dist/aptos.js.map +1 -0
  4. package/dist/examples/examples.test.js +69 -0
  5. package/dist/examples/examples.test.js.map +1 -0
  6. package/dist/tasks/install.js +93 -0
  7. package/dist/tasks/install.js.map +1 -0
  8. package/dist/tasks/install.test.js +227 -0
  9. package/dist/tasks/install.test.js.map +1 -0
  10. package/dist/tasks/run.js +26 -0
  11. package/dist/tasks/run.js.map +1 -0
  12. package/dist/tasks/run.test.js +92 -0
  13. package/dist/tasks/run.test.js.map +1 -0
  14. package/dist/tasks/update.js +68 -0
  15. package/dist/tasks/update.js.map +1 -0
  16. package/dist/utils/brewOperations.js +34 -0
  17. package/dist/utils/brewOperations.js.map +1 -0
  18. package/dist/utils/brewOperations.test.js +83 -0
  19. package/dist/utils/brewOperations.test.js.map +1 -0
  20. package/dist/utils/consts.js +3 -0
  21. package/dist/utils/consts.js.map +1 -0
  22. package/dist/utils/execSyncShell.js +9 -0
  23. package/dist/utils/execSyncShell.js.map +1 -0
  24. package/dist/utils/executableIsAvailable.js +12 -0
  25. package/dist/utils/executableIsAvailable.js.map +1 -0
  26. package/dist/utils/getLocalBinPath.js +86 -0
  27. package/dist/utils/getLocalBinPath.js.map +1 -0
  28. package/dist/utils/getUserOs.js +101 -0
  29. package/dist/utils/getUserOs.js.map +1 -0
  30. package/dist/utils/getUserOs.test.js +143 -0
  31. package/dist/utils/getUserOs.test.js.map +1 -0
  32. package/dist/utils/ghOperations.js +87 -0
  33. package/dist/utils/ghOperations.js.map +1 -0
  34. package/dist/utils/ghOperations.test.js +217 -0
  35. package/dist/utils/ghOperations.test.js.map +1 -0
  36. package/dist/utils/parseCommandOptions.js +21 -0
  37. package/dist/utils/parseCommandOptions.js.map +1 -0
  38. package/dist/utils/windowsPackageManagers.js +100 -0
  39. package/dist/utils/windowsPackageManagers.js.map +1 -0
  40. package/dist/utils/windowsPackageManagers.test.js +169 -0
  41. package/dist/utils/windowsPackageManagers.test.js.map +1 -0
  42. package/package.json +22 -11
  43. package/bin/.gitkeep +0 -0
  44. package/bin/aptos.ts +0 -42
  45. package/bin/tasks/install.ts +0 -55
  46. package/bin/tasks/run.ts +0 -23
  47. package/bin/tasks/update.ts +0 -41
  48. package/bin/utils/aptosExecutableIsAvailable.ts +0 -14
  49. package/bin/utils/brewOperations.ts +0 -12
  50. package/bin/utils/consts.ts +0 -3
  51. package/bin/utils/execSyncShell.ts +0 -8
  52. package/bin/utils/getLocalBinPath.ts +0 -28
  53. package/bin/utils/getUserOs.ts +0 -18
  54. package/bin/utils/ghOperations.ts +0 -20
  55. package/bin/utils/handleHelpOptions.ts +0 -38
  56. package/bin/utils/parseCommandOptions.ts +0 -28
  57. package/bin/utils/versions.ts +0 -9
@@ -1,38 +0,0 @@
1
- import { spawnSync } from "child_process";
2
- import { Command } from "commander";
3
-
4
- /**
5
- * Handle the `--help` option for the Aptos CLI. This function is used to combine
6
- * the Aptos CLI help output with the Commander help output.
7
- * @param program - The Commander program instance.
8
- * @param unknownOptions - The unknown options passed to the CLI.
9
- * @returns void
10
- */
11
- export const handleHelpOptions = (
12
- program: Command,
13
- unknownOptions: string[]
14
- ) => {
15
- // Capture the Aptos CLI help output
16
- const cliHelp = spawnSync(`aptos`, unknownOptions, {
17
- stdio: "pipe",
18
- encoding: "utf-8",
19
- });
20
- // Generate Commander help text
21
- const commanderHelp = program.helpInformation();
22
-
23
- // Remove the "Usage" and "Options" lines from the Commander output
24
- const commanderOptionsOnly = commanderHelp
25
- .split("\n")
26
- .filter((line) => !line.startsWith("Usage") && !line.startsWith("Options"))
27
- .join("\n");
28
-
29
- // Find where the CLI options start and append the Commander options to the existing CLI options
30
- const combinedHelp = cliHelp.stdout.replace(
31
- "Options:",
32
- `Options:\n${commanderOptionsOnly.trim()}`
33
- );
34
-
35
- // Output the combined help
36
- console.log(combinedHelp);
37
- return;
38
- };
@@ -1,28 +0,0 @@
1
- import { existsSync } from "fs";
2
- import { installCli } from "../tasks/install.js";
3
- import { runCLI } from "../tasks/run.js";
4
- import { updateCli } from "../tasks/update.js";
5
- import { getLocalBinPath } from "./getLocalBinPath.js";
6
-
7
- export const parseCommandOptions = async (
8
- options: { install: boolean; update: boolean },
9
- unknownOptions: string[]
10
- ) => {
11
- // if `--install` flag is set, only install the cli and dont run it
12
- if (options.install) {
13
- await installCli();
14
- return;
15
- }
16
- // if `--update` flag is set, update the cli and dont run it
17
- if (options.update) {
18
- await updateCli();
19
- return;
20
- }
21
-
22
- // if no flags are set, install and run the cli
23
- const path = getLocalBinPath();
24
- if (!existsSync(path)) {
25
- await installCli();
26
- }
27
- await runCLI(unknownOptions);
28
- };
@@ -1,9 +0,0 @@
1
- import { execSyncShell } from "./execSyncShell.js";
2
-
3
- /**
4
- * Determine the current SSL version
5
- */
6
- export const getCurrentOpenSSLVersion = () => {
7
- const out = execSyncShell("openssl version", { encoding: "utf8" });
8
- return out.split(" ")[1].trim();
9
- };