vyft 0.4.0-alpha → 0.4.2-alpha
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/LICENSE +191 -21
- package/README.md +3 -49
- package/dist/commands/context/add.d.ts +4 -0
- package/dist/commands/context/add.d.ts.map +1 -0
- package/dist/commands/context/add.js +98 -0
- package/dist/commands/context/add.js.map +1 -0
- package/dist/commands/context/index.d.ts +4 -0
- package/dist/commands/context/index.d.ts.map +1 -0
- package/dist/commands/context/index.js +12 -0
- package/dist/commands/context/index.js.map +1 -0
- package/dist/commands/context/list.d.ts +4 -0
- package/dist/commands/context/list.d.ts.map +1 -0
- package/dist/commands/context/list.js +25 -0
- package/dist/commands/context/list.js.map +1 -0
- package/dist/commands/context/remove.d.ts +4 -0
- package/dist/commands/context/remove.d.ts.map +1 -0
- package/dist/commands/context/remove.js +36 -0
- package/dist/commands/context/remove.js.map +1 -0
- package/dist/commands/context/use.d.ts +4 -0
- package/dist/commands/context/use.d.ts.map +1 -0
- package/dist/commands/context/use.js +32 -0
- package/dist/commands/context/use.js.map +1 -0
- package/dist/commands/deploy.d.ts +4 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +55 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/destroy.d.ts +4 -0
- package/dist/commands/destroy.d.ts.map +1 -0
- package/dist/commands/destroy.js +70 -0
- package/dist/commands/destroy.js.map +1 -0
- package/dist/commands/diff.d.ts +4 -0
- package/dist/commands/diff.d.ts.map +1 -0
- package/dist/commands/diff.js +52 -0
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/init.d.ts +4 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +92 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/local/detect.d.ts +7 -0
- package/dist/commands/local/detect.d.ts.map +1 -0
- package/dist/commands/local/detect.js +146 -0
- package/dist/commands/local/detect.js.map +1 -0
- package/dist/commands/local/dev.d.ts +4 -0
- package/dist/commands/local/dev.d.ts.map +1 -0
- package/dist/commands/local/dev.js +387 -0
- package/dist/commands/local/dev.js.map +1 -0
- package/dist/commands/local/down.d.ts +4 -0
- package/dist/commands/local/down.d.ts.map +1 -0
- package/dist/commands/local/down.js +61 -0
- package/dist/commands/local/down.js.map +1 -0
- package/dist/commands/local/index.d.ts +4 -0
- package/dist/commands/local/index.d.ts.map +1 -0
- package/dist/commands/local/index.js +12 -0
- package/dist/commands/local/index.js.map +1 -0
- package/dist/commands/local/reset.d.ts +4 -0
- package/dist/commands/local/reset.d.ts.map +1 -0
- package/dist/commands/local/reset.js +67 -0
- package/dist/commands/local/reset.js.map +1 -0
- package/dist/commands/local/up.d.ts +4 -0
- package/dist/commands/local/up.d.ts.map +1 -0
- package/dist/commands/local/up.js +58 -0
- package/dist/commands/local/up.js.map +1 -0
- package/dist/commands/refresh.d.ts +4 -0
- package/dist/commands/refresh.d.ts.map +1 -0
- package/dist/commands/refresh.js +39 -0
- package/dist/commands/refresh.js.map +1 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +65 -0
- package/dist/config.js.map +1 -0
- package/dist/contexts.d.ts +21 -0
- package/dist/contexts.d.ts.map +1 -0
- package/dist/contexts.js +72 -0
- package/dist/contexts.js.map +1 -0
- package/dist/index.d.ts +2 -9
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -7
- package/dist/index.js.map +1 -0
- package/dist/lib.d.ts +7 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js +6 -0
- package/dist/lib.js.map +1 -0
- package/dist/providers.d.ts +9 -0
- package/dist/providers.d.ts.map +1 -0
- package/dist/providers.js +41 -0
- package/dist/providers.js.map +1 -0
- package/dist/runtime.d.ts +18 -15
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +154 -0
- package/dist/runtime.js.map +1 -0
- package/dist/runtime.test.d.ts +2 -0
- package/dist/runtime.test.d.ts.map +1 -0
- package/dist/runtime.test.js +119 -0
- package/dist/runtime.test.js.map +1 -0
- package/dist/utils/fs.d.ts +4 -0
- package/dist/utils/fs.d.ts.map +1 -0
- package/dist/utils/fs.js +33 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/pm.d.ts +3 -0
- package/dist/utils/pm.d.ts.map +1 -0
- package/dist/utils/pm.js +17 -0
- package/dist/utils/pm.js.map +1 -0
- package/dist/utils/prompts.d.ts +2 -0
- package/dist/utils/prompts.d.ts.map +1 -0
- package/dist/utils/prompts.js +6 -0
- package/dist/utils/prompts.js.map +1 -0
- package/dist/utils/templates.d.ts +3 -0
- package/dist/utils/templates.d.ts.map +1 -0
- package/dist/utils/templates.js +48 -0
- package/dist/utils/templates.js.map +1 -0
- package/package.json +31 -48
- package/templates/bun/index.ts +8 -0
- package/templates/bun/package.json +15 -0
- package/templates/bun/tsconfig.json +15 -0
- package/templates/bun/vyft.config.ts +3 -0
- package/dist/build.d.ts +0 -12
- package/dist/build.js +0 -44
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +0 -842
- package/dist/context.d.ts +0 -39
- package/dist/context.js +0 -101
- package/dist/docker.d.ts +0 -69
- package/dist/docker.js +0 -958
- package/dist/exec.d.ts +0 -2
- package/dist/exec.js +0 -28
- package/dist/init.d.ts +0 -1
- package/dist/init.js +0 -117
- package/dist/interpolate.d.ts +0 -13
- package/dist/interpolate.js +0 -19
- package/dist/local/dev.d.ts +0 -31
- package/dist/local/dev.js +0 -109
- package/dist/local/index.d.ts +0 -2
- package/dist/local/index.js +0 -2
- package/dist/local/runtime.d.ts +0 -61
- package/dist/local/runtime.js +0 -391
- package/dist/logger.d.ts +0 -2
- package/dist/logger.js +0 -10
- package/dist/proxy.d.ts +0 -16
- package/dist/proxy.js +0 -0
- package/dist/resource.d.ts +0 -181
- package/dist/resource.js +0 -45
- package/dist/services/index.d.ts +0 -26
- package/dist/services/index.js +0 -35
- package/dist/services/minio.d.ts +0 -36
- package/dist/services/minio.js +0 -53
- package/dist/services/mongo.d.ts +0 -28
- package/dist/services/mongo.js +0 -45
- package/dist/services/mysql.d.ts +0 -28
- package/dist/services/mysql.js +0 -44
- package/dist/services/nats.d.ts +0 -26
- package/dist/services/nats.js +0 -38
- package/dist/services/postgres.d.ts +0 -28
- package/dist/services/postgres.js +0 -45
- package/dist/services/rabbitmq.d.ts +0 -28
- package/dist/services/rabbitmq.js +0 -44
- package/dist/services/redis.d.ts +0 -28
- package/dist/services/redis.js +0 -49
- package/dist/services/storage.d.ts +0 -39
- package/dist/services/storage.js +0 -94
- package/dist/swarm/factories.d.ts +0 -16
- package/dist/swarm/factories.js +0 -63
- package/dist/swarm/index.d.ts +0 -20
- package/dist/swarm/index.js +0 -5
- package/dist/swarm/proxy.d.ts +0 -24
- package/dist/swarm/proxy.js +0 -339
- package/dist/swarm/types.d.ts +0 -26
- package/dist/swarm/types.js +0 -0
- package/dist/symbols.d.ts +0 -15
- package/dist/symbols.js +0 -4
- package/templates/fullstack/apps/api/Dockerfile +0 -22
- package/templates/fullstack/apps/api/package.json +0 -26
- package/templates/fullstack/apps/api/src/auth.ts +0 -21
- package/templates/fullstack/apps/api/src/db.ts +0 -16
- package/templates/fullstack/apps/api/src/index.ts +0 -17
- package/templates/fullstack/apps/api/src/router.ts +0 -11
- package/templates/fullstack/apps/api/src/schema.ts +0 -11
- package/templates/fullstack/apps/api/tsconfig.json +0 -8
- package/templates/fullstack/apps/web/index.html +0 -12
- package/templates/fullstack/apps/web/package.json +0 -21
- package/templates/fullstack/apps/web/src/app.tsx +0 -8
- package/templates/fullstack/apps/web/src/main.tsx +0 -9
- package/templates/fullstack/apps/web/tsconfig.json +0 -7
- package/templates/fullstack/apps/web/vite.config.ts +0 -14
- package/templates/fullstack/dockerignore +0 -7
- package/templates/fullstack/gitignore +0 -3
- package/templates/fullstack/package.json +0 -14
- package/templates/fullstack/pnpm-workspace.yaml +0 -2
- package/templates/fullstack/tsconfig.json +0 -11
- package/templates/fullstack/vyft.config.ts +0 -22
package/dist/context.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/** A named deployment target storing a host endpoint and runtime backend. */
|
|
2
|
-
export interface VyftContext {
|
|
3
|
-
/** Unique context name (e.g. `"prod"`, `"staging"`). */
|
|
4
|
-
name: string;
|
|
5
|
-
/** Docker endpoint (e.g. `"ssh://root@1.2.3.4"`). `undefined` means local socket. */
|
|
6
|
-
host?: string;
|
|
7
|
-
/** Runtime backend. Currently only `"swarm"`. */
|
|
8
|
-
runtime: string;
|
|
9
|
-
/** Optional human-readable description. */
|
|
10
|
-
description?: string;
|
|
11
|
-
}
|
|
12
|
-
/** Returns the vyft config directory, creating it if necessary. Respects `$XDG_CONFIG_HOME`. */
|
|
13
|
-
export declare function configDir(): string;
|
|
14
|
-
/** Load a context by name. Returns `undefined` if no matching file exists. */
|
|
15
|
-
export declare function getContext(name: string): VyftContext | undefined;
|
|
16
|
-
/** List all explicitly created contexts. */
|
|
17
|
-
export declare function listContexts(): VyftContext[];
|
|
18
|
-
/**
|
|
19
|
-
* Persist a context to disk.
|
|
20
|
-
*/
|
|
21
|
-
export declare function saveContext(ctx: VyftContext): void;
|
|
22
|
-
/**
|
|
23
|
-
* Delete a context from disk.
|
|
24
|
-
* @throws If the context is currently active or doesn't exist.
|
|
25
|
-
*/
|
|
26
|
-
export declare function removeContext(name: string): void;
|
|
27
|
-
/** Read the active context name from `config.json`. Returns `undefined` when no context is set. */
|
|
28
|
-
export declare function getCurrentContextName(): string | undefined;
|
|
29
|
-
/**
|
|
30
|
-
* Set the active context.
|
|
31
|
-
* @throws If the named context doesn't exist.
|
|
32
|
-
*/
|
|
33
|
-
export declare function setCurrentContext(name: string): void;
|
|
34
|
-
/**
|
|
35
|
-
* Resolve a context by name. If no override is given, uses the current active context.
|
|
36
|
-
* Returns `undefined` when no context is configured and no override is provided.
|
|
37
|
-
* @throws If a named context doesn't exist.
|
|
38
|
-
*/
|
|
39
|
-
export declare function resolveContext(override?: string): VyftContext | undefined;
|
package/dist/context.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync, } from "node:fs";
|
|
2
|
-
import os from "node:os";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
/** Returns the vyft config directory, creating it if necessary. Respects `$XDG_CONFIG_HOME`. */
|
|
5
|
-
export function configDir() {
|
|
6
|
-
const xdg = process.env.XDG_CONFIG_HOME;
|
|
7
|
-
const dir = xdg
|
|
8
|
-
? path.join(xdg, "vyft")
|
|
9
|
-
: path.join(os.homedir(), ".config", "vyft");
|
|
10
|
-
mkdirSync(path.join(dir, "contexts"), { recursive: true });
|
|
11
|
-
return dir;
|
|
12
|
-
}
|
|
13
|
-
/** Load a context by name. Returns `undefined` if no matching file exists. */
|
|
14
|
-
export function getContext(name) {
|
|
15
|
-
const file = path.join(configDir(), "contexts", `${name}.json`);
|
|
16
|
-
if (!existsSync(file))
|
|
17
|
-
return undefined;
|
|
18
|
-
return JSON.parse(readFileSync(file, "utf-8"));
|
|
19
|
-
}
|
|
20
|
-
/** List all explicitly created contexts. */
|
|
21
|
-
export function listContexts() {
|
|
22
|
-
const dir = configDir();
|
|
23
|
-
const contextsDir = path.join(dir, "contexts");
|
|
24
|
-
const results = [];
|
|
25
|
-
if (!existsSync(contextsDir))
|
|
26
|
-
return results;
|
|
27
|
-
for (const file of readdirSync(contextsDir)) {
|
|
28
|
-
if (!file.endsWith(".json"))
|
|
29
|
-
continue;
|
|
30
|
-
try {
|
|
31
|
-
const ctx = JSON.parse(readFileSync(path.join(contextsDir, file), "utf-8"));
|
|
32
|
-
results.push(ctx);
|
|
33
|
-
}
|
|
34
|
-
catch {
|
|
35
|
-
// skip malformed files
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return results;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Persist a context to disk.
|
|
42
|
-
*/
|
|
43
|
-
export function saveContext(ctx) {
|
|
44
|
-
const file = path.join(configDir(), "contexts", `${ctx.name}.json`);
|
|
45
|
-
writeFileSync(file, `${JSON.stringify(ctx, null, 2)}\n`);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Delete a context from disk.
|
|
49
|
-
* @throws If the context is currently active or doesn't exist.
|
|
50
|
-
*/
|
|
51
|
-
export function removeContext(name) {
|
|
52
|
-
const current = getCurrentContextName();
|
|
53
|
-
if (name === current) {
|
|
54
|
-
throw new Error(`Cannot remove "${name}" because it is the active context. Switch first with: vyft context use <other>`);
|
|
55
|
-
}
|
|
56
|
-
const file = path.join(configDir(), "contexts", `${name}.json`);
|
|
57
|
-
if (!existsSync(file)) {
|
|
58
|
-
throw new Error(`Context "${name}" does not exist`);
|
|
59
|
-
}
|
|
60
|
-
rmSync(file);
|
|
61
|
-
}
|
|
62
|
-
/** Read the active context name from `config.json`. Returns `undefined` when no context is set. */
|
|
63
|
-
export function getCurrentContextName() {
|
|
64
|
-
const file = path.join(configDir(), "config.json");
|
|
65
|
-
if (!existsSync(file))
|
|
66
|
-
return undefined;
|
|
67
|
-
try {
|
|
68
|
-
const config = JSON.parse(readFileSync(file, "utf-8"));
|
|
69
|
-
return config.currentContext;
|
|
70
|
-
}
|
|
71
|
-
catch {
|
|
72
|
-
return undefined;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Set the active context.
|
|
77
|
-
* @throws If the named context doesn't exist.
|
|
78
|
-
*/
|
|
79
|
-
export function setCurrentContext(name) {
|
|
80
|
-
const ctx = getContext(name);
|
|
81
|
-
if (!ctx)
|
|
82
|
-
throw new Error(`Context "${name}" does not exist`);
|
|
83
|
-
const file = path.join(configDir(), "config.json");
|
|
84
|
-
const config = { currentContext: name };
|
|
85
|
-
writeFileSync(file, `${JSON.stringify(config, null, 2)}\n`);
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Resolve a context by name. If no override is given, uses the current active context.
|
|
89
|
-
* Returns `undefined` when no context is configured and no override is provided.
|
|
90
|
-
* @throws If a named context doesn't exist.
|
|
91
|
-
*/
|
|
92
|
-
export function resolveContext(override) {
|
|
93
|
-
const name = override ?? getCurrentContextName();
|
|
94
|
-
if (!name)
|
|
95
|
-
return undefined;
|
|
96
|
-
const ctx = getContext(name);
|
|
97
|
-
if (!ctx) {
|
|
98
|
-
throw new Error(`Context "${name}" not found`);
|
|
99
|
-
}
|
|
100
|
-
return ctx;
|
|
101
|
-
}
|
package/dist/docker.d.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import type { Logger } from "pino";
|
|
2
|
-
import type { ReverseProxy } from "./proxy.js";
|
|
3
|
-
import type { Resource, ResourceType, Service } from "./resource.js";
|
|
4
|
-
import type { CreateResult, Runtime } from "./runtime.js";
|
|
5
|
-
export declare function parseRoute(route: string): {
|
|
6
|
-
host: string;
|
|
7
|
-
path?: string;
|
|
8
|
-
};
|
|
9
|
-
export interface ManagedResource {
|
|
10
|
-
id: string;
|
|
11
|
-
type: ResourceType;
|
|
12
|
-
route?: string;
|
|
13
|
-
derived?: boolean;
|
|
14
|
-
parentService?: string;
|
|
15
|
-
}
|
|
16
|
-
export declare class DockerClient implements Runtime {
|
|
17
|
-
private docker;
|
|
18
|
-
private localDocker;
|
|
19
|
-
private isRemote;
|
|
20
|
-
private sshClient;
|
|
21
|
-
private project;
|
|
22
|
-
private secretValues;
|
|
23
|
-
private builtImages;
|
|
24
|
-
private log;
|
|
25
|
-
proxy: ReverseProxy;
|
|
26
|
-
verbose: boolean;
|
|
27
|
-
constructor(project: string, opts?: {
|
|
28
|
-
host?: string;
|
|
29
|
-
parentLogger?: Logger;
|
|
30
|
-
});
|
|
31
|
-
/** Close the SSH connection (if any), allowing the process to exit. */
|
|
32
|
-
destroy(): void;
|
|
33
|
-
private ensureNetwork;
|
|
34
|
-
ensureInfrastructure(): Promise<void>;
|
|
35
|
-
listManagedResources(): Promise<ManagedResource[]>;
|
|
36
|
-
create(resource: Resource, options?: {
|
|
37
|
-
silent?: boolean;
|
|
38
|
-
}): Promise<CreateResult>;
|
|
39
|
-
exists(resource: Resource): Promise<boolean>;
|
|
40
|
-
remove(resource: Resource): Promise<void>;
|
|
41
|
-
private createVolume;
|
|
42
|
-
private volumeExists;
|
|
43
|
-
private removeVolume;
|
|
44
|
-
private createSecret;
|
|
45
|
-
private secretExists;
|
|
46
|
-
private removeSecret;
|
|
47
|
-
private storeSecretData;
|
|
48
|
-
private lookupSecretId;
|
|
49
|
-
private createDerivedSecret;
|
|
50
|
-
private resolveEnv;
|
|
51
|
-
buildImage(service: Service): Promise<string | null>;
|
|
52
|
-
private createService;
|
|
53
|
-
private serviceExists;
|
|
54
|
-
waitForHealthy(id: string, timeoutMs?: number): Promise<void>;
|
|
55
|
-
private removeService;
|
|
56
|
-
private pullImage;
|
|
57
|
-
private createStatic;
|
|
58
|
-
private removeStatic;
|
|
59
|
-
serviceLogs(options: {
|
|
60
|
-
follow?: boolean;
|
|
61
|
-
tail?: number;
|
|
62
|
-
services?: string[];
|
|
63
|
-
}): AsyncGenerator<{
|
|
64
|
-
service: string;
|
|
65
|
-
stream: "stdout" | "stderr";
|
|
66
|
-
text: string;
|
|
67
|
-
}>;
|
|
68
|
-
removeProjectNetwork(): Promise<void>;
|
|
69
|
-
}
|