dev-env-kit 0.1.3
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/.dev-env.example.yml +71 -0
- package/LICENSE +21 -0
- package/README.md +128 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +176 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/commands/generate.d.ts +5 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +62 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/setup.d.ts +7 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +123 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/share.d.ts +11 -0
- package/dist/commands/share.d.ts.map +1 -0
- package/dist/commands/share.js +113 -0
- package/dist/commands/share.js.map +1 -0
- package/dist/commands/snapshot.d.ts +4 -0
- package/dist/commands/snapshot.d.ts.map +1 -0
- package/dist/commands/snapshot.js +75 -0
- package/dist/commands/snapshot.js.map +1 -0
- package/dist/core/config/loader.d.ts +10 -0
- package/dist/core/config/loader.d.ts.map +1 -0
- package/dist/core/config/loader.js +137 -0
- package/dist/core/config/loader.js.map +1 -0
- package/dist/core/config/validator.d.ts +10 -0
- package/dist/core/config/validator.d.ts.map +1 -0
- package/dist/core/config/validator.js +63 -0
- package/dist/core/config/validator.js.map +1 -0
- package/dist/core/docker/compose-generator.d.ts +10 -0
- package/dist/core/docker/compose-generator.d.ts.map +1 -0
- package/dist/core/docker/compose-generator.js +133 -0
- package/dist/core/docker/compose-generator.js.map +1 -0
- package/dist/core/snapshot/storage.d.ts +13 -0
- package/dist/core/snapshot/storage.d.ts.map +1 -0
- package/dist/core/snapshot/storage.js +99 -0
- package/dist/core/snapshot/storage.js.map +1 -0
- package/dist/types/config.d.ts +378 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +61 -0
- package/dist/types/config.js.map +1 -0
- package/dist/utils/exec.d.ts +11 -0
- package/dist/utils/exec.d.ts.map +1 -0
- package/dist/utils/exec.js +63 -0
- package/dist/utils/exec.js.map +1 -0
- package/dist/utils/file-ops.d.ts +10 -0
- package/dist/utils/file-ops.d.ts.map +1 -0
- package/dist/utils/file-ops.js +150 -0
- package/dist/utils/file-ops.js.map +1 -0
- package/dist/utils/load-execa.js +4 -0
- package/dist/utils/logger.d.ts +21 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +94 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/platform.d.ts +12 -0
- package/dist/utils/platform.d.ts.map +1 -0
- package/dist/utils/platform.js +103 -0
- package/dist/utils/platform.js.map +1 -0
- package/package.json +72 -0
- package/templates/docker-compose.hbs +31 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.SNAPSHOT_CONFIG_FILENAME = exports.SNAPSHOTS_SUBDIR = exports.SNAPSHOT_DIR_NAME = void 0;
|
|
37
|
+
exports.sanitizeSnapshotName = sanitizeSnapshotName;
|
|
38
|
+
exports.getSnapshotDir = getSnapshotDir;
|
|
39
|
+
exports.createSnapshot = createSnapshot;
|
|
40
|
+
exports.listSnapshots = listSnapshots;
|
|
41
|
+
exports.getSnapshotConfig = getSnapshotConfig;
|
|
42
|
+
const path = __importStar(require("path"));
|
|
43
|
+
const fs = __importStar(require("fs-extra"));
|
|
44
|
+
const file_ops_1 = require("../../utils/file-ops");
|
|
45
|
+
exports.SNAPSHOT_DIR_NAME = '.devkit';
|
|
46
|
+
exports.SNAPSHOTS_SUBDIR = 'snapshots';
|
|
47
|
+
exports.SNAPSHOT_CONFIG_FILENAME = 'dev-env.yml';
|
|
48
|
+
function sanitizeSnapshotName(name) {
|
|
49
|
+
return name.replace(/[^a-zA-Z0-9_-]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '') || 'snapshot';
|
|
50
|
+
}
|
|
51
|
+
function getSnapshotDir(projectRoot) {
|
|
52
|
+
return path.join(projectRoot, exports.SNAPSHOT_DIR_NAME, exports.SNAPSHOTS_SUBDIR);
|
|
53
|
+
}
|
|
54
|
+
async function createSnapshot(projectRoot, name, configYaml) {
|
|
55
|
+
const safeName = sanitizeSnapshotName(name) || 'snapshot';
|
|
56
|
+
const snapshotDir = getSnapshotDir(projectRoot);
|
|
57
|
+
const snapshotPath = path.join(snapshotDir, safeName);
|
|
58
|
+
await (0, file_ops_1.ensureDir)(snapshotPath);
|
|
59
|
+
const createdAt = new Date().toISOString();
|
|
60
|
+
const meta = { name: safeName, createdAt };
|
|
61
|
+
await (0, file_ops_1.writeJson)(path.join(snapshotPath, 'metadata.json'), meta, 2);
|
|
62
|
+
await (0, file_ops_1.writeFile)(path.join(snapshotPath, exports.SNAPSHOT_CONFIG_FILENAME), configYaml);
|
|
63
|
+
return meta;
|
|
64
|
+
}
|
|
65
|
+
async function listSnapshots(projectRoot) {
|
|
66
|
+
const snapshotDir = getSnapshotDir(projectRoot);
|
|
67
|
+
if (!(await (0, file_ops_1.fileExists)(snapshotDir))) {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
const entries = await fs.readdir(snapshotDir, { withFileTypes: true });
|
|
71
|
+
const results = [];
|
|
72
|
+
for (const entry of entries) {
|
|
73
|
+
if (!entry.isDirectory())
|
|
74
|
+
continue;
|
|
75
|
+
const metaPath = path.join(snapshotDir, entry.name, 'metadata.json');
|
|
76
|
+
if (!(await (0, file_ops_1.fileExists)(metaPath)))
|
|
77
|
+
continue;
|
|
78
|
+
try {
|
|
79
|
+
const meta = await (0, file_ops_1.readJson)(metaPath);
|
|
80
|
+
if (meta?.name && meta?.createdAt) {
|
|
81
|
+
results.push({ name: meta.name, createdAt: meta.createdAt });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
//skip invalid metadata
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return results.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
|
|
89
|
+
}
|
|
90
|
+
async function getSnapshotConfig(projectRoot, name) {
|
|
91
|
+
const safeName = sanitizeSnapshotName(name) || 'snapshot';
|
|
92
|
+
const snapshotDir = getSnapshotDir(projectRoot);
|
|
93
|
+
const configPath = path.join(snapshotDir, safeName, exports.SNAPSHOT_CONFIG_FILENAME);
|
|
94
|
+
if (!(await (0, file_ops_1.fileExists)(configPath))) {
|
|
95
|
+
throw new Error(`Snapshot "${safeName}" not found. List snapshots with: envkit snapshot list`);
|
|
96
|
+
}
|
|
97
|
+
return (0, file_ops_1.readFile)(configPath);
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../src/core/snapshot/storage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,oDAEC;AAED,wCAEC;AAED,wCAiBC;AAED,sCAwBC;AAGD,8CAYC;AA/ED,2CAA6B;AAC7B,6CAA+B;AAC/B,mDAAuG;AAE1F,QAAA,iBAAiB,GAAG,SAAS,CAAC;AAC9B,QAAA,gBAAgB,GAAG,WAAW,CAAC;AAC/B,QAAA,wBAAwB,GAAG,aAAa,CAAC;AAOtD,SAAgB,oBAAoB,CAAC,IAAY;IAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,UAAU,CAAC;AACtG,CAAC;AAED,SAAgB,cAAc,CAAC,WAAmB;IAChD,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,yBAAiB,EAAE,wBAAgB,CAAC,CAAC;AACrE,CAAC;AAEM,KAAK,UAAU,cAAc,CAClC,WAAmB,EACnB,IAAY,EACZ,UAAkB;IAElB,MAAM,QAAQ,GAAG,oBAAoB,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC;IAC1D,MAAM,WAAW,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;IAChD,MAAM,YAAY,GAAG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AC;YACpD,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,SAAS,EAAE,CAAC;gBAClC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;YAC/D,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,uBAAuB;QACzB,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AACnG,CAAC;AAGM,KAAK,UAAU,iBAAiB,CAAC,WAAmB,EAAE,IAAY;IACvE,MAAM,QAAQ,GAAG,oBAAoB,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC;IAC1D,MAAM,WAAW,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;IAChD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,gCAAwB,CAAC,CAAC;IAE9E,IAAI,CAAC,CAAC,MAAM,IAAA,qBAAU,EAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CACb,aAAa,QAAQ,wDAAwD,CAC9E,CAAC;IACJ,CAAC;IAED,OAAO,IAAA,mBAAQ,EAAC,UAAU,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const DependencySchema: z.ZodObject<{
|
|
3
|
+
type: z.ZodEnum<["npm", "yarn", "pnpm", "pip", "pipenv", "poetry", "cargo", "go", "custom"]>;
|
|
4
|
+
command: z.ZodString;
|
|
5
|
+
path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
type: "custom" | "npm" | "yarn" | "pnpm" | "pip" | "pipenv" | "poetry" | "cargo" | "go";
|
|
8
|
+
path: string;
|
|
9
|
+
command: string;
|
|
10
|
+
}, {
|
|
11
|
+
type: "custom" | "npm" | "yarn" | "pnpm" | "pip" | "pipenv" | "poetry" | "cargo" | "go";
|
|
12
|
+
command: string;
|
|
13
|
+
path?: string | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
export type Dependency = z.infer<typeof DependencySchema>;
|
|
16
|
+
export declare const DatabaseSchema: z.ZodObject<{
|
|
17
|
+
type: z.ZodEnum<["postgresql", "mysql", "mariadb", "mongodb", "redis", "sqlite"]>;
|
|
18
|
+
name: z.ZodOptional<z.ZodString>;
|
|
19
|
+
version: z.ZodOptional<z.ZodString>;
|
|
20
|
+
port: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
host: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
22
|
+
user: z.ZodOptional<z.ZodString>;
|
|
23
|
+
password: z.ZodOptional<z.ZodString>;
|
|
24
|
+
database: z.ZodOptional<z.ZodString>;
|
|
25
|
+
migrations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
26
|
+
path: z.ZodString;
|
|
27
|
+
command: z.ZodString;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
path: string;
|
|
30
|
+
command: string;
|
|
31
|
+
}, {
|
|
32
|
+
path: string;
|
|
33
|
+
command: string;
|
|
34
|
+
}>, "many">>;
|
|
35
|
+
seed: z.ZodOptional<z.ZodObject<{
|
|
36
|
+
command: z.ZodString;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
command: string;
|
|
39
|
+
}, {
|
|
40
|
+
command: string;
|
|
41
|
+
}>>;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
type: "postgresql" | "mysql" | "mariadb" | "mongodb" | "redis" | "sqlite";
|
|
44
|
+
host: string;
|
|
45
|
+
name?: string | undefined;
|
|
46
|
+
version?: string | undefined;
|
|
47
|
+
port?: number | undefined;
|
|
48
|
+
user?: string | undefined;
|
|
49
|
+
password?: string | undefined;
|
|
50
|
+
database?: string | undefined;
|
|
51
|
+
migrations?: {
|
|
52
|
+
path: string;
|
|
53
|
+
command: string;
|
|
54
|
+
}[] | undefined;
|
|
55
|
+
seed?: {
|
|
56
|
+
command: string;
|
|
57
|
+
} | undefined;
|
|
58
|
+
}, {
|
|
59
|
+
type: "postgresql" | "mysql" | "mariadb" | "mongodb" | "redis" | "sqlite";
|
|
60
|
+
name?: string | undefined;
|
|
61
|
+
version?: string | undefined;
|
|
62
|
+
port?: number | undefined;
|
|
63
|
+
host?: string | undefined;
|
|
64
|
+
user?: string | undefined;
|
|
65
|
+
password?: string | undefined;
|
|
66
|
+
database?: string | undefined;
|
|
67
|
+
migrations?: {
|
|
68
|
+
path: string;
|
|
69
|
+
command: string;
|
|
70
|
+
}[] | undefined;
|
|
71
|
+
seed?: {
|
|
72
|
+
command: string;
|
|
73
|
+
} | undefined;
|
|
74
|
+
}>;
|
|
75
|
+
export type Database = z.infer<typeof DatabaseSchema>;
|
|
76
|
+
export declare const ServiceSchema: z.ZodObject<{
|
|
77
|
+
type: z.ZodString;
|
|
78
|
+
version: z.ZodOptional<z.ZodString>;
|
|
79
|
+
port: z.ZodOptional<z.ZodNumber>;
|
|
80
|
+
host: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
81
|
+
management_port: z.ZodOptional<z.ZodNumber>;
|
|
82
|
+
}, "strip", z.ZodTypeAny, {
|
|
83
|
+
type: string;
|
|
84
|
+
host: string;
|
|
85
|
+
version?: string | undefined;
|
|
86
|
+
port?: number | undefined;
|
|
87
|
+
management_port?: number | undefined;
|
|
88
|
+
}, {
|
|
89
|
+
type: string;
|
|
90
|
+
version?: string | undefined;
|
|
91
|
+
port?: number | undefined;
|
|
92
|
+
host?: string | undefined;
|
|
93
|
+
management_port?: number | undefined;
|
|
94
|
+
}>;
|
|
95
|
+
export type Service = z.infer<typeof ServiceSchema>;
|
|
96
|
+
export declare const HealthCheckSchema: z.ZodObject<{
|
|
97
|
+
name: z.ZodString;
|
|
98
|
+
type: z.ZodString;
|
|
99
|
+
connection_string: z.ZodOptional<z.ZodString>;
|
|
100
|
+
url: z.ZodOptional<z.ZodString>;
|
|
101
|
+
}, "strip", z.ZodTypeAny, {
|
|
102
|
+
type: string;
|
|
103
|
+
name: string;
|
|
104
|
+
connection_string?: string | undefined;
|
|
105
|
+
url?: string | undefined;
|
|
106
|
+
}, {
|
|
107
|
+
type: string;
|
|
108
|
+
name: string;
|
|
109
|
+
connection_string?: string | undefined;
|
|
110
|
+
url?: string | undefined;
|
|
111
|
+
}>;
|
|
112
|
+
export type HealthCheck = z.infer<typeof HealthCheckSchema>;
|
|
113
|
+
export declare const SnapshotConfigSchema: z.ZodObject<{
|
|
114
|
+
include_databases: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
115
|
+
include_volumes: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
116
|
+
exclude_paths: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
117
|
+
}, "strip", z.ZodTypeAny, {
|
|
118
|
+
include_databases: boolean;
|
|
119
|
+
include_volumes: boolean;
|
|
120
|
+
exclude_paths: string[];
|
|
121
|
+
}, {
|
|
122
|
+
include_databases?: boolean | undefined;
|
|
123
|
+
include_volumes?: boolean | undefined;
|
|
124
|
+
exclude_paths?: string[] | undefined;
|
|
125
|
+
}>;
|
|
126
|
+
export type SnapshotConfig = z.infer<typeof SnapshotConfigSchema>;
|
|
127
|
+
export declare const DockerConfigSchema: z.ZodObject<{
|
|
128
|
+
enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
129
|
+
output_file: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
130
|
+
network_name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
131
|
+
}, "strip", z.ZodTypeAny, {
|
|
132
|
+
enabled: boolean;
|
|
133
|
+
output_file: string;
|
|
134
|
+
network_name: string;
|
|
135
|
+
}, {
|
|
136
|
+
enabled?: boolean | undefined;
|
|
137
|
+
output_file?: string | undefined;
|
|
138
|
+
network_name?: string | undefined;
|
|
139
|
+
}>;
|
|
140
|
+
export type DockerConfig = z.infer<typeof DockerConfigSchema>;
|
|
141
|
+
export declare const DevEnvConfigSchema: z.ZodObject<{
|
|
142
|
+
name: z.ZodString;
|
|
143
|
+
version: z.ZodOptional<z.ZodString>;
|
|
144
|
+
dependencies: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
145
|
+
type: z.ZodEnum<["npm", "yarn", "pnpm", "pip", "pipenv", "poetry", "cargo", "go", "custom"]>;
|
|
146
|
+
command: z.ZodString;
|
|
147
|
+
path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
148
|
+
}, "strip", z.ZodTypeAny, {
|
|
149
|
+
type: "custom" | "npm" | "yarn" | "pnpm" | "pip" | "pipenv" | "poetry" | "cargo" | "go";
|
|
150
|
+
path: string;
|
|
151
|
+
command: string;
|
|
152
|
+
}, {
|
|
153
|
+
type: "custom" | "npm" | "yarn" | "pnpm" | "pip" | "pipenv" | "poetry" | "cargo" | "go";
|
|
154
|
+
command: string;
|
|
155
|
+
path?: string | undefined;
|
|
156
|
+
}>, "many">>>;
|
|
157
|
+
databases: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
158
|
+
type: z.ZodEnum<["postgresql", "mysql", "mariadb", "mongodb", "redis", "sqlite"]>;
|
|
159
|
+
name: z.ZodOptional<z.ZodString>;
|
|
160
|
+
version: z.ZodOptional<z.ZodString>;
|
|
161
|
+
port: z.ZodOptional<z.ZodNumber>;
|
|
162
|
+
host: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
163
|
+
user: z.ZodOptional<z.ZodString>;
|
|
164
|
+
password: z.ZodOptional<z.ZodString>;
|
|
165
|
+
database: z.ZodOptional<z.ZodString>;
|
|
166
|
+
migrations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
167
|
+
path: z.ZodString;
|
|
168
|
+
command: z.ZodString;
|
|
169
|
+
}, "strip", z.ZodTypeAny, {
|
|
170
|
+
path: string;
|
|
171
|
+
command: string;
|
|
172
|
+
}, {
|
|
173
|
+
path: string;
|
|
174
|
+
command: string;
|
|
175
|
+
}>, "many">>;
|
|
176
|
+
seed: z.ZodOptional<z.ZodObject<{
|
|
177
|
+
command: z.ZodString;
|
|
178
|
+
}, "strip", z.ZodTypeAny, {
|
|
179
|
+
command: string;
|
|
180
|
+
}, {
|
|
181
|
+
command: string;
|
|
182
|
+
}>>;
|
|
183
|
+
}, "strip", z.ZodTypeAny, {
|
|
184
|
+
type: "postgresql" | "mysql" | "mariadb" | "mongodb" | "redis" | "sqlite";
|
|
185
|
+
host: string;
|
|
186
|
+
name?: string | undefined;
|
|
187
|
+
version?: string | undefined;
|
|
188
|
+
port?: number | undefined;
|
|
189
|
+
user?: string | undefined;
|
|
190
|
+
password?: string | undefined;
|
|
191
|
+
database?: string | undefined;
|
|
192
|
+
migrations?: {
|
|
193
|
+
path: string;
|
|
194
|
+
command: string;
|
|
195
|
+
}[] | undefined;
|
|
196
|
+
seed?: {
|
|
197
|
+
command: string;
|
|
198
|
+
} | undefined;
|
|
199
|
+
}, {
|
|
200
|
+
type: "postgresql" | "mysql" | "mariadb" | "mongodb" | "redis" | "sqlite";
|
|
201
|
+
name?: string | undefined;
|
|
202
|
+
version?: string | undefined;
|
|
203
|
+
port?: number | undefined;
|
|
204
|
+
host?: string | undefined;
|
|
205
|
+
user?: string | undefined;
|
|
206
|
+
password?: string | undefined;
|
|
207
|
+
database?: string | undefined;
|
|
208
|
+
migrations?: {
|
|
209
|
+
path: string;
|
|
210
|
+
command: string;
|
|
211
|
+
}[] | undefined;
|
|
212
|
+
seed?: {
|
|
213
|
+
command: string;
|
|
214
|
+
} | undefined;
|
|
215
|
+
}>, "many">>>;
|
|
216
|
+
services: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
217
|
+
type: z.ZodString;
|
|
218
|
+
version: z.ZodOptional<z.ZodString>;
|
|
219
|
+
port: z.ZodOptional<z.ZodNumber>;
|
|
220
|
+
host: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
221
|
+
management_port: z.ZodOptional<z.ZodNumber>;
|
|
222
|
+
}, "strip", z.ZodTypeAny, {
|
|
223
|
+
type: string;
|
|
224
|
+
host: string;
|
|
225
|
+
version?: string | undefined;
|
|
226
|
+
port?: number | undefined;
|
|
227
|
+
management_port?: number | undefined;
|
|
228
|
+
}, {
|
|
229
|
+
type: string;
|
|
230
|
+
version?: string | undefined;
|
|
231
|
+
port?: number | undefined;
|
|
232
|
+
host?: string | undefined;
|
|
233
|
+
management_port?: number | undefined;
|
|
234
|
+
}>, "many">>>;
|
|
235
|
+
env: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
236
|
+
health_checks: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
237
|
+
name: z.ZodString;
|
|
238
|
+
type: z.ZodString;
|
|
239
|
+
connection_string: z.ZodOptional<z.ZodString>;
|
|
240
|
+
url: z.ZodOptional<z.ZodString>;
|
|
241
|
+
}, "strip", z.ZodTypeAny, {
|
|
242
|
+
type: string;
|
|
243
|
+
name: string;
|
|
244
|
+
connection_string?: string | undefined;
|
|
245
|
+
url?: string | undefined;
|
|
246
|
+
}, {
|
|
247
|
+
type: string;
|
|
248
|
+
name: string;
|
|
249
|
+
connection_string?: string | undefined;
|
|
250
|
+
url?: string | undefined;
|
|
251
|
+
}>, "many">>>;
|
|
252
|
+
snapshot: z.ZodOptional<z.ZodObject<{
|
|
253
|
+
include_databases: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
254
|
+
include_volumes: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
255
|
+
exclude_paths: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
256
|
+
}, "strip", z.ZodTypeAny, {
|
|
257
|
+
include_databases: boolean;
|
|
258
|
+
include_volumes: boolean;
|
|
259
|
+
exclude_paths: string[];
|
|
260
|
+
}, {
|
|
261
|
+
include_databases?: boolean | undefined;
|
|
262
|
+
include_volumes?: boolean | undefined;
|
|
263
|
+
exclude_paths?: string[] | undefined;
|
|
264
|
+
}>>;
|
|
265
|
+
docker: z.ZodOptional<z.ZodObject<{
|
|
266
|
+
enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
267
|
+
output_file: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
268
|
+
network_name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
269
|
+
}, "strip", z.ZodTypeAny, {
|
|
270
|
+
enabled: boolean;
|
|
271
|
+
output_file: string;
|
|
272
|
+
network_name: string;
|
|
273
|
+
}, {
|
|
274
|
+
enabled?: boolean | undefined;
|
|
275
|
+
output_file?: string | undefined;
|
|
276
|
+
network_name?: string | undefined;
|
|
277
|
+
}>>;
|
|
278
|
+
}, "strip", z.ZodTypeAny, {
|
|
279
|
+
name: string;
|
|
280
|
+
dependencies: {
|
|
281
|
+
type: "custom" | "npm" | "yarn" | "pnpm" | "pip" | "pipenv" | "poetry" | "cargo" | "go";
|
|
282
|
+
path: string;
|
|
283
|
+
command: string;
|
|
284
|
+
}[];
|
|
285
|
+
databases: {
|
|
286
|
+
type: "postgresql" | "mysql" | "mariadb" | "mongodb" | "redis" | "sqlite";
|
|
287
|
+
host: string;
|
|
288
|
+
name?: string | undefined;
|
|
289
|
+
version?: string | undefined;
|
|
290
|
+
port?: number | undefined;
|
|
291
|
+
user?: string | undefined;
|
|
292
|
+
password?: string | undefined;
|
|
293
|
+
database?: string | undefined;
|
|
294
|
+
migrations?: {
|
|
295
|
+
path: string;
|
|
296
|
+
command: string;
|
|
297
|
+
}[] | undefined;
|
|
298
|
+
seed?: {
|
|
299
|
+
command: string;
|
|
300
|
+
} | undefined;
|
|
301
|
+
}[];
|
|
302
|
+
services: {
|
|
303
|
+
type: string;
|
|
304
|
+
host: string;
|
|
305
|
+
version?: string | undefined;
|
|
306
|
+
port?: number | undefined;
|
|
307
|
+
management_port?: number | undefined;
|
|
308
|
+
}[];
|
|
309
|
+
env: Record<string, string>;
|
|
310
|
+
health_checks: {
|
|
311
|
+
type: string;
|
|
312
|
+
name: string;
|
|
313
|
+
connection_string?: string | undefined;
|
|
314
|
+
url?: string | undefined;
|
|
315
|
+
}[];
|
|
316
|
+
version?: string | undefined;
|
|
317
|
+
snapshot?: {
|
|
318
|
+
include_databases: boolean;
|
|
319
|
+
include_volumes: boolean;
|
|
320
|
+
exclude_paths: string[];
|
|
321
|
+
} | undefined;
|
|
322
|
+
docker?: {
|
|
323
|
+
enabled: boolean;
|
|
324
|
+
output_file: string;
|
|
325
|
+
network_name: string;
|
|
326
|
+
} | undefined;
|
|
327
|
+
}, {
|
|
328
|
+
name: string;
|
|
329
|
+
version?: string | undefined;
|
|
330
|
+
dependencies?: {
|
|
331
|
+
type: "custom" | "npm" | "yarn" | "pnpm" | "pip" | "pipenv" | "poetry" | "cargo" | "go";
|
|
332
|
+
command: string;
|
|
333
|
+
path?: string | undefined;
|
|
334
|
+
}[] | undefined;
|
|
335
|
+
databases?: {
|
|
336
|
+
type: "postgresql" | "mysql" | "mariadb" | "mongodb" | "redis" | "sqlite";
|
|
337
|
+
name?: string | undefined;
|
|
338
|
+
version?: string | undefined;
|
|
339
|
+
port?: number | undefined;
|
|
340
|
+
host?: string | undefined;
|
|
341
|
+
user?: string | undefined;
|
|
342
|
+
password?: string | undefined;
|
|
343
|
+
database?: string | undefined;
|
|
344
|
+
migrations?: {
|
|
345
|
+
path: string;
|
|
346
|
+
command: string;
|
|
347
|
+
}[] | undefined;
|
|
348
|
+
seed?: {
|
|
349
|
+
command: string;
|
|
350
|
+
} | undefined;
|
|
351
|
+
}[] | undefined;
|
|
352
|
+
services?: {
|
|
353
|
+
type: string;
|
|
354
|
+
version?: string | undefined;
|
|
355
|
+
port?: number | undefined;
|
|
356
|
+
host?: string | undefined;
|
|
357
|
+
management_port?: number | undefined;
|
|
358
|
+
}[] | undefined;
|
|
359
|
+
env?: Record<string, string> | undefined;
|
|
360
|
+
health_checks?: {
|
|
361
|
+
type: string;
|
|
362
|
+
name: string;
|
|
363
|
+
connection_string?: string | undefined;
|
|
364
|
+
url?: string | undefined;
|
|
365
|
+
}[] | undefined;
|
|
366
|
+
snapshot?: {
|
|
367
|
+
include_databases?: boolean | undefined;
|
|
368
|
+
include_volumes?: boolean | undefined;
|
|
369
|
+
exclude_paths?: string[] | undefined;
|
|
370
|
+
} | undefined;
|
|
371
|
+
docker?: {
|
|
372
|
+
enabled?: boolean | undefined;
|
|
373
|
+
output_file?: string | undefined;
|
|
374
|
+
network_name?: string | undefined;
|
|
375
|
+
} | undefined;
|
|
376
|
+
}>;
|
|
377
|
+
export type DevEnvConfig = z.infer<typeof DevEnvConfigSchema>;
|
|
378
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;EAI3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAG1D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBzB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;EAMxB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;EAK5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,oBAAoB;;;;;;;;;;;;EAI/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;EAI7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DevEnvConfigSchema = exports.DockerConfigSchema = exports.SnapshotConfigSchema = exports.HealthCheckSchema = exports.ServiceSchema = exports.DatabaseSchema = exports.DependencySchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.DependencySchema = zod_1.z.object({
|
|
6
|
+
type: zod_1.z.enum(['npm', 'yarn', 'pnpm', 'pip', 'pipenv', 'poetry', 'cargo', 'go', 'custom']),
|
|
7
|
+
command: zod_1.z.string(),
|
|
8
|
+
path: zod_1.z.string().optional().default('.'),
|
|
9
|
+
});
|
|
10
|
+
exports.DatabaseSchema = zod_1.z.object({
|
|
11
|
+
type: zod_1.z.enum(['postgresql', 'mysql', 'mariadb', 'mongodb', 'redis', 'sqlite']),
|
|
12
|
+
name: zod_1.z.string().optional(),
|
|
13
|
+
version: zod_1.z.string().optional(),
|
|
14
|
+
port: zod_1.z.number().optional(),
|
|
15
|
+
host: zod_1.z.string().optional().default('localhost'),
|
|
16
|
+
user: zod_1.z.string().optional(),
|
|
17
|
+
password: zod_1.z.string().optional(),
|
|
18
|
+
database: zod_1.z.string().optional(),
|
|
19
|
+
migrations: zod_1.z.array(zod_1.z.object({
|
|
20
|
+
path: zod_1.z.string(),
|
|
21
|
+
command: zod_1.z.string(),
|
|
22
|
+
})).optional(),
|
|
23
|
+
seed: zod_1.z.object({
|
|
24
|
+
command: zod_1.z.string(),
|
|
25
|
+
}).optional(),
|
|
26
|
+
});
|
|
27
|
+
exports.ServiceSchema = zod_1.z.object({
|
|
28
|
+
type: zod_1.z.string(),
|
|
29
|
+
version: zod_1.z.string().optional(),
|
|
30
|
+
port: zod_1.z.number().optional(),
|
|
31
|
+
host: zod_1.z.string().optional().default('localhost'),
|
|
32
|
+
management_port: zod_1.z.number().optional(),
|
|
33
|
+
});
|
|
34
|
+
exports.HealthCheckSchema = zod_1.z.object({
|
|
35
|
+
name: zod_1.z.string(),
|
|
36
|
+
type: zod_1.z.string(),
|
|
37
|
+
connection_string: zod_1.z.string().optional(),
|
|
38
|
+
url: zod_1.z.string().optional(),
|
|
39
|
+
});
|
|
40
|
+
exports.SnapshotConfigSchema = zod_1.z.object({
|
|
41
|
+
include_databases: zod_1.z.boolean().optional().default(true),
|
|
42
|
+
include_volumes: zod_1.z.boolean().optional().default(true),
|
|
43
|
+
exclude_paths: zod_1.z.array(zod_1.z.string()).optional().default(['node_modules', '.git']),
|
|
44
|
+
});
|
|
45
|
+
exports.DockerConfigSchema = zod_1.z.object({
|
|
46
|
+
enabled: zod_1.z.boolean().optional().default(true),
|
|
47
|
+
output_file: zod_1.z.string().optional().default('docker-compose.yml'),
|
|
48
|
+
network_name: zod_1.z.string().optional().default('dev-network'),
|
|
49
|
+
});
|
|
50
|
+
exports.DevEnvConfigSchema = zod_1.z.object({
|
|
51
|
+
name: zod_1.z.string(),
|
|
52
|
+
version: zod_1.z.string().optional(),
|
|
53
|
+
dependencies: zod_1.z.array(exports.DependencySchema).optional().default([]),
|
|
54
|
+
databases: zod_1.z.array(exports.DatabaseSchema).optional().default([]),
|
|
55
|
+
services: zod_1.z.array(exports.ServiceSchema).optional().default([]),
|
|
56
|
+
env: zod_1.z.record(zod_1.z.string()).optional().default({}),
|
|
57
|
+
health_checks: zod_1.z.array(exports.HealthCheckSchema).optional().default([]),
|
|
58
|
+
snapshot: exports.SnapshotConfigSchema.optional(),
|
|
59
|
+
docker: exports.DockerConfigSchema.optional(),
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAEX,QAAA,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IACzF,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC;CACzC,CAAC,CAAC;AAKU,QAAA,cAAc,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,IAAI,EAAE,OAAC,CAAC,IAA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EAAE,OAAC,CAAC,KAAK,CAAC,wBAAgB,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAC9D,SAAS,EAAE,OAAC,CAAC,KAAK,CAAC,sBAAc,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACzD,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,qBAAa,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACvD,GAAG,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAChD,aAAa,EAAE,OAAC,CAAC,KAAK,CAAC,yBAAiB,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAChE,QAAQ,EAAE,4BAAoB,CAAC,QAAQ,EAAE;IACzC,MAAM,EAAE,0BAAkB,CAAC,QAAQ,EAAE;CACtC,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ExecaReturnValue } from 'execa';
|
|
2
|
+
export interface ExecOptions {
|
|
3
|
+
cwd?: string;
|
|
4
|
+
env?: Record<string, string>;
|
|
5
|
+
silent?: boolean;
|
|
6
|
+
shell?: boolean | string;
|
|
7
|
+
}
|
|
8
|
+
export declare function exec(command: string, args?: string[], options?: ExecOptions): Promise<ExecaReturnValue<string>>;
|
|
9
|
+
export declare function execStdout(command: string, args?: string[], options?: ExecOptions): Promise<string>;
|
|
10
|
+
export declare function commandExists(command: string): Promise<boolean>;
|
|
11
|
+
//# sourceMappingURL=exec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/utils/exec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAI9C,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC1B;AAQD,wBAAsB,IAAI,CACxB,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,MAAM,EAAO,EACnB,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAgCnC;AAKD,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,MAAM,EAAO,EACnB,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,MAAM,CAAC,CAGjB;AAKD,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAWrE"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.exec = exec;
|
|
4
|
+
exports.execStdout = execStdout;
|
|
5
|
+
exports.commandExists = commandExists;
|
|
6
|
+
const logger_1 = require("./logger");
|
|
7
|
+
const platform_1 = require("./platform");
|
|
8
|
+
async function getExeca() {
|
|
9
|
+
const loadExeca = require('./load-execa.js');
|
|
10
|
+
const m = await loadExeca();
|
|
11
|
+
return m.execa;
|
|
12
|
+
}
|
|
13
|
+
async function exec(command, args = [], options = {}) {
|
|
14
|
+
const { cwd, env, silent = false, shell } = options;
|
|
15
|
+
// On Windows, use shell for commands that might need it
|
|
16
|
+
const useShell = shell !== undefined ? shell : (0, platform_1.isWindows)();
|
|
17
|
+
if (!silent) {
|
|
18
|
+
logger_1.logger.debug(`Executing: ${command} ${args.join(' ')}`);
|
|
19
|
+
}
|
|
20
|
+
const execa = await getExeca();
|
|
21
|
+
try {
|
|
22
|
+
const result = await execa(command, args, {
|
|
23
|
+
cwd,
|
|
24
|
+
env,
|
|
25
|
+
shell: useShell ? ((0, platform_1.isWindows)() ? (0, platform_1.getShell)() : true) : false,
|
|
26
|
+
stdio: silent ? 'pipe' : 'inherit',
|
|
27
|
+
});
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
if (!silent) {
|
|
32
|
+
logger_1.logger.error(`Command failed: ${command} ${args.join(' ')}`);
|
|
33
|
+
if (error.stdout) {
|
|
34
|
+
logger_1.logger.error(`Stdout: ${error.stdout}`);
|
|
35
|
+
}
|
|
36
|
+
if (error.stderr) {
|
|
37
|
+
logger_1.logger.error(`Stderr: ${error.stderr}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//Execute a command and return stdout
|
|
44
|
+
async function execStdout(command, args = [], options = {}) {
|
|
45
|
+
const result = await exec(command, args, { ...options, silent: true });
|
|
46
|
+
return result.stdout.trim();
|
|
47
|
+
}
|
|
48
|
+
//Check if a command exists in PATH
|
|
49
|
+
async function commandExists(command) {
|
|
50
|
+
try {
|
|
51
|
+
if ((0, platform_1.isWindows)()) {
|
|
52
|
+
await execStdout('where', [command], { silent: true });
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
await execStdout('which', [command], { silent: true });
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=exec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/utils/exec.ts"],"names":[],"mappings":";;AAiBA,oBAoCC;AAKD,gCAOC;AAKD,sCAWC;AAhFD,qCAAkC;AAClC,yCAAiD;AASjD,KAAK,UAAU,QAAQ;IACrB,MAAM,SAAS,GAAG,OAAO,CAAC,iBAAiB,CAAC,C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AK,CAAC,WAAW,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;YAC1C,CAAC;YACD,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;gBACjB,eAAM,CAAC,KAAK,CAAC,WAAW,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAGA,qCAAqC;AAE/B,KAAK,UAAU,UAAU,CAC9B,OAAe,EACf,OAAiB,EAAE,EACnB,UAAuB,EAAE;IAEzB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IACvE,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AAC9B,CAAC;AAGA,mCAAmC;AAE7B,KAAK,UAAU,aAAa,CAAC,OAAe;IACjD,IAAI,CAAC;QACH,IAAI,IAAA,oBAAS,GAAE,EAAE,CAAC;YAChB,MAAM,UAAU,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACzD,CAAC;aAAM,CAAC;YACN,MAAM,UAAU,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function fileExists(filePath: string): Promise<boolean>;
|
|
2
|
+
export declare function readFile(filePath: string): Promise<string>;
|
|
3
|
+
export declare function writeFile(filePath: string, content: string): Promise<void>;
|
|
4
|
+
export declare function readJson<T = any>(filePath: string): Promise<T>;
|
|
5
|
+
export declare function writeJson(filePath: string, data: any, indent?: number): Promise<void>;
|
|
6
|
+
export declare function ensureDir(dirPath: string): Promise<void>;
|
|
7
|
+
export declare function copy(src: string, dest: string): Promise<void>;
|
|
8
|
+
export declare function findFile(dirPath: string, fileName: string): Promise<string | null>;
|
|
9
|
+
export declare function findFiles(dirPath: string, pattern: RegExp): Promise<string[]>;
|
|
10
|
+
//# sourceMappingURL=file-ops.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-ops.d.ts","sourceRoot":"","sources":["../../src/utils/file-ops.ts"],"names":[],"mappings":"AAIA,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOnE;AAED,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAOhE;AAED,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQhF;AAED,wBAAsB,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAQpE;AAED,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,GAAE,MAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAG9F;AAED,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO9D;AAED,wBAAsB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOnE;AAED,wBAAsB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAoBxF;AAED,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAsBnF"}
|