Lines 8-48javascript
9 __defProp(target, name, { get: all[name], enumerable: true });
12// packages/cli/src/credentials.ts
13import { mkdir, open, readFile, rm, stat } from "node:fs/promises";
14import { dirname } from "node:path";
15async function saveCredentials(paths, credentials) {
16 await mkdir(dirname(paths.credentialsFile), { recursive: true });
17 const handle = await open(paths.credentialsFile, "w", 384);
19 await handle.writeFile(JSON.stringify(credentials, null, 2));
23 await chmodStrict(paths.credentialsFile);
25async function chmodStrict(file) {
26 const info = await stat(file);
27 const mode = info.mode & 511;
29 const { chmod } = await import("node:fs/promises");
30 await chmod(file, 384);
MediumDynamic Require
Package source references dynamic require/import behavior.
dist/index.jsView on unpkg · L28 33async function loadCredentials(paths) {
35 const raw = await readFile(paths.credentialsFile, "utf8");
36 const parsed = JSON.parse(raw);
37 if (typeof parsed["server"] !== "string" || typeof parsed["email"] !== "string" || typeof parsed["encodedToken"] !== "string") {
41 server: parsed["server"],
42 email: parsed["email"],
43 encodedToken: parsed["encodedToken"]