ramm 0.0.31 → 0.0.33

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/ramm.js CHANGED
@@ -351,10 +351,15 @@ var addKeyToHostConfig = async (pathToHost, address, pathToKey) => {
351
351
  `;
352
352
  await writeIfNew(pathToHost, text);
353
353
  };
354
- var getServerFingerprintOverSsh = async (context) => {
354
+ var getServerFingerprint = async (context) => {
355
355
  const { stdout } = await execCommandOverSsh('ssh-keyscan -t ed25519 localhost | grep -v "^#"', context);
356
356
  return stdout.replace("localhost", context.domain);
357
357
  };
358
+ var saveSshFingerptint = async (filePath, context) => {
359
+ const normalizedPath = normalizePath(filePath);
360
+ const fingerprint = await getServerFingerprint(context);
361
+ await writeIfNewCompletely(filePath, normalizedPath);
362
+ };
358
363
  async function createSshKey(filePath, comment) {
359
364
  printFunction(`${createSshKey.name} ${filePath}`);
360
365
  const normalizedPathToKey = normalizePath(filePath);
@@ -458,11 +463,11 @@ var passVarsServer = async () => {
458
463
  return jsonData;
459
464
  };
460
465
  export {
466
+ writeIfNewCompletely,
461
467
  writeIfNew,
462
- writeIfNewCompletely as writeFileIfNotMatch,
463
468
  writeFile,
464
- addSshKeyToUse as setupSshKey,
465
469
  setupNftable,
470
+ saveSshFingerptint,
466
471
  runPodmanContainerService,
467
472
  runPodmanContainer,
468
473
  restartSystemdService,
@@ -475,7 +480,7 @@ export {
475
480
  installSystemPackage,
476
481
  installPodman,
477
482
  installBun,
478
- getServerFingerprintOverSsh,
483
+ getServerFingerprint,
479
484
  execCommandRaw,
480
485
  execCommandOverSsh,
481
486
  execCommandMayError,
@@ -484,6 +489,7 @@ export {
484
489
  createAndAddSshKey,
485
490
  copyFilesBySsh,
486
491
  buildAndRunOverSsh,
492
+ addSshKeyToUse,
487
493
  addNftPodmanRule,
488
494
  addKeyToHostConfig,
489
495
  Context
@@ -7,8 +7,8 @@ export { restartSystemdService } from "./systemd.ts";
7
7
  export { installSystemPackage } from "./packages.ts";
8
8
  export { printBlock } from "./print.ts";
9
9
  export { setupNftable } from "./nft.ts";
10
- export { writeIfNew, writeFile, writeIfNewCompletely as writeFileIfNotMatch, normalizeFileContent, } from "./files.ts";
11
- export { createAndAddSshKey, getServerFingerprintOverSsh, addKeyToHostConfig, addSshKeyToUse as setupSshKey, } from "./ssh.ts";
10
+ export { writeIfNew, writeFile, writeIfNewCompletely, normalizeFileContent, } from "./files.ts";
11
+ export { createAndAddSshKey, getServerFingerprint, addKeyToHostConfig, addSshKeyToUse, saveSshFingerptint, } from "./ssh.ts";
12
12
  export { normalizePath } from "./path.ts";
13
13
  export { createCron } from "./cron.ts";
14
14
  export { buildAndRunOverSsh, passVarsClient, passVarsServer } from "./build.ts";
@@ -1,6 +1,7 @@
1
1
  import type { Context } from "./context.ts";
2
2
  export declare const addKeyToHostConfig: (pathToHost: string, address: string, pathToKey: string) => Promise<void>;
3
- export declare const getServerFingerprintOverSsh: (context: Context) => Promise<string>;
3
+ export declare const getServerFingerprint: (context: Context) => Promise<string>;
4
+ export declare const saveSshFingerptint: (filePath: string, context: Context) => Promise<void>;
4
5
  export declare const createAndAddSshKey: (filePath: string, comment: string, context: Context) => Promise<void>;
5
6
  export declare const addSshKeyToUse: ({ key, fingerprint, filePath, server, }: {
6
7
  key: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ramm",
3
3
  "type": "module",
4
- "version": "0.0.31",
4
+ "version": "0.0.33",
5
5
  "scripts": {
6
6
  "build": "bun build ./src/ramm.ts --target bun --outdir ./dist && cp ./src/bun.sh ./dist/bun.sh",
7
7
  "types": "tsc --project tsconfig.types.json"