Files
twenty/packages/twenty-sdk/src/cli/commands/build.ts
T
martmull 731e297147 Twenty sdk cli oauth (#18638)
<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>
2026-03-17 11:43:17 +01:00

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}`));
}
}
}