gigadrive 1.1.0 → 1.1.2
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.cjs +125 -112
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +125 -112
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -100,7 +100,7 @@ var getPackageManager = async ({ cwd }) => {
|
|
|
100
100
|
try {
|
|
101
101
|
await exec({ command: "bun --version", cwd });
|
|
102
102
|
return "bun";
|
|
103
|
-
} catch
|
|
103
|
+
} catch {
|
|
104
104
|
return "npm";
|
|
105
105
|
}
|
|
106
106
|
};
|
|
@@ -242,6 +242,7 @@ var import_path4 = __toESM(require("path"), 1);
|
|
|
242
242
|
var import_build_utils2 = require("@gigadrive/build-utils");
|
|
243
243
|
var import_archiver = __toESM(require("archiver"), 1);
|
|
244
244
|
var import_fs3 = __toESM(require("fs"), 1);
|
|
245
|
+
var import_promises = __toESM(require("fs/promises"), 1);
|
|
245
246
|
var import_ignore = __toESM(require("ignore"), 1);
|
|
246
247
|
var import_path3 = __toESM(require("path"), 1);
|
|
247
248
|
var ignoreFileNames = [
|
|
@@ -251,78 +252,84 @@ var ignoreFileNames = [
|
|
|
251
252
|
".dockerignore",
|
|
252
253
|
".nowignore"
|
|
253
254
|
];
|
|
254
|
-
function readIgnoreFile(ignorePath) {
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
async function readIgnoreFile(ignorePath) {
|
|
256
|
+
try {
|
|
257
|
+
await import_promises.default.access(ignorePath);
|
|
258
|
+
const content = await import_promises.default.readFile(ignorePath, "utf8");
|
|
259
|
+
return content.split("\n").filter((line) => line.trim() !== "");
|
|
260
|
+
} catch {
|
|
261
|
+
return [];
|
|
257
262
|
}
|
|
258
|
-
return [];
|
|
259
263
|
}
|
|
260
|
-
function collectIgnorePatterns(dir, baseDir, ignoreRules) {
|
|
261
|
-
const items =
|
|
262
|
-
|
|
264
|
+
async function collectIgnorePatterns(dir, baseDir, ignoreRules) {
|
|
265
|
+
const items = await import_promises.default.readdir(dir);
|
|
266
|
+
for (const item of items) {
|
|
263
267
|
const fullPath = import_path3.default.join(dir, item);
|
|
264
268
|
const relativePath = import_path3.default.relative(baseDir, fullPath);
|
|
265
|
-
const stat =
|
|
269
|
+
const stat = await import_promises.default.lstat(fullPath);
|
|
266
270
|
if (stat.isDirectory()) {
|
|
267
271
|
if (ignoreRules.ignores(`${relativePath}/`)) {
|
|
268
|
-
|
|
272
|
+
continue;
|
|
269
273
|
}
|
|
270
|
-
|
|
274
|
+
for (const ignoreFileName of ignoreFileNames) {
|
|
271
275
|
const ignoreFilePath = import_path3.default.join(fullPath, ignoreFileName);
|
|
272
|
-
|
|
273
|
-
|
|
276
|
+
try {
|
|
277
|
+
await import_promises.default.access(ignoreFilePath);
|
|
278
|
+
const patterns = (await readIgnoreFile(ignoreFilePath)).map((pattern) => {
|
|
274
279
|
return pattern.startsWith("!") ? `!${import_path3.default.join(relativePath, pattern.slice(1))}` : import_path3.default.join(relativePath, pattern);
|
|
275
280
|
});
|
|
276
281
|
ignoreRules.add(patterns);
|
|
282
|
+
} catch {
|
|
277
283
|
}
|
|
278
|
-
}
|
|
279
|
-
collectIgnorePatterns(fullPath, baseDir, ignoreRules);
|
|
284
|
+
}
|
|
285
|
+
await collectIgnorePatterns(fullPath, baseDir, ignoreRules);
|
|
280
286
|
}
|
|
281
|
-
}
|
|
287
|
+
}
|
|
282
288
|
}
|
|
283
|
-
function initializeIgnoreRules(baseDir) {
|
|
289
|
+
async function initializeIgnoreRules(baseDir) {
|
|
284
290
|
const ignoreRules = (0, import_ignore.default)();
|
|
285
291
|
ignoreRules.add([".git/", "**/.DS_Store", "**/Thumbs.db"]);
|
|
286
|
-
|
|
292
|
+
for (const ignoreFileName of ignoreFileNames) {
|
|
287
293
|
const ignoreFilePath = import_path3.default.join(baseDir, ignoreFileName);
|
|
288
|
-
|
|
289
|
-
|
|
294
|
+
try {
|
|
295
|
+
await import_promises.default.access(ignoreFilePath);
|
|
296
|
+
const patterns = (await readIgnoreFile(ignoreFilePath)).map((pattern) => {
|
|
290
297
|
return pattern.startsWith("!") ? `!${pattern.slice(1)}` : pattern;
|
|
291
298
|
});
|
|
292
299
|
ignoreRules.add(patterns);
|
|
300
|
+
} catch {
|
|
293
301
|
}
|
|
294
|
-
}
|
|
295
|
-
collectIgnorePatterns(baseDir, baseDir, ignoreRules);
|
|
302
|
+
}
|
|
303
|
+
await collectIgnorePatterns(baseDir, baseDir, ignoreRules);
|
|
296
304
|
return ignoreRules;
|
|
297
305
|
}
|
|
298
306
|
async function getFilesToInclude(dir, ignoreRules, whitelist) {
|
|
299
307
|
const filesToInclude = [];
|
|
300
|
-
function
|
|
301
|
-
const items =
|
|
302
|
-
|
|
308
|
+
async function walkDir(currentDir) {
|
|
309
|
+
const items = await import_promises.default.readdir(currentDir);
|
|
310
|
+
for (const item of items) {
|
|
303
311
|
const fullPath = import_path3.default.join(currentDir, item);
|
|
304
312
|
const relativePath = import_path3.default.relative(dir, fullPath);
|
|
305
|
-
const stat =
|
|
313
|
+
const stat = await import_promises.default.lstat(fullPath);
|
|
306
314
|
if (stat.isDirectory()) {
|
|
307
315
|
if (ignoreRules.ignores(`${relativePath}/`)) {
|
|
308
|
-
|
|
316
|
+
continue;
|
|
309
317
|
}
|
|
310
|
-
|
|
318
|
+
await walkDir(fullPath);
|
|
311
319
|
} else {
|
|
312
320
|
if (!ignoreRules.ignores(relativePath)) {
|
|
313
321
|
filesToInclude.push(fullPath);
|
|
314
322
|
} else if (ignoreRules.ignores(relativePath) && ignoreRules.test(relativePath).unignored) {
|
|
315
323
|
filesToInclude.push(fullPath);
|
|
316
|
-
} else {
|
|
317
324
|
}
|
|
318
325
|
}
|
|
319
|
-
}
|
|
326
|
+
}
|
|
320
327
|
}
|
|
321
|
-
|
|
328
|
+
await walkDir(dir);
|
|
322
329
|
return filesToInclude;
|
|
323
330
|
}
|
|
324
331
|
async function createZipArchive(inputDir, outputFile, options = {}) {
|
|
325
|
-
const ignoreRules = options.useIgnoreFiles !== false ? initializeIgnoreRules(inputDir) : (0, import_ignore.default)();
|
|
332
|
+
const ignoreRules = options.useIgnoreFiles !== false ? await initializeIgnoreRules(inputDir) : (0, import_ignore.default)();
|
|
326
333
|
const filesToInclude = options.whitelist ? await Promise.all(options.whitelist.map((file) => (0, import_build_utils2.getFilesForPattern)(inputDir, file))) : await getFilesToInclude(inputDir, ignoreRules);
|
|
327
334
|
const output = import_fs3.default.createWriteStream(outputFile);
|
|
328
335
|
const archive = (0, import_archiver.default)("zip", { zlib: { level: 9 } });
|
|
@@ -330,10 +337,10 @@ async function createZipArchive(inputDir, outputFile, options = {}) {
|
|
|
330
337
|
output.on("close", () => resolve());
|
|
331
338
|
archive.on("error", reject);
|
|
332
339
|
archive.pipe(output);
|
|
333
|
-
filesToInclude.
|
|
340
|
+
for (const file of filesToInclude.flat()) {
|
|
334
341
|
archive.file(file, { name: import_path3.default.relative(inputDir, file) });
|
|
335
|
-
}
|
|
336
|
-
archive.finalize();
|
|
342
|
+
}
|
|
343
|
+
void archive.finalize();
|
|
337
344
|
});
|
|
338
345
|
}
|
|
339
346
|
|
|
@@ -390,53 +397,57 @@ var handleDeployment = async (deploymentId, config2) => {
|
|
|
390
397
|
error("The deployment failed. Please check the logs for more information.");
|
|
391
398
|
process.exit(1);
|
|
392
399
|
}
|
|
393
|
-
const statusInterval = setInterval(
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
400
|
+
const statusInterval = setInterval(() => {
|
|
401
|
+
void (async () => {
|
|
402
|
+
try {
|
|
403
|
+
debug(`Fetching deployment status for ${deploymentId}`);
|
|
404
|
+
const newStatus = await getDeploymentStatus(deploymentId);
|
|
405
|
+
debug(`Current status: ${status}, New status: ${newStatus}`);
|
|
406
|
+
if (newStatus === "ACTIVE" || newStatus === "FAILED") {
|
|
407
|
+
debug(`Final status reached: ${newStatus}, clearing interval`);
|
|
408
|
+
clearInterval(statusInterval);
|
|
409
|
+
clearInterval(logsInterval);
|
|
410
|
+
if (newStatus === "ACTIVE") {
|
|
411
|
+
success(`Deployed to https://${deploymentId}.gigadrivedev.com`);
|
|
412
|
+
} else {
|
|
413
|
+
error("The deployment failed. Please check the logs for more information.");
|
|
414
|
+
}
|
|
415
|
+
return;
|
|
406
416
|
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
417
|
+
if (newStatus !== status) {
|
|
418
|
+
debug(`Updating status from ${status} to ${newStatus}`);
|
|
419
|
+
status = newStatus;
|
|
420
|
+
spinner(`Status: ${status.toLowerCase().replace(/^\w/, (c) => c.toUpperCase())}`);
|
|
421
|
+
}
|
|
422
|
+
} catch (err) {
|
|
423
|
+
debug(`Error fetching status: ${err.message}`);
|
|
413
424
|
}
|
|
414
|
-
}
|
|
415
|
-
debug(`Error fetching status: ${err.message}`);
|
|
416
|
-
}
|
|
425
|
+
})();
|
|
417
426
|
}, 1e3);
|
|
418
|
-
const logsInterval = setInterval(
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
427
|
+
const logsInterval = setInterval(() => {
|
|
428
|
+
void (async () => {
|
|
429
|
+
try {
|
|
430
|
+
debug(`Fetching logs for ${deploymentId}, current log count: ${logs.length}`);
|
|
431
|
+
const newLogs = await getLogs(deploymentId, {
|
|
432
|
+
offset: logs.length,
|
|
433
|
+
limit: 100,
|
|
434
|
+
"createdAt[gt]": logs[logs.length - 1]?.createdAt
|
|
435
|
+
});
|
|
436
|
+
debug(`Fetched ${newLogs.items.length} new logs`);
|
|
437
|
+
for (const logEntry of newLogs.items) {
|
|
438
|
+
logs.push(logEntry);
|
|
439
|
+
if (logEntry.type === "ERROR") {
|
|
440
|
+
error(logEntry.message);
|
|
441
|
+
} else if (logEntry.type === "WARN") {
|
|
442
|
+
warn(logEntry.message);
|
|
443
|
+
} else {
|
|
444
|
+
log(logEntry.message);
|
|
445
|
+
}
|
|
435
446
|
}
|
|
447
|
+
} catch (err) {
|
|
448
|
+
debug(`Error fetching logs: ${err.message}`);
|
|
436
449
|
}
|
|
437
|
-
}
|
|
438
|
-
debug(`Error fetching logs: ${err.message}`);
|
|
439
|
-
}
|
|
450
|
+
})();
|
|
440
451
|
}, 1e3);
|
|
441
452
|
spinner(`Status: ${status.toLowerCase().replace(/^\w/, (c) => c.toUpperCase())}`);
|
|
442
453
|
};
|
|
@@ -491,35 +502,37 @@ var uploadArchive = async (deploymentId, logs, config2) => {
|
|
|
491
502
|
debug(`Processing chunk ${index}/${numChunks}, start: ${start}, end: ${end}`);
|
|
492
503
|
const presignedUrl = await getPresignedUrl(deploymentId, uploadId, index);
|
|
493
504
|
debug("Presigned URL for part", index, presignedUrl);
|
|
494
|
-
const promise = new Promise(
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
505
|
+
const promise = new Promise((resolve, reject) => {
|
|
506
|
+
void (async () => {
|
|
507
|
+
try {
|
|
508
|
+
debug(`Reading chunk ${index} data`);
|
|
509
|
+
const readStream = import_fs4.default.createReadStream(archivePath, {
|
|
510
|
+
start,
|
|
511
|
+
end: index < numChunks ? end - 1 : void 0
|
|
512
|
+
});
|
|
513
|
+
const chunks = [];
|
|
514
|
+
readStream.on("data", (chunk) => {
|
|
515
|
+
chunks.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
|
|
516
|
+
});
|
|
517
|
+
await new Promise((resolveRead) => {
|
|
518
|
+
readStream.on("end", () => resolveRead());
|
|
519
|
+
readStream.on("error", reject);
|
|
520
|
+
});
|
|
521
|
+
const buffer = Buffer.concat(chunks);
|
|
522
|
+
debug(`Uploading chunk ${index} to presigned URL (${buffer.length} bytes)`);
|
|
523
|
+
const response = await fetch(presignedUrl, {
|
|
524
|
+
method: "PUT",
|
|
525
|
+
headers: {
|
|
526
|
+
"Content-Type": "application/zip",
|
|
527
|
+
"Content-Length": String(buffer.length)
|
|
528
|
+
},
|
|
529
|
+
body: buffer
|
|
530
|
+
});
|
|
531
|
+
resolve(response);
|
|
532
|
+
} catch (err) {
|
|
533
|
+
reject(err instanceof Error ? err : new Error(String(err)));
|
|
534
|
+
}
|
|
535
|
+
})();
|
|
523
536
|
});
|
|
524
537
|
promises.push(promise);
|
|
525
538
|
}
|
|
@@ -650,7 +663,7 @@ var getDeploymentStatus = async (deploymentId) => {
|
|
|
650
663
|
return deployment.status;
|
|
651
664
|
};
|
|
652
665
|
var getLogs = async (deploymentId, options) => {
|
|
653
|
-
debug(`Getting logs for deployment: ${deploymentId}, options:`, options);
|
|
666
|
+
debug(`Getting logs for deployment: ${deploymentId}, options:`, options ?? "No options");
|
|
654
667
|
const res = await fetch(`http://localhost:3000/deployments/${deploymentId}/logs${(0, import_commons.objectToQueryString)(options)}`, {
|
|
655
668
|
method: "GET",
|
|
656
669
|
headers: {
|
|
@@ -684,7 +697,7 @@ var main = async () => {
|
|
|
684
697
|
let exitCode = 0;
|
|
685
698
|
const program = new import_commander.Command();
|
|
686
699
|
program.option("-v, --verbose", "Enable verbose logging", false);
|
|
687
|
-
program.hook("preSubcommand", (thisCommand
|
|
700
|
+
program.hook("preSubcommand", (thisCommand) => {
|
|
688
701
|
setVerbose(thisCommand.opts().verbose === true);
|
|
689
702
|
if (thisCommand.opts().verbose) {
|
|
690
703
|
log("Using verbose mode");
|
|
@@ -704,13 +717,13 @@ var main = async () => {
|
|
|
704
717
|
}
|
|
705
718
|
return exitCode;
|
|
706
719
|
};
|
|
707
|
-
var handleRejection =
|
|
720
|
+
var handleRejection = (err) => {
|
|
708
721
|
if (err) {
|
|
709
722
|
if (err instanceof Error) {
|
|
710
|
-
|
|
723
|
+
handleUnexpected(err);
|
|
711
724
|
} else {
|
|
712
725
|
console.error(`An unexpected rejection occurred
|
|
713
|
-
${err}`);
|
|
726
|
+
${JSON.stringify(err)}`);
|
|
714
727
|
}
|
|
715
728
|
} else {
|
|
716
729
|
console.error("An unexpected empty rejection occurred");
|
|
@@ -729,7 +742,7 @@ process.on("exit", () => {
|
|
|
729
742
|
const terminal = process.stderr.isTTY ? process.stderr : process.stdout.isTTY ? process.stdout : void 0;
|
|
730
743
|
terminal?.write("\x1B[?25h");
|
|
731
744
|
});
|
|
732
|
-
main().then(
|
|
745
|
+
main().then((exitCode) => {
|
|
733
746
|
process.exitCode = exitCode;
|
|
734
747
|
}).catch(handleUnexpected);
|
|
735
748
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/commands/build/index.ts","../src/util/pm.ts","../../build-utils/src/exec.ts","../src/commands/debug/config/index.ts","../src/util/log.ts","../src/commands/debug/index.ts","../src/commands/platform/deploy/index.ts","../src/util/zip.ts","../src/commands/platform/index.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { build } from './commands/build';\nimport { debug } from './commands/debug';\nimport { platform } from './commands/platform';\nimport { error, log, setVerbose } from './util/log';\n\nlet { isTTY } = process.stdout;\n//process.stdin.resume();\n\nconst main = async () => {\n if (process.env.FORCE_TTY === '1') {\n isTTY = true;\n process.stdout.isTTY = true;\n process.stdin.isTTY = true;\n }\n\n let exitCode = 0;\n\n const program = new Command();\n\n program.option('-v, --verbose', 'Enable verbose logging', false);\n\n program.hook('preSubcommand', (thisCommand, actionCommand) => {\n setVerbose((thisCommand.opts().verbose as boolean) === true);\n\n if (thisCommand.opts().verbose) {\n log('Using verbose mode');\n }\n });\n\n program.hook('preAction', (thisCommand) => {\n setVerbose((thisCommand.opts().verbose as boolean) === true);\n });\n\n // register commands\n platform(program);\n debug(program);\n build(program);\n\n try {\n await program.parseAsync(process.argv);\n } catch (err) {\n error(err);\n exitCode = 1;\n }\n\n return exitCode;\n};\n\nconst handleRejection = async (err: any) => {\n if (err) {\n if (err instanceof Error) {\n await handleUnexpected(err);\n } else {\n // eslint-disable-next-line no-console\n console.error(`An unexpected rejection occurred\\n ${err}`);\n }\n } else {\n console.error('An unexpected empty rejection occurred');\n }\n\n process.exit(1);\n};\n\nconst handleUnexpected = (error: Error) => {\n const { message } = error;\n\n console.error(`An unexpected error occurred\\n ${message}`);\n\n process.exit(1);\n};\n\nprocess.on('unhandledRejection', handleRejection);\nprocess.on('uncaughtException', handleUnexpected);\n\nprocess.on('exit', () => {\n const terminal = process.stderr.isTTY ? process.stderr : process.stdout.isTTY ? process.stdout : undefined;\n terminal?.write('\\u001B[?25h');\n});\n\nmain()\n .then(async (exitCode) => {\n process.exitCode = exitCode;\n })\n .catch(handleUnexpected);\n","import { exec } from '@gigadrive/build-utils';\nimport type { Command } from 'commander';\nimport fs from 'fs';\nimport path from 'path';\nimport { buildCommand, getPackageManager, installCommand } from '../../util/pm';\n\nexport const build = (parent: Command) => {\n parent\n .command('build')\n .description('Build the current project')\n .action(async () => {\n // Set relevant environment variables\n const env = {\n ...process.env,\n NODE_ENV: 'production',\n NEBULA: '1',\n VERCEL: '1', // Vercel compatibility\n NOW_BUILDER: '1',\n };\n\n const cwd = process.cwd();\n\n const packageJsonPath = path.join(cwd, 'package.json');\n\n if (!fs.existsSync(packageJsonPath)) {\n console.log('No package.json found');\n return;\n }\n\n // Read package.json and check for build scripts\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));\n\n const buildScript = packageJson.scripts?.build;\n\n // If build script is not defined, return null\n if (!buildScript) {\n console.log('No build script found in package.json');\n return;\n }\n\n const packageManager = await getPackageManager({ cwd });\n\n if (!packageManager) {\n console.log('No package manager found');\n return;\n }\n\n await exec({\n command: installCommand(packageManager),\n cwd,\n env,\n onOutput: (chunk) => {\n console.log(chunk);\n },\n });\n\n await exec({\n command: buildCommand(packageManager),\n cwd,\n env,\n onOutput: (chunk) => {\n console.log(chunk);\n },\n });\n });\n};\n","import fs from 'fs';\nimport path from 'path';\nimport { exec } from '../../../build-utils/src/exec';\n\nexport type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';\n\n/**\n * Detects the package manager to use for a specific directory\n */\nexport const getPackageManager = async ({ cwd }: { cwd: string }): Promise<PackageManager | null> => {\n // check if package.json exists\n const packageJsonPath = path.join(cwd, 'package.json');\n\n // If package.json does not exist, return null\n if (!fs.existsSync(packageJsonPath)) {\n return null;\n }\n\n // Check if yarn lock exists\n if (fs.existsSync(path.join(cwd, 'yarn.lock'))) {\n return 'yarn';\n }\n\n // Check if pnpm lock exists\n if (fs.existsSync(path.join(cwd, 'pnpm-lock.yaml'))) {\n return 'pnpm';\n }\n\n // Check if bun lock exists\n if (fs.existsSync(path.join(cwd, 'bun.lockb'))) {\n return 'bun';\n }\n\n // Check if pnpm lock exists\n if (fs.existsSync(path.join(cwd, 'package-lock.json'))) {\n return 'npm';\n }\n\n // Check if bun is installed\n try {\n await exec({ command: 'bun --version', cwd });\n return 'bun';\n } catch (e) {\n // If bun is not installed, return npm\n return 'npm';\n }\n};\n\nexport const installCommand = (pm: PackageManager) => {\n return (\n {\n bun: 'bun install',\n npm: 'npm install',\n pnpm: 'pnpm install',\n yarn: 'yarn install',\n }[pm] || 'npm install'\n );\n};\n\nexport const buildCommand = (pm: PackageManager) => {\n return (\n {\n bun: 'bun run build',\n npm: 'npm run build',\n pnpm: 'pnpm build',\n yarn: 'yarn build',\n }[pm] || 'npm run build'\n );\n};\n","import { spawn } from 'child_process';\n\ntype CommandInput = string | { command: string; args?: string[] };\n\ninterface ExecOptions {\n /**\n * The command to execute.\n */\n command: CommandInput;\n\n /**\n * The working directory for the command.\n */\n cwd?: string;\n\n /**\n * Environment variables for the command.\n * Does not include the current process's environment variables by default.\n */\n env?: Record<string, string>;\n\n /**\n * Callback for handling output from the command (stdout).\n */\n onOutput?: (data: string) => void;\n\n /**\n * Callback for handling errors from the command (stderr).\n */\n onError?: (data: string) => void;\n}\n\n/**\n * Executes a command asynchronously in a child process\n * @param options Configuration options for executing the process\n * @returns Promise that resolves when the process completes\n */\nexport async function exec({\n command,\n cwd = process.cwd(),\n env,\n onOutput = (data: string) => console.log(data),\n onError = (data: string) => console.error(data),\n}: ExecOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n let spawnCommand: string;\n let spawnArgs: string[] = [];\n\n if (typeof command === 'string') {\n // For string input, first argument is the command, rest are args\n const parts = command.split(' ');\n spawnCommand = parts[0];\n spawnArgs = parts.slice(1);\n } else {\n // For object input, use command and args properties\n spawnCommand = command.command;\n spawnArgs = command.args || [];\n }\n\n const childProcess = spawn(spawnCommand, spawnArgs, {\n cwd,\n shell: true,\n env,\n });\n\n childProcess.stdout.on('data', (data) => {\n onOutput(data.toString().trim());\n });\n\n childProcess.stderr.on('data', (data) => {\n onError(data.toString().trim());\n });\n\n childProcess.on('error', (error) => {\n reject(new Error(`Failed to start process: ${error.message}`));\n });\n\n childProcess.on('close', (code) => {\n if (code === 0) {\n resolve();\n } else {\n reject(new Error(`Process exited with code ${code}`));\n }\n });\n });\n}\n","import { findConfig, parseConfig } from '@gigadrive/network-config';\nimport { Command } from 'commander';\nimport { log } from 'console';\nimport { debug } from '../../../util/log';\n\nexport const config = (parent: Command) => {\n parent\n .command('config')\n .description('Provide debug info about the project configuration in the current directory')\n .action(async () => {\n const configPath = findConfig(process.cwd());\n\n if (!configPath) {\n debug('No config file found');\n throw new Error('The current project folder does not have a valid config file.');\n }\n\n const config = await parseConfig(configPath, process.cwd());\n\n log(`Config file found at: ${configPath}`);\n log(JSON.stringify(config, null, 2));\n });\n};\n","import { createConsola } from 'consola';\n\nlet verbose: boolean = false;\n\n// Create a custom consola instance that can be updated with verbose settings\nconst consola = createConsola({\n level: verbose ? 4 : 3, // 4 includes debug messages, 3 is the default (info and above)\n formatOptions: {\n colors: true,\n },\n});\n\n// Update the consola instance when verbose setting changes\nconst updateConsola = () => {\n consola.level = verbose ? 4 : 3;\n};\n\nexport const setVerbose = (value: boolean) => {\n verbose = value;\n updateConsola();\n};\n\nexport const isVerbose = () => verbose;\n\nexport const log = (message: any) => {\n consola.info(message);\n};\n\nexport const error = (message: any) => {\n consola.error(message);\n};\n\nexport const success = (message: any) => {\n consola.success(message);\n};\n\nexport const warn = (message: any) => {\n consola.warn(message);\n};\n\nexport const debug = (message?: any, ...optionalParams: any[]) => {\n if (!verbose) {\n return;\n }\n\n consola.debug('[DEBUG]', message, ...optionalParams);\n};\n\nexport const spinner = (message: any) => {\n //render(<Spinner label={message} />);\n log(message);\n};\n","import type { Command } from 'commander';\nimport { config } from './config';\n\nexport const debug = (program: Command) => {\n const debug = program.command('debug').description('Provides various debugging utilities');\n\n // register subcommands\n config(debug);\n};\n","import { formatFileSize, objectToQueryString } from '@gigadrive/commons';\nimport type { NormalizedConfig } from '@gigadrive/network-config';\nimport { findConfig, parseConfig } from '@gigadrive/network-config';\nimport type { Command } from 'commander';\nimport fs from 'fs';\nimport os from 'os';\nimport path from 'path';\nimport { debug, error, log, spinner, success, warn } from '../../../util/log';\nimport { createZipArchive } from '../../../util/zip';\n\nexport const deploy = (parent: Command) => {\n parent\n .command('deploy')\n .description('Deploy the current project')\n .action(async () => {\n debug('Starting deploy command');\n const configPath = findConfig(process.cwd());\n\n if (!configPath) {\n debug('No config file found');\n throw new Error('The current project folder does not have a valid config file.');\n }\n\n debug(`Found config at: ${configPath}`);\n const config = await parseConfig(configPath, process.cwd());\n debug('Parsed config', config);\n\n if (config.warnings.length > 0) {\n debug(`Found ${config.warnings.length} warnings in config`);\n config.warnings.forEach((message) => {\n warn(message);\n });\n }\n\n if (config.errors.length > 0) {\n debug(`Found ${config.errors.length} errors in config`);\n config.errors.forEach((message) => {\n error(message);\n });\n\n throw new Error('The current project folder does not have a valid config file.');\n }\n\n debug('Creating deployment');\n const deploymentId = await createDeployment({\n applicationId: 'test', // TODO\n });\n\n debug(`Deployment ID: ${deploymentId}`);\n\n debug('Starting deployment process');\n await handleDeployment(deploymentId, config);\n });\n};\n\nconst handleDeployment = async (deploymentId: string, config: NormalizedConfig) => {\n debug('Deployment process initialized');\n let status: DeploymentStatus = 'PENDING';\n const logs: DeploymentLog[] = [];\n\n // Log deployment ID\n addLog('Deployment ID: ' + deploymentId, 'INFO', logs);\n\n // Start upload\n try {\n debug('Starting upload process');\n await uploadArchive(deploymentId, logs, config);\n debug('Upload completed successfully');\n addLog('Upload complete.', 'INFO', logs);\n addLog('The deployment pipeline is now being provisioned. This may take a few seconds.', 'INFO', logs);\n } catch (err) {\n debug(`Upload failed with error: ${(err as Error).message}`);\n addLog(`Upload failed: ${(err as Error).message}`, 'ERROR', logs);\n status = 'FAILED';\n error('The deployment failed. Please check the logs for more information.');\n process.exit(1);\n }\n\n // Start status polling\n const statusInterval = setInterval(async () => {\n try {\n debug(`Fetching deployment status for ${deploymentId}`);\n const newStatus = await getDeploymentStatus(deploymentId);\n debug(`Current status: ${status}, New status: ${newStatus}`);\n\n if (newStatus === 'ACTIVE' || newStatus === 'FAILED') {\n debug(`Final status reached: ${newStatus}, clearing interval`);\n clearInterval(statusInterval);\n clearInterval(logsInterval);\n\n if (newStatus === 'ACTIVE') {\n success(`Deployed to https://${deploymentId}.gigadrivedev.com`);\n } else {\n error('The deployment failed. Please check the logs for more information.');\n }\n\n return;\n }\n\n if (newStatus !== status) {\n debug(`Updating status from ${status} to ${newStatus}`);\n status = newStatus;\n spinner(`Status: ${status.toLowerCase().replace(/^\\w/, (c) => c.toUpperCase())}`);\n }\n } catch (err) {\n debug(`Error fetching status: ${(err as Error).message}`);\n }\n }, 1000);\n\n // Start logs polling\n const logsInterval = setInterval(async () => {\n try {\n debug(`Fetching logs for ${deploymentId}, current log count: ${logs.length}`);\n const newLogs = await getLogs(deploymentId, {\n offset: logs.length,\n limit: 100,\n 'createdAt[gt]': logs[logs.length - 1]?.createdAt,\n });\n\n debug(`Fetched ${newLogs.items.length} new logs`);\n\n // Display new logs\n for (const logEntry of newLogs.items) {\n logs.push(logEntry);\n\n if (logEntry.type === 'ERROR') {\n error(logEntry.message);\n } else if (logEntry.type === 'WARN') {\n warn(logEntry.message);\n } else {\n log(logEntry.message);\n }\n }\n } catch (err) {\n debug(`Error fetching logs: ${(err as Error).message}`);\n }\n }, 1000);\n\n // Initial status display\n spinner(`Status: ${status.toLowerCase().replace(/^\\w/, (c) => c.toUpperCase())}`);\n};\n\nconst addLog = (message: string, type: 'INFO' | 'ERROR' | 'WARN', logs: DeploymentLog[]) => {\n debug(`Adding log: [${type}] ${message}`);\n logs.push({\n id: String(logs.length),\n message,\n type,\n createdAt: new Date().toISOString(),\n });\n\n if (type === 'ERROR') {\n error(message);\n } else if (type === 'WARN') {\n warn(message);\n } else {\n log(message);\n }\n};\n\nconst uploadArchive = async (deploymentId: string, logs: DeploymentLog[], config: NormalizedConfig) => {\n debug('Starting uploadArchive');\n addLog('Creating archive...', 'INFO', logs);\n\n const archivePath = path.join(process.env.TEMP || os.tmpdir(), `project-${Date.now()}.zip`);\n debug(`Archive path: ${archivePath}`);\n\n if (fs.existsSync(archivePath)) {\n debug(`Archive already exists, removing: ${archivePath}`);\n fs.unlinkSync(archivePath);\n }\n\n debug('Creating zip archive');\n\n await createZipArchive(config.userArchive?.rootOverwrite || process.cwd(), archivePath, {\n whitelist: config.userArchive?.fileWhitelist,\n useIgnoreFiles: false,\n useManagedIgnore: false,\n });\n\n const fileStats = fs.statSync(archivePath);\n const fileSize = fileStats.size;\n debug(`Archive created, size: ${fileSize} bytes (${formatFileSize(fileSize)})`);\n\n addLog(`Archive created (${formatFileSize(fileSize)})`, 'INFO', logs);\n\n addLog('Uploading archive...', 'INFO', logs);\n\n debug(`Starting multipart upload for deployment: ${deploymentId}`);\n const uploadId = await startMultipartUpload(deploymentId);\n\n debug(`Upload ID: ${uploadId}`);\n\n debug('Uploading archive...');\n\n const fileChunkSize = 10 * 1024 * 1024; // 10 MB\n const numChunks = Math.ceil(fileSize / fileChunkSize);\n debug(`File size: ${fileSize}, chunk size: ${fileChunkSize}, number of chunks: ${numChunks}`);\n\n const promises = [];\n let start: number, end: number;\n\n for (let index = 1; index < numChunks + 1; index++) {\n start = (index - 1) * fileChunkSize;\n end = index * fileChunkSize;\n debug(`Processing chunk ${index}/${numChunks}, start: ${start}, end: ${end}`);\n\n const presignedUrl = await getPresignedUrl(deploymentId, uploadId, index);\n debug('Presigned URL for part', index, presignedUrl);\n\n const promise = new Promise<Response>(async (resolve, reject) => {\n try {\n debug(`Reading chunk ${index} data`);\n const readStream = fs.createReadStream(archivePath, {\n start,\n end: index < numChunks ? end - 1 : undefined,\n });\n\n const chunks: Buffer[] = [];\n readStream.on('data', (chunk: Buffer | string) => {\n chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk);\n });\n\n await new Promise<void>((resolveRead) => {\n readStream.on('end', () => resolveRead());\n readStream.on('error', reject);\n });\n\n const buffer = Buffer.concat(chunks);\n\n debug(`Uploading chunk ${index} to presigned URL (${buffer.length} bytes)`);\n const response = await fetch(presignedUrl, {\n method: 'PUT',\n headers: {\n 'Content-Type': 'application/zip',\n 'Content-Length': String(buffer.length),\n },\n body: buffer,\n });\n resolve(response);\n } catch (err) {\n reject(err);\n }\n });\n\n promises.push(promise);\n }\n\n const finishedParts: { partNumber: number; etag: string }[] = [];\n\n try {\n debug(`Waiting for all ${promises.length} upload promises to complete`);\n const responses = await Promise.all(promises);\n debug('All upload promises completed');\n\n for (let index = 0; index < responses.length; index++) {\n const res = responses[index];\n debug(`Checking response for part ${index + 1}, status: ${res.status}`);\n\n if (!res.ok) {\n debug(`Failed to upload part ${index + 1}: ${res.statusText} ${await res.text()}`);\n throw new Error(`Failed to upload part ${index + 1}: ${res.statusText}`);\n }\n\n const etag = res.headers.get('ETag');\n if (!etag) {\n debug(`Failed to get ETag for part ${index + 1}`);\n throw new Error(`Failed to get ETag for part ${index + 1}`);\n }\n\n debug(`Part ${index + 1} uploaded successfully, ETag: ${etag}`);\n finishedParts.push({\n partNumber: index + 1,\n etag: etag,\n });\n }\n\n debug(`Completing upload with ${finishedParts.length} parts`);\n await completeUpload(deploymentId, uploadId, finishedParts);\n debug('Upload completed successfully');\n } catch (err) {\n const error = err as Error;\n debug(`Upload error: ${error.message}`);\n addLog(`Upload error: ${error.message}`, 'ERROR', logs);\n throw error;\n }\n};\n\nconst createDeployment = async ({ applicationId }: { applicationId: string }) => {\n debug(`Creating deployment for application: ${applicationId}`);\n const res = await fetch(`http://localhost:3000/${applicationId}/deployments`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({}),\n duplex: 'half',\n });\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to create deployment: ${errorText}`);\n throw new Error('Failed to create deployment: ' + errorText);\n }\n\n const deployment = (await res.json()) as { id: string };\n debug(`Deployment created with ID: ${deployment.id}`);\n\n return deployment.id as string;\n};\n\nconst startMultipartUpload = async (deploymentId: string) => {\n debug(`Starting multipart upload for deployment: ${deploymentId}`);\n const res = await fetch(`http://localhost:3000/deployments/${deploymentId}/pre-signed-url/start`, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to start multipart upload: ${errorText}`);\n throw new Error('Failed to start multipart upload: ' + errorText);\n }\n\n const upload = (await res.json()) as { uploadId: string };\n debug(`Multipart upload started with ID: ${upload.uploadId}`);\n\n return upload.uploadId as string;\n};\n\nconst getPresignedUrl = async (deploymentId: string, uploadId: string, partNumber: number) => {\n debug(`Getting presigned URL for deployment: ${deploymentId}, upload: ${uploadId}, part: ${partNumber}`);\n const res = await fetch(\n `http://localhost:3000/deployments/${deploymentId}/pre-signed-url/part?uploadId=${uploadId}&partNumber=${partNumber}`,\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n }\n );\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to get pre-signed URL: ${errorText}`);\n throw new Error('Failed to get pre-signed URL: ' + errorText);\n }\n\n const upload = (await res.json()) as { url: string };\n debug(`Got presigned URL for part ${partNumber}`);\n\n return upload.url as string;\n};\n\nconst completeUpload = async (\n deploymentId: string,\n uploadId: string,\n parts: { partNumber: number; etag: string }[]\n) => {\n debug(`Completing upload for deployment: ${deploymentId}, upload: ${uploadId}, parts: ${parts.length}`);\n const res = await fetch(`http://localhost:3000/deployments/${deploymentId}/pre-signed-url/complete`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n uploadId,\n parts,\n }),\n duplex: 'half',\n });\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to complete upload: ${errorText}`);\n throw new Error('Failed to complete upload: ' + errorText);\n }\n\n debug('Upload completed successfully');\n};\n\nconst getDeploymentStatus = async (deploymentId: string) => {\n debug(`Getting deployment status for: ${deploymentId}`);\n const res = await fetch(`http://localhost:3000/deployments/${deploymentId}`, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to get deployment status: ${errorText}`);\n throw new Error('Failed to get deployment status: ' + errorText);\n }\n\n const deployment = (await res.json()) as { status: DeploymentStatus };\n debug(`Deployment status: ${deployment.status}`);\n\n return deployment.status as DeploymentStatus;\n};\n\nconst getLogs = async (\n deploymentId: string,\n options?: {\n offset: number;\n limit: number;\n 'createdAt[gt]'?: string;\n }\n) => {\n debug(`Getting logs for deployment: ${deploymentId}, options:`, options);\n const res = await fetch(`http://localhost:3000/deployments/${deploymentId}/logs${objectToQueryString(options)}`, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to get logs: ${errorText}`);\n throw new Error('Failed to get logs: ' + errorText);\n }\n\n const logs = (await res.json()) as {\n totalItems: number;\n limit: number;\n offset: number;\n items: DeploymentLog[];\n };\n\n debug(`Got ${logs.items.length} logs, total: ${logs.totalItems}`);\n return logs;\n};\n\ntype DeploymentStatus = 'PENDING' | 'BUILDING' | 'PROVISIONING' | 'FAILED' | 'ACTIVE' | 'SUSPENDED';\n\ntype DeploymentLog = { id: string; message: string; type: 'INFO' | 'ERROR' | 'WARN'; createdAt: string };\n","import { getFilesForPattern } from '@gigadrive/build-utils';\nimport archiver from 'archiver';\nimport fs from 'fs';\nimport ignore, { type Ignore } from 'ignore';\nimport path from 'path';\n\nconst ignoreFileNames = [/*'.gitignore', */ '.gigadriveignore', '.vercelignore', '.dockerignore', '.nowignore'];\n\n// Function to read and parse the ignore file\nfunction readIgnoreFile(ignorePath: string) {\n if (fs.existsSync(ignorePath)) {\n return fs\n .readFileSync(ignorePath, 'utf8')\n .split('\\n')\n .filter((line) => line.trim() !== '');\n }\n return [];\n}\n\n// Collect ignore patterns from the given directory (including the root)\nfunction collectIgnorePatterns(dir: string, baseDir: string, ignoreRules: Ignore) {\n const items = fs.readdirSync(dir);\n\n items.forEach((item) => {\n const fullPath = path.join(dir, item);\n const relativePath = path.relative(baseDir, fullPath);\n const stat = fs.lstatSync(fullPath);\n\n if (stat.isDirectory()) {\n // If the directory itself is ignored, skip it unless it has a negation rule\n if (ignoreRules.ignores(`${relativePath}/`)) {\n return;\n }\n\n // Check if the directory contains an ignore file\n ignoreFileNames.forEach((ignoreFileName) => {\n const ignoreFilePath = path.join(fullPath, ignoreFileName);\n if (fs.existsSync(ignoreFilePath)) {\n const patterns = readIgnoreFile(ignoreFilePath).map((pattern) => {\n return pattern.startsWith('!')\n ? `!${path.join(relativePath, pattern.slice(1))}`\n : path.join(relativePath, pattern);\n });\n ignoreRules.add(patterns);\n }\n });\n\n // Recurse into subdirectory\n collectIgnorePatterns(fullPath, baseDir, ignoreRules);\n }\n });\n}\n\n// Function to initialize ignore rules including root-level ignore files\nfunction initializeIgnoreRules(baseDir: string): Ignore {\n const ignoreRules = ignore();\n\n // Add default ignore rules\n ignoreRules.add(['.git/', '**/.DS_Store', '**/Thumbs.db']);\n\n // Process root-level ignore files\n ignoreFileNames.forEach((ignoreFileName) => {\n const ignoreFilePath = path.join(baseDir, ignoreFileName);\n if (fs.existsSync(ignoreFilePath)) {\n const patterns = readIgnoreFile(ignoreFilePath).map((pattern) => {\n return pattern.startsWith('!') ? `!${pattern.slice(1)}` : pattern;\n });\n ignoreRules.add(patterns);\n }\n });\n\n // Recursively process all subdirectories to gather additional ignore patterns\n collectIgnorePatterns(baseDir, baseDir, ignoreRules);\n\n return ignoreRules;\n}\n\n// Function to get all files and directories, excluding those in the ignore list\nasync function getFilesToInclude(dir: string, ignoreRules: Ignore, whitelist?: string[]) {\n const filesToInclude: string[] = [];\n\n function walkSync(currentDir: string) {\n const items = fs.readdirSync(currentDir);\n\n items.forEach((item) => {\n const fullPath = path.join(currentDir, item);\n const relativePath = path.relative(dir, fullPath);\n const stat = fs.lstatSync(fullPath);\n\n if (stat.isDirectory()) {\n if (ignoreRules.ignores(`${relativePath}/`)) {\n //console.debug(`Ignoring directory: ${relativePath}/`);\n return;\n }\n walkSync(fullPath);\n } else {\n if (!ignoreRules.ignores(relativePath)) {\n filesToInclude.push(fullPath);\n } else if (ignoreRules.ignores(relativePath) && ignoreRules.test(relativePath).unignored) {\n // Handle whitelisted files that were previously ignored\n filesToInclude.push(fullPath);\n } else {\n //console.debug(`Ignoring file: ${relativePath}`);\n }\n }\n });\n }\n\n walkSync(dir);\n return filesToInclude;\n}\n\n// Function to create the zip archive\nexport async function createZipArchive(\n inputDir: string,\n outputFile: string,\n options: {\n whitelist?: string[];\n useIgnoreFiles?: boolean;\n useManagedIgnore?: boolean;\n } = {}\n) {\n const ignoreRules = options.useIgnoreFiles !== false ? initializeIgnoreRules(inputDir) : ignore();\n\n // Get list of files to include in the zip\n const filesToInclude = options.whitelist\n ? await Promise.all(options.whitelist.map((file) => getFilesForPattern(inputDir, file)))\n : await getFilesToInclude(inputDir, ignoreRules);\n\n // Create zip file\n const output = fs.createWriteStream(outputFile);\n const archive = archiver('zip', { zlib: { level: 9 } });\n\n return new Promise<void>((resolve, reject) => {\n output.on('close', () => resolve());\n archive.on('error', reject);\n\n archive.pipe(output);\n\n // Add files to the archive\n filesToInclude.forEach((file) => {\n archive.file(file, { name: path.relative(inputDir, file) });\n });\n\n archive.finalize();\n });\n}\n","import type { Command } from 'commander';\nimport { deploy } from './deploy';\n\nexport const platform = (program: Command) => {\n const platform = program.command('platform').description('Manage the platform');\n\n // register subcommands\n deploy(platform);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uBAAwB;;;ACAxB,yBAAqB;AAErB,IAAAA,aAAe;AACf,IAAAC,eAAiB;;;ACHjB,gBAAe;AACf,kBAAiB;;;ACDjB,2BAAsB;AAqCtB,eAAsB,KAAK;AAAA,EACzB;AAAA,EACA,MAAM,QAAQ,IAAI;AAAA,EAClB;AAAA,EACA,WAAW,CAAC,SAAiB,QAAQ,IAAI,IAAI;AAAA,EAC7C,UAAU,CAAC,SAAiB,QAAQ,MAAM,IAAI;AAChD,GAA+B;AAC7B,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,QAAI;AACJ,QAAI,YAAsB,CAAC;AAE3B,QAAI,OAAO,YAAY,UAAU;AAE/B,YAAM,QAAQ,QAAQ,MAAM,GAAG;AAC/B,qBAAe,MAAM,CAAC;AACtB,kBAAY,MAAM,MAAM,CAAC;AAAA,IAC3B,OAAO;AAEL,qBAAe,Q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BAAoB;AAAA,IAC1B;AAAA,EACF,CAAC;AAED,UAAQ,KAAK,aAAa,CAAC,gBAAgB;AACzC,eAAY,YAAY,KAAK,EAAE,YAAwB,IAAI;AAAA,EAC7D,CAAC;AAGD,WAAS,OAAO;AAChB,EAAAC,OAAM,OAAO;AACb,QAAM,OAAO;AAEb,MAAI;AACF,UAAM,QAAQ,WAAW,QAAQ,IAAI;AAAA,EACvC,SAAS,KAAK;AACZ,UAAM,GAAG;AACT,eAAW;AAAA,EACb;AAEA,SAAO;AACT;AAEA,IAAM,kBAAkB,OAAO,QAAa;AAC1C,MAAI,KAAK;AACP,QAAI,eAAe,OAAO;AACxB,YAAM,iBAAiB,GAAG;AAAA,IAC5B,OAAO;AAEL,cAAQ,MAAM;AAAA,IAAuC,GAAG,EAAE;AAAA,IAC5D;AAAA,EACF,OAAO;AACL,YAAQ,MAAM,wCAAwC;AAAA,EACxD;AAEA,UAAQ,KAAK,CAAC;AAChB;AAEA,IAAM,mBAAmB,CAACC,WAAiB;AACzC,QAAM,EAAE,QAAQ,IAAIA;AAEpB,UAAQ,MAAM;AAAA,IAAmC,OAAO,EAAE;AAE1D,UAAQ,KAAK,CAAC;AAChB;AAEA,QAAQ,GAAG,sBAAsB,eAAe;AAChD,QAAQ,GAAG,qBAAqB,gBAAgB;AAEhD,QAAQ,GAAG,QAAQ,MAAM;AACvB,QAAM,WAAW,QAAQ,OAAO,QAAQ,QAAQ,SAAS,QAAQ,OAAO,QAAQ,QAAQ,SAAS;AACjG,YAAU,MAAM,WAAa;AAC/B,CAAC;AAED,KAAK,EACF,KAAK,OAAO,aAAa;AACxB,UAAQ,WAAW;AACrB,CAAC,EACA,MAAM,gBAAgB;","names":["import_fs","import_path","error","path","fs","path","fs","config","debug","import_network_config","import_fs","import_path","import_build_utils","import_fs","import_path","fs","path","ignore","archiver","config","path","os","fs","error","platform","debug","error"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/commands/build/index.ts","../src/util/pm.ts","../../build-utils/src/exec.ts","../src/commands/debug/config/index.ts","../src/util/log.ts","../src/commands/debug/index.ts","../src/commands/platform/deploy/index.ts","../src/util/zip.ts","../src/commands/platform/index.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { build } from './commands/build';\nimport { debug } from './commands/debug';\nimport { platform } from './commands/platform';\nimport { error, log, setVerbose } from './util/log';\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nlet { isTTY } = process.stdout;\n//process.stdin.resume();\n\nconst main = async () => {\n if (process.env.FORCE_TTY === '1') {\n isTTY = true;\n process.stdout.isTTY = true;\n process.stdin.isTTY = true;\n }\n\n let exitCode = 0;\n\n const program = new Command();\n\n program.option('-v, --verbose', 'Enable verbose logging', false);\n\n program.hook('preSubcommand', (thisCommand) => {\n setVerbose((thisCommand.opts().verbose as boolean) === true);\n\n if (thisCommand.opts().verbose) {\n log('Using verbose mode');\n }\n });\n\n program.hook('preAction', (thisCommand) => {\n setVerbose((thisCommand.opts().verbose as boolean) === true);\n });\n\n // register commands\n platform(program);\n debug(program);\n build(program);\n\n try {\n await program.parseAsync(process.argv);\n } catch (err) {\n error(err as string | number | boolean | object);\n exitCode = 1;\n }\n\n return exitCode;\n};\n\nconst handleRejection = (err: unknown) => {\n if (err) {\n if (err instanceof Error) {\n handleUnexpected(err);\n } else {\n console.error(`An unexpected rejection occurred\\n ${JSON.stringify(err)}`);\n }\n } else {\n console.error('An unexpected empty rejection occurred');\n }\n\n process.exit(1);\n};\n\nconst handleUnexpected = (error: Error) => {\n const { message } = error;\n\n console.error(`An unexpected error occurred\\n ${message}`);\n\n process.exit(1);\n};\n\nprocess.on('unhandledRejection', handleRejection);\nprocess.on('uncaughtException', handleUnexpected);\n\nprocess.on('exit', () => {\n const terminal = process.stderr.isTTY ? process.stderr : process.stdout.isTTY ? process.stdout : undefined;\n terminal?.write('\\u001B[?25h');\n});\n\nmain()\n .then((exitCode) => {\n process.exitCode = exitCode;\n })\n .catch(handleUnexpected);\n","import { exec } from '@gigadrive/build-utils';\nimport type { Command } from 'commander';\nimport fs from 'fs';\nimport path from 'path';\nimport { buildCommand, getPackageManager, installCommand } from '../../util/pm';\n\nexport const build = (parent: Command) => {\n parent\n .command('build')\n .description('Build the current project')\n .action(async () => {\n // Set relevant environment variables\n const env = {\n ...process.env,\n NODE_ENV: 'production',\n NEBULA: '1',\n VERCEL: '1', // Vercel compatibility\n NOW_BUILDER: '1',\n };\n\n const cwd = process.cwd();\n\n const packageJsonPath = path.join(cwd, 'package.json');\n\n if (!fs.existsSync(packageJsonPath)) {\n console.log('No package.json found');\n return;\n }\n\n // Read package.json and check for build scripts\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));\n\n const buildScript = packageJson.scripts?.build;\n\n // If build script is not defined, return null\n if (!buildScript) {\n console.log('No build script found in package.json');\n return;\n }\n\n const packageManager = await getPackageManager({ cwd });\n\n if (!packageManager) {\n console.log('No package manager found');\n return;\n }\n\n await exec({\n command: installCommand(packageManager),\n cwd,\n env,\n onOutput: (chunk) => {\n console.log(chunk);\n },\n });\n\n await exec({\n command: buildCommand(packageManager),\n cwd,\n env,\n onOutput: (chunk) => {\n console.log(chunk);\n },\n });\n });\n};\n","import fs from 'fs';\nimport path from 'path';\nimport { exec } from '../../../build-utils/src/exec';\n\nexport type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';\n\n/**\n * Detects the package manager to use for a specific directory\n */\nexport const getPackageManager = async ({ cwd }: { cwd: string }): Promise<PackageManager | null> => {\n // check if package.json exists\n const packageJsonPath = path.join(cwd, 'package.json');\n\n // If package.json does not exist, return null\n if (!fs.existsSync(packageJsonPath)) {\n return null;\n }\n\n // Check if yarn lock exists\n if (fs.existsSync(path.join(cwd, 'yarn.lock'))) {\n return 'yarn';\n }\n\n // Check if pnpm lock exists\n if (fs.existsSync(path.join(cwd, 'pnpm-lock.yaml'))) {\n return 'pnpm';\n }\n\n // Check if bun lock exists\n if (fs.existsSync(path.join(cwd, 'bun.lockb'))) {\n return 'bun';\n }\n\n // Check if pnpm lock exists\n if (fs.existsSync(path.join(cwd, 'package-lock.json'))) {\n return 'npm';\n }\n\n // Check if bun is installed\n try {\n await exec({ command: 'bun --version', cwd });\n return 'bun';\n } catch {\n // If bun is not installed, return npm\n return 'npm';\n }\n};\n\nexport const installCommand = (pm: PackageManager) => {\n return (\n {\n bun: 'bun install',\n npm: 'npm install',\n pnpm: 'pnpm install',\n yarn: 'yarn install',\n }[pm] || 'npm install'\n );\n};\n\nexport const buildCommand = (pm: PackageManager) => {\n return (\n {\n bun: 'bun run build',\n npm: 'npm run build',\n pnpm: 'pnpm build',\n yarn: 'yarn build',\n }[pm] || 'npm run build'\n );\n};\n","import { spawn } from 'child_process';\n\ntype CommandInput = string | { command: string; args?: string[] };\n\ninterface ExecOptions {\n /**\n * The command to execute.\n */\n command: CommandInput;\n\n /**\n * The working directory for the command.\n */\n cwd?: string;\n\n /**\n * Environment variables for the command.\n * Does not include the current process's environment variables by default.\n */\n env?: Record<string, string>;\n\n /**\n * Callback for handling output from the command (stdout).\n */\n onOutput?: (data: string) => void;\n\n /**\n * Callback for handling errors from the command (stderr).\n */\n onError?: (data: string) => void;\n}\n\n/**\n * Executes a command asynchronously in a child process\n * @param options Configuration options for executing the process\n * @returns Promise that resolves when the process completes\n */\nexport async function exec({\n command,\n cwd = process.cwd(),\n env,\n onOutput = (data: string) => console.log(data),\n onError = (data: string) => console.error(data),\n}: ExecOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n let spawnCommand: string;\n let spawnArgs: string[] = [];\n\n if (typeof command === 'string') {\n // For string input, first argument is the command, rest are args\n const parts = command.split(' ');\n spawnCommand = parts[0];\n spawnArgs = parts.slice(1);\n } else {\n // For object input, use command and args properties\n spawnCommand = command.command;\n spawnArgs = command.args || [];\n }\n\n const childProcess = spawn(spawnCommand, spawnArgs, {\n cwd,\n shell: true,\n env,\n });\n\n childProcess.stdout.on('data', (data) => {\n onOutput(data.toString().trim());\n });\n\n childProcess.stderr.on('data', (data) => {\n onError(data.toString().trim());\n });\n\n childProcess.on('error', (error) => {\n reject(new Error(`Failed to start process: ${error.message}`));\n });\n\n childProcess.on('close', (code) => {\n if (code === 0) {\n resolve();\n } else {\n reject(new Error(`Process exited with code ${code}`));\n }\n });\n });\n}\n","import { findConfig, parseConfig } from '@gigadrive/network-config';\nimport { Command } from 'commander';\nimport { log } from 'console';\nimport { debug } from '../../../util/log';\n\nexport const config = (parent: Command) => {\n parent\n .command('config')\n .description('Provide debug info about the project configuration in the current directory')\n .action(async () => {\n const configPath = findConfig(process.cwd());\n\n if (!configPath) {\n debug('No config file found');\n throw new Error('The current project folder does not have a valid config file.');\n }\n\n const config = await parseConfig(configPath, process.cwd());\n\n log(`Config file found at: ${configPath}`);\n log(JSON.stringify(config, null, 2));\n });\n};\n","import { createConsola } from 'consola';\n\nlet verbose: boolean = false;\n\n// Create a custom consola instance that can be updated with verbose settings\nconst consola = createConsola({\n level: verbose ? 4 : 3, // 4 includes debug messages, 3 is the default (info and above)\n formatOptions: {\n colors: true,\n },\n});\n\n// Update the consola instance when verbose setting changes\nconst updateConsola = () => {\n consola.level = verbose ? 4 : 3;\n};\n\nexport const setVerbose = (value: boolean) => {\n verbose = value;\n updateConsola();\n};\n\nexport const isVerbose = () => verbose;\n\nexport const log = (message: string | number | boolean | object) => {\n consola.info(message);\n};\n\nexport const error = (message: string | number | boolean | object) => {\n consola.error(message);\n};\n\nexport const success = (message: string | number | boolean | object) => {\n consola.success(message);\n};\n\nexport const warn = (message: string | number | boolean | object) => {\n consola.warn(message);\n};\n\nexport const debug = (\n message?: string | number | boolean | object,\n ...optionalParams: (string | number | boolean | object)[]\n) => {\n if (!verbose) {\n return;\n }\n\n consola.debug('[DEBUG]', message, ...optionalParams);\n};\n\nexport const spinner = (message: string | number | boolean | object) => {\n //render(<Spinner label={message} />);\n log(message);\n};\n","import type { Command } from 'commander';\nimport { config } from './config';\n\nexport const debug = (program: Command) => {\n const debug = program.command('debug').description('Provides various debugging utilities');\n\n // register subcommands\n config(debug);\n};\n","import { formatFileSize, objectToQueryString } from '@gigadrive/commons';\nimport type { NormalizedConfig } from '@gigadrive/network-config';\nimport { findConfig, parseConfig } from '@gigadrive/network-config';\nimport type { Command } from 'commander';\nimport fs from 'fs';\nimport os from 'os';\nimport path from 'path';\nimport { debug, error, log, spinner, success, warn } from '../../../util/log';\nimport { createZipArchive } from '../../../util/zip';\n\nexport const deploy = (parent: Command) => {\n parent\n .command('deploy')\n .description('Deploy the current project')\n .action(async () => {\n debug('Starting deploy command');\n const configPath = findConfig(process.cwd());\n\n if (!configPath) {\n debug('No config file found');\n throw new Error('The current project folder does not have a valid config file.');\n }\n\n debug(`Found config at: ${configPath}`);\n const config = await parseConfig(configPath, process.cwd());\n debug('Parsed config', config);\n\n if (config.warnings.length > 0) {\n debug(`Found ${config.warnings.length} warnings in config`);\n config.warnings.forEach((message) => {\n warn(message);\n });\n }\n\n if (config.errors.length > 0) {\n debug(`Found ${config.errors.length} errors in config`);\n config.errors.forEach((message) => {\n error(message);\n });\n\n throw new Error('The current project folder does not have a valid config file.');\n }\n\n debug('Creating deployment');\n const deploymentId = await createDeployment({\n applicationId: 'test', // TODO\n });\n\n debug(`Deployment ID: ${deploymentId}`);\n\n debug('Starting deployment process');\n await handleDeployment(deploymentId, config);\n });\n};\n\nconst handleDeployment = async (deploymentId: string, config: NormalizedConfig) => {\n debug('Deployment process initialized');\n let status: DeploymentStatus = 'PENDING';\n const logs: DeploymentLog[] = [];\n\n // Log deployment ID\n addLog('Deployment ID: ' + deploymentId, 'INFO', logs);\n\n // Start upload\n try {\n debug('Starting upload process');\n await uploadArchive(deploymentId, logs, config);\n debug('Upload completed successfully');\n addLog('Upload complete.', 'INFO', logs);\n addLog('The deployment pipeline is now being provisioned. This may take a few seconds.', 'INFO', logs);\n } catch (err) {\n debug(`Upload failed with error: ${(err as Error).message}`);\n addLog(`Upload failed: ${(err as Error).message}`, 'ERROR', logs);\n status = 'FAILED';\n error('The deployment failed. Please check the logs for more information.');\n process.exit(1);\n }\n\n // Start status polling\n const statusInterval = setInterval(() => {\n void (async () => {\n try {\n debug(`Fetching deployment status for ${deploymentId}`);\n const newStatus = await getDeploymentStatus(deploymentId);\n debug(`Current status: ${status}, New status: ${newStatus}`);\n\n if (newStatus === 'ACTIVE' || newStatus === 'FAILED') {\n debug(`Final status reached: ${newStatus}, clearing interval`);\n clearInterval(statusInterval);\n clearInterval(logsInterval);\n\n if (newStatus === 'ACTIVE') {\n success(`Deployed to https://${deploymentId}.gigadrivedev.com`);\n } else {\n error('The deployment failed. Please check the logs for more information.');\n }\n\n return;\n }\n\n if (newStatus !== status) {\n debug(`Updating status from ${status} to ${newStatus}`);\n status = newStatus;\n spinner(`Status: ${status.toLowerCase().replace(/^\\w/, (c) => c.toUpperCase())}`);\n }\n } catch (err) {\n debug(`Error fetching status: ${(err as Error).message}`);\n }\n })();\n }, 1000);\n\n // Start logs polling\n const logsInterval = setInterval(() => {\n void (async () => {\n try {\n debug(`Fetching logs for ${deploymentId}, current log count: ${logs.length}`);\n const newLogs = await getLogs(deploymentId, {\n offset: logs.length,\n limit: 100,\n 'createdAt[gt]': logs[logs.length - 1]?.createdAt,\n });\n\n debug(`Fetched ${newLogs.items.length} new logs`);\n\n // Display new logs\n for (const logEntry of newLogs.items) {\n logs.push(logEntry);\n\n if (logEntry.type === 'ERROR') {\n error(logEntry.message);\n } else if (logEntry.type === 'WARN') {\n warn(logEntry.message);\n } else {\n log(logEntry.message);\n }\n }\n } catch (err) {\n debug(`Error fetching logs: ${(err as Error).message}`);\n }\n })();\n }, 1000);\n\n // Initial status display\n spinner(`Status: ${status.toLowerCase().replace(/^\\w/, (c) => c.toUpperCase())}`);\n};\n\nconst addLog = (message: string, type: 'INFO' | 'ERROR' | 'WARN', logs: DeploymentLog[]) => {\n debug(`Adding log: [${type}] ${message}`);\n logs.push({\n id: String(logs.length),\n message,\n type,\n createdAt: new Date().toISOString(),\n });\n\n if (type === 'ERROR') {\n error(message);\n } else if (type === 'WARN') {\n warn(message);\n } else {\n log(message);\n }\n};\n\nconst uploadArchive = async (deploymentId: string, logs: DeploymentLog[], config: NormalizedConfig) => {\n debug('Starting uploadArchive');\n addLog('Creating archive...', 'INFO', logs);\n\n const archivePath = path.join(process.env.TEMP || os.tmpdir(), `project-${Date.now()}.zip`);\n debug(`Archive path: ${archivePath}`);\n\n if (fs.existsSync(archivePath)) {\n debug(`Archive already exists, removing: ${archivePath}`);\n fs.unlinkSync(archivePath);\n }\n\n debug('Creating zip archive');\n\n await createZipArchive(config.userArchive?.rootOverwrite || process.cwd(), archivePath, {\n whitelist: config.userArchive?.fileWhitelist,\n useIgnoreFiles: false,\n useManagedIgnore: false,\n });\n\n const fileStats = fs.statSync(archivePath);\n const fileSize = fileStats.size;\n debug(`Archive created, size: ${fileSize} bytes (${formatFileSize(fileSize)})`);\n\n addLog(`Archive created (${formatFileSize(fileSize)})`, 'INFO', logs);\n\n addLog('Uploading archive...', 'INFO', logs);\n\n debug(`Starting multipart upload for deployment: ${deploymentId}`);\n const uploadId = await startMultipartUpload(deploymentId);\n\n debug(`Upload ID: ${uploadId}`);\n\n debug('Uploading archive...');\n\n const fileChunkSize = 10 * 1024 * 1024; // 10 MB\n const numChunks = Math.ceil(fileSize / fileChunkSize);\n debug(`File size: ${fileSize}, chunk size: ${fileChunkSize}, number of chunks: ${numChunks}`);\n\n const promises = [];\n let start: number, end: number;\n\n for (let index = 1; index < numChunks + 1; index++) {\n start = (index - 1) * fileChunkSize;\n end = index * fileChunkSize;\n debug(`Processing chunk ${index}/${numChunks}, start: ${start}, end: ${end}`);\n\n const presignedUrl = await getPresignedUrl(deploymentId, uploadId, index);\n debug('Presigned URL for part', index, presignedUrl);\n\n const promise = new Promise<Response>((resolve, reject) => {\n void (async () => {\n try {\n debug(`Reading chunk ${index} data`);\n const readStream = fs.createReadStream(archivePath, {\n start,\n end: index < numChunks ? end - 1 : undefined,\n });\n\n const chunks: Buffer[] = [];\n readStream.on('data', (chunk: Buffer | string) => {\n chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk);\n });\n\n await new Promise<void>((resolveRead) => {\n readStream.on('end', () => resolveRead());\n readStream.on('error', reject);\n });\n\n const buffer = Buffer.concat(chunks);\n\n debug(`Uploading chunk ${index} to presigned URL (${buffer.length} bytes)`);\n const response = await fetch(presignedUrl, {\n method: 'PUT',\n headers: {\n 'Content-Type': 'application/zip',\n 'Content-Length': String(buffer.length),\n },\n body: buffer,\n });\n resolve(response);\n } catch (err) {\n reject(err instanceof Error ? err : new Error(String(err)));\n }\n })();\n });\n\n promises.push(promise);\n }\n\n const finishedParts: { partNumber: number; etag: string }[] = [];\n\n try {\n debug(`Waiting for all ${promises.length} upload promises to complete`);\n const responses = await Promise.all(promises);\n debug('All upload promises completed');\n\n for (let index = 0; index < responses.length; index++) {\n const res = responses[index];\n debug(`Checking response for part ${index + 1}, status: ${res.status}`);\n\n if (!res.ok) {\n debug(`Failed to upload part ${index + 1}: ${res.statusText} ${await res.text()}`);\n throw new Error(`Failed to upload part ${index + 1}: ${res.statusText}`);\n }\n\n const etag = res.headers.get('ETag');\n if (!etag) {\n debug(`Failed to get ETag for part ${index + 1}`);\n throw new Error(`Failed to get ETag for part ${index + 1}`);\n }\n\n debug(`Part ${index + 1} uploaded successfully, ETag: ${etag}`);\n finishedParts.push({\n partNumber: index + 1,\n etag: etag,\n });\n }\n\n debug(`Completing upload with ${finishedParts.length} parts`);\n await completeUpload(deploymentId, uploadId, finishedParts);\n debug('Upload completed successfully');\n } catch (err) {\n const error = err as Error;\n debug(`Upload error: ${error.message}`);\n addLog(`Upload error: ${error.message}`, 'ERROR', logs);\n throw error;\n }\n};\n\nconst createDeployment = async ({ applicationId }: { applicationId: string }) => {\n debug(`Creating deployment for application: ${applicationId}`);\n const res = await fetch(`http://localhost:3000/${applicationId}/deployments`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({}),\n duplex: 'half',\n });\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to create deployment: ${errorText}`);\n throw new Error('Failed to create deployment: ' + errorText);\n }\n\n const deployment = (await res.json()) as { id: string };\n debug(`Deployment created with ID: ${deployment.id}`);\n\n return deployment.id;\n};\n\nconst startMultipartUpload = async (deploymentId: string) => {\n debug(`Starting multipart upload for deployment: ${deploymentId}`);\n const res = await fetch(`http://localhost:3000/deployments/${deploymentId}/pre-signed-url/start`, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to start multipart upload: ${errorText}`);\n throw new Error('Failed to start multipart upload: ' + errorText);\n }\n\n const upload = (await res.json()) as { uploadId: string };\n debug(`Multipart upload started with ID: ${upload.uploadId}`);\n\n return upload.uploadId;\n};\n\nconst getPresignedUrl = async (deploymentId: string, uploadId: string, partNumber: number) => {\n debug(`Getting presigned URL for deployment: ${deploymentId}, upload: ${uploadId}, part: ${partNumber}`);\n const res = await fetch(\n `http://localhost:3000/deployments/${deploymentId}/pre-signed-url/part?uploadId=${uploadId}&partNumber=${partNumber}`,\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n }\n );\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to get pre-signed URL: ${errorText}`);\n throw new Error('Failed to get pre-signed URL: ' + errorText);\n }\n\n const upload = (await res.json()) as { url: string };\n debug(`Got presigned URL for part ${partNumber}`);\n\n return upload.url;\n};\n\nconst completeUpload = async (\n deploymentId: string,\n uploadId: string,\n parts: { partNumber: number; etag: string }[]\n) => {\n debug(`Completing upload for deployment: ${deploymentId}, upload: ${uploadId}, parts: ${parts.length}`);\n const res = await fetch(`http://localhost:3000/deployments/${deploymentId}/pre-signed-url/complete`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n uploadId,\n parts,\n }),\n duplex: 'half',\n });\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to complete upload: ${errorText}`);\n throw new Error('Failed to complete upload: ' + errorText);\n }\n\n debug('Upload completed successfully');\n};\n\nconst getDeploymentStatus = async (deploymentId: string) => {\n debug(`Getting deployment status for: ${deploymentId}`);\n const res = await fetch(`http://localhost:3000/deployments/${deploymentId}`, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to get deployment status: ${errorText}`);\n throw new Error('Failed to get deployment status: ' + errorText);\n }\n\n const deployment = (await res.json()) as { status: DeploymentStatus };\n debug(`Deployment status: ${deployment.status}`);\n\n return deployment.status;\n};\n\nconst getLogs = async (\n deploymentId: string,\n options?: {\n offset: number;\n limit: number;\n 'createdAt[gt]'?: string;\n }\n) => {\n debug(`Getting logs for deployment: ${deploymentId}, options:`, options ?? 'No options');\n const res = await fetch(`http://localhost:3000/deployments/${deploymentId}/logs${objectToQueryString(options)}`, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to get logs: ${errorText}`);\n throw new Error('Failed to get logs: ' + errorText);\n }\n\n const logs = (await res.json()) as {\n totalItems: number;\n limit: number;\n offset: number;\n items: DeploymentLog[];\n };\n\n debug(`Got ${logs.items.length} logs, total: ${logs.totalItems}`);\n return logs;\n};\n\ntype DeploymentStatus = 'PENDING' | 'BUILDING' | 'PROVISIONING' | 'FAILED' | 'ACTIVE' | 'SUSPENDED';\n\ntype DeploymentLog = { id: string; message: string; type: 'INFO' | 'ERROR' | 'WARN'; createdAt: string };\n","import { getFilesForPattern } from '@gigadrive/build-utils';\nimport archiver from 'archiver';\nimport fs from 'fs';\nimport fsPromises from 'fs/promises';\nimport ignore, { type Ignore } from 'ignore';\nimport path from 'path';\n\nconst ignoreFileNames = [/*'.gitignore', */ '.gigadriveignore', '.vercelignore', '.dockerignore', '.nowignore'];\n\n// Function to read and parse the ignore file\nasync function readIgnoreFile(ignorePath: string) {\n try {\n await fsPromises.access(ignorePath);\n const content = await fsPromises.readFile(ignorePath, 'utf8');\n return content.split('\\n').filter((line: string) => line.trim() !== '');\n } catch {\n return [];\n }\n}\n\n// Collect ignore patterns from the given directory (including the root)\nasync function collectIgnorePatterns(dir: string, baseDir: string, ignoreRules: Ignore) {\n const items = await fsPromises.readdir(dir);\n\n for (const item of items) {\n const fullPath = path.join(dir, item);\n const relativePath = path.relative(baseDir, fullPath);\n const stat = await fsPromises.lstat(fullPath);\n\n if (stat.isDirectory()) {\n // If the directory itself is ignored, skip it unless it has a negation rule\n if (ignoreRules.ignores(`${relativePath}/`)) {\n continue;\n }\n\n // Check if the directory contains an ignore file\n for (const ignoreFileName of ignoreFileNames) {\n const ignoreFilePath = path.join(fullPath, ignoreFileName);\n try {\n await fsPromises.access(ignoreFilePath);\n const patterns = (await readIgnoreFile(ignoreFilePath)).map((pattern: string) => {\n return pattern.startsWith('!')\n ? `!${path.join(relativePath, pattern.slice(1))}`\n : path.join(relativePath, pattern);\n });\n ignoreRules.add(patterns);\n } catch {\n // File doesn't exist, skip\n }\n }\n\n // Recurse into subdirectory\n await collectIgnorePatterns(fullPath, baseDir, ignoreRules);\n }\n }\n}\n\n// Function to initialize ignore rules including root-level ignore files\nasync function initializeIgnoreRules(baseDir: string): Promise<Ignore> {\n const ignoreRules = ignore();\n\n // Add default ignore rules\n ignoreRules.add(['.git/', '**/.DS_Store', '**/Thumbs.db']);\n\n // Process root-level ignore files\n for (const ignoreFileName of ignoreFileNames) {\n const ignoreFilePath = path.join(baseDir, ignoreFileName);\n try {\n await fsPromises.access(ignoreFilePath);\n const patterns = (await readIgnoreFile(ignoreFilePath)).map((pattern: string) => {\n return pattern.startsWith('!') ? `!${pattern.slice(1)}` : pattern;\n });\n ignoreRules.add(patterns);\n } catch {\n // File doesn't exist, skip\n }\n }\n\n // Recursively process all subdirectories to gather additional ignore patterns\n await collectIgnorePatterns(baseDir, baseDir, ignoreRules);\n\n return ignoreRules;\n}\n\n// Function to get all files and directories, excluding those in the ignore list\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nasync function getFilesToInclude(dir: string, ignoreRules: Ignore, whitelist?: string[]) {\n const filesToInclude: string[] = [];\n\n async function walkDir(currentDir: string) {\n const items = await fsPromises.readdir(currentDir);\n\n for (const item of items) {\n const fullPath = path.join(currentDir, item);\n const relativePath = path.relative(dir, fullPath);\n const stat = await fsPromises.lstat(fullPath);\n\n if (stat.isDirectory()) {\n if (ignoreRules.ignores(`${relativePath}/`)) {\n continue;\n }\n await walkDir(fullPath);\n } else {\n if (!ignoreRules.ignores(relativePath)) {\n filesToInclude.push(fullPath);\n } else if (ignoreRules.ignores(relativePath) && ignoreRules.test(relativePath).unignored) {\n // Handle whitelisted files that were previously ignored\n filesToInclude.push(fullPath);\n }\n }\n }\n }\n\n await walkDir(dir);\n return filesToInclude;\n}\n\n// Function to create the zip archive\nexport async function createZipArchive(\n inputDir: string,\n outputFile: string,\n options: {\n whitelist?: string[];\n useIgnoreFiles?: boolean;\n useManagedIgnore?: boolean;\n } = {}\n) {\n const ignoreRules = options.useIgnoreFiles !== false ? await initializeIgnoreRules(inputDir) : ignore();\n\n // Get list of files to include in the zip\n const filesToInclude = options.whitelist\n ? await Promise.all(options.whitelist.map((file) => getFilesForPattern(inputDir, file)))\n : await getFilesToInclude(inputDir, ignoreRules);\n\n // Create zip file\n const output = fs.createWriteStream(outputFile);\n const archive = archiver('zip', { zlib: { level: 9 } });\n\n return new Promise<void>((resolve, reject) => {\n output.on('close', () => resolve());\n archive.on('error', reject);\n\n archive.pipe(output);\n\n // Add files to the archive\n for (const file of filesToInclude.flat()) {\n archive.file(file, { name: path.relative(inputDir, file) });\n }\n\n void archive.finalize();\n });\n}\n","import type { Command } from 'commander';\nimport { deploy } from './deploy';\n\nexport const platform = (program: Command) => {\n const platform = program.command('platform').description('Manage the platform');\n\n // register subcommands\n deploy(platform);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uBAAwB;;;ACAxB,yBAAqB;A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AAG;AAAA,IACtB,OAAO;AACL,cAAQ,MAAM;AAAA,IAAuC,KAAK,UAAU,GAAG,CAAC,EAAE;AAAA,IAC5E;AAAA,EACF,OAAO;AACL,YAAQ,MAAM,wCAAwC;AAAA,EACxD;AAEA,UAAQ,KAAK,CAAC;AAChB;AAEA,IAAM,mBAAmB,CAACC,WAAiB;AACzC,QAAM,EAAE,QAAQ,IAAIA;AAEpB,UAAQ,MAAM;AAAA,IAAmC,OAAO,EAAE;AAE1D,UAAQ,KAAK,CAAC;AAChB;AAEA,QAAQ,GAAG,sBAAsB,eAAe;AAChD,QAAQ,GAAG,qBAAqB,gBAAgB;AAEhD,QAAQ,GAAG,QAAQ,MAAM;AACvB,QAAM,WAAW,QAAQ,OAAO,QAAQ,QAAQ,SAAS,QAAQ,OAAO,QAAQ,QAAQ,SAAS;AACjG,YAAU,MAAM,WAAa;AAC/B,CAAC;AAED,KAAK,EACF,KAAK,CAAC,aAAa;AAClB,UAAQ,WAAW;AACrB,CAAC,EACA,MAAM,gBAAgB;","names":["import_fs","import_path","error","path","fs","path","fs","config","debug","import_network_config","import_fs","import_path","import_build_utils","import_fs","import_path","fsPromises","path","ignore","fs","archiver","config","path","os","fs","error","platform","debug","error"]}
|
package/dist/index.mjs
CHANGED
|
@@ -77,7 +77,7 @@ var getPackageManager = async ({ cwd }) => {
|
|
|
77
77
|
try {
|
|
78
78
|
await exec({ command: "bun --version", cwd });
|
|
79
79
|
return "bun";
|
|
80
|
-
} catch
|
|
80
|
+
} catch {
|
|
81
81
|
return "npm";
|
|
82
82
|
}
|
|
83
83
|
};
|
|
@@ -219,6 +219,7 @@ import path4 from "path";
|
|
|
219
219
|
import { getFilesForPattern } from "@gigadrive/build-utils";
|
|
220
220
|
import archiver from "archiver";
|
|
221
221
|
import fs3 from "fs";
|
|
222
|
+
import fsPromises from "fs/promises";
|
|
222
223
|
import ignore from "ignore";
|
|
223
224
|
import path3 from "path";
|
|
224
225
|
var ignoreFileNames = [
|
|
@@ -228,78 +229,84 @@ var ignoreFileNames = [
|
|
|
228
229
|
".dockerignore",
|
|
229
230
|
".nowignore"
|
|
230
231
|
];
|
|
231
|
-
function readIgnoreFile(ignorePath) {
|
|
232
|
-
|
|
233
|
-
|
|
232
|
+
async function readIgnoreFile(ignorePath) {
|
|
233
|
+
try {
|
|
234
|
+
await fsPromises.access(ignorePath);
|
|
235
|
+
const content = await fsPromises.readFile(ignorePath, "utf8");
|
|
236
|
+
return content.split("\n").filter((line) => line.trim() !== "");
|
|
237
|
+
} catch {
|
|
238
|
+
return [];
|
|
234
239
|
}
|
|
235
|
-
return [];
|
|
236
240
|
}
|
|
237
|
-
function collectIgnorePatterns(dir, baseDir, ignoreRules) {
|
|
238
|
-
const items =
|
|
239
|
-
|
|
241
|
+
async function collectIgnorePatterns(dir, baseDir, ignoreRules) {
|
|
242
|
+
const items = await fsPromises.readdir(dir);
|
|
243
|
+
for (const item of items) {
|
|
240
244
|
const fullPath = path3.join(dir, item);
|
|
241
245
|
const relativePath = path3.relative(baseDir, fullPath);
|
|
242
|
-
const stat =
|
|
246
|
+
const stat = await fsPromises.lstat(fullPath);
|
|
243
247
|
if (stat.isDirectory()) {
|
|
244
248
|
if (ignoreRules.ignores(`${relativePath}/`)) {
|
|
245
|
-
|
|
249
|
+
continue;
|
|
246
250
|
}
|
|
247
|
-
|
|
251
|
+
for (const ignoreFileName of ignoreFileNames) {
|
|
248
252
|
const ignoreFilePath = path3.join(fullPath, ignoreFileName);
|
|
249
|
-
|
|
250
|
-
|
|
253
|
+
try {
|
|
254
|
+
await fsPromises.access(ignoreFilePath);
|
|
255
|
+
const patterns = (await readIgnoreFile(ignoreFilePath)).map((pattern) => {
|
|
251
256
|
return pattern.startsWith("!") ? `!${path3.join(relativePath, pattern.slice(1))}` : path3.join(relativePath, pattern);
|
|
252
257
|
});
|
|
253
258
|
ignoreRules.add(patterns);
|
|
259
|
+
} catch {
|
|
254
260
|
}
|
|
255
|
-
}
|
|
256
|
-
collectIgnorePatterns(fullPath, baseDir, ignoreRules);
|
|
261
|
+
}
|
|
262
|
+
await collectIgnorePatterns(fullPath, baseDir, ignoreRules);
|
|
257
263
|
}
|
|
258
|
-
}
|
|
264
|
+
}
|
|
259
265
|
}
|
|
260
|
-
function initializeIgnoreRules(baseDir) {
|
|
266
|
+
async function initializeIgnoreRules(baseDir) {
|
|
261
267
|
const ignoreRules = ignore();
|
|
262
268
|
ignoreRules.add([".git/", "**/.DS_Store", "**/Thumbs.db"]);
|
|
263
|
-
|
|
269
|
+
for (const ignoreFileName of ignoreFileNames) {
|
|
264
270
|
const ignoreFilePath = path3.join(baseDir, ignoreFileName);
|
|
265
|
-
|
|
266
|
-
|
|
271
|
+
try {
|
|
272
|
+
await fsPromises.access(ignoreFilePath);
|
|
273
|
+
const patterns = (await readIgnoreFile(ignoreFilePath)).map((pattern) => {
|
|
267
274
|
return pattern.startsWith("!") ? `!${pattern.slice(1)}` : pattern;
|
|
268
275
|
});
|
|
269
276
|
ignoreRules.add(patterns);
|
|
277
|
+
} catch {
|
|
270
278
|
}
|
|
271
|
-
}
|
|
272
|
-
collectIgnorePatterns(baseDir, baseDir, ignoreRules);
|
|
279
|
+
}
|
|
280
|
+
await collectIgnorePatterns(baseDir, baseDir, ignoreRules);
|
|
273
281
|
return ignoreRules;
|
|
274
282
|
}
|
|
275
283
|
async function getFilesToInclude(dir, ignoreRules, whitelist) {
|
|
276
284
|
const filesToInclude = [];
|
|
277
|
-
function
|
|
278
|
-
const items =
|
|
279
|
-
|
|
285
|
+
async function walkDir(currentDir) {
|
|
286
|
+
const items = await fsPromises.readdir(currentDir);
|
|
287
|
+
for (const item of items) {
|
|
280
288
|
const fullPath = path3.join(currentDir, item);
|
|
281
289
|
const relativePath = path3.relative(dir, fullPath);
|
|
282
|
-
const stat =
|
|
290
|
+
const stat = await fsPromises.lstat(fullPath);
|
|
283
291
|
if (stat.isDirectory()) {
|
|
284
292
|
if (ignoreRules.ignores(`${relativePath}/`)) {
|
|
285
|
-
|
|
293
|
+
continue;
|
|
286
294
|
}
|
|
287
|
-
|
|
295
|
+
await walkDir(fullPath);
|
|
288
296
|
} else {
|
|
289
297
|
if (!ignoreRules.ignores(relativePath)) {
|
|
290
298
|
filesToInclude.push(fullPath);
|
|
291
299
|
} else if (ignoreRules.ignores(relativePath) && ignoreRules.test(relativePath).unignored) {
|
|
292
300
|
filesToInclude.push(fullPath);
|
|
293
|
-
} else {
|
|
294
301
|
}
|
|
295
302
|
}
|
|
296
|
-
}
|
|
303
|
+
}
|
|
297
304
|
}
|
|
298
|
-
|
|
305
|
+
await walkDir(dir);
|
|
299
306
|
return filesToInclude;
|
|
300
307
|
}
|
|
301
308
|
async function createZipArchive(inputDir, outputFile, options = {}) {
|
|
302
|
-
const ignoreRules = options.useIgnoreFiles !== false ? initializeIgnoreRules(inputDir) : ignore();
|
|
309
|
+
const ignoreRules = options.useIgnoreFiles !== false ? await initializeIgnoreRules(inputDir) : ignore();
|
|
303
310
|
const filesToInclude = options.whitelist ? await Promise.all(options.whitelist.map((file) => getFilesForPattern(inputDir, file))) : await getFilesToInclude(inputDir, ignoreRules);
|
|
304
311
|
const output = fs3.createWriteStream(outputFile);
|
|
305
312
|
const archive = archiver("zip", { zlib: { level: 9 } });
|
|
@@ -307,10 +314,10 @@ async function createZipArchive(inputDir, outputFile, options = {}) {
|
|
|
307
314
|
output.on("close", () => resolve());
|
|
308
315
|
archive.on("error", reject);
|
|
309
316
|
archive.pipe(output);
|
|
310
|
-
filesToInclude.
|
|
317
|
+
for (const file of filesToInclude.flat()) {
|
|
311
318
|
archive.file(file, { name: path3.relative(inputDir, file) });
|
|
312
|
-
}
|
|
313
|
-
archive.finalize();
|
|
319
|
+
}
|
|
320
|
+
void archive.finalize();
|
|
314
321
|
});
|
|
315
322
|
}
|
|
316
323
|
|
|
@@ -367,53 +374,57 @@ var handleDeployment = async (deploymentId, config2) => {
|
|
|
367
374
|
error("The deployment failed. Please check the logs for more information.");
|
|
368
375
|
process.exit(1);
|
|
369
376
|
}
|
|
370
|
-
const statusInterval = setInterval(
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
377
|
+
const statusInterval = setInterval(() => {
|
|
378
|
+
void (async () => {
|
|
379
|
+
try {
|
|
380
|
+
debug(`Fetching deployment status for ${deploymentId}`);
|
|
381
|
+
const newStatus = await getDeploymentStatus(deploymentId);
|
|
382
|
+
debug(`Current status: ${status}, New status: ${newStatus}`);
|
|
383
|
+
if (newStatus === "ACTIVE" || newStatus === "FAILED") {
|
|
384
|
+
debug(`Final status reached: ${newStatus}, clearing interval`);
|
|
385
|
+
clearInterval(statusInterval);
|
|
386
|
+
clearInterval(logsInterval);
|
|
387
|
+
if (newStatus === "ACTIVE") {
|
|
388
|
+
success(`Deployed to https://${deploymentId}.gigadrivedev.com`);
|
|
389
|
+
} else {
|
|
390
|
+
error("The deployment failed. Please check the logs for more information.");
|
|
391
|
+
}
|
|
392
|
+
return;
|
|
383
393
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
394
|
+
if (newStatus !== status) {
|
|
395
|
+
debug(`Updating status from ${status} to ${newStatus}`);
|
|
396
|
+
status = newStatus;
|
|
397
|
+
spinner(`Status: ${status.toLowerCase().replace(/^\w/, (c) => c.toUpperCase())}`);
|
|
398
|
+
}
|
|
399
|
+
} catch (err) {
|
|
400
|
+
debug(`Error fetching status: ${err.message}`);
|
|
390
401
|
}
|
|
391
|
-
}
|
|
392
|
-
debug(`Error fetching status: ${err.message}`);
|
|
393
|
-
}
|
|
402
|
+
})();
|
|
394
403
|
}, 1e3);
|
|
395
|
-
const logsInterval = setInterval(
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
404
|
+
const logsInterval = setInterval(() => {
|
|
405
|
+
void (async () => {
|
|
406
|
+
try {
|
|
407
|
+
debug(`Fetching logs for ${deploymentId}, current log count: ${logs.length}`);
|
|
408
|
+
const newLogs = await getLogs(deploymentId, {
|
|
409
|
+
offset: logs.length,
|
|
410
|
+
limit: 100,
|
|
411
|
+
"createdAt[gt]": logs[logs.length - 1]?.createdAt
|
|
412
|
+
});
|
|
413
|
+
debug(`Fetched ${newLogs.items.length} new logs`);
|
|
414
|
+
for (const logEntry of newLogs.items) {
|
|
415
|
+
logs.push(logEntry);
|
|
416
|
+
if (logEntry.type === "ERROR") {
|
|
417
|
+
error(logEntry.message);
|
|
418
|
+
} else if (logEntry.type === "WARN") {
|
|
419
|
+
warn(logEntry.message);
|
|
420
|
+
} else {
|
|
421
|
+
log(logEntry.message);
|
|
422
|
+
}
|
|
412
423
|
}
|
|
424
|
+
} catch (err) {
|
|
425
|
+
debug(`Error fetching logs: ${err.message}`);
|
|
413
426
|
}
|
|
414
|
-
}
|
|
415
|
-
debug(`Error fetching logs: ${err.message}`);
|
|
416
|
-
}
|
|
427
|
+
})();
|
|
417
428
|
}, 1e3);
|
|
418
429
|
spinner(`Status: ${status.toLowerCase().replace(/^\w/, (c) => c.toUpperCase())}`);
|
|
419
430
|
};
|
|
@@ -468,35 +479,37 @@ var uploadArchive = async (deploymentId, logs, config2) => {
|
|
|
468
479
|
debug(`Processing chunk ${index}/${numChunks}, start: ${start}, end: ${end}`);
|
|
469
480
|
const presignedUrl = await getPresignedUrl(deploymentId, uploadId, index);
|
|
470
481
|
debug("Presigned URL for part", index, presignedUrl);
|
|
471
|
-
const promise = new Promise(
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
482
|
+
const promise = new Promise((resolve, reject) => {
|
|
483
|
+
void (async () => {
|
|
484
|
+
try {
|
|
485
|
+
debug(`Reading chunk ${index} data`);
|
|
486
|
+
const readStream = fs4.createReadStream(archivePath, {
|
|
487
|
+
start,
|
|
488
|
+
end: index < numChunks ? end - 1 : void 0
|
|
489
|
+
});
|
|
490
|
+
const chunks = [];
|
|
491
|
+
readStream.on("data", (chunk) => {
|
|
492
|
+
chunks.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
|
|
493
|
+
});
|
|
494
|
+
await new Promise((resolveRead) => {
|
|
495
|
+
readStream.on("end", () => resolveRead());
|
|
496
|
+
readStream.on("error", reject);
|
|
497
|
+
});
|
|
498
|
+
const buffer = Buffer.concat(chunks);
|
|
499
|
+
debug(`Uploading chunk ${index} to presigned URL (${buffer.length} bytes)`);
|
|
500
|
+
const response = await fetch(presignedUrl, {
|
|
501
|
+
method: "PUT",
|
|
502
|
+
headers: {
|
|
503
|
+
"Content-Type": "application/zip",
|
|
504
|
+
"Content-Length": String(buffer.length)
|
|
505
|
+
},
|
|
506
|
+
body: buffer
|
|
507
|
+
});
|
|
508
|
+
resolve(response);
|
|
509
|
+
} catch (err) {
|
|
510
|
+
reject(err instanceof Error ? err : new Error(String(err)));
|
|
511
|
+
}
|
|
512
|
+
})();
|
|
500
513
|
});
|
|
501
514
|
promises.push(promise);
|
|
502
515
|
}
|
|
@@ -627,7 +640,7 @@ var getDeploymentStatus = async (deploymentId) => {
|
|
|
627
640
|
return deployment.status;
|
|
628
641
|
};
|
|
629
642
|
var getLogs = async (deploymentId, options) => {
|
|
630
|
-
debug(`Getting logs for deployment: ${deploymentId}, options:`, options);
|
|
643
|
+
debug(`Getting logs for deployment: ${deploymentId}, options:`, options ?? "No options");
|
|
631
644
|
const res = await fetch(`http://localhost:3000/deployments/${deploymentId}/logs${objectToQueryString(options)}`, {
|
|
632
645
|
method: "GET",
|
|
633
646
|
headers: {
|
|
@@ -661,7 +674,7 @@ var main = async () => {
|
|
|
661
674
|
let exitCode = 0;
|
|
662
675
|
const program = new Command();
|
|
663
676
|
program.option("-v, --verbose", "Enable verbose logging", false);
|
|
664
|
-
program.hook("preSubcommand", (thisCommand
|
|
677
|
+
program.hook("preSubcommand", (thisCommand) => {
|
|
665
678
|
setVerbose(thisCommand.opts().verbose === true);
|
|
666
679
|
if (thisCommand.opts().verbose) {
|
|
667
680
|
log("Using verbose mode");
|
|
@@ -681,13 +694,13 @@ var main = async () => {
|
|
|
681
694
|
}
|
|
682
695
|
return exitCode;
|
|
683
696
|
};
|
|
684
|
-
var handleRejection =
|
|
697
|
+
var handleRejection = (err) => {
|
|
685
698
|
if (err) {
|
|
686
699
|
if (err instanceof Error) {
|
|
687
|
-
|
|
700
|
+
handleUnexpected(err);
|
|
688
701
|
} else {
|
|
689
702
|
console.error(`An unexpected rejection occurred
|
|
690
|
-
${err}`);
|
|
703
|
+
${JSON.stringify(err)}`);
|
|
691
704
|
}
|
|
692
705
|
} else {
|
|
693
706
|
console.error("An unexpected empty rejection occurred");
|
|
@@ -706,7 +719,7 @@ process.on("exit", () => {
|
|
|
706
719
|
const terminal = process.stderr.isTTY ? process.stderr : process.stdout.isTTY ? process.stdout : void 0;
|
|
707
720
|
terminal?.write("\x1B[?25h");
|
|
708
721
|
});
|
|
709
|
-
main().then(
|
|
722
|
+
main().then((exitCode) => {
|
|
710
723
|
process.exitCode = exitCode;
|
|
711
724
|
}).catch(handleUnexpected);
|
|
712
725
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/commands/build/index.ts","../src/util/pm.ts","../../build-utils/src/exec.ts","../src/commands/debug/config/index.ts","../src/util/log.ts","../src/commands/debug/index.ts","../src/commands/platform/deploy/index.ts","../src/util/zip.ts","../src/commands/platform/index.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { build } from './commands/build';\nimport { debug } from './commands/debug';\nimport { platform } from './commands/platform';\nimport { error, log, setVerbose } from './util/log';\n\nlet { isTTY } = process.stdout;\n//process.stdin.resume();\n\nconst main = async () => {\n if (process.env.FORCE_TTY === '1') {\n isTTY = true;\n process.stdout.isTTY = true;\n process.stdin.isTTY = true;\n }\n\n let exitCode = 0;\n\n const program = new Command();\n\n program.option('-v, --verbose', 'Enable verbose logging', false);\n\n program.hook('preSubcommand', (thisCommand, actionCommand) => {\n setVerbose((thisCommand.opts().verbose as boolean) === true);\n\n if (thisCommand.opts().verbose) {\n log('Using verbose mode');\n }\n });\n\n program.hook('preAction', (thisCommand) => {\n setVerbose((thisCommand.opts().verbose as boolean) === true);\n });\n\n // register commands\n platform(program);\n debug(program);\n build(program);\n\n try {\n await program.parseAsync(process.argv);\n } catch (err) {\n error(err);\n exitCode = 1;\n }\n\n return exitCode;\n};\n\nconst handleRejection = async (err: any) => {\n if (err) {\n if (err instanceof Error) {\n await handleUnexpected(err);\n } else {\n // eslint-disable-next-line no-console\n console.error(`An unexpected rejection occurred\\n ${err}`);\n }\n } else {\n console.error('An unexpected empty rejection occurred');\n }\n\n process.exit(1);\n};\n\nconst handleUnexpected = (error: Error) => {\n const { message } = error;\n\n console.error(`An unexpected error occurred\\n ${message}`);\n\n process.exit(1);\n};\n\nprocess.on('unhandledRejection', handleRejection);\nprocess.on('uncaughtException', handleUnexpected);\n\nprocess.on('exit', () => {\n const terminal = process.stderr.isTTY ? process.stderr : process.stdout.isTTY ? process.stdout : undefined;\n terminal?.write('\\u001B[?25h');\n});\n\nmain()\n .then(async (exitCode) => {\n process.exitCode = exitCode;\n })\n .catch(handleUnexpected);\n","import { exec } from '@gigadrive/build-utils';\nimport type { Command } from 'commander';\nimport fs from 'fs';\nimport path from 'path';\nimport { buildCommand, getPackageManager, installCommand } from '../../util/pm';\n\nexport const build = (parent: Command) => {\n parent\n .command('build')\n .description('Build the current project')\n .action(async () => {\n // Set relevant environment variables\n const env = {\n ...process.env,\n NODE_ENV: 'production',\n NEBULA: '1',\n VERCEL: '1', // Vercel compatibility\n NOW_BUILDER: '1',\n };\n\n const cwd = process.cwd();\n\n const packageJsonPath = path.join(cwd, 'package.json');\n\n if (!fs.existsSync(packageJsonPath)) {\n console.log('No package.json found');\n return;\n }\n\n // Read package.json and check for build scripts\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));\n\n const buildScript = packageJson.scripts?.build;\n\n // If build script is not defined, return null\n if (!buildScript) {\n console.log('No build script found in package.json');\n return;\n }\n\n const packageManager = await getPackageManager({ cwd });\n\n if (!packageManager) {\n console.log('No package manager found');\n return;\n }\n\n await exec({\n command: installCommand(packageManager),\n cwd,\n env,\n onOutput: (chunk) => {\n console.log(chunk);\n },\n });\n\n await exec({\n command: buildCommand(packageManager),\n cwd,\n env,\n onOutput: (chunk) => {\n console.log(chunk);\n },\n });\n });\n};\n","import fs from 'fs';\nimport path from 'path';\nimport { exec } from '../../../build-utils/src/exec';\n\nexport type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';\n\n/**\n * Detects the package manager to use for a specific directory\n */\nexport const getPackageManager = async ({ cwd }: { cwd: string }): Promise<PackageManager | null> => {\n // check if package.json exists\n const packageJsonPath = path.join(cwd, 'package.json');\n\n // If package.json does not exist, return null\n if (!fs.existsSync(packageJsonPath)) {\n return null;\n }\n\n // Check if yarn lock exists\n if (fs.existsSync(path.join(cwd, 'yarn.lock'))) {\n return 'yarn';\n }\n\n // Check if pnpm lock exists\n if (fs.existsSync(path.join(cwd, 'pnpm-lock.yaml'))) {\n return 'pnpm';\n }\n\n // Check if bun lock exists\n if (fs.existsSync(path.join(cwd, 'bun.lockb'))) {\n return 'bun';\n }\n\n // Check if pnpm lock exists\n if (fs.existsSync(path.join(cwd, 'package-lock.json'))) {\n return 'npm';\n }\n\n // Check if bun is installed\n try {\n await exec({ command: 'bun --version', cwd });\n return 'bun';\n } catch (e) {\n // If bun is not installed, return npm\n return 'npm';\n }\n};\n\nexport const installCommand = (pm: PackageManager) => {\n return (\n {\n bun: 'bun install',\n npm: 'npm install',\n pnpm: 'pnpm install',\n yarn: 'yarn install',\n }[pm] || 'npm install'\n );\n};\n\nexport const buildCommand = (pm: PackageManager) => {\n return (\n {\n bun: 'bun run build',\n npm: 'npm run build',\n pnpm: 'pnpm build',\n yarn: 'yarn build',\n }[pm] || 'npm run build'\n );\n};\n","import { spawn } from 'child_process';\n\ntype CommandInput = string | { command: string; args?: string[] };\n\ninterface ExecOptions {\n /**\n * The command to execute.\n */\n command: CommandInput;\n\n /**\n * The working directory for the command.\n */\n cwd?: string;\n\n /**\n * Environment variables for the command.\n * Does not include the current process's environment variables by default.\n */\n env?: Record<string, string>;\n\n /**\n * Callback for handling output from the command (stdout).\n */\n onOutput?: (data: string) => void;\n\n /**\n * Callback for handling errors from the command (stderr).\n */\n onError?: (data: string) => void;\n}\n\n/**\n * Executes a command asynchronously in a child process\n * @param options Configuration options for executing the process\n * @returns Promise that resolves when the process completes\n */\nexport async function exec({\n command,\n cwd = process.cwd(),\n env,\n onOutput = (data: string) => console.log(data),\n onError = (data: string) => console.error(data),\n}: ExecOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n let spawnCommand: string;\n let spawnArgs: string[] = [];\n\n if (typeof command === 'string') {\n // For string input, first argument is the command, rest are args\n const parts = command.split(' ');\n spawnCommand = parts[0];\n spawnArgs = parts.slice(1);\n } else {\n // For object input, use command and args properties\n spawnCommand = command.command;\n spawnArgs = command.args || [];\n }\n\n const childProcess = spawn(spawnCommand, spawnArgs, {\n cwd,\n shell: true,\n env,\n });\n\n childProcess.stdout.on('data', (data) => {\n onOutput(data.toString().trim());\n });\n\n childProcess.stderr.on('data', (data) => {\n onError(data.toString().trim());\n });\n\n childProcess.on('error', (error) => {\n reject(new Error(`Failed to start process: ${error.message}`));\n });\n\n childProcess.on('close', (code) => {\n if (code === 0) {\n resolve();\n } else {\n reject(new Error(`Process exited with code ${code}`));\n }\n });\n });\n}\n","import { findConfig, parseConfig } from '@gigadrive/network-config';\nimport { Command } from 'commander';\nimport { log } from 'console';\nimport { debug } from '../../../util/log';\n\nexport const config = (parent: Command) => {\n parent\n .command('config')\n .description('Provide debug info about the project configuration in the current directory')\n .action(async () => {\n const configPath = findConfig(process.cwd());\n\n if (!configPath) {\n debug('No config file found');\n throw new Error('The current project folder does not have a valid config file.');\n }\n\n const config = await parseConfig(configPath, process.cwd());\n\n log(`Config file found at: ${configPath}`);\n log(JSON.stringify(config, null, 2));\n });\n};\n","import { createConsola } from 'consola';\n\nlet verbose: boolean = false;\n\n// Create a custom consola instance that can be updated with verbose settings\nconst consola = createConsola({\n level: verbose ? 4 : 3, // 4 includes debug messages, 3 is the default (info and above)\n formatOptions: {\n colors: true,\n },\n});\n\n// Update the consola instance when verbose setting changes\nconst updateConsola = () => {\n consola.level = verbose ? 4 : 3;\n};\n\nexport const setVerbose = (value: boolean) => {\n verbose = value;\n updateConsola();\n};\n\nexport const isVerbose = () => verbose;\n\nexport const log = (message: any) => {\n consola.info(message);\n};\n\nexport const error = (message: any) => {\n consola.error(message);\n};\n\nexport const success = (message: any) => {\n consola.success(message);\n};\n\nexport const warn = (message: any) => {\n consola.warn(message);\n};\n\nexport const debug = (message?: any, ...optionalParams: any[]) => {\n if (!verbose) {\n return;\n }\n\n consola.debug('[DEBUG]', message, ...optionalParams);\n};\n\nexport const spinner = (message: any) => {\n //render(<Spinner label={message} />);\n log(message);\n};\n","import type { Command } from 'commander';\nimport { config } from './config';\n\nexport const debug = (program: Command) => {\n const debug = program.command('debug').description('Provides various debugging utilities');\n\n // register subcommands\n config(debug);\n};\n","import { formatFileSize, objectToQueryString } from '@gigadrive/commons';\nimport type { NormalizedConfig } from '@gigadrive/network-config';\nimport { findConfig, parseConfig } from '@gigadrive/network-config';\nimport type { Command } from 'commander';\nimport fs from 'fs';\nimport os from 'os';\nimport path from 'path';\nimport { debug, error, log, spinner, success, warn } from '../../../util/log';\nimport { createZipArchive } from '../../../util/zip';\n\nexport const deploy = (parent: Command) => {\n parent\n .command('deploy')\n .description('Deploy the current project')\n .action(async () => {\n debug('Starting deploy command');\n const configPath = findConfig(process.cwd());\n\n if (!configPath) {\n debug('No config file found');\n throw new Error('The current project folder does not have a valid config file.');\n }\n\n debug(`Found config at: ${configPath}`);\n const config = await parseConfig(configPath, process.cwd());\n debug('Parsed config', config);\n\n if (config.warnings.length > 0) {\n debug(`Found ${config.warnings.length} warnings in config`);\n config.warnings.forEach((message) => {\n warn(message);\n });\n }\n\n if (config.errors.length > 0) {\n debug(`Found ${config.errors.length} errors in config`);\n config.errors.forEach((message) => {\n error(message);\n });\n\n throw new Error('The current project folder does not have a valid config file.');\n }\n\n debug('Creating deployment');\n const deploymentId = await createDeployment({\n applicationId: 'test', // TODO\n });\n\n debug(`Deployment ID: ${deploymentId}`);\n\n debug('Starting deployment process');\n await handleDeployment(deploymentId, config);\n });\n};\n\nconst handleDeployment = async (deploymentId: string, config: NormalizedConfig) => {\n debug('Deployment process initialized');\n let status: DeploymentStatus = 'PENDING';\n const logs: DeploymentLog[] = [];\n\n // Log deployment ID\n addLog('Deployment ID: ' + deploymentId, 'INFO', logs);\n\n // Start upload\n try {\n debug('Starting upload process');\n await uploadArchive(deploymentId, logs, config);\n debug('Upload completed successfully');\n addLog('Upload complete.', 'INFO', logs);\n addLog('The deployment pipeline is now being provisioned. This may take a few seconds.', 'INFO', logs);\n } catch (err) {\n debug(`Upload failed with error: ${(err as Error).message}`);\n addLog(`Upload failed: ${(err as Error).message}`, 'ERROR', logs);\n status = 'FAILED';\n error('The deployment failed. Please check the logs for more information.');\n process.exit(1);\n }\n\n // Start status polling\n const statusInterval = setInterval(async () => {\n try {\n debug(`Fetching deployment status for ${deploymentId}`);\n const newStatus = await getDeploymentStatus(deploymentId);\n debug(`Current status: ${status}, New status: ${newStatus}`);\n\n if (newStatus === 'ACTIVE' || newStatus === 'FAILED') {\n debug(`Final status reached: ${newStatus}, clearing interval`);\n clearInterval(statusInterval);\n clearInterval(logsInterval);\n\n if (newStatus === 'ACTIVE') {\n success(`Deployed to https://${deploymentId}.gigadrivedev.com`);\n } else {\n error('The deployment failed. Please check the logs for more information.');\n }\n\n return;\n }\n\n if (newStatus !== status) {\n debug(`Updating status from ${status} to ${newStatus}`);\n status = newStatus;\n spinner(`Status: ${status.toLowerCase().replace(/^\\w/, (c) => c.toUpperCase())}`);\n }\n } catch (err) {\n debug(`Error fetching status: ${(err as Error).message}`);\n }\n }, 1000);\n\n // Start logs polling\n const logsInterval = setInterval(async () => {\n try {\n debug(`Fetching logs for ${deploymentId}, current log count: ${logs.length}`);\n const newLogs = await getLogs(deploymentId, {\n offset: logs.length,\n limit: 100,\n 'createdAt[gt]': logs[logs.length - 1]?.createdAt,\n });\n\n debug(`Fetched ${newLogs.items.length} new logs`);\n\n // Display new logs\n for (const logEntry of newLogs.items) {\n logs.push(logEntry);\n\n if (logEntry.type === 'ERROR') {\n error(logEntry.message);\n } else if (logEntry.type === 'WARN') {\n warn(logEntry.message);\n } else {\n log(logEntry.message);\n }\n }\n } catch (err) {\n debug(`Error fetching logs: ${(err as Error).message}`);\n }\n }, 1000);\n\n // Initial status display\n spinner(`Status: ${status.toLowerCase().replace(/^\\w/, (c) => c.toUpperCase())}`);\n};\n\nconst addLog = (message: string, type: 'INFO' | 'ERROR' | 'WARN', logs: DeploymentLog[]) => {\n debug(`Adding log: [${type}] ${message}`);\n logs.push({\n id: String(logs.length),\n message,\n type,\n createdAt: new Date().toISOString(),\n });\n\n if (type === 'ERROR') {\n error(message);\n } else if (type === 'WARN') {\n warn(message);\n } else {\n log(message);\n }\n};\n\nconst uploadArchive = async (deploymentId: string, logs: DeploymentLog[], config: NormalizedConfig) => {\n debug('Starting uploadArchive');\n addLog('Creating archive...', 'INFO', logs);\n\n const archivePath = path.join(process.env.TEMP || os.tmpdir(), `project-${Date.now()}.zip`);\n debug(`Archive path: ${archivePath}`);\n\n if (fs.existsSync(archivePath)) {\n debug(`Archive already exists, removing: ${archivePath}`);\n fs.unlinkSync(archivePath);\n }\n\n debug('Creating zip archive');\n\n await createZipArchive(config.userArchive?.rootOverwrite || process.cwd(), archivePath, {\n whitelist: config.userArchive?.fileWhitelist,\n useIgnoreFiles: false,\n useManagedIgnore: false,\n });\n\n const fileStats = fs.statSync(archivePath);\n const fileSize = fileStats.size;\n debug(`Archive created, size: ${fileSize} bytes (${formatFileSize(fileSize)})`);\n\n addLog(`Archive created (${formatFileSize(fileSize)})`, 'INFO', logs);\n\n addLog('Uploading archive...', 'INFO', logs);\n\n debug(`Starting multipart upload for deployment: ${deploymentId}`);\n const uploadId = await startMultipartUpload(deploymentId);\n\n debug(`Upload ID: ${uploadId}`);\n\n debug('Uploading archive...');\n\n const fileChunkSize = 10 * 1024 * 1024; // 10 MB\n const numChunks = Math.ceil(fileSize / fileChunkSize);\n debug(`File size: ${fileSize}, chunk size: ${fileChunkSize}, number of chunks: ${numChunks}`);\n\n const promises = [];\n let start: number, end: number;\n\n for (let index = 1; index < numChunks + 1; index++) {\n start = (index - 1) * fileChunkSize;\n end = index * fileChunkSize;\n debug(`Processing chunk ${index}/${numChunks}, start: ${start}, end: ${end}`);\n\n const presignedUrl = await getPresignedUrl(deploymentId, uploadId, index);\n debug('Presigned URL for part', index, presignedUrl);\n\n const promise = new Promise<Response>(async (resolve, reject) => {\n try {\n debug(`Reading chunk ${index} data`);\n const readStream = fs.createReadStream(archivePath, {\n start,\n end: index < numChunks ? end - 1 : undefined,\n });\n\n const chunks: Buffer[] = [];\n readStream.on('data', (chunk: Buffer | string) => {\n chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk);\n });\n\n await new Promise<void>((resolveRead) => {\n readStream.on('end', () => resolveRead());\n readStream.on('error', reject);\n });\n\n const buffer = Buffer.concat(chunks);\n\n debug(`Uploading chunk ${index} to presigned URL (${buffer.length} bytes)`);\n const response = await fetch(presignedUrl, {\n method: 'PUT',\n headers: {\n 'Content-Type': 'application/zip',\n 'Content-Length': String(buffer.length),\n },\n body: buffer,\n });\n resolve(response);\n } catch (err) {\n reject(err);\n }\n });\n\n promises.push(promise);\n }\n\n const finishedParts: { partNumber: number; etag: string }[] = [];\n\n try {\n debug(`Waiting for all ${promises.length} upload promises to complete`);\n const responses = await Promise.all(promises);\n debug('All upload promises completed');\n\n for (let index = 0; index < responses.length; index++) {\n const res = responses[index];\n debug(`Checking response for part ${index + 1}, status: ${res.status}`);\n\n if (!res.ok) {\n debug(`Failed to upload part ${index + 1}: ${res.statusText} ${await res.text()}`);\n throw new Error(`Failed to upload part ${index + 1}: ${res.statusText}`);\n }\n\n const etag = res.headers.get('ETag');\n if (!etag) {\n debug(`Failed to get ETag for part ${index + 1}`);\n throw new Error(`Failed to get ETag for part ${index + 1}`);\n }\n\n debug(`Part ${index + 1} uploaded successfully, ETag: ${etag}`);\n finishedParts.push({\n partNumber: index + 1,\n etag: etag,\n });\n }\n\n debug(`Completing upload with ${finishedParts.length} parts`);\n await completeUpload(deploymentId, uploadId, finishedParts);\n debug('Upload completed successfully');\n } catch (err) {\n const error = err as Error;\n debug(`Upload error: ${error.message}`);\n addLog(`Upload error: ${error.message}`, 'ERROR', logs);\n throw error;\n }\n};\n\nconst createDeployment = async ({ applicationId }: { applicationId: string }) => {\n debug(`Creating deployment for application: ${applicationId}`);\n const res = await fetch(`http://localhost:3000/${applicationId}/deployments`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({}),\n duplex: 'half',\n });\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to create deployment: ${errorText}`);\n throw new Error('Failed to create deployment: ' + errorText);\n }\n\n const deployment = (await res.json()) as { id: string };\n debug(`Deployment created with ID: ${deployment.id}`);\n\n return deployment.id as string;\n};\n\nconst startMultipartUpload = async (deploymentId: string) => {\n debug(`Starting multipart upload for deployment: ${deploymentId}`);\n const res = await fetch(`http://localhost:3000/deployments/${deploymentId}/pre-signed-url/start`, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to start multipart upload: ${errorText}`);\n throw new Error('Failed to start multipart upload: ' + errorText);\n }\n\n const upload = (await res.json()) as { uploadId: string };\n debug(`Multipart upload started with ID: ${upload.uploadId}`);\n\n return upload.uploadId as string;\n};\n\nconst getPresignedUrl = async (deploymentId: string, uploadId: string, partNumber: number) => {\n debug(`Getting presigned URL for deployment: ${deploymentId}, upload: ${uploadId}, part: ${partNumber}`);\n const res = await fetch(\n `http://localhost:3000/deployments/${deploymentId}/pre-signed-url/part?uploadId=${uploadId}&partNumber=${partNumber}`,\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n }\n );\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to get pre-signed URL: ${errorText}`);\n throw new Error('Failed to get pre-signed URL: ' + errorText);\n }\n\n const upload = (await res.json()) as { url: string };\n debug(`Got presigned URL for part ${partNumber}`);\n\n return upload.url as string;\n};\n\nconst completeUpload = async (\n deploymentId: string,\n uploadId: string,\n parts: { partNumber: number; etag: string }[]\n) => {\n debug(`Completing upload for deployment: ${deploymentId}, upload: ${uploadId}, parts: ${parts.length}`);\n const res = await fetch(`http://localhost:3000/deployments/${deploymentId}/pre-signed-url/complete`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n uploadId,\n parts,\n }),\n duplex: 'half',\n });\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to complete upload: ${errorText}`);\n throw new Error('Failed to complete upload: ' + errorText);\n }\n\n debug('Upload completed successfully');\n};\n\nconst getDeploymentStatus = async (deploymentId: string) => {\n debug(`Getting deployment status for: ${deploymentId}`);\n const res = await fetch(`http://localhost:3000/deployments/${deploymentId}`, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to get deployment status: ${errorText}`);\n throw new Error('Failed to get deployment status: ' + errorText);\n }\n\n const deployment = (await res.json()) as { status: DeploymentStatus };\n debug(`Deployment status: ${deployment.status}`);\n\n return deployment.status as DeploymentStatus;\n};\n\nconst getLogs = async (\n deploymentId: string,\n options?: {\n offset: number;\n limit: number;\n 'createdAt[gt]'?: string;\n }\n) => {\n debug(`Getting logs for deployment: ${deploymentId}, options:`, options);\n const res = await fetch(`http://localhost:3000/deployments/${deploymentId}/logs${objectToQueryString(options)}`, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to get logs: ${errorText}`);\n throw new Error('Failed to get logs: ' + errorText);\n }\n\n const logs = (await res.json()) as {\n totalItems: number;\n limit: number;\n offset: number;\n items: DeploymentLog[];\n };\n\n debug(`Got ${logs.items.length} logs, total: ${logs.totalItems}`);\n return logs;\n};\n\ntype DeploymentStatus = 'PENDING' | 'BUILDING' | 'PROVISIONING' | 'FAILED' | 'ACTIVE' | 'SUSPENDED';\n\ntype DeploymentLog = { id: string; message: string; type: 'INFO' | 'ERROR' | 'WARN'; createdAt: string };\n","import { getFilesForPattern } from '@gigadrive/build-utils';\nimport archiver from 'archiver';\nimport fs from 'fs';\nimport ignore, { type Ignore } from 'ignore';\nimport path from 'path';\n\nconst ignoreFileNames = [/*'.gitignore', */ '.gigadriveignore', '.vercelignore', '.dockerignore', '.nowignore'];\n\n// Function to read and parse the ignore file\nfunction readIgnoreFile(ignorePath: string) {\n if (fs.existsSync(ignorePath)) {\n return fs\n .readFileSync(ignorePath, 'utf8')\n .split('\\n')\n .filter((line) => line.trim() !== '');\n }\n return [];\n}\n\n// Collect ignore patterns from the given directory (including the root)\nfunction collectIgnorePatterns(dir: string, baseDir: string, ignoreRules: Ignore) {\n const items = fs.readdirSync(dir);\n\n items.forEach((item) => {\n const fullPath = path.join(dir, item);\n const relativePath = path.relative(baseDir, fullPath);\n const stat = fs.lstatSync(fullPath);\n\n if (stat.isDirectory()) {\n // If the directory itself is ignored, skip it unless it has a negation rule\n if (ignoreRules.ignores(`${relativePath}/`)) {\n return;\n }\n\n // Check if the directory contains an ignore file\n ignoreFileNames.forEach((ignoreFileName) => {\n const ignoreFilePath = path.join(fullPath, ignoreFileName);\n if (fs.existsSync(ignoreFilePath)) {\n const patterns = readIgnoreFile(ignoreFilePath).map((pattern) => {\n return pattern.startsWith('!')\n ? `!${path.join(relativePath, pattern.slice(1))}`\n : path.join(relativePath, pattern);\n });\n ignoreRules.add(patterns);\n }\n });\n\n // Recurse into subdirectory\n collectIgnorePatterns(fullPath, baseDir, ignoreRules);\n }\n });\n}\n\n// Function to initialize ignore rules including root-level ignore files\nfunction initializeIgnoreRules(baseDir: string): Ignore {\n const ignoreRules = ignore();\n\n // Add default ignore rules\n ignoreRules.add(['.git/', '**/.DS_Store', '**/Thumbs.db']);\n\n // Process root-level ignore files\n ignoreFileNames.forEach((ignoreFileName) => {\n const ignoreFilePath = path.join(baseDir, ignoreFileName);\n if (fs.existsSync(ignoreFilePath)) {\n const patterns = readIgnoreFile(ignoreFilePath).map((pattern) => {\n return pattern.startsWith('!') ? `!${pattern.slice(1)}` : pattern;\n });\n ignoreRules.add(patterns);\n }\n });\n\n // Recursively process all subdirectories to gather additional ignore patterns\n collectIgnorePatterns(baseDir, baseDir, ignoreRules);\n\n return ignoreRules;\n}\n\n// Function to get all files and directories, excluding those in the ignore list\nasync function getFilesToInclude(dir: string, ignoreRules: Ignore, whitelist?: string[]) {\n const filesToInclude: string[] = [];\n\n function walkSync(currentDir: string) {\n const items = fs.readdirSync(currentDir);\n\n items.forEach((item) => {\n const fullPath = path.join(currentDir, item);\n const relativePath = path.relative(dir, fullPath);\n const stat = fs.lstatSync(fullPath);\n\n if (stat.isDirectory()) {\n if (ignoreRules.ignores(`${relativePath}/`)) {\n //console.debug(`Ignoring directory: ${relativePath}/`);\n return;\n }\n walkSync(fullPath);\n } else {\n if (!ignoreRules.ignores(relativePath)) {\n filesToInclude.push(fullPath);\n } else if (ignoreRules.ignores(relativePath) && ignoreRules.test(relativePath).unignored) {\n // Handle whitelisted files that were previously ignored\n filesToInclude.push(fullPath);\n } else {\n //console.debug(`Ignoring file: ${relativePath}`);\n }\n }\n });\n }\n\n walkSync(dir);\n return filesToInclude;\n}\n\n// Function to create the zip archive\nexport async function createZipArchive(\n inputDir: string,\n outputFile: string,\n options: {\n whitelist?: string[];\n useIgnoreFiles?: boolean;\n useManagedIgnore?: boolean;\n } = {}\n) {\n const ignoreRules = options.useIgnoreFiles !== false ? initializeIgnoreRules(inputDir) : ignore();\n\n // Get list of files to include in the zip\n const filesToInclude = options.whitelist\n ? await Promise.all(options.whitelist.map((file) => getFilesForPattern(inputDir, file)))\n : await getFilesToInclude(inputDir, ignoreRules);\n\n // Create zip file\n const output = fs.createWriteStream(outputFile);\n const archive = archiver('zip', { zlib: { level: 9 } });\n\n return new Promise<void>((resolve, reject) => {\n output.on('close', () => resolve());\n archive.on('error', reject);\n\n archive.pipe(output);\n\n // Add files to the archive\n filesToInclude.forEach((file) => {\n archive.file(file, { name: path.relative(inputDir, file) });\n });\n\n archive.finalize();\n });\n}\n","import type { Command } from 'commander';\nimport { deploy } from './deploy';\n\nexport const platform = (program: Command) => {\n const platform = program.command('platform').description('Manage the platform');\n\n // register subcommands\n deploy(platform);\n};\n"],"mappings":";;;AAAA,SAAS,eAAe;;;ACAxB,SAAS,QAAAA,aAAY;AAErB,OAAOC,SAAQ;AACf,OAAOC,WAAU;;;ACHjB,OAAO,QAAQ;AACf,OAAO,UAAU;;;ACDjB,SAAS,aAAa;AAqCtB,eAAsB,KAAK;AAAA,EACzB;AAAA,EACA,MAAM,QAAQ,IAAI;AAAA,EAClB;AAAA,EACA,WAAW,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","log","debug","findConfig","parseConfig","fs","path","fs","path","findConfig","config","parseConfig","path","fs","error","platform","debug","error"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/commands/build/index.ts","../src/util/pm.ts","../../build-utils/src/exec.ts","../src/commands/debug/config/index.ts","../src/util/log.ts","../src/commands/debug/index.ts","../src/commands/platform/deploy/index.ts","../src/util/zip.ts","../src/commands/platform/index.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { build } from './commands/build';\nimport { debug } from './commands/debug';\nimport { platform } from './commands/platform';\nimport { error, log, setVerbose } from './util/log';\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nlet { isTTY } = process.stdout;\n//process.stdin.resume();\n\nconst main = async () => {\n if (process.env.FORCE_TTY === '1') {\n isTTY = true;\n process.stdout.isTTY = true;\n process.stdin.isTTY = true;\n }\n\n let exitCode = 0;\n\n const program = new Command();\n\n program.option('-v, --verbose', 'Enable verbose logging', false);\n\n program.hook('preSubcommand', (thisCommand) => {\n setVerbose((thisCommand.opts().verbose as boolean) === true);\n\n if (thisCommand.opts().verbose) {\n log('Using verbose mode');\n }\n });\n\n program.hook('preAction', (thisCommand) => {\n setVerbose((thisCommand.opts().verbose as boolean) === true);\n });\n\n // register commands\n platform(program);\n debug(program);\n build(program);\n\n try {\n await program.parseAsync(process.argv);\n } catch (err) {\n error(err as string | number | boolean | object);\n exitCode = 1;\n }\n\n return exitCode;\n};\n\nconst handleRejection = (err: unknown) => {\n if (err) {\n if (err instanceof Error) {\n handleUnexpected(err);\n } else {\n console.error(`An unexpected rejection occurred\\n ${JSON.stringify(err)}`);\n }\n } else {\n console.error('An unexpected empty rejection occurred');\n }\n\n process.exit(1);\n};\n\nconst handleUnexpected = (error: Error) => {\n const { message } = error;\n\n console.error(`An unexpected error occurred\\n ${message}`);\n\n process.exit(1);\n};\n\nprocess.on('unhandledRejection', handleRejection);\nprocess.on('uncaughtException', handleUnexpected);\n\nprocess.on('exit', () => {\n const terminal = process.stderr.isTTY ? process.stderr : process.stdout.isTTY ? process.stdout : undefined;\n terminal?.write('\\u001B[?25h');\n});\n\nmain()\n .then((exitCode) => {\n process.exitCode = exitCode;\n })\n .catch(handleUnexpected);\n","import { exec } from '@gigadrive/build-utils';\nimport type { Command } from 'commander';\nimport fs from 'fs';\nimport path from 'path';\nimport { buildCommand, getPackageManager, installCommand } from '../../util/pm';\n\nexport const build = (parent: Command) => {\n parent\n .command('build')\n .description('Build the current project')\n .action(async () => {\n // Set relevant environment variables\n const env = {\n ...process.env,\n NODE_ENV: 'production',\n NEBULA: '1',\n VERCEL: '1', // Vercel compatibility\n NOW_BUILDER: '1',\n };\n\n const cwd = process.cwd();\n\n const packageJsonPath = path.join(cwd, 'package.json');\n\n if (!fs.existsSync(packageJsonPath)) {\n console.log('No package.json found');\n return;\n }\n\n // Read package.json and check for build scripts\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));\n\n const buildScript = packageJson.scripts?.build;\n\n // If build script is not defined, return null\n if (!buildScript) {\n console.log('No build script found in package.json');\n return;\n }\n\n const packageManager = await getPackageManager({ cwd });\n\n if (!packageManager) {\n console.log('No package manager found');\n return;\n }\n\n await exec({\n command: installCommand(packageManager),\n cwd,\n env,\n onOutput: (chunk) => {\n console.log(chunk);\n },\n });\n\n await exec({\n command: buildCommand(packageManager),\n cwd,\n env,\n onOutput: (chunk) => {\n console.log(chunk);\n },\n });\n });\n};\n","import fs from 'fs';\nimport path from 'path';\nimport { exec } from '../../../build-utils/src/exec';\n\nexport type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';\n\n/**\n * Detects the package manager to use for a specific directory\n */\nexport const getPackageManager = async ({ cwd }: { cwd: string }): Promise<PackageManager | null> => {\n // check if package.json exists\n const packageJsonPath = path.join(cwd, 'package.json');\n\n // If package.json does not exist, return null\n if (!fs.existsSync(packageJsonPath)) {\n return null;\n }\n\n // Check if yarn lock exists\n if (fs.existsSync(path.join(cwd, 'yarn.lock'))) {\n return 'yarn';\n }\n\n // Check if pnpm lock exists\n if (fs.existsSync(path.join(cwd, 'pnpm-lock.yaml'))) {\n return 'pnpm';\n }\n\n // Check if bun lock exists\n if (fs.existsSync(path.join(cwd, 'bun.lockb'))) {\n return 'bun';\n }\n\n // Check if pnpm lock exists\n if (fs.existsSync(path.join(cwd, 'package-lock.json'))) {\n return 'npm';\n }\n\n // Check if bun is installed\n try {\n await exec({ command: 'bun --version', cwd });\n return 'bun';\n } catch {\n // If bun is not installed, return npm\n return 'npm';\n }\n};\n\nexport const installCommand = (pm: PackageManager) => {\n return (\n {\n bun: 'bun install',\n npm: 'npm install',\n pnpm: 'pnpm install',\n yarn: 'yarn install',\n }[pm] || 'npm install'\n );\n};\n\nexport const buildCommand = (pm: PackageManager) => {\n return (\n {\n bun: 'bun run build',\n npm: 'npm run build',\n pnpm: 'pnpm build',\n yarn: 'yarn build',\n }[pm] || 'npm run build'\n );\n};\n","import { spawn } from 'child_process';\n\ntype CommandInput = string | { command: string; args?: string[] };\n\ninterface ExecOptions {\n /**\n * The command to execute.\n */\n command: CommandInput;\n\n /**\n * The working directory for the command.\n */\n cwd?: string;\n\n /**\n * Environment variables for the command.\n * Does not include the current process's environment variables by default.\n */\n env?: Record<string, string>;\n\n /**\n * Callback for handling output from the command (stdout).\n */\n onOutput?: (data: string) => void;\n\n /**\n * Callback for handling errors from the command (stderr).\n */\n onError?: (data: string) => void;\n}\n\n/**\n * Executes a command asynchronously in a child process\n * @param options Configuration options for executing the process\n * @returns Promise that resolves when the process completes\n */\nexport async function exec({\n command,\n cwd = process.cwd(),\n env,\n onOutput = (data: string) => console.log(data),\n onError = (data: string) => console.error(data),\n}: ExecOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n let spawnCommand: string;\n let spawnArgs: string[] = [];\n\n if (typeof command === 'string') {\n // For string input, first argument is the command, rest are args\n const parts = command.split(' ');\n spawnCommand = parts[0];\n spawnArgs = parts.slice(1);\n } else {\n // For object input, use command and args properties\n spawnCommand = command.command;\n spawnArgs = command.args || [];\n }\n\n const childProcess = spawn(spawnCommand, spawnArgs, {\n cwd,\n shell: true,\n env,\n });\n\n childProcess.stdout.on('data', (data) => {\n onOutput(data.toString().trim());\n });\n\n childProcess.stderr.on('data', (data) => {\n onError(data.toString().trim());\n });\n\n childProcess.on('error', (error) => {\n reject(new Error(`Failed to start process: ${error.message}`));\n });\n\n childProcess.on('close', (code) => {\n if (code === 0) {\n resolve();\n } else {\n reject(new Error(`Process exited with code ${code}`));\n }\n });\n });\n}\n","import { findConfig, parseConfig } from '@gigadrive/network-config';\nimport { Command } from 'commander';\nimport { log } from 'console';\nimport { debug } from '../../../util/log';\n\nexport const config = (parent: Command) => {\n parent\n .command('config')\n .description('Provide debug info about the project configuration in the current directory')\n .action(async () => {\n const configPath = findConfig(process.cwd());\n\n if (!configPath) {\n debug('No config file found');\n throw new Error('The current project folder does not have a valid config file.');\n }\n\n const config = await parseConfig(configPath, process.cwd());\n\n log(`Config file found at: ${configPath}`);\n log(JSON.stringify(config, null, 2));\n });\n};\n","import { createConsola } from 'consola';\n\nlet verbose: boolean = false;\n\n// Create a custom consola instance that can be updated with verbose settings\nconst consola = createConsola({\n level: verbose ? 4 : 3, // 4 includes debug messages, 3 is the default (info and above)\n formatOptions: {\n colors: true,\n },\n});\n\n// Update the consola instance when verbose setting changes\nconst updateConsola = () => {\n consola.level = verbose ? 4 : 3;\n};\n\nexport const setVerbose = (value: boolean) => {\n verbose = value;\n updateConsola();\n};\n\nexport const isVerbose = () => verbose;\n\nexport const log = (message: string | number | boolean | object) => {\n consola.info(message);\n};\n\nexport const error = (message: string | number | boolean | object) => {\n consola.error(message);\n};\n\nexport const success = (message: string | number | boolean | object) => {\n consola.success(message);\n};\n\nexport const warn = (message: string | number | boolean | object) => {\n consola.warn(message);\n};\n\nexport const debug = (\n message?: string | number | boolean | object,\n ...optionalParams: (string | number | boolean | object)[]\n) => {\n if (!verbose) {\n return;\n }\n\n consola.debug('[DEBUG]', message, ...optionalParams);\n};\n\nexport const spinner = (message: string | number | boolean | object) => {\n //render(<Spinner label={message} />);\n log(message);\n};\n","import type { Command } from 'commander';\nimport { config } from './config';\n\nexport const debug = (program: Command) => {\n const debug = program.command('debug').description('Provides various debugging utilities');\n\n // register subcommands\n config(debug);\n};\n","import { formatFileSize, objectToQueryString } from '@gigadrive/commons';\nimport type { NormalizedConfig } from '@gigadrive/network-config';\nimport { findConfig, parseConfig } from '@gigadrive/network-config';\nimport type { Command } from 'commander';\nimport fs from 'fs';\nimport os from 'os';\nimport path from 'path';\nimport { debug, error, log, spinner, success, warn } from '../../../util/log';\nimport { createZipArchive } from '../../../util/zip';\n\nexport const deploy = (parent: Command) => {\n parent\n .command('deploy')\n .description('Deploy the current project')\n .action(async () => {\n debug('Starting deploy command');\n const configPath = findConfig(process.cwd());\n\n if (!configPath) {\n debug('No config file found');\n throw new Error('The current project folder does not have a valid config file.');\n }\n\n debug(`Found config at: ${configPath}`);\n const config = await parseConfig(configPath, process.cwd());\n debug('Parsed config', config);\n\n if (config.warnings.length > 0) {\n debug(`Found ${config.warnings.length} warnings in config`);\n config.warnings.forEach((message) => {\n warn(message);\n });\n }\n\n if (config.errors.length > 0) {\n debug(`Found ${config.errors.length} errors in config`);\n config.errors.forEach((message) => {\n error(message);\n });\n\n throw new Error('The current project folder does not have a valid config file.');\n }\n\n debug('Creating deployment');\n const deploymentId = await createDeployment({\n applicationId: 'test', // TODO\n });\n\n debug(`Deployment ID: ${deploymentId}`);\n\n debug('Starting deployment process');\n await handleDeployment(deploymentId, config);\n });\n};\n\nconst handleDeployment = async (deploymentId: string, config: NormalizedConfig) => {\n debug('Deployment process initialized');\n let status: DeploymentStatus = 'PENDING';\n const logs: DeploymentLog[] = [];\n\n // Log deployment ID\n addLog('Deployment ID: ' + deploymentId, 'INFO', logs);\n\n // Start upload\n try {\n debug('Starting upload process');\n await uploadArchive(deploymentId, logs, config);\n debug('Upload completed successfully');\n addLog('Upload complete.', 'INFO', logs);\n addLog('The deployment pipeline is now being provisioned. This may take a few seconds.', 'INFO', logs);\n } catch (err) {\n debug(`Upload failed with error: ${(err as Error).message}`);\n addLog(`Upload failed: ${(err as Error).message}`, 'ERROR', logs);\n status = 'FAILED';\n error('The deployment failed. Please check the logs for more information.');\n process.exit(1);\n }\n\n // Start status polling\n const statusInterval = setInterval(() => {\n void (async () => {\n try {\n debug(`Fetching deployment status for ${deploymentId}`);\n const newStatus = await getDeploymentStatus(deploymentId);\n debug(`Current status: ${status}, New status: ${newStatus}`);\n\n if (newStatus === 'ACTIVE' || newStatus === 'FAILED') {\n debug(`Final status reached: ${newStatus}, clearing interval`);\n clearInterval(statusInterval);\n clearInterval(logsInterval);\n\n if (newStatus === 'ACTIVE') {\n success(`Deployed to https://${deploymentId}.gigadrivedev.com`);\n } else {\n error('The deployment failed. Please check the logs for more information.');\n }\n\n return;\n }\n\n if (newStatus !== status) {\n debug(`Updating status from ${status} to ${newStatus}`);\n status = newStatus;\n spinner(`Status: ${status.toLowerCase().replace(/^\\w/, (c) => c.toUpperCase())}`);\n }\n } catch (err) {\n debug(`Error fetching status: ${(err as Error).message}`);\n }\n })();\n }, 1000);\n\n // Start logs polling\n const logsInterval = setInterval(() => {\n void (async () => {\n try {\n debug(`Fetching logs for ${deploymentId}, current log count: ${logs.length}`);\n const newLogs = await getLogs(deploymentId, {\n offset: logs.length,\n limit: 100,\n 'createdAt[gt]': logs[logs.length - 1]?.createdAt,\n });\n\n debug(`Fetched ${newLogs.items.length} new logs`);\n\n // Display new logs\n for (const logEntry of newLogs.items) {\n logs.push(logEntry);\n\n if (logEntry.type === 'ERROR') {\n error(logEntry.message);\n } else if (logEntry.type === 'WARN') {\n warn(logEntry.message);\n } else {\n log(logEntry.message);\n }\n }\n } catch (err) {\n debug(`Error fetching logs: ${(err as Error).message}`);\n }\n })();\n }, 1000);\n\n // Initial status display\n spinner(`Status: ${status.toLowerCase().replace(/^\\w/, (c) => c.toUpperCase())}`);\n};\n\nconst addLog = (message: string, type: 'INFO' | 'ERROR' | 'WARN', logs: DeploymentLog[]) => {\n debug(`Adding log: [${type}] ${message}`);\n logs.push({\n id: String(logs.length),\n message,\n type,\n createdAt: new Date().toISOString(),\n });\n\n if (type === 'ERROR') {\n error(message);\n } else if (type === 'WARN') {\n warn(message);\n } else {\n log(message);\n }\n};\n\nconst uploadArchive = async (deploymentId: string, logs: DeploymentLog[], config: NormalizedConfig) => {\n debug('Starting uploadArchive');\n addLog('Creating archive...', 'INFO', logs);\n\n const archivePath = path.join(process.env.TEMP || os.tmpdir(), `project-${Date.now()}.zip`);\n debug(`Archive path: ${archivePath}`);\n\n if (fs.existsSync(archivePath)) {\n debug(`Archive already exists, removing: ${archivePath}`);\n fs.unlinkSync(archivePath);\n }\n\n debug('Creating zip archive');\n\n await createZipArchive(config.userArchive?.rootOverwrite || process.cwd(), archivePath, {\n whitelist: config.userArchive?.fileWhitelist,\n useIgnoreFiles: false,\n useManagedIgnore: false,\n });\n\n const fileStats = fs.statSync(archivePath);\n const fileSize = fileStats.size;\n debug(`Archive created, size: ${fileSize} bytes (${formatFileSize(fileSize)})`);\n\n addLog(`Archive created (${formatFileSize(fileSize)})`, 'INFO', logs);\n\n addLog('Uploading archive...', 'INFO', logs);\n\n debug(`Starting multipart upload for deployment: ${deploymentId}`);\n const uploadId = await startMultipartUpload(deploymentId);\n\n debug(`Upload ID: ${uploadId}`);\n\n debug('Uploading archive...');\n\n const fileChunkSize = 10 * 1024 * 1024; // 10 MB\n const numChunks = Math.ceil(fileSize / fileChunkSize);\n debug(`File size: ${fileSize}, chunk size: ${fileChunkSize}, number of chunks: ${numChunks}`);\n\n const promises = [];\n let start: number, end: number;\n\n for (let index = 1; index < numChunks + 1; index++) {\n start = (index - 1) * fileChunkSize;\n end = index * fileChunkSize;\n debug(`Processing chunk ${index}/${numChunks}, start: ${start}, end: ${end}`);\n\n const presignedUrl = await getPresignedUrl(deploymentId, uploadId, index);\n debug('Presigned URL for part', index, presignedUrl);\n\n const promise = new Promise<Response>((resolve, reject) => {\n void (async () => {\n try {\n debug(`Reading chunk ${index} data`);\n const readStream = fs.createReadStream(archivePath, {\n start,\n end: index < numChunks ? end - 1 : undefined,\n });\n\n const chunks: Buffer[] = [];\n readStream.on('data', (chunk: Buffer | string) => {\n chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk);\n });\n\n await new Promise<void>((resolveRead) => {\n readStream.on('end', () => resolveRead());\n readStream.on('error', reject);\n });\n\n const buffer = Buffer.concat(chunks);\n\n debug(`Uploading chunk ${index} to presigned URL (${buffer.length} bytes)`);\n const response = await fetch(presignedUrl, {\n method: 'PUT',\n headers: {\n 'Content-Type': 'application/zip',\n 'Content-Length': String(buffer.length),\n },\n body: buffer,\n });\n resolve(response);\n } catch (err) {\n reject(err instanceof Error ? err : new Error(String(err)));\n }\n })();\n });\n\n promises.push(promise);\n }\n\n const finishedParts: { partNumber: number; etag: string }[] = [];\n\n try {\n debug(`Waiting for all ${promises.length} upload promises to complete`);\n const responses = await Promise.all(promises);\n debug('All upload promises completed');\n\n for (let index = 0; index < responses.length; index++) {\n const res = responses[index];\n debug(`Checking response for part ${index + 1}, status: ${res.status}`);\n\n if (!res.ok) {\n debug(`Failed to upload part ${index + 1}: ${res.statusText} ${await res.text()}`);\n throw new Error(`Failed to upload part ${index + 1}: ${res.statusText}`);\n }\n\n const etag = res.headers.get('ETag');\n if (!etag) {\n debug(`Failed to get ETag for part ${index + 1}`);\n throw new Error(`Failed to get ETag for part ${index + 1}`);\n }\n\n debug(`Part ${index + 1} uploaded successfully, ETag: ${etag}`);\n finishedParts.push({\n partNumber: index + 1,\n etag: etag,\n });\n }\n\n debug(`Completing upload with ${finishedParts.length} parts`);\n await completeUpload(deploymentId, uploadId, finishedParts);\n debug('Upload completed successfully');\n } catch (err) {\n const error = err as Error;\n debug(`Upload error: ${error.message}`);\n addLog(`Upload error: ${error.message}`, 'ERROR', logs);\n throw error;\n }\n};\n\nconst createDeployment = async ({ applicationId }: { applicationId: string }) => {\n debug(`Creating deployment for application: ${applicationId}`);\n const res = await fetch(`http://localhost:3000/${applicationId}/deployments`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({}),\n duplex: 'half',\n });\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to create deployment: ${errorText}`);\n throw new Error('Failed to create deployment: ' + errorText);\n }\n\n const deployment = (await res.json()) as { id: string };\n debug(`Deployment created with ID: ${deployment.id}`);\n\n return deployment.id;\n};\n\nconst startMultipartUpload = async (deploymentId: string) => {\n debug(`Starting multipart upload for deployment: ${deploymentId}`);\n const res = await fetch(`http://localhost:3000/deployments/${deploymentId}/pre-signed-url/start`, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to start multipart upload: ${errorText}`);\n throw new Error('Failed to start multipart upload: ' + errorText);\n }\n\n const upload = (await res.json()) as { uploadId: string };\n debug(`Multipart upload started with ID: ${upload.uploadId}`);\n\n return upload.uploadId;\n};\n\nconst getPresignedUrl = async (deploymentId: string, uploadId: string, partNumber: number) => {\n debug(`Getting presigned URL for deployment: ${deploymentId}, upload: ${uploadId}, part: ${partNumber}`);\n const res = await fetch(\n `http://localhost:3000/deployments/${deploymentId}/pre-signed-url/part?uploadId=${uploadId}&partNumber=${partNumber}`,\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n }\n );\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to get pre-signed URL: ${errorText}`);\n throw new Error('Failed to get pre-signed URL: ' + errorText);\n }\n\n const upload = (await res.json()) as { url: string };\n debug(`Got presigned URL for part ${partNumber}`);\n\n return upload.url;\n};\n\nconst completeUpload = async (\n deploymentId: string,\n uploadId: string,\n parts: { partNumber: number; etag: string }[]\n) => {\n debug(`Completing upload for deployment: ${deploymentId}, upload: ${uploadId}, parts: ${parts.length}`);\n const res = await fetch(`http://localhost:3000/deployments/${deploymentId}/pre-signed-url/complete`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n uploadId,\n parts,\n }),\n duplex: 'half',\n });\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to complete upload: ${errorText}`);\n throw new Error('Failed to complete upload: ' + errorText);\n }\n\n debug('Upload completed successfully');\n};\n\nconst getDeploymentStatus = async (deploymentId: string) => {\n debug(`Getting deployment status for: ${deploymentId}`);\n const res = await fetch(`http://localhost:3000/deployments/${deploymentId}`, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to get deployment status: ${errorText}`);\n throw new Error('Failed to get deployment status: ' + errorText);\n }\n\n const deployment = (await res.json()) as { status: DeploymentStatus };\n debug(`Deployment status: ${deployment.status}`);\n\n return deployment.status;\n};\n\nconst getLogs = async (\n deploymentId: string,\n options?: {\n offset: number;\n limit: number;\n 'createdAt[gt]'?: string;\n }\n) => {\n debug(`Getting logs for deployment: ${deploymentId}, options:`, options ?? 'No options');\n const res = await fetch(`http://localhost:3000/deployments/${deploymentId}/logs${objectToQueryString(options)}`, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n\n if (!res.ok) {\n const errorText = await res.text();\n debug(`Failed to get logs: ${errorText}`);\n throw new Error('Failed to get logs: ' + errorText);\n }\n\n const logs = (await res.json()) as {\n totalItems: number;\n limit: number;\n offset: number;\n items: DeploymentLog[];\n };\n\n debug(`Got ${logs.items.length} logs, total: ${logs.totalItems}`);\n return logs;\n};\n\ntype DeploymentStatus = 'PENDING' | 'BUILDING' | 'PROVISIONING' | 'FAILED' | 'ACTIVE' | 'SUSPENDED';\n\ntype DeploymentLog = { id: string; message: string; type: 'INFO' | 'ERROR' | 'WARN'; createdAt: string };\n","import { getFilesForPattern } from '@gigadrive/build-utils';\nimport archiver from 'archiver';\nimport fs from 'fs';\nimport fsPromises from 'fs/promises';\nimport ignore, { type Ignore } from 'ignore';\nimport path from 'path';\n\nconst ignoreFileNames = [/*'.gitignore', */ '.gigadriveignore', '.vercelignore', '.dockerignore', '.nowignore'];\n\n// Function to read and parse the ignore file\nasync function readIgnoreFile(ignorePath: string) {\n try {\n await fsPromises.access(ignorePath);\n const content = await fsPromises.readFile(ignorePath, 'utf8');\n return content.split('\\n').filter((line: string) => line.trim() !== '');\n } catch {\n return [];\n }\n}\n\n// Collect ignore patterns from the given directory (including the root)\nasync function collectIgnorePatterns(dir: string, baseDir: string, ignoreRules: Ignore) {\n const items = await fsPromises.readdir(dir);\n\n for (const item of items) {\n const fullPath = path.join(dir, item);\n const relativePath = path.relative(baseDir, fullPath);\n const stat = await fsPromises.lstat(fullPath);\n\n if (stat.isDirectory()) {\n // If the directory itself is ignored, skip it unless it has a negation rule\n if (ignoreRules.ignores(`${relativePath}/`)) {\n continue;\n }\n\n // Check if the directory contains an ignore file\n for (const ignoreFileName of ignoreFileNames) {\n const ignoreFilePath = path.join(fullPath, ignoreFileName);\n try {\n await fsPromises.access(ignoreFilePath);\n const patterns = (await readIgnoreFile(ignoreFilePath)).map((pattern: string) => {\n return pattern.startsWith('!')\n ? `!${path.join(relativePath, pattern.slice(1))}`\n : path.join(relativePath, pattern);\n });\n ignoreRules.add(patterns);\n } catch {\n // File doesn't exist, skip\n }\n }\n\n // Recurse into subdirectory\n await collectIgnorePatterns(fullPath, baseDir, ignoreRules);\n }\n }\n}\n\n// Function to initialize ignore rules including root-level ignore files\nasync function initializeIgnoreRules(baseDir: string): Promise<Ignore> {\n const ignoreRules = ignore();\n\n // Add default ignore rules\n ignoreRules.add(['.git/', '**/.DS_Store', '**/Thumbs.db']);\n\n // Process root-level ignore files\n for (const ignoreFileName of ignoreFileNames) {\n const ignoreFilePath = path.join(baseDir, ignoreFileName);\n try {\n await fsPromises.access(ignoreFilePath);\n const patterns = (await readIgnoreFile(ignoreFilePath)).map((pattern: string) => {\n return pattern.startsWith('!') ? `!${pattern.slice(1)}` : pattern;\n });\n ignoreRules.add(patterns);\n } catch {\n // File doesn't exist, skip\n }\n }\n\n // Recursively process all subdirectories to gather additional ignore patterns\n await collectIgnorePatterns(baseDir, baseDir, ignoreRules);\n\n return ignoreRules;\n}\n\n// Function to get all files and directories, excluding those in the ignore list\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nasync function getFilesToInclude(dir: string, ignoreRules: Ignore, whitelist?: string[]) {\n const filesToInclude: string[] = [];\n\n async function walkDir(currentDir: string) {\n const items = await fsPromises.readdir(currentDir);\n\n for (const item of items) {\n const fullPath = path.join(currentDir, item);\n const relativePath = path.relative(dir, fullPath);\n const stat = await fsPromises.lstat(fullPath);\n\n if (stat.isDirectory()) {\n if (ignoreRules.ignores(`${relativePath}/`)) {\n continue;\n }\n await walkDir(fullPath);\n } else {\n if (!ignoreRules.ignores(relativePath)) {\n filesToInclude.push(fullPath);\n } else if (ignoreRules.ignores(relativePath) && ignoreRules.test(relativePath).unignored) {\n // Handle whitelisted files that were previously ignored\n filesToInclude.push(fullPath);\n }\n }\n }\n }\n\n await walkDir(dir);\n return filesToInclude;\n}\n\n// Function to create the zip archive\nexport async function createZipArchive(\n inputDir: string,\n outputFile: string,\n options: {\n whitelist?: string[];\n useIgnoreFiles?: boolean;\n useManagedIgnore?: boolean;\n } = {}\n) {\n const ignoreRules = options.useIgnoreFiles !== false ? await initializeIgnoreRules(inputDir) : ignore();\n\n // Get list of files to include in the zip\n const filesToInclude = options.whitelist\n ? await Promise.all(options.whitelist.map((file) => getFilesForPattern(inputDir, file)))\n : await getFilesToInclude(inputDir, ignoreRules);\n\n // Create zip file\n const output = fs.createWriteStream(outputFile);\n const archive = archiver('zip', { zlib: { level: 9 } });\n\n return new Promise<void>((resolve, reject) => {\n output.on('close', () => resolve());\n archive.on('error', reject);\n\n archive.pipe(output);\n\n // Add files to the archive\n for (const file of filesToInclude.flat()) {\n archive.file(file, { name: path.relative(inputDir, file) });\n }\n\n void archive.finalize();\n });\n}\n","import type { Command } from 'commander';\nimport { deploy } from './deploy';\n\nexport const platform = (program: Command) => {\n const platform = program.command('platform').description('Manage the platform');\n\n // register subcommands\n deploy(platform);\n};\n"],"mappings":";;;AAAA,SAAS,eAAe;;;ACAxB,SAAS,QAAAA,aAAY;AAErB,OAAOC,SAAQ;AACf,OAAOC,WAAU;;;ACHjB,OAAO,QAAQ;AACf,OAAO,UAAU;;;ACDjB,SAAS,aAAa;AAqCtB,eAAsB,KAAK;AAAA,EACzB;AAAA,EACA,MAAM,QAAQ,IAAI;AAAA,EAClB;AAAA,EACA,WAAW,CAAC,SAAiB,QAAQ,IAAI,IAAI;AAAA,EAC7C,UAAU,CAAC,SAAiB,QAAQ,MAAM,IAAI;AAChD,GAA+B;AAC7B,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,QAAI;AACJ,QAAI,YAAsB,CAAC;AAE3B,QAAI,OAAO,YAAY,UAAU;AAE/B,YAAM,QAAQ,QAAQ,MAAM,GAAG;AAC/B,qBAAe,MAAM,CAAC;AACtB,kBAAY,MAAM,MAAM,CAAC;AAAA,IAC3B,OAAO;AAEL,qBAAe,QAAQ;AACvB,kBAAY,QAAQ,QAAQ,CAAC;AAAA,IAC/B;AAEA,UAAM,eAAe,MAAM,cAAc,WAAW;AAAA,MAClD;AAAA,MACA,OAAO;AAAA,MACP;AAAA,IACF,CAAC;AAED,iBAAa,OAAO,GAAG,QAAQ,CAAC,SAAS;AACvC,eAAS,KAAK,SAAS,EAAE,KAAK,CAAC;AAAA,IACjC,CAAC;AAED,iBAAa,OAAO,GAAG,QAAQ,CAAC,SAAS;AACvC,cAAQ,KAAK,SAAS,EAAE,KAAK,CAAC;AAAA,IAChC,CAAC;AAED,iBAAa,GAAG,SAAS,CAACC,WAAU;AAClC,aAAO,IAAI,MAAM,4BAA4BA,OAAM,OAAO,EAAE,CAAC;AAAA,IAC/D,CAAC;AAED,iBAAa,GAAG,SAAS,CAAC,SAAS;AACjC,UAAI,SAAS,GAAG;AACd,gBAAQ;AAAA,MACV,OAAO;AACL,eAAO,IAAI,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AK,UAAU,GAAG,CAAC,EAAE;AAAA,IAC5E;AAAA,EACF,OAAO;AACL,YAAQ,MAAM,wCAAwC;AAAA,EACxD;AAEA,UAAQ,KAAK,CAAC;AAChB;AAEA,IAAM,mBAAmB,CAACC,WAAiB;AACzC,QAAM,EAAE,QAAQ,IAAIA;AAEpB,UAAQ,MAAM;AAAA,IAAmC,OAAO,EAAE;AAE1D,UAAQ,KAAK,CAAC;AAChB;AAEA,QAAQ,GAAG,sBAAsB,eAAe;AAChD,QAAQ,GAAG,qBAAqB,gBAAgB;AAEhD,QAAQ,GAAG,QAAQ,MAAM;AACvB,QAAM,WAAW,QAAQ,OAAO,QAAQ,QAAQ,SAAS,QAAQ,OAAO,QAAQ,QAAQ,SAAS;AACjG,YAAU,MAAM,WAAa;AAC/B,CAAC;AAED,KAAK,EACF,KAAK,CAAC,aAAa;AAClB,UAAQ,WAAW;AACrB,CAAC,EACA,MAAM,gBAAgB;","names":["exec","fs","path","error","path","fs","exec","log","config","log","debug","findConfig","parseConfig","fs","path","fs","path","findConfig","config","parseConfig","path","fs","error","platform","debug","error"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gigadrive",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/Gigadrive/sdk.git",
|
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
"arg": "^5.0.2",
|
|
24
24
|
"commander": "^13.1.0",
|
|
25
25
|
"consola": "^3.4.2",
|
|
26
|
-
"ignore": "^7.0.
|
|
26
|
+
"ignore": "^7.0.5",
|
|
27
27
|
"react": "^18.3.1",
|
|
28
|
-
"react-devtools-core": "^6.1.
|
|
29
|
-
"@gigadrive/
|
|
30
|
-
"@gigadrive/network-config": "2.1.
|
|
31
|
-
"@gigadrive/
|
|
28
|
+
"react-devtools-core": "^6.1.5",
|
|
29
|
+
"@gigadrive/build-utils": "1.0.1",
|
|
30
|
+
"@gigadrive/network-config": "2.1.2",
|
|
31
|
+
"@gigadrive/commons": "2.1.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@types/archiver": "^6.0.
|
|
35
|
-
"@types/react": "^18.3.
|
|
36
|
-
"esbuild": "^0.25.
|
|
37
|
-
"typescript": "^5.
|
|
34
|
+
"@types/archiver": "^6.0.3",
|
|
35
|
+
"@types/react": "^18.3.24",
|
|
36
|
+
"esbuild": "^0.25.10",
|
|
37
|
+
"typescript": "^5.9.2"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|