gigadrive 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -206,7 +206,6 @@ var warn = (message) => {
206
206
  };
207
207
  var debug = (message, ...optionalParams) => {
208
208
  if (!verbose) {
209
- console.log("debug", message, ...optionalParams);
210
209
  return;
211
210
  }
212
211
  consola.debug("[DEBUG]", message, ...optionalParams);
@@ -364,7 +363,7 @@ var handleDeployment = async (deploymentId, config) => {
364
363
  addLog(`Upload failed: ${err.message}`, "ERROR", logs);
365
364
  status = "FAILED";
366
365
  error("The deployment failed. Please check the logs for more information.");
367
- return;
366
+ process.exit(1);
368
367
  }
369
368
  const statusInterval = setInterval(async () => {
370
369
  try {
@@ -655,16 +654,15 @@ var main = async () => {
655
654
  }
656
655
  let exitCode = 0;
657
656
  const program = new import_commander.Command();
658
- program.option("-v, --verbose", "Enable verbose logging");
657
+ program.option("-v, --verbose", "Enable verbose logging", false);
659
658
  program.hook("preSubcommand", (thisCommand, actionCommand) => {
660
- setVerbose(thisCommand.opts().verbose);
661
- console.log("preSubcommand hook", thisCommand.opts().verbose);
659
+ setVerbose(thisCommand.opts().verbose === true);
662
660
  if (thisCommand.opts().verbose) {
663
661
  log("Using verbose mode");
664
662
  }
665
663
  });
666
664
  program.hook("preAction", (thisCommand) => {
667
- setVerbose(thisCommand.opts().verbose);
665
+ setVerbose(thisCommand.opts().verbose === true);
668
666
  });
669
667
  platform(program);
670
668
  build(program);
@@ -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');\n\n program.hook('preSubcommand', (thisCommand, actionCommand) => {\n setVerbose(thisCommand.opts().verbose as boolean);\n console.log('preSubcommand hook', thisCommand.opts().verbose);\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);\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 return;\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 console.log('debug', message, ...optionalParams);\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,SAAS,EAAE,KAAK,CAAC;AAAA,IACjC,CAAC;AAED,iBAAa,OAAO,GAAG,QAAQ,CAAC,SAAS;AACvC,cAAQ,KAAK,SAAS,EAAE,KAAK,CAAC;AAAA,IAChC,CAAC;AAED,iBAAa,GAAG,SAAS,CAACC,WAAU;AAClC,aAAO,IAAI,MAAM,4BAA4BA,OAAM,OAAO,EAAE,CAAC;AAAA,IAC/D,CAAC;AAED,iBAAa,GAAG,SAAS,CAAC,SAAS;AACjC,UAAI,SAAS,GAAG;AACd,gBAAQ;AAAA,MAC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CAAC,gBAAgB;AACzC,eAAW,YAAY,KAAK,EAAE,OAAkB;AAAA,EAClD,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":["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/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,SAAS,EAAE,KAAK,CAAC;AAAA,IACjC,CAAC;AAED,iBAAa,OAAO,GAAG,QAAQ,CAAC,SAAS;AACvC,cAAQ,KAAK,SAAS,EAAE,KAAK,CAAC;AAAA,IAChC,CAAC;AAED,iBAAa,GAAG,SAAS,CAACC,WAAU;AAClC,aAAO,IAAI,MAAM,4BAA4BA,OAAM,OAAO,EAAE,CAAC;AAAA,IAC/D,CAAC;AAED,iBAAa,GAAG,SAAS,CAAC,SAAS;AACjC,U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Y,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":["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"]}
package/dist/index.mjs CHANGED
@@ -183,7 +183,6 @@ var warn = (message) => {
183
183
  };
184
184
  var debug = (message, ...optionalParams) => {
185
185
  if (!verbose) {
186
- console.log("debug", message, ...optionalParams);
187
186
  return;
188
187
  }
189
188
  consola.debug("[DEBUG]", message, ...optionalParams);
@@ -341,7 +340,7 @@ var handleDeployment = async (deploymentId, config) => {
341
340
  addLog(`Upload failed: ${err.message}`, "ERROR", logs);
342
341
  status = "FAILED";
343
342
  error("The deployment failed. Please check the logs for more information.");
344
- return;
343
+ process.exit(1);
345
344
  }
346
345
  const statusInterval = setInterval(async () => {
347
346
  try {
@@ -632,16 +631,15 @@ var main = async () => {
632
631
  }
633
632
  let exitCode = 0;
634
633
  const program = new Command();
635
- program.option("-v, --verbose", "Enable verbose logging");
634
+ program.option("-v, --verbose", "Enable verbose logging", false);
636
635
  program.hook("preSubcommand", (thisCommand, actionCommand) => {
637
- setVerbose(thisCommand.opts().verbose);
638
- console.log("preSubcommand hook", thisCommand.opts().verbose);
636
+ setVerbose(thisCommand.opts().verbose === true);
639
637
  if (thisCommand.opts().verbose) {
640
638
  log("Using verbose mode");
641
639
  }
642
640
  });
643
641
  program.hook("preAction", (thisCommand) => {
644
- setVerbose(thisCommand.opts().verbose);
642
+ setVerbose(thisCommand.opts().verbose === true);
645
643
  });
646
644
  platform(program);
647
645
  build(program);
@@ -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');\n\n program.hook('preSubcommand', (thisCommand, actionCommand) => {\n setVerbose(thisCommand.opts().verbose as boolean);\n console.log('preSubcommand hook', thisCommand.opts().verbose);\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);\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 return;\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 console.log('debug', message, ...optionalParams);\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,E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AM,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/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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Q,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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gigadrive",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/Gigadrive/sdk.git",
@@ -26,9 +26,9 @@
26
26
  "ignore": "^7.0.3",
27
27
  "react": "^18.3.1",
28
28
  "react-devtools-core": "^6.1.1",
29
- "@gigadrive/commons": "1.1.0",
29
+ "@gigadrive/network-config": "2.0.4",
30
30
  "@gigadrive/build-utils": "1.0.0",
31
- "@gigadrive/network-config": "2.0.2"
31
+ "@gigadrive/commons": "2.0.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/archiver": "^6.0.2",