import ora from 'ora' import { getCliClient } from '../cli-client.js' import { fileManifestForRange, syncAssetDependencies } from '../pack.js' import { syncResult } from '../output.js' export interface SyncCommandOptions { cwd?: string baseUrl?: string } export async function syncCommand(opts: SyncCommandOptions): Promise { const spinner = ora({ text: 'Syncing assetDependencies', isEnabled: Boolean(process.stderr.isTTY), isSilent: !process.stderr.isTTY, }).start() try { const { client } = await getCliClient({ baseUrl: opts.baseUrl }) const result = await syncAssetDependencies( opts.cwd ?? process.cwd(), fileManifestForRange(client.asset), ) spinner.stop() console.log(syncResult(result)) } catch (err) { spinner.stop() throw err } }