ramm 0.0.8 → 0.0.10
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 +18 -3
- package/dist/types/files.d.ts +1 -1
- package/dist/types/path.d.ts +1 -0
- package/dist/types/ramm.d.ts +1 -0
- package/dist/types/ssh.d.ts +1 -1
- package/package.json +1 -1
package/dist/ramm.js
CHANGED
|
@@ -218,6 +218,19 @@ var addNftPodmanRule = async () => {
|
|
|
218
218
|
};
|
|
219
219
|
// src/files.ts
|
|
220
220
|
import { appendFile, exists } from "fs/promises";
|
|
221
|
+
|
|
222
|
+
// src/path.ts
|
|
223
|
+
import { homedir } from "os";
|
|
224
|
+
import { join } from "path";
|
|
225
|
+
function normalizePath(rawFilePath) {
|
|
226
|
+
let finalFilePath = rawFilePath.trim();
|
|
227
|
+
if (finalFilePath.startsWith("~/")) {
|
|
228
|
+
finalFilePath = join(homedir(), finalFilePath.slice(2));
|
|
229
|
+
}
|
|
230
|
+
return finalFilePath;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// src/files.ts
|
|
221
234
|
var finalizeWithNewline = (str) => {
|
|
222
235
|
if (str.at(-1) !== `
|
|
223
236
|
`) {
|
|
@@ -245,7 +258,8 @@ var checkStrInFile = async (filePath, str) => {
|
|
|
245
258
|
}
|
|
246
259
|
return false;
|
|
247
260
|
};
|
|
248
|
-
var writeIfNew = async (
|
|
261
|
+
var writeIfNew = async (rawFilePath, str) => {
|
|
262
|
+
const filePath = normalizePath(rawFilePath);
|
|
249
263
|
await createDir(filePath);
|
|
250
264
|
if (await checkStrInFile(filePath, str)) {
|
|
251
265
|
return;
|
|
@@ -257,11 +271,11 @@ var writeIfNew = async (filePath, str) => {
|
|
|
257
271
|
};
|
|
258
272
|
// src/ssh.ts
|
|
259
273
|
import { debug } from "console";
|
|
260
|
-
var addKeyToHostConfig = async (address, pathToKey) => {
|
|
274
|
+
var addKeyToHostConfig = async (pathToHost, address, pathToKey) => {
|
|
261
275
|
const text = `Host ${address}
|
|
262
276
|
IdentityFile ${pathToKey}
|
|
263
277
|
`;
|
|
264
|
-
await writeIfNew(
|
|
278
|
+
await writeIfNew(pathToHost, text);
|
|
265
279
|
};
|
|
266
280
|
var getServerFingerprintBySsh = async (context) => {
|
|
267
281
|
const { output } = await execBySsh('ssh-keyscan -t ed25519 localhost | grep -v "^#"', context);
|
|
@@ -300,6 +314,7 @@ export {
|
|
|
300
314
|
runPodmanContainerService,
|
|
301
315
|
runPodmanContainer,
|
|
302
316
|
restartSystemdService,
|
|
317
|
+
normalizePath,
|
|
303
318
|
installSystemPackage,
|
|
304
319
|
installPodman,
|
|
305
320
|
installBun,
|
package/dist/types/files.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const writeIfNew: (
|
|
1
|
+
export declare const writeIfNew: (rawFilePath: string, str: string) => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function normalizePath(rawFilePath: string): string;
|
package/dist/types/ramm.d.ts
CHANGED
package/dist/types/ssh.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Context } from "./context.ts";
|
|
2
|
-
export declare const addKeyToHostConfig: (address: string, pathToKey: string) => Promise<void>;
|
|
2
|
+
export declare const addKeyToHostConfig: (pathToHost: string, address: string, pathToKey: string) => Promise<void>;
|
|
3
3
|
export declare const getServerFingerprintBySsh: (context: Context) => Promise<string>;
|
|
4
4
|
export declare const createAndAddSshKey: (pathToKey: string, comment: string, context: Context) => Promise<void>;
|
package/package.json
CHANGED