Sync built files (#17379)
as title, upload built files to local storage --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
+9
-2
@@ -1,6 +1,13 @@
|
||||
export type LogPrefix = 'init' | 'manifest-watch' | 'functions-watch' | 'front-components-watch';
|
||||
export type LogPrefix =
|
||||
| 'init'
|
||||
| 'manifest-watch'
|
||||
| 'functions-watch'
|
||||
| 'front-components-watch';
|
||||
|
||||
export const getOutputByPrefix = (output: string, prefix: LogPrefix): string => {
|
||||
export const getOutputByPrefix = (
|
||||
output: string,
|
||||
prefix: LogPrefix,
|
||||
): string => {
|
||||
const prefixPattern = `[${prefix}]`;
|
||||
const lines = output.split('\n');
|
||||
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
// Loose type for JSON manifest imports where enum values are inferred as strings
|
||||
type JsonManifestInput = {
|
||||
functions?: Array<{ builtHandlerChecksum?: string | null; [key: string]: unknown }>;
|
||||
frontComponents?: Array<{ builtComponentChecksum?: string | null; [key: string]: unknown }>;
|
||||
functions?: Array<{
|
||||
builtHandlerChecksum?: string | null;
|
||||
[key: string]: unknown;
|
||||
}>;
|
||||
frontComponents?: Array<{
|
||||
builtComponentChecksum?: string | null;
|
||||
[key: string]: unknown;
|
||||
}>;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
|
||||
@@ -20,4 +26,5 @@ export const normalizeManifestForComparison = <T extends JsonManifestInput>(
|
||||
? '[checksum]'
|
||||
: null,
|
||||
})),
|
||||
sources: {}, // removing sources for now, waiting compressed file implementation
|
||||
});
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
import { runCliCommand, type RunCliCommandResult } from './run-cli-command.util';
|
||||
import {
|
||||
runCliCommand,
|
||||
type RunCliCommandResult,
|
||||
} from './run-cli-command.util';
|
||||
|
||||
export type RunAppBuildOptions = {
|
||||
appPath: string;
|
||||
timeout?: number;
|
||||
};
|
||||
|
||||
export const runAppBuild = (options: RunAppBuildOptions): Promise<RunCliCommandResult> => {
|
||||
export const runAppBuild = (
|
||||
options: RunAppBuildOptions,
|
||||
): Promise<RunCliCommandResult> => {
|
||||
const { appPath, timeout = 30000 } = options;
|
||||
|
||||
// app:build runs once and exits, so we don't wait for specific output
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
import { runCliCommand, type RunCliCommandResult } from './run-cli-command.util';
|
||||
import {
|
||||
runCliCommand,
|
||||
type RunCliCommandResult,
|
||||
} from './run-cli-command.util';
|
||||
|
||||
export type RunAppDevOptions = {
|
||||
appPath: string;
|
||||
timeout?: number;
|
||||
};
|
||||
|
||||
export const runAppDev = (options: RunAppDevOptions): Promise<RunCliCommandResult> => {
|
||||
export const runAppDev = (
|
||||
options: RunAppDevOptions,
|
||||
): Promise<RunCliCommandResult> => {
|
||||
const { appPath, timeout = 30000 } = options;
|
||||
|
||||
|
||||
return runCliCommand({
|
||||
command: 'app:dev',
|
||||
args: [appPath],
|
||||
|
||||
@@ -23,12 +23,7 @@ export type RunCliCommandResult = {
|
||||
export const runCliCommand = (
|
||||
options: RunCliCommandOptions,
|
||||
): Promise<RunCliCommandResult> => {
|
||||
const {
|
||||
command,
|
||||
args = [],
|
||||
waitForOutput,
|
||||
timeout = 30000,
|
||||
} = options;
|
||||
const { command, args = [], waitForOutput, timeout = 30000 } = options;
|
||||
|
||||
return new Promise((resolve) => {
|
||||
// Run from CLI directory to use twenty-sdk's tsconfig paths
|
||||
@@ -68,7 +63,7 @@ export const runCliCommand = (
|
||||
setTimeout(() => {
|
||||
child.kill();
|
||||
resolve({ success: true, output });
|
||||
}, 500);
|
||||
}, 1500);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
export const sanitizeOutput = (output: string): string => {
|
||||
return output
|
||||
// Remove ANSI color codes
|
||||
.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, '')
|
||||
// Normalize file paths (replace any absolute path to a test app)
|
||||
.replace(/\/[^\s]+\/__tests__\/apps\/[^/]+/g, '<APP_PATH>')
|
||||
// Normalize timestamps
|
||||
.replace(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/g, '<TIMESTAMP>')
|
||||
// Normalize durations
|
||||
.replace(/\d+ms/g, '<DURATION>')
|
||||
// Trim trailing whitespace from each line
|
||||
.split('\n')
|
||||
.map((line) => line.trimEnd())
|
||||
.join('\n')
|
||||
.trim();
|
||||
return (
|
||||
output
|
||||
// Remove ANSI color codes
|
||||
.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, '')
|
||||
// Normalize file paths (replace any absolute path to a test app)
|
||||
.replace(/\/[^\s]+\/__tests__\/apps\/[^/]+/g, '<APP_PATH>')
|
||||
// Normalize timestamps
|
||||
.replace(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/g, '<TIMESTAMP>')
|
||||
// Normalize durations
|
||||
.replace(/\d+ms/g, '<DURATION>')
|
||||
// Trim trailing whitespace from each line
|
||||
.split('\n')
|
||||
.map((line) => line.trimEnd())
|
||||
.join('\n')
|
||||
.trim()
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user