Rework watcher (#17284)
Heavy Refactoring of the watcher, sorry about this one, I'll keep iterating on it. In a nutshell: - app-dev.ts is maintaining 3 watchers in parallel: manifest, function and frontComponent
This commit is contained in:
@@ -1,20 +1,17 @@
|
||||
import { ConfigService } from '@/cli/utilities/config/services/config.service';
|
||||
import axios, { type AxiosInstance, type AxiosResponse } from 'axios';
|
||||
import chalk from 'chalk';
|
||||
import * as fs from 'fs';
|
||||
import { createClient } from 'graphql-sse';
|
||||
import {
|
||||
buildClientSchema,
|
||||
getIntrospectionQuery,
|
||||
printSchema,
|
||||
} from 'graphql/index';
|
||||
import { createClient } from 'graphql-sse';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { type ApiResponse } from '../types/api-response.types';
|
||||
import { ConfigService } from '@/cli/utilities/config/services/config.service';
|
||||
import {
|
||||
type PackageJson,
|
||||
type ApplicationManifest,
|
||||
} from 'twenty-shared/application';
|
||||
import { type ApplicationManifest } from 'twenty-shared/application';
|
||||
import { type FileFolder } from 'twenty-shared/types';
|
||||
import { type ApiResponse } from '../types/api-response.types';
|
||||
|
||||
export class ApiService {
|
||||
private client: AxiosInstance;
|
||||
@@ -91,25 +88,19 @@ export class ApiService {
|
||||
}
|
||||
|
||||
async syncApplication({
|
||||
packageJson,
|
||||
yarnLock,
|
||||
manifest,
|
||||
}: {
|
||||
packageJson: PackageJson;
|
||||
yarnLock: string;
|
||||
manifest: ApplicationManifest;
|
||||
}): Promise<ApiResponse> {
|
||||
try {
|
||||
const mutation = `
|
||||
mutation SyncApplication($manifest: JSON!, $packageJson: JSON!, $yarnLock: String!) {
|
||||
syncApplication(manifest: $manifest, packageJson: $packageJson, yarnLock: $yarnLock)
|
||||
mutation SyncApplication($manifest: JSON!) {
|
||||
syncApplication(manifest: $manifest)
|
||||
}
|
||||
`;
|
||||
|
||||
const variables = {
|
||||
manifest,
|
||||
yarnLock,
|
||||
packageJson,
|
||||
};
|
||||
|
||||
const response: AxiosResponse = await this.client.post(
|
||||
@@ -136,7 +127,7 @@ export class ApiService {
|
||||
return {
|
||||
success: true,
|
||||
data: response.data.data.syncApplication,
|
||||
message: `Successfully synced application: ${packageJson.name}`,
|
||||
message: `Successfully synced application: ${manifest.packageJson.name}`,
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user