@turboops/cli 1.0.73-dev.1355 → 1.0.74-dev.1360
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/index.js +59 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -711,11 +711,11 @@ var apiClient = {
|
|
|
711
711
|
/**
|
|
712
712
|
* Upload compose file content to project (CLI endpoint)
|
|
713
713
|
*/
|
|
714
|
-
async uploadCompose(projectId, content, message) {
|
|
714
|
+
async uploadCompose(projectId, content, message, envExamples) {
|
|
715
715
|
return this.request(
|
|
716
716
|
"POST",
|
|
717
717
|
`/cli/deployment/projects/${projectId}/compose`,
|
|
718
|
-
{ content, message }
|
|
718
|
+
{ content, message, ...envExamples ? { envExamples } : {} }
|
|
719
719
|
);
|
|
720
720
|
},
|
|
721
721
|
/**
|
|
@@ -1314,7 +1314,7 @@ function getStatusColor(status) {
|
|
|
1314
1314
|
}
|
|
1315
1315
|
|
|
1316
1316
|
// src/commands/init.ts
|
|
1317
|
-
import { readFileSync as readFileSync2, existsSync as existsSync3 } from "fs";
|
|
1317
|
+
import { readFileSync as readFileSync2, existsSync as existsSync3, statSync } from "fs";
|
|
1318
1318
|
import { resolve } from "path";
|
|
1319
1319
|
import chalk5 from "chalk";
|
|
1320
1320
|
import { Command as Command3 } from "commander";
|
|
@@ -2342,15 +2342,22 @@ async function detectAndUploadCompose(projectSlug) {
|
|
|
2342
2342
|
}
|
|
2343
2343
|
try {
|
|
2344
2344
|
const content = readFileSync2(fullPath, "utf-8");
|
|
2345
|
+
const envExamples = collectEnvExamples();
|
|
2345
2346
|
const { error } = await apiClient.uploadCompose(
|
|
2346
2347
|
project.id,
|
|
2347
2348
|
content,
|
|
2348
|
-
"Uploaded via turbo init"
|
|
2349
|
+
"Uploaded via turbo init",
|
|
2350
|
+
envExamples
|
|
2349
2351
|
);
|
|
2350
2352
|
if (error) {
|
|
2351
2353
|
logger.warning(`Compose-Upload fehlgeschlagen: ${error}`);
|
|
2352
2354
|
} else {
|
|
2353
2355
|
logger.success(`Docker-Compose (${composePath}) am Projekt gespeichert.`);
|
|
2356
|
+
if (envExamples) {
|
|
2357
|
+
logger.success(
|
|
2358
|
+
"Umgebungsvariablen aus .env.example am Projekt hinterlegt."
|
|
2359
|
+
);
|
|
2360
|
+
}
|
|
2354
2361
|
}
|
|
2355
2362
|
} catch {
|
|
2356
2363
|
logger.warning(`Compose-Datei ${composePath} konnte nicht gelesen werden.`);
|
|
@@ -2494,6 +2501,54 @@ Erstelle die Datei "${pipelineFile}".`;
|
|
|
2494
2501
|
);
|
|
2495
2502
|
}
|
|
2496
2503
|
}
|
|
2504
|
+
var DIR_TO_SERVICE = {
|
|
2505
|
+
".": "_root",
|
|
2506
|
+
"projects/api": "api",
|
|
2507
|
+
"projects/app": "app",
|
|
2508
|
+
"packages/api": "api",
|
|
2509
|
+
"packages/app": "app",
|
|
2510
|
+
api: "api",
|
|
2511
|
+
app: "app",
|
|
2512
|
+
backend: "api",
|
|
2513
|
+
frontend: "app",
|
|
2514
|
+
server: "api",
|
|
2515
|
+
client: "app"
|
|
2516
|
+
};
|
|
2517
|
+
function collectEnvExamples() {
|
|
2518
|
+
const cwd = process.cwd();
|
|
2519
|
+
const envFileNames = [".env.example", ".env.sample"];
|
|
2520
|
+
const result = { services: {} };
|
|
2521
|
+
let found = false;
|
|
2522
|
+
for (const [dir, serviceName] of Object.entries(DIR_TO_SERVICE)) {
|
|
2523
|
+
for (const fileName of envFileNames) {
|
|
2524
|
+
const filePath = resolve(cwd, dir, fileName);
|
|
2525
|
+
if (!existsSync3(filePath)) {
|
|
2526
|
+
continue;
|
|
2527
|
+
}
|
|
2528
|
+
const relativePath = dir === "." ? fileName : `${dir}/${fileName}`;
|
|
2529
|
+
const fileSize = statSync(filePath).size;
|
|
2530
|
+
if (fileSize > 64 * 1024) {
|
|
2531
|
+
logger.warning(`${relativePath} ist zu gro\xDF (> 64 KB) \u2014 \xFCbersprungen.`);
|
|
2532
|
+
break;
|
|
2533
|
+
}
|
|
2534
|
+
const content = readFileSync2(filePath, "utf-8");
|
|
2535
|
+
found = true;
|
|
2536
|
+
if (serviceName === "_root") {
|
|
2537
|
+
result.root = content;
|
|
2538
|
+
logger.info(
|
|
2539
|
+
`${relativePath} gefunden \u2014 Stage-Umgebungsvariablen werden vorbereitet.`
|
|
2540
|
+
);
|
|
2541
|
+
} else if (!result.services[serviceName]) {
|
|
2542
|
+
result.services[serviceName] = content;
|
|
2543
|
+
logger.info(
|
|
2544
|
+
`${relativePath} gefunden \u2014 Umgebungsvariablen f\xFCr Service "${serviceName}" werden vorbereitet.`
|
|
2545
|
+
);
|
|
2546
|
+
}
|
|
2547
|
+
break;
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
return found ? result : void 0;
|
|
2551
|
+
}
|
|
2497
2552
|
|
|
2498
2553
|
// src/commands/deploy.ts
|
|
2499
2554
|
import { readFileSync as readFileSync3, existsSync as existsSync4 } from "fs";
|