@aptos-labs/aptos-cli 1.0.1 → 1.1.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 (51) hide show
  1. package/README.md +66 -2
  2. package/bin/tasks/install.ts +2 -2
  3. package/bin/tasks/update.ts +25 -17
  4. package/bin/utils/brewOperations.ts +0 -11
  5. package/package.json +1 -1
  6. package/bin/utils/getAptosCliLatestVersion.ts +0 -14
  7. package/dist/aptos.d.ts +0 -2
  8. package/dist/aptos.js +0 -24
  9. package/dist/aptos.js.map +0 -1
  10. package/dist/tasks/install.d.ts +0 -1
  11. package/dist/tasks/install.js +0 -42
  12. package/dist/tasks/install.js.map +0 -1
  13. package/dist/tasks/run.d.ts +0 -1
  14. package/dist/tasks/run.js +0 -17
  15. package/dist/tasks/run.js.map +0 -1
  16. package/dist/tasks/update.d.ts +0 -1
  17. package/dist/tasks/update.js +0 -26
  18. package/dist/tasks/update.js.map +0 -1
  19. package/dist/utils/aptosExecutableIsAvailable.d.ts +0 -1
  20. package/dist/utils/aptosExecutableIsAvailable.js +0 -11
  21. package/dist/utils/aptosExecutableIsAvailable.js.map +0 -1
  22. package/dist/utils/brewOperations.d.ts +0 -2
  23. package/dist/utils/brewOperations.js +0 -12
  24. package/dist/utils/brewOperations.js.map +0 -1
  25. package/dist/utils/consts.d.ts +0 -2
  26. package/dist/utils/consts.js +0 -3
  27. package/dist/utils/consts.js.map +0 -1
  28. package/dist/utils/execSyncShell.d.ts +0 -1
  29. package/dist/utils/execSyncShell.js +0 -5
  30. package/dist/utils/execSyncShell.js.map +0 -1
  31. package/dist/utils/getAptosCliLatestVersion.d.ts +0 -1
  32. package/dist/utils/getAptosCliLatestVersion.js +0 -12
  33. package/dist/utils/getAptosCliLatestVersion.js.map +0 -1
  34. package/dist/utils/getLocalBinPath.d.ts +0 -1
  35. package/dist/utils/getLocalBinPath.js +0 -30
  36. package/dist/utils/getLocalBinPath.js.map +0 -1
  37. package/dist/utils/getUserOs.d.ts +0 -1
  38. package/dist/utils/getUserOs.js +0 -15
  39. package/dist/utils/getUserOs.js.map +0 -1
  40. package/dist/utils/ghOperations.d.ts +0 -1
  41. package/dist/utils/ghOperations.js +0 -12
  42. package/dist/utils/ghOperations.js.map +0 -1
  43. package/dist/utils/handleHelpOptions.d.ts +0 -2
  44. package/dist/utils/handleHelpOptions.js +0 -16
  45. package/dist/utils/handleHelpOptions.js.map +0 -1
  46. package/dist/utils/parseCommandOptions.d.ts +0 -4
  47. package/dist/utils/parseCommandOptions.js +0 -21
  48. package/dist/utils/parseCommandOptions.js.map +0 -1
  49. package/dist/utils/versions.d.ts +0 -1
  50. package/dist/utils/versions.js +0 -6
  51. package/dist/utils/versions.js.map +0 -1
package/README.md CHANGED
@@ -1,3 +1,67 @@
1
- # aptos-cli
1
+ # Aptos CLI
2
2
 
