Fix twenty cli (#15997)

As title

fixes "app add" and "app init" commands
adds tests
This commit is contained in:
martmull
2025-11-21 19:21:30 +01:00
committed by GitHub
parent 3b5949ec3c
commit aa5d30a911
22 changed files with 201 additions and 696 deletions
@@ -0,0 +1,34 @@
import { getServerlessFunctionBaseFile } from '../get-serverless-function-base-file';
describe('getServerlessFunctionBaseFile', () => {
it('should render proper file', () => {
expect(
getServerlessFunctionBaseFile({
name: 'serverless-function-name',
universalIdentifier: '71e45a58-41da-4ae4-8b73-a543c0a9d3d4',
}),
)
.toBe(`import { type ServerlessFunctionConfig } from 'twenty-sdk/application';
export const main = async (params: {
a: string;
b: number;
}): Promise<{ message: string }> => {
const { a, b } = params;
// Rename the parameters and code below with your own logic
// This is just an example
const message = \`Hello, input: \${a} and \${b}\`;
return { message };
};
export const config: ServerlessFunctionConfig = {
universalIdentifier: '71e45a58-41da-4ae4-8b73-a543c0a9d3d4',
name: 'serverless-function-name',
timeoutSeconds: 5,
};
`);
});
});