Fix dev mode (#16333)

Fixes infinite loop in dev mode

Solution -> We stop generating in dev mode
This commit is contained in:
martmull
2025-12-04 17:03:22 +01:00
committed by GitHub
parent 5e8fbc7c5c
commit 0ced7da8e0
2 changed files with 19 additions and 4 deletions
@@ -10,6 +10,7 @@ export const main = async (params: { recipient?: string }) => {
Authorization: `Bearer ${process.env.TWENTY_API_KEY}`,
},
});
const createPostCard = await client.mutation({
createPostCard: {
__args: {
@@ -21,6 +22,9 @@ export const main = async (params: { recipient?: string }) => {
id: true,
},
});
console.log('createPostCard result', createPostCard);
return createPostCard;
} catch (error) {
console.error(error);
@@ -1,10 +1,11 @@
import chalk from 'chalk';
import * as chokidar from 'chokidar';
import { CURRENT_EXECUTION_DIRECTORY } from '../constants/current-execution-directory';
import { AppSyncCommand } from './app-sync.command';
import { ApiService } from '@/cli/services/api.service';
import { loadManifest } from '@/cli/utils/load-manifest';
export class AppDevCommand {
private syncCommand = new AppSyncCommand();
private apiService = new ApiService();
async execute(options: {
appPath?: string;
@@ -17,7 +18,7 @@ export class AppDevCommand {
this.logStartupInfo(appPath, debounceMs);
await this.syncCommand.execute(appPath);
await this.synchronize(appPath);
const watcher = this.setupFileWatcher(appPath, debounceMs);
@@ -31,6 +32,16 @@ export class AppDevCommand {
}
}
private async synchronize(appPath: string) {
const { manifest, packageJson, yarnLock } = await loadManifest(appPath);
await this.apiService.syncApplication({
manifest,
packageJson,
yarnLock,
});
}
private logStartupInfo(appPath: string, debounceMs: number): void {
console.log(chalk.blue('🚀 Starting Twenty Application Development Mode'));
console.log(chalk.gray(`📁 App Path: ${appPath}`));
@@ -57,7 +68,7 @@ export class AppDevCommand {
timeout = setTimeout(async () => {
console.log(chalk.blue('🔄 Changes detected, syncing...'));
await this.syncCommand.execute(appPath);
await this.synchronize(appPath);
console.log(
chalk.gray('👀 Watching for changes... (Press Ctrl+C to stop)'),