3
- This package allows you to use the Aptos CLI from inside a JS / TS project.
3
+ The `@aptos-labs/aptos-cli` package allows you to use the Aptos CLI from inside a `Nodejs` project.
4
+
5
+ ## Download
6
+
7
+ To install the Aptos CLI, you need to have Node.js and npm installed on your system. Then, you can install it using:
8
+
9
+ ```bash
10
+ npm install @aptos-labs/aptos-cli
11
+ ```
12
+
13
+ That command will download the Aptos CLI and create a Node bin file, making it available to use in a Node environment.
14
+
15
+ ## Install
16
+
17
+ Once you have the package installed and the Node bin file, you can run the following command, in your project environment, to install the Aptos CLI in your project:
18
+
19
+ ```bash
20
+ npx aptos --install
21
+ ```
22
+
23
+ Alternatively, you can simply run the cli using the `npx aptos` command. That will install the Aptos CLI in your project if it's not already installed.
24
+
25
+ ```bash
26
+ npx aptos
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ To use the Aptos CLI, in your project environment, run the `npx aptos` command, to see the available commands.
32
+
33
+ ```bash
34
+ npx aptos
35
+ ```
36
+
37
+ ## Updating the Aptos CLI
38
+
39
+ To update the Aptos CLI, you can run the following command within your project environment:
40
+
41
+ ```bash
42
+ npx aptos --update
43
+ ```
44
+
45
+ ## Development
46
+
47
+ To set up the project for development:
48
+
49
+ 1. Clone the repository
50
+ 2. Install dependencies:
51
+ ```bash
52
+ npm install
53
+ ```
54
+ 3. Run the development server:
55
+ ```bash
56
+ npm run dev
57
+ ```
58
+
59
+ This will build the project and run the CLI.
60
+
61
+ ## Building
62
+
63
+ To build the project:
64
+
65
+ ```bash
66
+ npm run build
67
+ ```
@@ -5,8 +5,8 @@ import { GH_CLI_DOWNLOAD_URL, PNAME } from "../utils/consts.js";
5
5
  import { execSyncShell } from "../utils/execSyncShell.js";
6
6
  import { getCurrentOpenSSLVersion } from "../utils/versions.js";
7
7
  import { getOS } from "../utils/getUserOs.js";
8
- import { getLatestVersion } from "../utils/getAptosCliLatestVersion.js";
9
8
  import { getLocalBinPath } from "../utils/getLocalBinPath.js";
9
+ import { getLatestVersionGh } from "../utils/ghOperations.js";
10
10
 
11
11
  // Install the CLI.
12
12
  export const installCli = async () => {
@@ -16,7 +16,7 @@ export const installCli = async () => {
16
16
  return;
17
17
  }
18
18
  // Look up the latest version.
19
- const latestCLIVersion = await getLatestVersion();
19
+ const latestCLIVersion = await getLatestVersionGh();
20
20
  console.log(`Downloading aptos CLI version ${latestCLIVersion}`);
21
21
  const os = getOS();
22
22
 
@@ -1,33 +1,41 @@
1
1
  import { existsSync } from "fs";
2
2
 
3
+ import { getLocalBinPath } from "../utils/getLocalBinPath.js";
4
+ import { execSync } from "child_process";
5
+ import { getOS } from "../utils/getUserOs.js";
6
+ import { getLatestVersionGh } from "../utils/ghOperations.js";
3
7
  import { execSyncShell } from "../utils/execSyncShell.js";
4
- import { getLatestVersion } from "../utils/getAptosCliLatestVersion.js";
5
8
  import { installCli } from "./install.js";
6
- import { getLocalBinPath } from "../utils/getLocalBinPath.js";
7
9
 
8
10
  export const updateCli = async () => {
9
11
  const path = getLocalBinPath();
12
+
10
13
  if (!existsSync(path)) {
11
14
  console.log(
12
15
  "Aptos CLI not installed, run `npx aptos --install` to install"
13
16
  );
14
17
  return;
15
18
  }
16
- // Look up the latest version.
17
- const latestVersion = await getLatestVersion();
18
- // Get the current version of the CLI.
19
- const currentVersion = execSyncShell(`${path} --version`, {
20
- encoding: "utf8",
21
- })
22
- .trim()
23
- .split(" ")[1];
24
- // Check if the installed version is the latest version.
25
- if (currentVersion !== latestVersion) {
26
- console.log(
27
- `A newer version of the CLI is available: ${latestVersion}, installing...`
28
- );
29
- installCli();
19
+
20
+ if (getOS() === "MacOS") {
21
+ // Upgrade aptos via brew.
22
+ return execSync("brew upgrade aptos");
30
23
  } else {
31
- console.log(`CLI is up to date`);
24
+ const latestVersion = await getLatestVersionGh();
25
+ // Get the current version of the CLI.
26
+ const currentVersion = execSyncShell(`${path} --version`, {
27
+ encoding: "utf8",
28
+ })
29
+ .trim()
30
+ .split(" ")[1];
31
+ // Check if the installed version is the latest version.
32
+ if (currentVersion !== latestVersion) {
33
+ console.log(
34
+ `A newer version of the CLI is available: ${latestVersion}, installing...`
35
+ );
36
+ await installCli();
37
+ } else {
38
+ console.log(`CLI is up to date`);
39
+ }
32
40
  }
33
41
  };
@@ -10,14 +10,3 @@ export const getCliPathBrew = () => {
10
10
  .trim();
11
11
  return `${directory}/bin/aptos`;
12
12
  };
13
-
14
- /**
15
- * Use brew to find the latest version of the CLI. Make sure to confirm that brew
16
- * is installed before calling this function.
17
- */
18
- export const getLatestVersionBrew = () => {
19
- const out = JSON.parse(
20
- execSyncShell("brew info --json aptos", { encoding: "utf8" })
21
- );
22
- return out[0].versions.stable;
23
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aptos-labs/aptos-cli",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "Aptos CLI available from npmjs",
5
5
  "bin": {
6
6
  "aptos": "./dist/aptos.js"
@@ -1,14 +0,0 @@
1
- import { getLatestVersionBrew } from "./brewOperations.js";
2
- import { getOS } from "./getUserOs.js";
3
- import { getLatestVersionGh } from "./ghOperations.js";
4
-
5
- /**
6
- * Determine the latest version of the CLI.
7
- */
8
- export const getLatestVersion = async () => {
9
- if (getOS() === "MacOS") {
10
- return getLatestVersionBrew();
11
- } else {
12
- return getLatestVersionGh();
13
- }
14
- };
package/dist/aptos.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/dist/aptos.js DELETED
@@ -1,24 +0,0 @@
1
- #!/usr/bin/env node
2
- import { program } from "commander";
3
- import { parseCommandOptions } from "./utils/parseCommandOptions.js";
4
- import { runCLI } from "./tasks/run.js";
5
- program
6
- .name("aptos")
7
- .helpOption(false)
8
- .option("-i, --install", "install the latest version of the CLI")
9
- .option("-u, --update", "update the CLI to the latest version")
10
- .allowUnknownOption();
11
- program.parse(process.argv);
12
- const main = async () => {
13
- const options = {
14
- install: program.opts().install,
15
- update: program.opts().update,
16
- };
17
- const unknownOptions = program.args;
18
- if (process.argv.includes("--help")) {
19
- return runCLI(unknownOptions);
20
- }
21
- await parseCommandOptions(options, unknownOptions);
22
- };
23
- main().catch(console.error);
24
- //# sourceMappingURL=aptos.js.map
package/dist/aptos.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"aptos.js","sourceRoot":"","sources":["../bin/aptos.ts"],"names":[],"mappings":";AAWA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,OAAO;KACJ,IAAI,CAAC,OAAO,CAAC;KACb,UAAU,CAAC,KAAK,CAAC;KACjB,MAAM,CAAC,eAAe,EAAE,uCAAuC,CAAC;KAChE,MAAM,CAAC,cAAc,EAAE,sCAAsC,CAAC;KAC9D,kBAAkB,EAAE,CAAC;AAExB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5B,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE;IACtB,MAAM,OAAO,GAAG;QACd,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,OAAO;QAC/B,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM;KAC9B,CAAC;IACF,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAGpC,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAEpC,OAAO,MAAM,CAAC,cAAc,CAAC,CAAC;IAChC,CAAC;IAED,MAAM,mBAAmB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;AACrD,CAAC,CAAC;AAEF,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare const installCli: () => Promise<void>;
@@ -1,42 +0,0 @@
1
- import { execSync } from "child_process";
2
- import { existsSync } from "fs";
3
- import { GH_CLI_DOWNLOAD_URL, PNAME } from "../utils/consts.js";
4
- import { execSyncShell } from "../utils/execSyncShell.js";
5
- import { getCurrentOpenSSLVersion } from "../utils/versions.js";
6
- import { getOS } from "../utils/getUserOs.js";
7
- import { getLatestVersion } from "../utils/getAptosCliLatestVersion.js";
8
- import { getLocalBinPath } from "../utils/getLocalBinPath.js";
9
- export const installCli = async () => {
10
- const path = getLocalBinPath();
11
- if (existsSync(path)) {
12
- console.log("Aptos CLI is already installed");
13
- return;
14
- }
15
- const latestCLIVersion = await getLatestVersion();
16
- console.log(`Downloading aptos CLI version ${latestCLIVersion}`);
17
- const os = getOS();
18
- if (os === "Windows") {
19
- const url = `${GH_CLI_DOWNLOAD_URL}/${PNAME}-v${latestCLIVersion}/${PNAME}-${latestCLIVersion}-${os}-x86_64.zip`;
20
- execSync(`powershell -Command "if (!(Test-Path -Path 'C:\\tmp')) { New-Item -ItemType Directory -Path 'C:\\tmp' } ; Invoke-RestMethod -Uri ${url} -OutFile C:\\tmp\\aptos.zip; Expand-Archive -Path C:\\tmp\\aptos.zip -DestinationPath C:\\tmp -Force; Move-Item -Path C:\\tmp\\aptos.exe -Destination \"${path}\""`);
21
- }
22
- else if (os === "MacOS") {
23
- execSyncShell("brew install aptos", { encoding: "utf8" });
24
- }
25
- else {
26
- let osVersion = "x86_64";
27
- let opensSslVersion = "1.0.0";
28
- try {
29
- opensSslVersion = getCurrentOpenSSLVersion();
30
- }
31
- catch (error) {
32
- console.log("Could not determine OpenSSL version, assuming older version (1.x.x)");
33
- }
34
- if (opensSslVersion.startsWith("3.")) {
35
- osVersion = "22.04-x86_64";
36
- }
37
- console.log(`Downloading CLI binary ${os}-${osVersion}`);
38
- const url = `${GH_CLI_DOWNLOAD_URL}/${PNAME}-v${latestCLIVersion}/${PNAME}-${latestCLIVersion}-${os}-${osVersion}.zip`;
39
- execSync(`curl -L -o /tmp/aptos.zip ${url}; unzip -o -q /tmp/aptos.zip -d /tmp; mv /tmp/aptos ${path};`);
40
- }
41
- };
42
- //# sourceMappingURL=install.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"install.js","sourceRoot":"","sources":["../../bin/tasks/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAEhC,OAAO,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,IAAI,EAAE;IACnC,MAAM,IAAI,GAAG,eAAe,EAAE,CAAC;IAC/B,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACrB,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;QAC9C,OAAO;IACT,CAAC;IAED,MAAM,gBAAgB,GAAG,MAAM,gBAAgB,EAAE,CAAC;IAClD,OAAO,CAAC,GAAG,CAAC,iCAAiC,gBAAgB,EAAE,CAAC,CAAC;IACjE,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IAEnB,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;QACrB,MAAM,GAAG,GAAG,GAAG,mBAAmB,IAAI,KAAK,KAAK,gBAAgB,IAAI,KAAK,IAAI,gBAAgB,IAAI,EAAE,aAAa,CAAC;QAEjH,QAAQ,CACN,oIAAoI,GAAG,4JAA4J,IAAI,KAAK,CAC7S,CAAC;IACJ,CAAC;SAAM,IAAI,EAAE,KAAK,OAAO,EAAE,CAAC;QAE1B,aAAa,CAAC,oBAAoB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IAC5D,CAAC;SAAM,CAAC;QAGN,IAAI,SAAS,GAAG,QAAQ,CAAC;QACzB,IAAI,eAAe,GAAG,OAAO,CAAC;QAC9B,IAAI,CAAC;YACH,eAAe,GAAG,wBAAwB,EAAE,CAAC;QAC/C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CACT,qEAAqE,CACtE,CAAC;QACJ,CAAC;QAED,IAAI,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACrC,SAAS,GAAG,cAAc,CAAC;QAC7B,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,IAAI,SAAS,EAAE,CAAC,CAAC;QACzD,MAAM,GAAG,GAAG,GAAG,mBAAmB,IAAI,KAAK,KAAK,gBAAgB,IAAI,KAAK,IAAI,gBAAgB,IAAI,EAAE,IAAI,SAAS,MAAM,CAAC;QAEvH,QAAQ,CACN,6BAA6B,GAAG,uDAAuD,IAAI,GAAG,CAC/F,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare const runCLI: (args?: string[]) => Promise<void>;
package/dist/tasks/run.js DELETED
@@ -1,17 +0,0 @@
1
- import { spawn } from "child_process";
2
- import { existsSync } from "fs";
3
- import { getOS } from "../utils/getUserOs.js";
4
- import { getLocalBinPath } from "../utils/getLocalBinPath.js";
5
- export const runCLI = async (args = []) => {
6
- const path = getLocalBinPath();
7
- if (!existsSync(path)) {
8
- console.log("Aptos CLI not installed, run `npx aptos --install` to install");
9
- return;
10
- }
11
- const os = getOS();
12
- spawn(path, args, {
13
- stdio: "inherit",
14
- shell: os === "Windows",
15
- });
16
- };
17
- //# sourceMappingURL=run.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../../bin/tasks/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,EAAE,OAAiB,EAAE,EAAE,EAAE;IAClD,MAAM,IAAI,GAAG,eAAe,EAAE,CAAC;IAC/B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,OAAO,CAAC,GAAG,CACT,+DAA+D,CAChE,CAAC;QACF,OAAO;IACT,CAAC;IACD,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IAInB,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE;QAChB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,EAAE,KAAK,SAAS;KACxB,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare const updateCli: () => Promise<void>;
@@ -1,26 +0,0 @@
1
- import { existsSync } from "fs";
2
- import { execSyncShell } from "../utils/execSyncShell.js";
3
- import { getLatestVersion } from "../utils/getAptosCliLatestVersion.js";
4
- import { installCli } from "./install.js";
5
- import { getLocalBinPath } from "../utils/getLocalBinPath.js";
6
- export const updateCli = async () => {
7
- const path = getLocalBinPath();
8
- if (!existsSync(path)) {
9
- console.log("Aptos CLI not installed, run `npx aptos --install` to install");
10
- return;
11
- }
12
- const latestVersion = await getLatestVersion();
13
- const currentVersion = execSyncShell(`${path} --version`, {
14
- encoding: "utf8",
15
- })
16
- .trim()
17
- .split(" ")[1];
18
- if (currentVersion !== latestVersion) {
19
- console.log(`A newer version of the CLI is available: ${latestVersion}, installing...`);
20
- installCli();
21
- }
22
- else {
23
- console.log(`CLI is up to date`);
24
- }
25
- };
26
- //# sourceMappingURL=update.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update.js","sourceRoot":"","sources":["../../bin/tasks/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,IAAI,EAAE;IAClC,MAAM,IAAI,GAAG,eAAe,EAAE,CAAC;IAC/B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,OAAO,CAAC,GAAG,CACT,+DAA+D,CAChE,CAAC;QACF,OAAO;IACT,CAAC;IAED,MAAM,aAAa,GAAG,MAAM,gBAAgB,EAAE,CAAC;IAE/C,MAAM,cAAc,GAAG,aAAa,CAAC,GAAG,IAAI,YAAY,EAAE;QACxD,QAAQ,EAAE,MAAM;KACjB,CAAC;SACC,IAAI,EAAE;SACN,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAEjB,IAAI,cAAc,KAAK,aAAa,EAAE,CAAC;QACrC,OAAO,CAAC,GAAG,CACT,4CAA4C,aAAa,iBAAiB,CAC3E,CAAC;QACF,UAAU,EAAE,CAAC;IACf,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACnC,CAAC;AACH,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare const executableIsAvailable: (name: any) => boolean;
@@ -1,11 +0,0 @@
1
- import { execSyncShell } from "./execSyncShell.js";
2
- export const executableIsAvailable = (name) => {
3
- try {
4
- execSyncShell(`which ${name}`, { encoding: "utf8" });
5
- return true;
6
- }
7
- catch (error) {
8
- return false;
9
- }
10
- };
11
- //# sourceMappingURL=aptosExecutableIsAvailable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aptosExecutableIsAvailable.js","sourceRoot":"","sources":["../../bin/utils/aptosExecutableIsAvailable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAMnD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE,EAAE;IAC5C,IAAI,CAAC;QACH,aAAa,CAAC,SAAS,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const getCliPathBrew: () => string;
2
- export declare const getLatestVersionBrew: () => any;
@@ -1,12 +0,0 @@
1
- import { execSyncShell } from "./execSyncShell.js";
2
- export const getCliPathBrew = () => {
3
- const directory = execSyncShell("brew --prefix aptos", { encoding: "utf8" })
4
- .toString()
5
- .trim();
6
- return `${directory}/bin/aptos`;
7
- };
8
- export const getLatestVersionBrew = () => {
9
- const out = JSON.parse(execSyncShell("brew info --json aptos", { encoding: "utf8" }));
10
- return out[0].versions.stable;
11
- };
12
- //# sourceMappingURL=brewOperations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"brewOperations.js","sourceRoot":"","sources":["../../bin/utils/brewOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAMnD,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,MAAM,SAAS,GAAG,aAAa,CAAC,qBAAqB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;SACzE,QAAQ,EAAE;SACV,IAAI,EAAE,CAAC;IACV,OAAO,GAAG,SAAS,YAAY,CAAC;AAClC,CAAC,CAAC;AAMF,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CACpB,aAAa,CAAC,wBAAwB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAC9D,CAAC;IACF,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;AAChC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const PNAME = "aptos-cli";
2
- export declare const GH_CLI_DOWNLOAD_URL = "https://github.com/aptos-labs/aptos-core/releases/download";
@@ -1,3 +0,0 @@
1
- export const PNAME = "aptos-cli";
2
- export const GH_CLI_DOWNLOAD_URL = "https://github.com/aptos-labs/aptos-core/releases/download";
3
- //# sourceMappingURL=consts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"consts.js","sourceRoot":"","sources":["../../bin/utils/consts.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG,WAAW,CAAC;AACjC,MAAM,CAAC,MAAM,mBAAmB,GAC9B,4DAA4D,CAAC"}
@@ -1 +0,0 @@
1
- export declare const execSyncShell: (command: any, options: any) => string;
@@ -1,5 +0,0 @@
1
- import { execSync } from "child_process";
2
- export const execSyncShell = (command, options) => {
3
- return execSync(command, { shell: true, ...options });
4
- };
5
- //# sourceMappingURL=execSyncShell.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"execSyncShell.js","sourceRoot":"","sources":["../../bin/utils/execSyncShell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAKzC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;IAChD,OAAO,QAAQ,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;AACxD,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare const getLatestVersion: () => Promise<any>;
@@ -1,12 +0,0 @@
1
- import { getLatestVersionBrew } from "./brewOperations.js";
2
- import { getOS } from "./getUserOs.js";
3
- import { getLatestVersionGh } from "./ghOperations.js";
4
- export const getLatestVersion = async () => {
5
- if (getOS() === "MacOS") {
6
- return getLatestVersionBrew();
7
- }
8
- else {
9
- return getLatestVersionGh();
10
- }
11
- };
12
- //# sourceMappingURL=getAptosCliLatestVersion.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getAptosCliLatestVersion.js","sourceRoot":"","sources":["../../bin/utils/getAptosCliLatestVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAKvD,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,IAAI,EAAE;IACzC,IAAI,KAAK,EAAE,KAAK,OAAO,EAAE,CAAC;QACxB,OAAO,oBAAoB,EAAE,CAAC;IAChC,CAAC;SAAM,CAAC;QACN,OAAO,kBAAkB,EAAE,CAAC;IAC9B,CAAC;AACH,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare const getLocalBinPath: () => any;
@@ -1,30 +0,0 @@
1
- import { dirname } from "path";
2
- import { executableIsAvailable } from "./aptosExecutableIsAvailable.js";
3
- import { getCliPathBrew } from "./brewOperations.js";
4
- import { PNAME } from "./consts.js";
5
- import { getOS } from "./getUserOs.js";
6
- import { fileURLToPath } from "url";
7
- export const getLocalBinPath = () => {
8
- let path;
9
- const os = getOS();
10
- if (os === "MacOS") {
11
- const brewInstalled = executableIsAvailable("brew");
12
- if (!brewInstalled) {
13
- throw "Please install brew to continue: https://brew.sh/";
14
- }
15
- try {
16
- path = getCliPathBrew();
17
- }
18
- catch (e) {
19
- path = "";
20
- }
21
- }
22
- else if (os === "Windows") {
23
- path = `${dirname(fileURLToPath(import.meta.url))}\\${PNAME}.exe`;
24
- }
25
- else {
26
- path = `${dirname(fileURLToPath(import.meta.url))}/${PNAME}`;
27
- }
28
- return path;
29
- };
30
- //# sourceMappingURL=getLocalBinPath.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getLocalBinPath.js","sourceRoot":"","sources":["../../bin/utils/getLocalBinPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,IAAI,IAAI,CAAC;IACT,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IACnB,IAAI,EAAE,KAAK,OAAO,EAAE,CAAC;QAEnB,MAAM,aAAa,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;QACpD,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,MAAM,mDAAmD,CAAC;QAC5D,CAAC;QACD,IAAI,CAAC;YACH,IAAI,GAAG,cAAc,EAAE,CAAC;QAC1B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,GAAG,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;SAAM,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;QAC5B,IAAI,GAAG,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC;IACpE,CAAC;SAAM,CAAC;QACN,IAAI,GAAG,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC;IAC/D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare const getOS: () => "MacOS" | "Ubuntu" | "Windows";
@@ -1,15 +0,0 @@
1
- import { platform } from "os";
2
- export const getOS = () => {
3
- const osPlatform = platform();
4
- switch (osPlatform) {
5
- case "darwin":
6
- return "MacOS";
7
- case "linux":
8
- return "Ubuntu";
9
- case "win32":
10
- return "Windows";
11
- default:
12
- throw new Error(`Unsupported OS ${osPlatform}`);
13
- }
14
- };
15
- //# sourceMappingURL=getUserOs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getUserOs.js","sourceRoot":"","sources":["../../bin/utils/getUserOs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAK9B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,EAAE;IACxB,MAAM,UAAU,GAAG,QAAQ,EAAE,CAAC;IAC9B,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,QAAQ;YACX,OAAO,OAAO,CAAC;QACjB,KAAK,OAAO;YACV,OAAO,QAAQ,CAAC;QAClB,KAAK,OAAO;YACV,OAAO,SAAS,CAAC;QACnB;YACE,MAAM,IAAI,KAAK,CAAC,kBAAkB,UAAU,EAAE,CAAC,CAAC;IACpD,CAAC;AACH,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare const getLatestVersionGh: () => Promise<any>;
@@ -1,12 +0,0 @@
1
- import { PNAME } from "./consts.js";
2
- export const getLatestVersionGh = async () => {
3
- const prefix = `${PNAME}-v`;
4
- const response = await (await fetch("https://api.github.com/repos/aptos-labs/aptos-core/releases?per_page=100")).json();
5
- for (const release of response) {
6
- if (release["tag_name"].startsWith(`${prefix}`)) {
7
- return release.tag_name.replace(`${prefix}`, "");
8
- }
9
- }
10
- throw "Could not determine latest version of Aptos CLI";
11
- };
12
- //# sourceMappingURL=ghOperations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ghOperations.js","sourceRoot":"","sources":["../../bin/utils/ghOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAMpC,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,IAAI,EAAE;IAC3C,MAAM,MAAM,GAAG,GAAG,KAAK,IAAI,CAAC;IAC5B,MAAM,QAAQ,GAAG,MAAM,CACrB,MAAM,KAAK,CACT,0EAA0E,CAC3E,CACF,CAAC,IAAI,EAAE,CAAC;IACT,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC;YAChD,OAAO,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IACD,MAAM,iDAAiD,CAAC;AAC1D,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- import { Command } from "commander";
2
- export declare const handleHelpOptions: (program: Command, unknownOptions: string[]) => void;
@@ -1,16 +0,0 @@
1
- import { spawnSync } from "child_process";
2
- export const handleHelpOptions = (program, unknownOptions) => {
3
- const cliHelp = spawnSync(`aptos`, unknownOptions, {
4
- stdio: "pipe",
5
- encoding: "utf-8",
6
- });
7
- const commanderHelp = program.helpInformation();
8
- const commanderOptionsOnly = commanderHelp
9
- .split("\n")
10
- .filter((line) => !line.startsWith("Usage") && !line.startsWith("Options"))
11
- .join("\n");
12
- const combinedHelp = cliHelp.stdout.replace("Options:", `Options:\n${commanderOptionsOnly.trim()}`);
13
- console.log(combinedHelp);
14
- return;
15
- };
16
- //# sourceMappingURL=handleHelpOptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handleHelpOptions.js","sourceRoot":"","sources":["../../bin/utils/handleHelpOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAU1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,OAAgB,EAChB,cAAwB,EACxB,EAAE;IAEF,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,EAAE,cAAc,EAAE;QACjD,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,OAAO;KAClB,CAAC,CAAC;IAEH,MAAM,aAAa,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAGhD,MAAM,oBAAoB,GAAG,aAAa;SACvC,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;SAC1E,IAAI,CAAC,IAAI,CAAC,CAAC;IAGd,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CACzC,UAAU,EACV,aAAa,oBAAoB,CAAC,IAAI,EAAE,EAAE,CAC3C,CAAC;IAGF,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAC1B,OAAO;AACT,CAAC,CAAC"}
@@ -1,4 +0,0 @@
1
- export declare const parseCommandOptions: (options: {
2
- install: boolean;
3
- update: boolean;
4
- }, unknownOptions: string[]) => Promise<void>;
@@ -1,21 +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
- export const parseCommandOptions = async (options, unknownOptions) => {
7
- if (options.install) {
8
- await installCli();
9
- return;
10
- }
11
- if (options.update) {
12
- await updateCli();
13
- return;
14
- }
15
- const path = getLocalBinPath();
16
- if (!existsSync(path)) {
17
- await installCli();
18
- }
19
- await runCLI(unknownOptions);
20
- };
21
- //# sourceMappingURL=parseCommandOptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseCommandOptions.js","sourceRoot":"","sources":["../../bin/utils/parseCommandOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EACtC,OAA8C,EAC9C,cAAwB,EACxB,EAAE;IAEF,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,UAAU,EAAE,CAAC;QACnB,OAAO;IACT,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,MAAM,SAAS,EAAE,CAAC;QAClB,OAAO;IACT,CAAC;IAGD,MAAM,IAAI,GAAG,eAAe,EAAE,CAAC;IAC/B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,MAAM,UAAU,EAAE,CAAC;IACrB,CAAC;IACD,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC;AAC/B,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare const getCurrentOpenSSLVersion: () => string;
@@ -1,6 +0,0 @@
1
- import { execSyncShell } from "./execSyncShell.js";
2
- export const getCurrentOpenSSLVersion = () => {
3
- const out = execSyncShell("openssl version", { encoding: "utf8" });
4
- return out.split(" ")[1].trim();
5
- };
6
- //# sourceMappingURL=versions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"versions.js","sourceRoot":"","sources":["../../bin/utils/versions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKnD,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,MAAM,GAAG,GAAG,aAAa,CAAC,iBAAiB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IACnE,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAClC,CAAC,CAAC"}