@temps-sdk/cli 0.1.2 → 0.1.4

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 (2) hide show
  1. package/dist/index.js +18 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -17731,6 +17731,9 @@ class Conf {
17731
17731
 
17732
17732
  // src/config/store.ts
17733
17733
  init_output();
17734
+ import { readFile, writeFile, mkdir } from "node:fs/promises";
17735
+ import { existsSync } from "node:fs";
17736
+ import { dirname } from "node:path";
17734
17737
  var DEFAULT_CONFIG = {
17735
17738
  apiUrl: "http://localhost:3000",
17736
17739
  outputFormat: "table",
@@ -17747,7 +17750,6 @@ var SECRET_KEYS = {
17747
17750
  email: "temps_email"
17748
17751
  };
17749
17752
  async function setSecret(key, value) {
17750
- const secretsPath = getSecretsPath();
17751
17753
  const secrets = await loadSecrets();
17752
17754
  secrets[key] = value;
17753
17755
  await saveSecrets(secrets);
@@ -17764,9 +17766,8 @@ function getSecretsPath() {
17764
17766
  async function loadSecrets() {
17765
17767
  const secretsPath = getSecretsPath();
17766
17768
  try {
17767
- const file = Bun.file(secretsPath);
17768
- if (await file.exists()) {
17769
- const content = await file.text();
17769
+ if (existsSync(secretsPath)) {
17770
+ const content = await readFile(secretsPath, "utf-8");
17770
17771
  const secrets = {};
17771
17772
  for (const line of content.split(`
17772
17773
  `)) {
@@ -17790,17 +17791,15 @@ async function loadSecrets() {
17790
17791
  }
17791
17792
  async function saveSecrets(secrets) {
17792
17793
  const secretsPath = getSecretsPath();
17793
- const dir = secretsPath.substring(0, secretsPath.lastIndexOf("/"));
17794
- await Bun.write(`${dir}/.keep`, "");
17794
+ const dir = dirname(secretsPath);
17795
+ await mkdir(dir, { recursive: true });
17795
17796
  const lines = ["# Temps CLI secrets - DO NOT SHARE THIS FILE"];
17796
17797
  for (const [key, value] of Object.entries(secrets)) {
17797
17798
  lines.push(`${key}="${value}"`);
17798
17799
  }
17799
- await Bun.write(secretsPath, lines.join(`
17800
+ await writeFile(secretsPath, lines.join(`
17800
17801
  `) + `
17801
- `);
17802
- const { chmod } = await import("node:fs/promises");
17803
- await chmod(secretsPath, 384);
17802
+ `, { mode: 384 });
17804
17803
  }
17805
17804
  var config = {
17806
17805
  get(key) {
@@ -19685,9 +19684,13 @@ async function loginWithApiKey(apiKey) {
19685
19684
  email: result.email
19686
19685
  });
19687
19686
  newline();
19688
- box(`Logged in as ${colors.bold(result.email)}
19689
- API: ${colors.muted(config.get("apiUrl"))}
19690
- Credentials stored in: ${colors.muted(credentials.path)}`, `${icons.sparkles} Welcome to Temps!`);
19687
+ const lines = [
19688
+ result.email ? `Logged in as ${colors.bold(result.email)}` : null,
19689
+ `API: ${colors.muted(config.get("apiUrl"))}`,
19690
+ `Credentials stored in: ${colors.muted(credentials.path)}`
19691
+ ].filter(Boolean).join(`
19692
+ `);
19693
+ box(lines, `${icons.sparkles} Welcome to Temps!`);
19691
19694
  } catch (err) {
19692
19695
  await credentials.clear();
19693
19696
  throw new AuthenticationError("Invalid API key");
@@ -21137,6 +21140,7 @@ async function listRepos(provider) {
21137
21140
  }
21138
21141
 
21139
21142
  // src/commands/backups/index.ts
21143
+ import { writeFile as writeFile2 } from "node:fs/promises";
21140
21144
  init_spinner();
21141
21145
  init_output();
21142
21146
  function registerBackupsCommands(program2) {
@@ -21276,7 +21280,7 @@ async function downloadBackup(backupId, options) {
21276
21280
  });
21277
21281
  if (response.data) {
21278
21282
  const buffer = Buffer.from(await response.data.arrayBuffer());
21279
- await Bun.write(outputPath, buffer);
21283
+ await writeFile2(outputPath, buffer);
21280
21284
  }
21281
21285
  });
21282
21286
  success(`Backup downloaded to ${outputPath}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temps-sdk/cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "CLI for Temps deployment platform",
5
5
  "type": "module",
6
6
  "bin": {