ramm 0.0.19 → 0.0.20
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/a.js +3 -0
- package/dist/ramm.js +35 -0
- package/dist/types/build.d.ts +7 -0
- package/dist/types/context.d.ts +1 -0
- package/dist/types/ramm.d.ts +1 -0
- package/package.json +4 -1
- package/dist/types/dist/ramm.d.ts +0 -30
- package/dist/types/src/base.d.ts +0 -15
- package/dist/types/src/context.d.ts +0 -15
- package/dist/types/src/debug.d.ts +0 -4
- package/dist/types/src/init.d.ts +0 -2
- package/dist/types/src/nft.d.ts +0 -2
- package/dist/types/src/packages.d.ts +0 -1
- package/dist/types/src/podman.d.ts +0 -6
- package/dist/types/src/ramm.d.ts +0 -10
- package/dist/types/src/ssh.d.ts +0 -2
- package/dist/types/src/systemd.d.ts +0 -6
package/dist/a.js
ADDED
package/dist/ramm.js
CHANGED
|
@@ -23,6 +23,7 @@ class Context {
|
|
|
23
23
|
userspace;
|
|
24
24
|
sudo;
|
|
25
25
|
sshKey;
|
|
26
|
+
params = {};
|
|
26
27
|
constructor({
|
|
27
28
|
name,
|
|
28
29
|
address,
|
|
@@ -375,6 +376,37 @@ var createCron = async ({
|
|
|
375
376
|
await execCommand(`crontab ${tempFile}`);
|
|
376
377
|
await execCommand(`rm ${tempFile}`);
|
|
377
378
|
};
|
|
379
|
+
// src/build.ts
|
|
380
|
+
var {build, file: file2 } = globalThis.Bun;
|
|
381
|
+
var buildAndRunOverSsh = async ({
|
|
382
|
+
entrypoint,
|
|
383
|
+
context
|
|
384
|
+
}) => {
|
|
385
|
+
const normalizedEntrypoint = normalizePath(entrypoint);
|
|
386
|
+
const distName = `ramm_dist`;
|
|
387
|
+
const distDir = `/tmp/${distName}`;
|
|
388
|
+
const outputs = await build({
|
|
389
|
+
outdir: distDir,
|
|
390
|
+
entrypoints: [normalizedEntrypoint],
|
|
391
|
+
target: "bun"
|
|
392
|
+
});
|
|
393
|
+
const pathToDistFile = outputs.outputs[0]?.path;
|
|
394
|
+
const relativePathToFile = pathToDistFile.slice(distDir.length + 1);
|
|
395
|
+
await copyFilesBySsh(`${distDir}/`, distDir, context);
|
|
396
|
+
await execBySsh(`bun run ${distDir}/${relativePathToFile}`, context);
|
|
397
|
+
await execCommand(`rm -rf ${distDir}`);
|
|
398
|
+
};
|
|
399
|
+
var passVarsClient = async (data, context) => {
|
|
400
|
+
const json = JSON.stringify(data);
|
|
401
|
+
await writeFile("/tmp/ramm_json", json);
|
|
402
|
+
await copyFilesBySsh("/tmp/ramm_json", "/tmp/ramm_json", context);
|
|
403
|
+
await execCommand("rm -rf /tmp/ramm_json");
|
|
404
|
+
};
|
|
405
|
+
var passVarsServer = async () => {
|
|
406
|
+
const jsonData = await file2("/tmp/ramm_json").json();
|
|
407
|
+
await execCommand("rm -rf /tmp/ramm_json");
|
|
408
|
+
return jsonData;
|
|
409
|
+
};
|
|
378
410
|
export {
|
|
379
411
|
writeIfNew,
|
|
380
412
|
writeFileIfNotMatch,
|
|
@@ -383,6 +415,8 @@ export {
|
|
|
383
415
|
runPodmanContainerService,
|
|
384
416
|
runPodmanContainer,
|
|
385
417
|
restartSystemdService,
|
|
418
|
+
passVarsServer,
|
|
419
|
+
passVarsClient,
|
|
386
420
|
normalizePath,
|
|
387
421
|
normalizeFileContent,
|
|
388
422
|
installSystemPackage,
|
|
@@ -395,6 +429,7 @@ export {
|
|
|
395
429
|
createCron,
|
|
396
430
|
createAndAddSshKey,
|
|
397
431
|
copyFilesBySsh,
|
|
432
|
+
buildAndRunOverSsh,
|
|
398
433
|
addNftPodmanRule,
|
|
399
434
|
addKeyToHostConfig,
|
|
400
435
|
Context
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Context } from "./context.ts";
|
|
2
|
+
export declare const buildAndRunOverSsh: ({ entrypoint, context, }: {
|
|
3
|
+
entrypoint: string;
|
|
4
|
+
context: Context;
|
|
5
|
+
}) => Promise<void>;
|
|
6
|
+
export declare const passVarsClient: (data: Record<string, any>, context: Context) => Promise<void>;
|
|
7
|
+
export declare const passVarsServer: () => Promise<any>;
|
package/dist/types/context.d.ts
CHANGED
package/dist/types/ramm.d.ts
CHANGED
|
@@ -11,3 +11,4 @@ export { writeIfNew, writeFile, writeFileIfNotMatch, normalizeFileContent, } fro
|
|
|
11
11
|
export { createAndAddSshKey, getServerFingerprintBySsh, addKeyToHostConfig, } from "./ssh.ts";
|
|
12
12
|
export { normalizePath } from "./path.ts";
|
|
13
13
|
export { createCron } from "./cron.ts";
|
|
14
|
+
export { buildAndRunOverSsh, passVarsClient, passVarsServer } from "./build.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.20",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "bun build ./src/ramm.ts --target bun --outdir ./dist && cp ./src/bun.sh ./dist/bun.sh && bun run types",
|
|
7
7
|
"types": "tsc --project tsconfig.types.json"
|
|
@@ -17,5 +17,8 @@
|
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/bun": "latest",
|
|
19
19
|
"typescript": "^5.8.2"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"desy": "^0.0.14"
|
|
20
23
|
}
|
|
21
24
|
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export function setupNftable(allowedIpSsh: any): Promise<void>;
|
|
2
|
-
export function runPodmanContainerService(name: any, command: any, context?: Context): Promise<void>;
|
|
3
|
-
export function runPodmanContainer(name: any, command: any): Promise<void>;
|
|
4
|
-
export function restartSystemdService(name: any, constext?: Context): Promise<void>;
|
|
5
|
-
export function installSystemPackage(packageName: any): Promise<void>;
|
|
6
|
-
export function installPodman(): Promise<void>;
|
|
7
|
-
export function installBun(context: any): Promise<void>;
|
|
8
|
-
export function execBySsh(command: any, context: any): Promise<{
|
|
9
|
-
output: string;
|
|
10
|
-
spawnResult: import("bun").Subprocess<"inherit", "pipe", "inherit">;
|
|
11
|
-
}>;
|
|
12
|
-
export function debugBlock(text: any): void;
|
|
13
|
-
export function createAndAddSshKey(pathToKey: any, comment: any, context: any): Promise<void>;
|
|
14
|
-
export function copyFilesBySsh(from: any, to: any, context: any): Promise<void>;
|
|
15
|
-
export function addNftPodmanRule(): Promise<void>;
|
|
16
|
-
export class Context {
|
|
17
|
-
constructor({ name, address, userspace, sudo, sshKey }: {
|
|
18
|
-
name: any;
|
|
19
|
-
address: any;
|
|
20
|
-
userspace?: boolean | undefined;
|
|
21
|
-
sudo?: boolean | undefined;
|
|
22
|
-
sshKey: any;
|
|
23
|
-
});
|
|
24
|
-
name: any;
|
|
25
|
-
domain: any;
|
|
26
|
-
userspace: boolean;
|
|
27
|
-
sudo: boolean;
|
|
28
|
-
sshKey: any;
|
|
29
|
-
getAddress(): string;
|
|
30
|
-
}
|
package/dist/types/src/base.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Context } from "./context.ts";
|
|
2
|
-
export declare const defaultContext: Context;
|
|
3
|
-
export declare const execCommand: (command: string) => Promise<{
|
|
4
|
-
output: string;
|
|
5
|
-
spawnResult: import("bun").Subprocess<"inherit", "pipe", "inherit">;
|
|
6
|
-
}>;
|
|
7
|
-
export declare const execCommandSilent: (command: string) => Promise<{
|
|
8
|
-
output: string;
|
|
9
|
-
spawnResult: import("bun").Subprocess<"ignore", "pipe", "inherit">;
|
|
10
|
-
}>;
|
|
11
|
-
export declare const copyFilesBySsh: (from: string, to: string, context: Context) => Promise<void>;
|
|
12
|
-
export declare const execBySsh: (command: string, context: Context) => Promise<{
|
|
13
|
-
output: string;
|
|
14
|
-
spawnResult: import("bun").Subprocess<"inherit", "pipe", "inherit">;
|
|
15
|
-
}>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare class Context {
|
|
2
|
-
name: string;
|
|
3
|
-
domain: string;
|
|
4
|
-
userspace: boolean;
|
|
5
|
-
sudo: boolean;
|
|
6
|
-
sshKey?: string;
|
|
7
|
-
constructor({ name, address, userspace, sudo, sshKey, }: {
|
|
8
|
-
name: string;
|
|
9
|
-
address: string;
|
|
10
|
-
userspace?: boolean;
|
|
11
|
-
sudo?: boolean;
|
|
12
|
-
sshKey?: string;
|
|
13
|
-
});
|
|
14
|
-
getAddress(): string;
|
|
15
|
-
}
|
package/dist/types/src/init.d.ts
DELETED
package/dist/types/src/nft.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const installSystemPackage: (packageName: string) => Promise<void>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Context } from "./context.ts";
|
|
2
|
-
export declare const installPodman: () => Promise<void>;
|
|
3
|
-
export declare const getCreateCommand: (name: string) => Promise<string>;
|
|
4
|
-
export declare const runPodmanContainer: (name: string, command: string) => Promise<void>;
|
|
5
|
-
export declare const runPodmanContainerService: (name: string, command: string, context?: Context) => Promise<void>;
|
|
6
|
-
export declare const addNftPodmanRule: () => Promise<void>;
|
package/dist/types/src/ramm.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { execBySsh, copyFilesBySsh } from "./base.ts";
|
|
2
|
-
export { Context } from "./context.ts";
|
|
3
|
-
export { installBun } from "./init.ts";
|
|
4
|
-
export { installPodman, runPodmanContainer } from "./podman.ts";
|
|
5
|
-
export { runPodmanContainerService, addNftPodmanRule } from "./podman.ts";
|
|
6
|
-
export { restartSystemdService } from "./systemd.ts";
|
|
7
|
-
export { installSystemPackage } from "./packages.ts";
|
|
8
|
-
export { debugBlock } from "./debug.ts";
|
|
9
|
-
export { setupNftable } from "./nft.ts";
|
|
10
|
-
export { createAndAddSshKey } from "./ssh.ts";
|
package/dist/types/src/ssh.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Context } from "./context.ts";
|
|
2
|
-
export declare const getSysyemdServiceName: (name: string) => string;
|
|
3
|
-
export declare const stopSystemdService: (constext: Context, name: string) => Promise<void>;
|
|
4
|
-
export declare const restartSystemdService: (name: string, constext?: Context) => Promise<void>;
|
|
5
|
-
export declare const checkSystemdService: (context: Context, serviceName: string) => Promise<boolean>;
|
|
6
|
-
export declare const createSystemdService: (context: Context, serviceName: string, pathToServiceFile: string) => Promise<void>;
|