gigadrive 1.0.2 → 1.1.1
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 +51 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +51 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -168,12 +168,9 @@ var build = (parent) => {
|
|
|
168
168
|
});
|
|
169
169
|
};
|
|
170
170
|
|
|
171
|
-
// src/commands/
|
|
172
|
-
var import_commons = require("@gigadrive/commons");
|
|
171
|
+
// src/commands/debug/config/index.ts
|
|
173
172
|
var import_network_config = require("@gigadrive/network-config");
|
|
174
|
-
var
|
|
175
|
-
var import_os = __toESM(require("os"), 1);
|
|
176
|
-
var import_path4 = __toESM(require("path"), 1);
|
|
173
|
+
var import_console = require("console");
|
|
177
174
|
|
|
178
175
|
// src/util/log.ts
|
|
179
176
|
var import_consola = require("consola");
|
|
@@ -214,7 +211,35 @@ var spinner = (message) => {
|
|
|
214
211
|
log(message);
|
|
215
212
|
};
|
|
216
213
|
|
|
214
|
+
// src/commands/debug/config/index.ts
|
|
215
|
+
var config = (parent) => {
|
|
216
|
+
parent.command("config").description("Provide debug info about the project configuration in the current directory").action(async () => {
|
|
217
|
+
const configPath = (0, import_network_config.findConfig)(process.cwd());
|
|
218
|
+
if (!configPath) {
|
|
219
|
+
debug("No config file found");
|
|
220
|
+
throw new Error("The current project folder does not have a valid config file.");
|
|
221
|
+
}
|
|
222
|
+
const config2 = await (0, import_network_config.parseConfig)(configPath, process.cwd());
|
|
223
|
+
(0, import_console.log)(`Config file found at: ${configPath}`);
|
|
224
|
+
(0, import_console.log)(JSON.stringify(config2, null, 2));
|
|
225
|
+
});
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
// src/commands/debug/index.ts
|
|
229
|
+
var debug2 = (program) => {
|
|
230
|
+
const debug3 = program.command("debug").description("Provides various debugging utilities");
|
|
231
|
+
config(debug3);
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
// src/commands/platform/deploy/index.ts
|
|
235
|
+
var import_commons = require("@gigadrive/commons");
|
|
236
|
+
var import_network_config2 = require("@gigadrive/network-config");
|
|
237
|
+
var import_fs4 = __toESM(require("fs"), 1);
|
|
238
|
+
var import_os = __toESM(require("os"), 1);
|
|
239
|
+
var import_path4 = __toESM(require("path"), 1);
|
|
240
|
+
|
|
217
241
|
// src/util/zip.ts
|
|
242
|
+
var import_build_utils2 = require("@gigadrive/build-utils");
|
|
218
243
|
var import_archiver = __toESM(require("archiver"), 1);
|
|
219
244
|
var import_fs3 = __toESM(require("fs"), 1);
|
|
220
245
|
var import_ignore = __toESM(require("ignore"), 1);
|
|
@@ -270,7 +295,7 @@ function initializeIgnoreRules(baseDir) {
|
|
|
270
295
|
collectIgnorePatterns(baseDir, baseDir, ignoreRules);
|
|
271
296
|
return ignoreRules;
|
|
272
297
|
}
|
|
273
|
-
async function getFilesToInclude(dir, ignoreRules) {
|
|
298
|
+
async function getFilesToInclude(dir, ignoreRules, whitelist) {
|
|
274
299
|
const filesToInclude = [];
|
|
275
300
|
function walkSync(currentDir) {
|
|
276
301
|
const items = import_fs3.default.readdirSync(currentDir);
|
|
@@ -298,7 +323,7 @@ async function getFilesToInclude(dir, ignoreRules) {
|
|
|
298
323
|
}
|
|
299
324
|
async function createZipArchive(inputDir, outputFile, options = {}) {
|
|
300
325
|
const ignoreRules = options.useIgnoreFiles !== false ? initializeIgnoreRules(inputDir) : (0, import_ignore.default)();
|
|
301
|
-
const filesToInclude = await getFilesToInclude(inputDir, ignoreRules);
|
|
326
|
+
const filesToInclude = options.whitelist ? await Promise.all(options.whitelist.map((file) => (0, import_build_utils2.getFilesForPattern)(inputDir, file))) : await getFilesToInclude(inputDir, ignoreRules);
|
|
302
327
|
const output = import_fs3.default.createWriteStream(outputFile);
|
|
303
328
|
const archive = (0, import_archiver.default)("zip", { zlib: { level: 9 } });
|
|
304
329
|
return new Promise((resolve, reject) => {
|
|
@@ -316,23 +341,23 @@ async function createZipArchive(inputDir, outputFile, options = {}) {
|
|
|
316
341
|
var deploy = (parent) => {
|
|
317
342
|
parent.command("deploy").description("Deploy the current project").action(async () => {
|
|
318
343
|
debug("Starting deploy command");
|
|
319
|
-
const configPath = (0,
|
|
344
|
+
const configPath = (0, import_network_config2.findConfig)(process.cwd());
|
|
320
345
|
if (!configPath) {
|
|
321
346
|
debug("No config file found");
|
|
322
347
|
throw new Error("The current project folder does not have a valid config file.");
|
|
323
348
|
}
|
|
324
349
|
debug(`Found config at: ${configPath}`);
|
|
325
|
-
const
|
|
326
|
-
debug("Parsed config",
|
|
327
|
-
if (
|
|
328
|
-
debug(`Found ${
|
|
329
|
-
|
|
350
|
+
const config2 = await (0, import_network_config2.parseConfig)(configPath, process.cwd());
|
|
351
|
+
debug("Parsed config", config2);
|
|
352
|
+
if (config2.warnings.length > 0) {
|
|
353
|
+
debug(`Found ${config2.warnings.length} warnings in config`);
|
|
354
|
+
config2.warnings.forEach((message) => {
|
|
330
355
|
warn(message);
|
|
331
356
|
});
|
|
332
357
|
}
|
|
333
|
-
if (
|
|
334
|
-
debug(`Found ${
|
|
335
|
-
|
|
358
|
+
if (config2.errors.length > 0) {
|
|
359
|
+
debug(`Found ${config2.errors.length} errors in config`);
|
|
360
|
+
config2.errors.forEach((message) => {
|
|
336
361
|
error(message);
|
|
337
362
|
});
|
|
338
363
|
throw new Error("The current project folder does not have a valid config file.");
|
|
@@ -344,17 +369,17 @@ var deploy = (parent) => {
|
|
|
344
369
|
});
|
|
345
370
|
debug(`Deployment ID: ${deploymentId}`);
|
|
346
371
|
debug("Starting deployment process");
|
|
347
|
-
await handleDeployment(deploymentId,
|
|
372
|
+
await handleDeployment(deploymentId, config2);
|
|
348
373
|
});
|
|
349
374
|
};
|
|
350
|
-
var handleDeployment = async (deploymentId,
|
|
375
|
+
var handleDeployment = async (deploymentId, config2) => {
|
|
351
376
|
debug("Deployment process initialized");
|
|
352
377
|
let status = "PENDING";
|
|
353
378
|
const logs = [];
|
|
354
379
|
addLog("Deployment ID: " + deploymentId, "INFO", logs);
|
|
355
380
|
try {
|
|
356
381
|
debug("Starting upload process");
|
|
357
|
-
await uploadArchive(deploymentId, logs);
|
|
382
|
+
await uploadArchive(deploymentId, logs, config2);
|
|
358
383
|
debug("Upload completed successfully");
|
|
359
384
|
addLog("Upload complete.", "INFO", logs);
|
|
360
385
|
addLog("The deployment pipeline is now being provisioned. This may take a few seconds.", "INFO", logs);
|
|
@@ -431,7 +456,7 @@ var addLog = (message, type, logs) => {
|
|
|
431
456
|
log(message);
|
|
432
457
|
}
|
|
433
458
|
};
|
|
434
|
-
var uploadArchive = async (deploymentId, logs) => {
|
|
459
|
+
var uploadArchive = async (deploymentId, logs, config2) => {
|
|
435
460
|
debug("Starting uploadArchive");
|
|
436
461
|
addLog("Creating archive...", "INFO", logs);
|
|
437
462
|
const archivePath = import_path4.default.join(process.env.TEMP || import_os.default.tmpdir(), `project-${Date.now()}.zip`);
|
|
@@ -441,7 +466,11 @@ var uploadArchive = async (deploymentId, logs) => {
|
|
|
441
466
|
import_fs4.default.unlinkSync(archivePath);
|
|
442
467
|
}
|
|
443
468
|
debug("Creating zip archive");
|
|
444
|
-
await createZipArchive(process.cwd(), archivePath, {
|
|
469
|
+
await createZipArchive(config2.userArchive?.rootOverwrite || process.cwd(), archivePath, {
|
|
470
|
+
whitelist: config2.userArchive?.fileWhitelist,
|
|
471
|
+
useIgnoreFiles: false,
|
|
472
|
+
useManagedIgnore: false
|
|
473
|
+
});
|
|
445
474
|
const fileStats = import_fs4.default.statSync(archivePath);
|
|
446
475
|
const fileSize = fileStats.size;
|
|
447
476
|
debug(`Archive created, size: ${fileSize} bytes (${(0, import_commons.formatFileSize)(fileSize)})`);
|
|
@@ -665,6 +694,7 @@ var main = async () => {
|
|
|
665
694
|
setVerbose(thisCommand.opts().verbose === true);
|
|
666
695
|
});
|
|
667
696
|
platform(program);
|
|
697
|
+
debug2(program);
|
|
668
698
|
build(program);
|
|
669
699
|
try {
|
|
670
700
|
await program.parseAsync(process.argv);
|
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/platform/deploy/index.ts","../src/util/log.ts","../src/util/zip.ts","../src/commands/platform/index.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { build } from './commands/build';\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 service commands\n platform(program);\n\n // register general commands\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 { 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);\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[]) => {\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 await createZipArchive(process.cwd(), archivePath, { useIgnoreFiles: false, useManagedIgnore: false });\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 { 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 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) {\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 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 = 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,QAAQ;AACvB,kBAAY,QAAQ,QAAQ,CAAC;AAAA,IAC/B;AAEA,UAAM,mBAAe,4BAAM,cAAc,WAAW;AAAA,MAClD;AAAA,MACA,OAAO;AAAA,MACP;AAAA,IACF,CAAC;AAED,iBAAa,OAAO,GAAG,QAAQ,CAAC,SAAS;AACvC,eAAS,KAAK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AM,gBAAgB;","names":["import_fs","import_path","error","path","fs","path","fs","import_fs","import_path","import_fs","import_path","fs","path","ignore","archiver","path","os","fs","error","platform","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\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,kBAA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,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"]}
|
package/dist/index.mjs
CHANGED
|
@@ -145,12 +145,9 @@ var build = (parent) => {
|
|
|
145
145
|
});
|
|
146
146
|
};
|
|
147
147
|
|
|
148
|
-
// src/commands/
|
|
149
|
-
import { formatFileSize, objectToQueryString } from "@gigadrive/commons";
|
|
148
|
+
// src/commands/debug/config/index.ts
|
|
150
149
|
import { findConfig, parseConfig } from "@gigadrive/network-config";
|
|
151
|
-
import
|
|
152
|
-
import os from "os";
|
|
153
|
-
import path4 from "path";
|
|
150
|
+
import { log as log2 } from "console";
|
|
154
151
|
|
|
155
152
|
// src/util/log.ts
|
|
156
153
|
import { createConsola } from "consola";
|
|
@@ -191,7 +188,35 @@ var spinner = (message) => {
|
|
|
191
188
|
log(message);
|
|
192
189
|
};
|
|
193
190
|
|
|
191
|
+
// src/commands/debug/config/index.ts
|
|
192
|
+
var config = (parent) => {
|
|
193
|
+
parent.command("config").description("Provide debug info about the project configuration in the current directory").action(async () => {
|
|
194
|
+
const configPath = findConfig(process.cwd());
|
|
195
|
+
if (!configPath) {
|
|
196
|
+
debug("No config file found");
|
|
197
|
+
throw new Error("The current project folder does not have a valid config file.");
|
|
198
|
+
}
|
|
199
|
+
const config2 = await parseConfig(configPath, process.cwd());
|
|
200
|
+
log2(`Config file found at: ${configPath}`);
|
|
201
|
+
log2(JSON.stringify(config2, null, 2));
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
// src/commands/debug/index.ts
|
|
206
|
+
var debug2 = (program) => {
|
|
207
|
+
const debug3 = program.command("debug").description("Provides various debugging utilities");
|
|
208
|
+
config(debug3);
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
// src/commands/platform/deploy/index.ts
|
|
212
|
+
import { formatFileSize, objectToQueryString } from "@gigadrive/commons";
|
|
213
|
+
import { findConfig as findConfig2, parseConfig as parseConfig2 } from "@gigadrive/network-config";
|
|
214
|
+
import fs4 from "fs";
|
|
215
|
+
import os from "os";
|
|
216
|
+
import path4 from "path";
|
|
217
|
+
|
|
194
218
|
// src/util/zip.ts
|
|
219
|
+
import { getFilesForPattern } from "@gigadrive/build-utils";
|
|
195
220
|
import archiver from "archiver";
|
|
196
221
|
import fs3 from "fs";
|
|
197
222
|
import ignore from "ignore";
|
|
@@ -247,7 +272,7 @@ function initializeIgnoreRules(baseDir) {
|
|
|
247
272
|
collectIgnorePatterns(baseDir, baseDir, ignoreRules);
|
|
248
273
|
return ignoreRules;
|
|
249
274
|
}
|
|
250
|
-
async function getFilesToInclude(dir, ignoreRules) {
|
|
275
|
+
async function getFilesToInclude(dir, ignoreRules, whitelist) {
|
|
251
276
|
const filesToInclude = [];
|
|
252
277
|
function walkSync(currentDir) {
|
|
253
278
|
const items = fs3.readdirSync(currentDir);
|
|
@@ -275,7 +300,7 @@ async function getFilesToInclude(dir, ignoreRules) {
|
|
|
275
300
|
}
|
|
276
301
|
async function createZipArchive(inputDir, outputFile, options = {}) {
|
|
277
302
|
const ignoreRules = options.useIgnoreFiles !== false ? initializeIgnoreRules(inputDir) : ignore();
|
|
278
|
-
const filesToInclude = await getFilesToInclude(inputDir, ignoreRules);
|
|
303
|
+
const filesToInclude = options.whitelist ? await Promise.all(options.whitelist.map((file) => getFilesForPattern(inputDir, file))) : await getFilesToInclude(inputDir, ignoreRules);
|
|
279
304
|
const output = fs3.createWriteStream(outputFile);
|
|
280
305
|
const archive = archiver("zip", { zlib: { level: 9 } });
|
|
281
306
|
return new Promise((resolve, reject) => {
|
|
@@ -293,23 +318,23 @@ async function createZipArchive(inputDir, outputFile, options = {}) {
|
|
|
293
318
|
var deploy = (parent) => {
|
|
294
319
|
parent.command("deploy").description("Deploy the current project").action(async () => {
|
|
295
320
|
debug("Starting deploy command");
|
|
296
|
-
const configPath =
|
|
321
|
+
const configPath = findConfig2(process.cwd());
|
|
297
322
|
if (!configPath) {
|
|
298
323
|
debug("No config file found");
|
|
299
324
|
throw new Error("The current project folder does not have a valid config file.");
|
|
300
325
|
}
|
|
301
326
|
debug(`Found config at: ${configPath}`);
|
|
302
|
-
const
|
|
303
|
-
debug("Parsed config",
|
|
304
|
-
if (
|
|
305
|
-
debug(`Found ${
|
|
306
|
-
|
|
327
|
+
const config2 = await parseConfig2(configPath, process.cwd());
|
|
328
|
+
debug("Parsed config", config2);
|
|
329
|
+
if (config2.warnings.length > 0) {
|
|
330
|
+
debug(`Found ${config2.warnings.length} warnings in config`);
|
|
331
|
+
config2.warnings.forEach((message) => {
|
|
307
332
|
warn(message);
|
|
308
333
|
});
|
|
309
334
|
}
|
|
310
|
-
if (
|
|
311
|
-
debug(`Found ${
|
|
312
|
-
|
|
335
|
+
if (config2.errors.length > 0) {
|
|
336
|
+
debug(`Found ${config2.errors.length} errors in config`);
|
|
337
|
+
config2.errors.forEach((message) => {
|
|
313
338
|
error(message);
|
|
314
339
|
});
|
|
315
340
|
throw new Error("The current project folder does not have a valid config file.");
|
|
@@ -321,17 +346,17 @@ var deploy = (parent) => {
|
|
|
321
346
|
});
|
|
322
347
|
debug(`Deployment ID: ${deploymentId}`);
|
|
323
348
|
debug("Starting deployment process");
|
|
324
|
-
await handleDeployment(deploymentId,
|
|
349
|
+
await handleDeployment(deploymentId, config2);
|
|
325
350
|
});
|
|
326
351
|
};
|
|
327
|
-
var handleDeployment = async (deploymentId,
|
|
352
|
+
var handleDeployment = async (deploymentId, config2) => {
|
|
328
353
|
debug("Deployment process initialized");
|
|
329
354
|
let status = "PENDING";
|
|
330
355
|
const logs = [];
|
|
331
356
|
addLog("Deployment ID: " + deploymentId, "INFO", logs);
|
|
332
357
|
try {
|
|
333
358
|
debug("Starting upload process");
|
|
334
|
-
await uploadArchive(deploymentId, logs);
|
|
359
|
+
await uploadArchive(deploymentId, logs, config2);
|
|
335
360
|
debug("Upload completed successfully");
|
|
336
361
|
addLog("Upload complete.", "INFO", logs);
|
|
337
362
|
addLog("The deployment pipeline is now being provisioned. This may take a few seconds.", "INFO", logs);
|
|
@@ -408,7 +433,7 @@ var addLog = (message, type, logs) => {
|
|
|
408
433
|
log(message);
|
|
409
434
|
}
|
|
410
435
|
};
|
|
411
|
-
var uploadArchive = async (deploymentId, logs) => {
|
|
436
|
+
var uploadArchive = async (deploymentId, logs, config2) => {
|
|
412
437
|
debug("Starting uploadArchive");
|
|
413
438
|
addLog("Creating archive...", "INFO", logs);
|
|
414
439
|
const archivePath = path4.join(process.env.TEMP || os.tmpdir(), `project-${Date.now()}.zip`);
|
|
@@ -418,7 +443,11 @@ var uploadArchive = async (deploymentId, logs) => {
|
|
|
418
443
|
fs4.unlinkSync(archivePath);
|
|
419
444
|
}
|
|
420
445
|
debug("Creating zip archive");
|
|
421
|
-
await createZipArchive(process.cwd(), archivePath, {
|
|
446
|
+
await createZipArchive(config2.userArchive?.rootOverwrite || process.cwd(), archivePath, {
|
|
447
|
+
whitelist: config2.userArchive?.fileWhitelist,
|
|
448
|
+
useIgnoreFiles: false,
|
|
449
|
+
useManagedIgnore: false
|
|
450
|
+
});
|
|
422
451
|
const fileStats = fs4.statSync(archivePath);
|
|
423
452
|
const fileSize = fileStats.size;
|
|
424
453
|
debug(`Archive created, size: ${fileSize} bytes (${formatFileSize(fileSize)})`);
|
|
@@ -642,6 +671,7 @@ var main = async () => {
|
|
|
642
671
|
setVerbose(thisCommand.opts().verbose === true);
|
|
643
672
|
});
|
|
644
673
|
platform(program);
|
|
674
|
+
debug2(program);
|
|
645
675
|
build(program);
|
|
646
676
|
try {
|
|
647
677
|
await program.parseAsync(process.argv);
|
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/platform/deploy/index.ts","../src/util/log.ts","../src/util/zip.ts","../src/commands/platform/index.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { build } from './commands/build';\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 service commands\n platform(program);\n\n // register general commands\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 { 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);\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[]) => {\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 await createZipArchive(process.cwd(), archivePath, { useIgnoreFiles: false, useManagedIgnore: false });\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 { 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 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) {\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 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 = 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,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,KAA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AAA,EACF,CAAC;AAED,UAAQ,KAAK,aAAa,CAAC,gBAAgB;AACzC,eAAY,YAAY,KAAK,EAAE,YAAwB,IAAI;AAAA,EAC7D,CAAC;AAGD,WAAS,OAAO;AAGhB,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":["exec","fs","path","error","path","fs","exec","fs","path","fs","path","path","fs","error","platform","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\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,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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oB;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":["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.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/Gigadrive/sdk.git",
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
"ignore": "^7.0.3",
|
|
27
27
|
"react": "^18.3.1",
|
|
28
28
|
"react-devtools-core": "^6.1.1",
|
|
29
|
-
"@gigadrive/
|
|
30
|
-
"@gigadrive/
|
|
31
|
-
"@gigadrive/
|
|
29
|
+
"@gigadrive/commons": "2.1.0",
|
|
30
|
+
"@gigadrive/network-config": "2.1.1",
|
|
31
|
+
"@gigadrive/build-utils": "1.0.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/archiver": "^6.0.2",
|
|
35
35
|
"@types/react": "^18.3.3",
|
|
36
|
-
"esbuild": "^0.25.
|
|
36
|
+
"esbuild": "^0.25.2",
|
|
37
37
|
"typescript": "^5.0.0"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|