731e297147
<img width="1418" height="804" alt="image" src="https://github.com/user-attachments/assets/de6c8222-6496-4a71-bc21-7e5e1269d5cb" /> --------- Co-authored-by: Félix Malfait <felix.malfait@gmail.com> Co-authored-by: Félix Malfait <felix@twenty.com>
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import { appBuild } from '@/cli/operations/build';
|
|
import { CURRENT_EXECUTION_DIRECTORY } from '@/cli/utilities/config/current-execution-directory';
|
|
import { checkSdkVersionCompatibility } from '@/cli/utilities/version/check-sdk-version-compatibility';
|
|
import chalk from 'chalk';
|
|
|
|
export type AppBuildCommandOptions = {
|
|
appPath?: string;
|
|
tarball?: boolean;
|
|
};
|
|
|
|
export class AppBuildCommand {
|
|
async execute(options: AppBuildCommandOptions): Promise<void> {
|
|
const appPath = options.appPath ?? CURRENT_EXECUTION_DIRECTORY;
|
|
|
|
await checkSdkVersionCompatibility(appPath);
|
|
|
|
console.log(chalk.blue('Building application...'));
|
|
console.log(chalk.gray(`App path: ${appPath}`));
|
|
console.log('');
|
|
|
|
const result = await appBuild({
|
|
appPath,
|
|
tarball: options.tarball,
|
|
onProgress: (message) => console.log(chalk.gray(message)),
|
|
});
|
|
|
|
if (!result.success) {
|
|
console.error(chalk.red(result.error.message));
|
|
process.exit(1);
|
|
}
|
|
|
|
console.log(
|
|
chalk.green(
|
|
`✓ Build succeeded (${result.data.fileCount} file${result.data.fileCount === 1 ? '' : 's'})`,
|
|
),
|
|
);
|
|
console.log(chalk.gray(`Output: ${result.data.outputDir}`));
|
|
|
|
if (result.data.tarballPath) {
|
|
console.log(chalk.gray(`Tarball: ${result.data.tarballPath}`));
|
|
}
|
|
}
|
|
}
|