@alchemy/cli 0.5.0 → 0.5.2
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.
- package/README.md +22 -71
- package/dist/{auth-E26YCAJV.js → auth-76PDHQ3U.js} +1 -1
- package/dist/{auth-7E33EMAI.js → auth-PYH5WEC3.js} +6 -3
- package/dist/{chunk-IGD4NIK7.js → chunk-5ZAK2VSS.js} +2 -2
- package/dist/chunk-BAAQ7ELR.js +143 -0
- package/dist/{chunk-LYUW7O6X.js → chunk-DBTRDS35.js} +30 -12
- package/dist/{chunk-5X6YRTPU.js → chunk-FM7GQX6U.js} +4 -2
- package/dist/chunk-KDMIWPZH.js +27 -0
- package/dist/chunk-NBDWF4ZQ.js +554 -0
- package/dist/chunk-NM25MEJZ.js +724 -0
- package/dist/{chunk-DUQFOLLZ.js → chunk-NSG4ZKZI.js} +3 -3
- package/dist/index.js +699 -30
- package/dist/{interactive-K7XOS6U6.js → interactive-CGEVIPC2.js} +9 -5
- package/dist/onboarding-DNEXVUUH.js +64 -0
- package/dist/resolve-CLDYJ27A.js +30 -0
- package/package.json +1 -1
- package/scripts/postinstall.cjs +17 -1
- package/dist/chunk-44OGGLN4.js +0 -681
- package/dist/chunk-T2XSNZE3.js +0 -1398
- package/dist/onboarding-F5PZMFZU.js +0 -227
|
@@ -3,20 +3,24 @@ if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
|
|
|
3
3
|
import {
|
|
4
4
|
getRPCNetworkIds,
|
|
5
5
|
getSetupMethod
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FM7GQX6U.js";
|
|
7
|
+
import "./chunk-KDMIWPZH.js";
|
|
8
|
+
import "./chunk-NM25MEJZ.js";
|
|
7
9
|
import {
|
|
8
10
|
getUpdateNoticeLines
|
|
9
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-NSG4ZKZI.js";
|
|
10
12
|
import {
|
|
11
13
|
bold,
|
|
12
14
|
brand,
|
|
13
15
|
brandedHelp,
|
|
14
|
-
configDir,
|
|
15
16
|
dim,
|
|
16
17
|
green,
|
|
17
|
-
load,
|
|
18
18
|
setBrandedHelpSuppressed
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-NBDWF4ZQ.js";
|
|
20
|
+
import {
|
|
21
|
+
configDir,
|
|
22
|
+
load
|
|
23
|
+
} from "./chunk-BAAQ7ELR.js";
|
|
20
24
|
import {
|
|
21
25
|
bgRgb,
|
|
22
26
|
isJSONMode,
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
|
|
3
|
+
import {
|
|
4
|
+
getUpdateNoticeLines
|
|
5
|
+
} from "./chunk-NSG4ZKZI.js";
|
|
6
|
+
import {
|
|
7
|
+
bold,
|
|
8
|
+
brand,
|
|
9
|
+
brandedHelp,
|
|
10
|
+
dim,
|
|
11
|
+
green,
|
|
12
|
+
promptText
|
|
13
|
+
} from "./chunk-NBDWF4ZQ.js";
|
|
14
|
+
import {
|
|
15
|
+
load,
|
|
16
|
+
save
|
|
17
|
+
} from "./chunk-BAAQ7ELR.js";
|
|
18
|
+
import "./chunk-56ZVYB4G.js";
|
|
19
|
+
|
|
20
|
+
// src/commands/onboarding.ts
|
|
21
|
+
async function runOnboarding(_program, latestUpdate = null) {
|
|
22
|
+
process.stdout.write(brandedHelp({ force: true }));
|
|
23
|
+
console.log("");
|
|
24
|
+
console.log(` ${brand("\u25C6")} ${bold("Welcome to Alchemy CLI")}`);
|
|
25
|
+
console.log(` ${dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")}`);
|
|
26
|
+
console.log(` ${dim(" Let's get you set up with authentication.")}`);
|
|
27
|
+
console.log("");
|
|
28
|
+
if (latestUpdate) {
|
|
29
|
+
for (const line of getUpdateNoticeLines(latestUpdate)) {
|
|
30
|
+
console.log(line);
|
|
31
|
+
}
|
|
32
|
+
console.log("");
|
|
33
|
+
}
|
|
34
|
+
const answer = await promptText({
|
|
35
|
+
message: "Press Enter to open browser and link your Alchemy account",
|
|
36
|
+
cancelMessage: "Skipped onboarding."
|
|
37
|
+
});
|
|
38
|
+
if (answer === null) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
const { performBrowserLogin, AUTH_PORT, getLoginUrl } = await import("./auth-76PDHQ3U.js");
|
|
42
|
+
console.log(` Opening browser to log in...`);
|
|
43
|
+
console.log(` ${dim(getLoginUrl(AUTH_PORT))}`);
|
|
44
|
+
console.log(` ${dim("Waiting for authentication...")}`);
|
|
45
|
+
try {
|
|
46
|
+
const result = await performBrowserLogin();
|
|
47
|
+
const cfg = load();
|
|
48
|
+
save({
|
|
49
|
+
...cfg,
|
|
50
|
+
auth_token: result.token,
|
|
51
|
+
auth_token_expires_at: result.expiresAt
|
|
52
|
+
});
|
|
53
|
+
console.log(` ${green("\u2713")} Logged in successfully`);
|
|
54
|
+
const { selectAppAfterAuth } = await import("./auth-PYH5WEC3.js");
|
|
55
|
+
await selectAppAfterAuth(result.token);
|
|
56
|
+
return true;
|
|
57
|
+
} catch (err) {
|
|
58
|
+
console.log(` ${dim(`Login failed: ${err instanceof Error ? err.message : String(err)}`)}`);
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
runOnboarding
|
|
64
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
|
|
3
|
+
import {
|
|
4
|
+
adminClientFromFlags,
|
|
5
|
+
clientFromFlags,
|
|
6
|
+
resolveAPIKey,
|
|
7
|
+
resolveAccessKey,
|
|
8
|
+
resolveAppId,
|
|
9
|
+
resolveAuthToken,
|
|
10
|
+
resolveConfiguredNetworkSlugs,
|
|
11
|
+
resolveNetwork,
|
|
12
|
+
resolveWalletKey,
|
|
13
|
+
resolveX402,
|
|
14
|
+
resolveX402Client
|
|
15
|
+
} from "./chunk-NM25MEJZ.js";
|
|
16
|
+
import "./chunk-BAAQ7ELR.js";
|
|
17
|
+
import "./chunk-56ZVYB4G.js";
|
|
18
|
+
export {
|
|
19
|
+
adminClientFromFlags,
|
|
20
|
+
clientFromFlags,
|
|
21
|
+
resolveAPIKey,
|
|
22
|
+
resolveAccessKey,
|
|
23
|
+
resolveAppId,
|
|
24
|
+
resolveAuthToken,
|
|
25
|
+
resolveConfiguredNetworkSlugs,
|
|
26
|
+
resolveNetwork,
|
|
27
|
+
resolveWalletKey,
|
|
28
|
+
resolveX402,
|
|
29
|
+
resolveX402Client
|
|
30
|
+
};
|
package/package.json
CHANGED
package/scripts/postinstall.cjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
const { unlinkSync } = require("node:fs");
|
|
4
|
+
const { join } = require("node:path");
|
|
5
|
+
|
|
3
6
|
function isGlobalInstall() {
|
|
4
7
|
return process.env.npm_config_global === "true";
|
|
5
8
|
}
|
|
@@ -8,8 +11,21 @@ function isCI() {
|
|
|
8
11
|
return process.env.CI === "true";
|
|
9
12
|
}
|
|
10
13
|
|
|
14
|
+
function clearUpdateCache() {
|
|
15
|
+
const home = process.env.HOME || require("node:os").homedir();
|
|
16
|
+
const configHome = process.env.XDG_CONFIG_HOME || join(home, ".config");
|
|
17
|
+
const cachePath = process.env.ALCHEMY_CONFIG
|
|
18
|
+
? process.env.ALCHEMY_CONFIG.replace(/config\.json$/, ".update-check")
|
|
19
|
+
: join(configHome, "alchemy", ".update-check");
|
|
20
|
+
try {
|
|
21
|
+
unlinkSync(cachePath);
|
|
22
|
+
} catch {
|
|
23
|
+
// Cache file may not exist yet — that's fine.
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
11
27
|
if (isGlobalInstall() && !isCI()) {
|
|
12
|
-
|
|
28
|
+
clearUpdateCache();
|
|
13
29
|
console.log("");
|
|
14
30
|
console.log("◆ Alchemy CLI installed");
|
|
15
31
|
console.log(" Run `alchemy` to get started.");
|