devflare 1.0.0-next.18 → 1.0.0-next.19
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/dist/account-d43d1eqs.js +475 -0
- package/dist/cli/index.js +1 -1
- package/dist/cloudflare/index.js +2 -2
- package/dist/cloudflare/tokens.d.ts.map +1 -1
- package/dist/index-7r7dfpcm.js +133 -0
- package/dist/index-k7m5f1dg.js +200 -0
- package/dist/index-vt803j3b.js +1372 -0
- package/dist/index.js +1 -1
- package/dist/login-7yex6ppq.js +77 -0
- package/dist/previews-6fepv94a.js +1225 -0
- package/dist/productions-2t9q8f57.js +505 -0
- package/dist/token-a2b38w0z.js +419 -0
- package/dist/worker-99tew196.js +513 -0
- package/dist/worker-entry/composed-worker.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getConfiguredAccountId
|
|
3
|
+
} from "./index-678j0n13.js";
|
|
4
|
+
import {
|
|
5
|
+
account
|
|
6
|
+
} from "./index-7r7dfpcm.js";
|
|
7
|
+
import"./index-k7m5f1dg.js";
|
|
8
|
+
import"./index-nbs4q0qg.js";
|
|
9
|
+
import {
|
|
10
|
+
getDependencies
|
|
11
|
+
} from "./index-z9gy8w6b.js";
|
|
12
|
+
import {
|
|
13
|
+
createCliTheme,
|
|
14
|
+
dim,
|
|
15
|
+
green,
|
|
16
|
+
logLine,
|
|
17
|
+
whiteDim,
|
|
18
|
+
yellow
|
|
19
|
+
} from "./index-stgn34cr.js";
|
|
20
|
+
import"./index-3t6rypgc.js";
|
|
21
|
+
import"./index-15fpa5tx.js";
|
|
22
|
+
import"./index-5vzcszr2.js";
|
|
23
|
+
import"./index-1d4jg11n.js";
|
|
24
|
+
import"./index-mg8vwqxf.js";
|
|
25
|
+
import"./index-c0whkev9.js";
|
|
26
|
+
import"./index-37x76zdn.js";
|
|
27
|
+
|
|
28
|
+
// src/cli/commands/login.ts
|
|
29
|
+
async function logResolvedAccount(cwd, logger, theme) {
|
|
30
|
+
try {
|
|
31
|
+
const primaryAccount = await account.getPrimaryAccount();
|
|
32
|
+
if (primaryAccount) {
|
|
33
|
+
logLine(logger, `${dim("Primary account:", theme)} ${green(primaryAccount.name, theme)} ${whiteDim(`(${primaryAccount.id})`, theme)}`);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
} catch {}
|
|
37
|
+
const configuredAccountId = await getConfiguredAccountId(cwd);
|
|
38
|
+
if (!configuredAccountId) {
|
|
39
|
+
logLine(logger, dim("Run `devflare account` to inspect available accounts.", theme));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const configuredAccount = await account.getAccountById(configuredAccountId);
|
|
43
|
+
if (configuredAccount) {
|
|
44
|
+
logLine(logger, `${dim("Configured account:", theme)} ${green(configuredAccount.name, theme)} ${whiteDim(`(${configuredAccount.id})`, theme)}`);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
logLine(logger, `${dim("Configured account ID:", theme)} ${whiteDim(configuredAccountId, theme)}`);
|
|
48
|
+
logLine(logger, dim("Run `devflare account --account <id>` to inspect the configured account.", theme));
|
|
49
|
+
}
|
|
50
|
+
async function runLoginCommand(parsed, logger, options) {
|
|
51
|
+
const force = parsed.options.force === true;
|
|
52
|
+
const cwd = options.cwd ?? process.cwd();
|
|
53
|
+
const theme = createCliTheme(parsed.options);
|
|
54
|
+
if (!force && await account.isAuthenticated()) {
|
|
55
|
+
logger.success("Already authenticated with Cloudflare");
|
|
56
|
+
await logResolvedAccount(cwd, logger, theme);
|
|
57
|
+
logLine(logger, dim("Use `devflare login --force` to open Wrangler login again.", theme));
|
|
58
|
+
return { exitCode: 0 };
|
|
59
|
+
}
|
|
60
|
+
logLine(logger);
|
|
61
|
+
logLine(logger, `${yellow("login", theme)} ${dim("Opening Wrangler login…", theme)}`);
|
|
62
|
+
const deps = await getDependencies();
|
|
63
|
+
const result = await deps.exec.exec("bunx", ["wrangler", "login"], {
|
|
64
|
+
cwd,
|
|
65
|
+
stdio: "inherit"
|
|
66
|
+
});
|
|
67
|
+
if (result.exitCode !== 0) {
|
|
68
|
+
logger.error("Wrangler login failed");
|
|
69
|
+
return { exitCode: 1 };
|
|
70
|
+
}
|
|
71
|
+
logger.success("Authenticated with Cloudflare");
|
|
72
|
+
await logResolvedAccount(cwd, logger, theme);
|
|
73
|
+
return { exitCode: 0 };
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
runLoginCommand
|
|
77
|
+
};
|