ramm 0.0.35 → 0.0.37
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 +8 -8
- package/dist/types/files.d.ts +2 -2
- package/dist/types/ramm.d.ts +1 -1
- package/package.json +3 -6
package/dist/ramm.js
CHANGED
|
@@ -335,7 +335,7 @@ var createFileIfNeed = async (rawFilePath) => {
|
|
|
335
335
|
await execCommand(`touch ${filePath}`);
|
|
336
336
|
}
|
|
337
337
|
};
|
|
338
|
-
var
|
|
338
|
+
var writeIfNewStr = async (rawFilePath, str) => {
|
|
339
339
|
const filePath = normalizePath(rawFilePath);
|
|
340
340
|
await createFileIfNeed(filePath);
|
|
341
341
|
if (await checkStrInFile(filePath, str)) {
|
|
@@ -348,7 +348,7 @@ var writeFile = async (pathToFile, str) => {
|
|
|
348
348
|
await createFileIfNeed(normalizedPath);
|
|
349
349
|
await write(normalizedPath, str);
|
|
350
350
|
};
|
|
351
|
-
var
|
|
351
|
+
var writeFileFull = async (pathToFile, str) => {
|
|
352
352
|
const normalizedPath = normalizePath(pathToFile);
|
|
353
353
|
await createFileIfNeed(normalizedPath);
|
|
354
354
|
const fileText = await file(normalizedPath).text();
|
|
@@ -363,7 +363,7 @@ var addKeyToHostConfig = async (pathToHost, address, pathToKey) => {
|
|
|
363
363
|
const text = `Host ${address}
|
|
364
364
|
IdentityFile ${pathToKey}
|
|
365
365
|
`;
|
|
366
|
-
await
|
|
366
|
+
await writeIfNewStr(pathToHost, text);
|
|
367
367
|
};
|
|
368
368
|
var getServerFingerprint = async (context) => {
|
|
369
369
|
const { stdout } = await execCommandOverSsh('ssh-keyscan -t ed25519 localhost | grep -v "^#"', context);
|
|
@@ -372,7 +372,7 @@ var getServerFingerprint = async (context) => {
|
|
|
372
372
|
var saveSshFingerptint = async (filePath, context) => {
|
|
373
373
|
const normalizedPath = normalizePath(filePath);
|
|
374
374
|
const fingerprint = await getServerFingerprint(context);
|
|
375
|
-
await
|
|
375
|
+
await writeFileFull(filePath, normalizedPath);
|
|
376
376
|
};
|
|
377
377
|
async function createSshKey(filePath, comment) {
|
|
378
378
|
printFunction(`${createSshKey.name} ${filePath}`);
|
|
@@ -413,9 +413,9 @@ var addSshKeyToUse = async ({
|
|
|
413
413
|
}) => {
|
|
414
414
|
printFunction(`${addSshKeyToUse.name} ${filePath}`);
|
|
415
415
|
const normalizedFilePath = normalizePath(filePath);
|
|
416
|
-
await
|
|
416
|
+
await writeFileFull(normalizedFilePath, key);
|
|
417
417
|
await execCommand(`chmod 0600 ${normalizedFilePath}`);
|
|
418
|
-
await
|
|
418
|
+
await writeIfNewStr("~/.ssh/known_hosts", fingerprint);
|
|
419
419
|
await addKeyToHostConfig("~/.ssh/config", server, normalizedFilePath);
|
|
420
420
|
};
|
|
421
421
|
// src/cron.ts
|
|
@@ -477,8 +477,8 @@ var passVarsServer = async () => {
|
|
|
477
477
|
return jsonData;
|
|
478
478
|
};
|
|
479
479
|
export {
|
|
480
|
-
|
|
481
|
-
|
|
480
|
+
writeIfNewStr,
|
|
481
|
+
writeFileFull,
|
|
482
482
|
writeFile,
|
|
483
483
|
setupNftable,
|
|
484
484
|
saveSshFingerptint,
|
package/dist/types/files.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const normalizeFileContent: (str: string) => string;
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const writeIfNewStr: (rawFilePath: string, str: string) => Promise<void>;
|
|
3
3
|
export declare const writeFile: (pathToFile: string, str: string) => Promise<void>;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const writeFileFull: (pathToFile: string, str: string) => Promise<void>;
|
package/dist/types/ramm.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ 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 {
|
|
10
|
+
export { writeIfNewStr, writeFile, writeFileFull, normalizeFileContent, } from "./files.ts";
|
|
11
11
|
export { createAndAddSshKey, getServerFingerprint, addKeyToHostConfig, addSshKeyToUse, saveSshFingerptint, } from "./ssh.ts";
|
|
12
12
|
export { normalizePath } from "./path.ts";
|
|
13
13
|
export { createCron } from "./cron.ts";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ramm",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.37",
|
|
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"
|
|
@@ -16,10 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/bun": "latest",
|
|
19
|
-
"typescript": "^5.8.2"
|
|
20
|
-
|
|
21
|
-
"dependencies": {
|
|
22
|
-
"dapes": "^0.0.26",
|
|
23
|
-
"desy": "^0.0.14"
|
|
19
|
+
"typescript": "^5.8.2",
|
|
20
|
+
"dapes": "^0.0.26"
|
|
24
21
|
}
|
|
25
22
|
}
|