From 621962e04998264cc155638b60c39e1dfe03ae10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Malfait?= Date: Tue, 10 Mar 2026 17:29:53 +0100 Subject: [PATCH] Move fixture apps from twenty-sdk to twenty-apps/fixtures (#18531) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - Move 4 test fixture apps from `twenty-sdk/src/cli/__tests__/apps/` to `twenty-apps/fixtures/` with meaningful names (`rich-app` → `postcard-app`, `root-app` → `minimal-app`) - Replace all `from '@/sdk'` imports with `from 'twenty-sdk'` so fixture apps are proper, portable twenty-sdk apps - Remove the fragile `"@/*": ["../../../../../src/*"]` tsconfig hack and replace with standard `"src/*": ["./src/*"]` paths - Create a centralized `fixture-paths.ts` utility in twenty-sdk tests for clean app path resolution ## Why The fixture apps were deeply nested in twenty-sdk's test directory and tightly coupled to its internal source layout via a tsconfig path alias hack. This made them: - Impossible to reuse outside of SDK CLI tests (e.g., for server-side dev seeding with `DevSeederService`) - Fragile — moving any twenty-sdk source file could break the path alias - Poorly discoverable — buried 5 directories deep in test infrastructure Moving them to `twenty-apps/fixtures/` makes them first-class portable apps that can be imported by `twenty-server` for seeding, used in E2E testing, and serve as canonical examples alongside `hello-world`. ## Test plan - [x] All 8 twenty-sdk integration tests pass (3 suites: postcard-app, minimal-app, invalid-app) - [x] Prettier formatting verified on all changed files - [ ] CI should confirm E2E tests also pass (these require a running server) Made with [Cursor](https://cursor.com) --- packages/twenty-apps/.gitignore | 1 + .../application.config.ts | 2 +- .../fixtures}/function-execute-app/my.role.ts | 2 +- .../function-execute-app/package.json | 0 .../logic-functions/add-numbers.function.ts | 2 +- .../function-execute-app}/tsconfig.json | 4 +- .../invalid-app/application.config.ts | 2 +- .../fixtures}/invalid-app/package.json | 0 .../fixtures}/invalid-app/src/first.object.ts | 2 +- .../invalid-app/src/second.object.ts | 2 +- .../fixtures/invalid-app}/tsconfig.json | 2 +- .../fixtures}/invalid-app/yarn.lock | 0 .../minimal-app}/application.config.ts | 2 +- .../minimal-app}/my.front-component.tsx | 2 +- .../fixtures/minimal-app}/my.function.ts | 2 +- .../fixtures/minimal-app}/my.object.ts | 2 +- .../fixtures/minimal-app}/my.role.ts | 2 +- .../fixtures/minimal-app}/package.json | 2 +- .../fixtures/minimal-app}/tsconfig.json | 5 +- .../fixtures/minimal-app}/yarn.lock | 0 .../fixtures/postcard-app}/.gitignore | 0 .../postcard-app}/application.config.ts | 2 +- .../fixtures/postcard-app}/package.json | 2 +- .../fixtures/postcard-app}/public/favicon.png | Bin .../src/components/card.front-component.tsx | 2 +- .../components/greeting.front-component.tsx | 2 +- .../src/components/test.front-component.tsx | 2 +- .../post-card-on-post-card-recipient.field.ts | 8 +- ...post-card-recipients-on-post-card.field.ts | 6 +- ...post-card-recipients-on-recipient.field.ts | 6 +- .../src/fields/postCardCategoryField.ts | 4 +- .../src/fields/postCardNumber.field.ts | 4 +- .../recipient-on-post-card-recipient.field.ts | 8 +- .../src/logic-functions/greeting.function.ts | 2 +- .../lookup-recipient.function.ts | 2 +- .../on-post-card-created.function.ts | 2 +- .../test-function-2.function.ts | 2 +- .../logic-functions/test-function.function.ts | 2 +- ...st-card-recipients.navigation-menu-item.ts | 4 +- .../post-cards.navigation-menu-item.ts | 4 +- .../recipients.navigation-menu-item.ts | 4 +- .../src/objects/post-card-recipient.object.ts | 2 +- .../src/objects/post-card.object.ts | 2 +- .../src/objects/recipient.object.ts | 2 +- .../src/roles/default-function.role.ts | 4 +- .../src/root.front-component.tsx | 2 +- .../postcard-app}/src/root.function.ts | 2 +- .../fixtures/postcard-app}/src/root.object.ts | 2 +- .../fixtures/postcard-app}/src/root.role.ts | 2 +- .../src/utils/card-display.component.tsx | 0 .../postcard-app}/src/utils/greeting.util.ts | 0 .../src/utils/test-function-2.util.ts | 0 .../views/all-post-card-recipients.view.ts | 4 +- .../src/views/all-post-cards.view.ts | 4 +- .../src/views/all-recipients.view.ts | 4 +- .../fixtures/postcard-app}/tsconfig.json | 5 +- .../fixtures/postcard-app}/yarn.lock | 0 .../src/cli/__tests__/apps/fixture-paths.ts | 11 +++ .../__e2e__/function-execute.e2e-spec.ts | 9 +- .../manifest.integration.spec.ts | 10 ++- .../app-dev/app-dev.integration.spec.ts | 16 ++-- .../app-dev/expected-manifest.ts | 0 .../app-dev/tests/console-output.tests.ts | 0 .../app-dev/tests/front-components.tests.ts | 0 .../app-dev/tests/logic-functions.tests.ts | 0 .../app-dev/tests/manifest.tests.ts | 2 +- ...tions-install-delete-reinstall.e2e-spec.ts | 9 +- .../__e2e__/health.e2e-spec.ts | 0 .../app-dev/app-dev.integration.spec.ts | 12 ++- .../app-dev/expected-manifest.ts | 0 .../app-dev/tests/console-output.tests.ts | 0 .../app-dev/tests/entities.tests.ts | 0 .../app-dev/tests/manifest.tests.ts | 0 .../src/cli/commands/app/app-build.ts | 3 + .../src/cli/commands/app/app-dev.ts | 7 +- .../src/cli/commands/app/app-publish.ts | 4 + .../check-sdk-version-compatibility.ts | 81 ++++++++++++++++++ 77 files changed, 204 insertions(+), 99 deletions(-) rename packages/{twenty-sdk/src/cli/__tests__/apps => twenty-apps/fixtures}/function-execute-app/application.config.ts (88%) rename packages/{twenty-sdk/src/cli/__tests__/apps => twenty-apps/fixtures}/function-execute-app/my.role.ts (92%) rename packages/{twenty-sdk/src/cli/__tests__/apps => twenty-apps/fixtures}/function-execute-app/package.json (100%) rename packages/{twenty-sdk/src/cli/__tests__/apps => twenty-apps/fixtures}/function-execute-app/src/logic-functions/add-numbers.function.ts (91%) rename packages/{twenty-sdk/src/cli/__tests__/apps/invalid-app => twenty-apps/fixtures/function-execute-app}/tsconfig.json (89%) rename packages/{twenty-sdk/src/cli/__tests__/apps => twenty-apps/fixtures}/invalid-app/application.config.ts (86%) rename packages/{twenty-sdk/src/cli/__tests__/apps => twenty-apps/fixtures}/invalid-app/package.json (100%) rename packages/{twenty-sdk/src/cli/__tests__/apps => twenty-apps/fixtures}/invalid-app/src/first.object.ts (91%) rename packages/{twenty-sdk/src/cli/__tests__/apps => twenty-apps/fixtures}/invalid-app/src/second.object.ts (91%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/invalid-app}/tsconfig.json (89%) rename packages/{twenty-sdk/src/cli/__tests__/apps => twenty-apps/fixtures}/invalid-app/yarn.lock (100%) rename packages/{twenty-sdk/src/cli/__tests__/apps/root-app => twenty-apps/fixtures/minimal-app}/application.config.ts (85%) rename packages/{twenty-sdk/src/cli/__tests__/apps/root-app => twenty-apps/fixtures/minimal-app}/my.front-component.tsx (86%) rename packages/{twenty-sdk/src/cli/__tests__/apps/root-app => twenty-apps/fixtures/minimal-app}/my.function.ts (87%) rename packages/{twenty-sdk/src/cli/__tests__/apps/root-app => twenty-apps/fixtures/minimal-app}/my.object.ts (90%) rename packages/{twenty-sdk/src/cli/__tests__/apps/root-app => twenty-apps/fixtures/minimal-app}/my.role.ts (91%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/minimal-app}/package.json (97%) rename packages/{twenty-sdk/src/cli/__tests__/apps/function-execute-app => twenty-apps/fixtures/minimal-app}/tsconfig.json (72%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/minimal-app}/yarn.lock (100%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/.gitignore (100%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/application.config.ts (94%) rename packages/{twenty-sdk/src/cli/__tests__/apps/root-app => twenty-apps/fixtures/postcard-app}/package.json (97%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/public/favicon.png (100%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/components/card.front-component.tsx (84%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/components/greeting.front-component.tsx (90%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/components/test.front-component.tsx (86%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/fields/post-card-on-post-card-recipient.field.ts (67%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/fields/post-card-recipients-on-post-card.field.ts (69%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/fields/post-card-recipients-on-recipient.field.ts (69%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/fields/postCardCategoryField.ts (82%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/fields/postCardNumber.field.ts (64%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/fields/recipient-on-post-card-recipient.field.ts (67%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/logic-functions/greeting.function.ts (89%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/logic-functions/lookup-recipient.function.ts (88%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/logic-functions/on-post-card-created.function.ts (88%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/logic-functions/test-function-2.function.ts (85%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/logic-functions/test-function.function.ts (89%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/navigation-menu-items/post-card-recipients.navigation-menu-item.ts (51%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/navigation-menu-items/post-cards.navigation-menu-item.ts (53%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/navigation-menu-items/recipients.navigation-menu-item.ts (53%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/objects/post-card-recipient.object.ts (93%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/objects/post-card.object.ts (97%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/objects/recipient.object.ts (94%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/roles/default-function.role.ts (90%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/root.front-component.tsx (87%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/root.function.ts (87%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/root.object.ts (92%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/root.role.ts (91%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/utils/card-display.component.tsx (100%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/utils/greeting.util.ts (100%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/utils/test-function-2.util.ts (100%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/views/all-post-card-recipients.view.ts (86%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/views/all-post-cards.view.ts (89%) rename packages/{twenty-sdk/src/cli/__tests__/apps/rich-app => twenty-apps/fixtures/postcard-app}/src/views/all-recipients.view.ts (86%) rename packages/{twenty-sdk/src/cli/__tests__/apps/root-app => twenty-apps/fixtures/postcard-app}/tsconfig.json (72%) rename packages/{twenty-sdk/src/cli/__tests__/apps/root-app => twenty-apps/fixtures/postcard-app}/yarn.lock (100%) create mode 100644 packages/twenty-sdk/src/cli/__tests__/apps/fixture-paths.ts rename packages/twenty-sdk/src/cli/__tests__/apps/{root-app => minimal-app}/__integration__/app-dev/app-dev.integration.spec.ts (66%) rename packages/twenty-sdk/src/cli/__tests__/apps/{root-app => minimal-app}/__integration__/app-dev/expected-manifest.ts (100%) rename packages/twenty-sdk/src/cli/__tests__/apps/{rich-app => minimal-app}/__integration__/app-dev/tests/console-output.tests.ts (100%) rename packages/twenty-sdk/src/cli/__tests__/apps/{root-app => minimal-app}/__integration__/app-dev/tests/front-components.tests.ts (100%) rename packages/twenty-sdk/src/cli/__tests__/apps/{root-app => minimal-app}/__integration__/app-dev/tests/logic-functions.tests.ts (100%) rename packages/twenty-sdk/src/cli/__tests__/apps/{root-app => minimal-app}/__integration__/app-dev/tests/manifest.tests.ts (89%) rename packages/twenty-sdk/src/cli/__tests__/apps/{rich-app => postcard-app}/__e2e__/applications-install-delete-reinstall.e2e-spec.ts (84%) rename packages/twenty-sdk/src/cli/__tests__/apps/{rich-app => postcard-app}/__e2e__/health.e2e-spec.ts (100%) rename packages/twenty-sdk/src/cli/__tests__/apps/{rich-app => postcard-app}/__integration__/app-dev/app-dev.integration.spec.ts (67%) rename packages/twenty-sdk/src/cli/__tests__/apps/{rich-app => postcard-app}/__integration__/app-dev/expected-manifest.ts (100%) rename packages/twenty-sdk/src/cli/__tests__/apps/{root-app => postcard-app}/__integration__/app-dev/tests/console-output.tests.ts (100%) rename packages/twenty-sdk/src/cli/__tests__/apps/{rich-app => postcard-app}/__integration__/app-dev/tests/entities.tests.ts (100%) rename packages/twenty-sdk/src/cli/__tests__/apps/{rich-app => postcard-app}/__integration__/app-dev/tests/manifest.tests.ts (100%) create mode 100644 packages/twenty-sdk/src/cli/utilities/version/check-sdk-version-compatibility.ts diff --git a/packages/twenty-apps/.gitignore b/packages/twenty-apps/.gitignore index 1614068bd9..b52530263b 100644 --- a/packages/twenty-apps/.gitignore +++ b/packages/twenty-apps/.gitignore @@ -1,2 +1,3 @@ generated +.twenty diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/application.config.ts b/packages/twenty-apps/fixtures/function-execute-app/application.config.ts similarity index 88% rename from packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/application.config.ts rename to packages/twenty-apps/fixtures/function-execute-app/application.config.ts index 5ec44ef59d..091e5bd584 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/application.config.ts +++ b/packages/twenty-apps/fixtures/function-execute-app/application.config.ts @@ -1,4 +1,4 @@ -import { defineApplication } from '@/sdk'; +import { defineApplication } from 'twenty-sdk'; import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from './my.role'; diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/my.role.ts b/packages/twenty-apps/fixtures/function-execute-app/my.role.ts similarity index 92% rename from packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/my.role.ts rename to packages/twenty-apps/fixtures/function-execute-app/my.role.ts index cf02d00129..a418c6dca2 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/my.role.ts +++ b/packages/twenty-apps/fixtures/function-execute-app/my.role.ts @@ -1,4 +1,4 @@ -import { defineRole } from '@/sdk'; +import { defineRole } from 'twenty-sdk'; export const DEFAULT_ROLE_UNIVERSAL_IDENTIFIER = '9f992b6c-17e9-4381-bab5-b6150b574304'; diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/package.json b/packages/twenty-apps/fixtures/function-execute-app/package.json similarity index 100% rename from packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/package.json rename to packages/twenty-apps/fixtures/function-execute-app/package.json diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/src/logic-functions/add-numbers.function.ts b/packages/twenty-apps/fixtures/function-execute-app/src/logic-functions/add-numbers.function.ts similarity index 91% rename from packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/src/logic-functions/add-numbers.function.ts rename to packages/twenty-apps/fixtures/function-execute-app/src/logic-functions/add-numbers.function.ts index e3ee6b3022..4939c3df00 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/src/logic-functions/add-numbers.function.ts +++ b/packages/twenty-apps/fixtures/function-execute-app/src/logic-functions/add-numbers.function.ts @@ -1,4 +1,4 @@ -import { defineLogicFunction } from '@/sdk'; +import { defineLogicFunction } from 'twenty-sdk'; export const ADD_NUMBERS_UNIVERSAL_IDENTIFIER = 'f9e5589c-e951-4d99-85db-0a305ab53502'; diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/tsconfig.json b/packages/twenty-apps/fixtures/function-execute-app/tsconfig.json similarity index 89% rename from packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/tsconfig.json rename to packages/twenty-apps/fixtures/function-execute-app/tsconfig.json index a86682adf1..97050faf75 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/tsconfig.json +++ b/packages/twenty-apps/fixtures/function-execute-app/tsconfig.json @@ -3,13 +3,13 @@ "target": "ES2020", "module": "ESNext", "moduleResolution": "bundler", - "esModuleInterop": true, "strict": true, + "esModuleInterop": true, "skipLibCheck": true, "jsx": "react-jsx", "baseUrl": ".", "paths": { - "@/*": ["../../../../../src/*"] + "src/*": ["./src/*"] } }, "include": ["**/*"], diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/application.config.ts b/packages/twenty-apps/fixtures/invalid-app/application.config.ts similarity index 86% rename from packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/application.config.ts rename to packages/twenty-apps/fixtures/invalid-app/application.config.ts index c6d5c7e8fd..aafbe38064 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/application.config.ts +++ b/packages/twenty-apps/fixtures/invalid-app/application.config.ts @@ -1,4 +1,4 @@ -import { defineApplication } from '@/sdk'; +import { defineApplication } from 'twenty-sdk'; export default defineApplication({ universalIdentifier: 'invalid-app-0000-0000-0000-000000000001', diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/package.json b/packages/twenty-apps/fixtures/invalid-app/package.json similarity index 100% rename from packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/package.json rename to packages/twenty-apps/fixtures/invalid-app/package.json diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/src/first.object.ts b/packages/twenty-apps/fixtures/invalid-app/src/first.object.ts similarity index 91% rename from packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/src/first.object.ts rename to packages/twenty-apps/fixtures/invalid-app/src/first.object.ts index f5e67153bc..03a167d45d 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/src/first.object.ts +++ b/packages/twenty-apps/fixtures/invalid-app/src/first.object.ts @@ -1,4 +1,4 @@ -import { defineObject, FieldType } from '@/sdk'; +import { defineObject, FieldType } from 'twenty-sdk'; const DUPLICATE_ID = 'duplicate-id-0000-0000-000000000001'; diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/src/second.object.ts b/packages/twenty-apps/fixtures/invalid-app/src/second.object.ts similarity index 91% rename from packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/src/second.object.ts rename to packages/twenty-apps/fixtures/invalid-app/src/second.object.ts index 2e77292758..61f0dd3a2a 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/src/second.object.ts +++ b/packages/twenty-apps/fixtures/invalid-app/src/second.object.ts @@ -1,4 +1,4 @@ -import { defineObject, FieldType } from '@/sdk'; +import { defineObject, FieldType } from 'twenty-sdk'; const DUPLICATE_ID = 'duplicate-id-0000-0000-000000000001'; diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/tsconfig.json b/packages/twenty-apps/fixtures/invalid-app/tsconfig.json similarity index 89% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/tsconfig.json rename to packages/twenty-apps/fixtures/invalid-app/tsconfig.json index 37e7e2155a..97050faf75 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/tsconfig.json +++ b/packages/twenty-apps/fixtures/invalid-app/tsconfig.json @@ -9,7 +9,7 @@ "jsx": "react-jsx", "baseUrl": ".", "paths": { - "@/*": ["../../../../../src/*"] + "src/*": ["./src/*"] } }, "include": ["**/*"], diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/yarn.lock b/packages/twenty-apps/fixtures/invalid-app/yarn.lock similarity index 100% rename from packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/yarn.lock rename to packages/twenty-apps/fixtures/invalid-app/yarn.lock diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/application.config.ts b/packages/twenty-apps/fixtures/minimal-app/application.config.ts similarity index 85% rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/application.config.ts rename to packages/twenty-apps/fixtures/minimal-app/application.config.ts index cede064231..5647809e32 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/application.config.ts +++ b/packages/twenty-apps/fixtures/minimal-app/application.config.ts @@ -1,4 +1,4 @@ -import { defineApplication } from '@/sdk'; +import { defineApplication } from 'twenty-sdk'; export default defineApplication({ universalIdentifier: 'e1e2e3e4-e5e6-4000-8000-000000000001', diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.front-component.tsx b/packages/twenty-apps/fixtures/minimal-app/my.front-component.tsx similarity index 86% rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.front-component.tsx rename to packages/twenty-apps/fixtures/minimal-app/my.front-component.tsx index 6806684e8b..6906a7b13f 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.front-component.tsx +++ b/packages/twenty-apps/fixtures/minimal-app/my.front-component.tsx @@ -1,4 +1,4 @@ -import { defineFrontComponent } from '@/sdk'; +import { defineFrontComponent } from 'twenty-sdk'; export const MyComponent = () => { return ( diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.function.ts b/packages/twenty-apps/fixtures/minimal-app/my.function.ts similarity index 87% rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.function.ts rename to packages/twenty-apps/fixtures/minimal-app/my.function.ts index 824c1eac33..6250794930 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.function.ts +++ b/packages/twenty-apps/fixtures/minimal-app/my.function.ts @@ -1,4 +1,4 @@ -import { defineLogicFunction } from '@/sdk'; +import { defineLogicFunction } from 'twenty-sdk'; const myHandler = () => { return 'my-function-result'; diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.object.ts b/packages/twenty-apps/fixtures/minimal-app/my.object.ts similarity index 90% rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.object.ts rename to packages/twenty-apps/fixtures/minimal-app/my.object.ts index 8adbc4719c..74eba6cdad 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.object.ts +++ b/packages/twenty-apps/fixtures/minimal-app/my.object.ts @@ -1,4 +1,4 @@ -import { FieldType, defineObject } from '@/sdk'; +import { FieldType, defineObject } from 'twenty-sdk'; export default defineObject({ universalIdentifier: 'e1e2e3e4-e5e6-4000-8000-000000000030', diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.role.ts b/packages/twenty-apps/fixtures/minimal-app/my.role.ts similarity index 91% rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.role.ts rename to packages/twenty-apps/fixtures/minimal-app/my.role.ts index 2a7634e3b5..935a5b12cf 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/my.role.ts +++ b/packages/twenty-apps/fixtures/minimal-app/my.role.ts @@ -1,4 +1,4 @@ -import { defineRole } from '@/sdk'; +import { defineRole } from 'twenty-sdk'; export default defineRole({ universalIdentifier: 'e1e2e3e4-e5e6-4000-8000-000000000040', diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/package.json b/packages/twenty-apps/fixtures/minimal-app/package.json similarity index 97% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/package.json rename to packages/twenty-apps/fixtures/minimal-app/package.json index f296649e52..d03347ef85 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/package.json +++ b/packages/twenty-apps/fixtures/minimal-app/package.json @@ -1,5 +1,5 @@ { - "name": "rich-app", + "name": "minimal-app", "version": "0.1.0", "license": "MIT", "engines": { diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/tsconfig.json b/packages/twenty-apps/fixtures/minimal-app/tsconfig.json similarity index 72% rename from packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/tsconfig.json rename to packages/twenty-apps/fixtures/minimal-app/tsconfig.json index b6520539e5..97050faf75 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/tsconfig.json +++ b/packages/twenty-apps/fixtures/minimal-app/tsconfig.json @@ -9,8 +9,9 @@ "jsx": "react-jsx", "baseUrl": ".", "paths": { - "@/*": ["../../../../../src/*"] + "src/*": ["./src/*"] } }, - "include": ["**/*"] + "include": ["**/*"], + "exclude": ["node_modules", "dist", ".twenty"] } diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/yarn.lock b/packages/twenty-apps/fixtures/minimal-app/yarn.lock similarity index 100% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/yarn.lock rename to packages/twenty-apps/fixtures/minimal-app/yarn.lock diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/.gitignore b/packages/twenty-apps/fixtures/postcard-app/.gitignore similarity index 100% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/.gitignore rename to packages/twenty-apps/fixtures/postcard-app/.gitignore diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/application.config.ts b/packages/twenty-apps/fixtures/postcard-app/application.config.ts similarity index 94% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/application.config.ts rename to packages/twenty-apps/fixtures/postcard-app/application.config.ts index 4fba0dfdef..03f615d2f4 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/application.config.ts +++ b/packages/twenty-apps/fixtures/postcard-app/application.config.ts @@ -1,4 +1,4 @@ -import { defineApplication } from '@/sdk'; +import { defineApplication } from 'twenty-sdk'; import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from './src/roles/default-function.role'; export default defineApplication({ diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/package.json b/packages/twenty-apps/fixtures/postcard-app/package.json similarity index 97% rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/package.json rename to packages/twenty-apps/fixtures/postcard-app/package.json index bc5f9c2339..f441dc81df 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/package.json +++ b/packages/twenty-apps/fixtures/postcard-app/package.json @@ -1,5 +1,5 @@ { - "name": "root-app", + "name": "postcard-app", "version": "0.1.0", "license": "MIT", "engines": { diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/public/favicon.png b/packages/twenty-apps/fixtures/postcard-app/public/favicon.png similarity index 100% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/public/favicon.png rename to packages/twenty-apps/fixtures/postcard-app/public/favicon.png diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/components/card.front-component.tsx b/packages/twenty-apps/fixtures/postcard-app/src/components/card.front-component.tsx similarity index 84% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/components/card.front-component.tsx rename to packages/twenty-apps/fixtures/postcard-app/src/components/card.front-component.tsx index 6e3d8df866..9b4ba078d9 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/components/card.front-component.tsx +++ b/packages/twenty-apps/fixtures/postcard-app/src/components/card.front-component.tsx @@ -1,4 +1,4 @@ -import { defineFrontComponent } from '@/sdk'; +import { defineFrontComponent } from 'twenty-sdk'; import { CardDisplay } from '../utils/card-display.component'; export default defineFrontComponent({ diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/components/greeting.front-component.tsx b/packages/twenty-apps/fixtures/postcard-app/src/components/greeting.front-component.tsx similarity index 90% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/components/greeting.front-component.tsx rename to packages/twenty-apps/fixtures/postcard-app/src/components/greeting.front-component.tsx index 641485f960..28632d82c0 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/components/greeting.front-component.tsx +++ b/packages/twenty-apps/fixtures/postcard-app/src/components/greeting.front-component.tsx @@ -1,4 +1,4 @@ -import { defineFrontComponent } from '@/sdk'; +import { defineFrontComponent } from 'twenty-sdk'; import { DEFAULT_NAME, formatGreeting } from '../utils/greeting.util'; const GreetingComponent = () => { diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/components/test.front-component.tsx b/packages/twenty-apps/fixtures/postcard-app/src/components/test.front-component.tsx similarity index 86% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/components/test.front-component.tsx rename to packages/twenty-apps/fixtures/postcard-app/src/components/test.front-component.tsx index 5bef8ed381..6acb4eebf7 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/components/test.front-component.tsx +++ b/packages/twenty-apps/fixtures/postcard-app/src/components/test.front-component.tsx @@ -1,4 +1,4 @@ -import { defineFrontComponent } from '@/sdk'; +import { defineFrontComponent } from 'twenty-sdk'; export const TestComponent = () => { return ( diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-on-post-card-recipient.field.ts b/packages/twenty-apps/fixtures/postcard-app/src/fields/post-card-on-post-card-recipient.field.ts similarity index 67% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-on-post-card-recipient.field.ts rename to packages/twenty-apps/fixtures/postcard-app/src/fields/post-card-on-post-card-recipient.field.ts index 1898ba206d..c8d24dbad3 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-on-post-card-recipient.field.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/fields/post-card-on-post-card-recipient.field.ts @@ -1,10 +1,10 @@ import { POST_CARD_ON_POST_CARD_RECIPIENT_ID, POST_CARD_RECIPIENTS_ON_POST_CARD_ID, -} from '@/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-post-card.field'; -import { POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object'; -import { defineField, FieldType, OnDeleteAction, RelationType } from '@/sdk'; -import { POST_CARD_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card.object'; +} from './post-card-recipients-on-post-card.field'; +import { POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER } from '../objects/post-card-recipient.object'; +import { defineField, FieldType, OnDeleteAction, RelationType } from 'twenty-sdk'; +import { POST_CARD_UNIVERSAL_IDENTIFIER } from '../objects/post-card.object'; export default defineField({ universalIdentifier: POST_CARD_ON_POST_CARD_RECIPIENT_ID, diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-post-card.field.ts b/packages/twenty-apps/fixtures/postcard-app/src/fields/post-card-recipients-on-post-card.field.ts similarity index 69% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-post-card.field.ts rename to packages/twenty-apps/fixtures/postcard-app/src/fields/post-card-recipients-on-post-card.field.ts index ae35ad1e4f..fd4f8ab2fb 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-post-card.field.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/fields/post-card-recipients-on-post-card.field.ts @@ -1,6 +1,6 @@ -import { POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object'; -import { defineField, FieldType, RelationType } from '@/sdk'; -import { POST_CARD_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card.object'; +import { POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER } from '../objects/post-card-recipient.object'; +import { defineField, FieldType, RelationType } from 'twenty-sdk'; +import { POST_CARD_UNIVERSAL_IDENTIFIER } from '../objects/post-card.object'; export const POST_CARD_RECIPIENTS_ON_POST_CARD_ID = 'a1a2b3c4-0001-4a7b-8c9d-0e1f2a3b4c5d'; diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-recipient.field.ts b/packages/twenty-apps/fixtures/postcard-app/src/fields/post-card-recipients-on-recipient.field.ts similarity index 69% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-recipient.field.ts rename to packages/twenty-apps/fixtures/postcard-app/src/fields/post-card-recipients-on-recipient.field.ts index c7bbe21a54..1c447ece0f 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-recipient.field.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/fields/post-card-recipients-on-recipient.field.ts @@ -1,6 +1,6 @@ -import { defineField, FieldType, RelationType } from '@/sdk'; -import { RECIPIENT_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/recipient.object'; -import { POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object'; +import { defineField, FieldType, RelationType } from 'twenty-sdk'; +import { RECIPIENT_UNIVERSAL_IDENTIFIER } from '../objects/recipient.object'; +import { POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER } from '../objects/post-card-recipient.object'; export const POST_CARD_RECIPIENTS_ON_RECIPIENT_ID = 'a1a2b3c4-0003-4a7b-8c9d-0e1f2a3b4c5d'; diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/postCardCategoryField.ts b/packages/twenty-apps/fixtures/postcard-app/src/fields/postCardCategoryField.ts similarity index 82% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/postCardCategoryField.ts rename to packages/twenty-apps/fixtures/postcard-app/src/fields/postCardCategoryField.ts index 2d02b2955c..6a21a9efdf 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/postCardCategoryField.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/fields/postCardCategoryField.ts @@ -1,5 +1,5 @@ -import { defineField, FieldType } from '@/sdk'; -import { POST_CARD_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card.object'; +import { defineField, FieldType } from 'twenty-sdk'; +import { POST_CARD_UNIVERSAL_IDENTIFIER } from '../objects/post-card.object'; export default defineField({ objectUniversalIdentifier: POST_CARD_UNIVERSAL_IDENTIFIER, diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/postCardNumber.field.ts b/packages/twenty-apps/fixtures/postcard-app/src/fields/postCardNumber.field.ts similarity index 64% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/postCardNumber.field.ts rename to packages/twenty-apps/fixtures/postcard-app/src/fields/postCardNumber.field.ts index 0aa42d9884..94d924865a 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/postCardNumber.field.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/fields/postCardNumber.field.ts @@ -1,5 +1,5 @@ -import { defineField, FieldType } from '@/sdk'; -import { POST_CARD_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card.object'; +import { defineField, FieldType } from 'twenty-sdk'; +import { POST_CARD_UNIVERSAL_IDENTIFIER } from '../objects/post-card.object'; export default defineField({ objectUniversalIdentifier: POST_CARD_UNIVERSAL_IDENTIFIER, diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/recipient-on-post-card-recipient.field.ts b/packages/twenty-apps/fixtures/postcard-app/src/fields/recipient-on-post-card-recipient.field.ts similarity index 67% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/recipient-on-post-card-recipient.field.ts rename to packages/twenty-apps/fixtures/postcard-app/src/fields/recipient-on-post-card-recipient.field.ts index 04295115eb..fc5bab92b9 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/recipient-on-post-card-recipient.field.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/fields/recipient-on-post-card-recipient.field.ts @@ -1,10 +1,10 @@ -import { defineField, FieldType, RelationType, OnDeleteAction } from '@/sdk'; -import { RECIPIENT_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/recipient.object'; -import { POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object'; +import { defineField, FieldType, RelationType, OnDeleteAction } from 'twenty-sdk'; +import { RECIPIENT_UNIVERSAL_IDENTIFIER } from '../objects/recipient.object'; +import { POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER } from '../objects/post-card-recipient.object'; import { POST_CARD_RECIPIENTS_ON_RECIPIENT_ID, RECIPIENT_ON_POST_CARD_RECIPIENT_ID, -} from '@/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-recipient.field'; +} from './post-card-recipients-on-recipient.field'; export default defineField({ universalIdentifier: RECIPIENT_ON_POST_CARD_RECIPIENT_ID, diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/greeting.function.ts b/packages/twenty-apps/fixtures/postcard-app/src/logic-functions/greeting.function.ts similarity index 89% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/greeting.function.ts rename to packages/twenty-apps/fixtures/postcard-app/src/logic-functions/greeting.function.ts index a02f5193b3..6b55f8356b 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/greeting.function.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/logic-functions/greeting.function.ts @@ -1,4 +1,4 @@ -import { defineLogicFunction } from '@/sdk'; +import { defineLogicFunction } from 'twenty-sdk'; import { DEFAULT_NAME, formatGreeting } from '../utils/greeting.util'; const greetingHandler = () => { diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/lookup-recipient.function.ts b/packages/twenty-apps/fixtures/postcard-app/src/logic-functions/lookup-recipient.function.ts similarity index 88% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/lookup-recipient.function.ts rename to packages/twenty-apps/fixtures/postcard-app/src/logic-functions/lookup-recipient.function.ts index 859cb00b42..997ffd0b53 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/lookup-recipient.function.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/logic-functions/lookup-recipient.function.ts @@ -1,4 +1,4 @@ -import { defineLogicFunction } from '@/sdk'; +import { defineLogicFunction } from 'twenty-sdk'; const handler = async (params: { recipientName: string }) => { return { found: true, name: params.recipientName }; diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/on-post-card-created.function.ts b/packages/twenty-apps/fixtures/postcard-app/src/logic-functions/on-post-card-created.function.ts similarity index 88% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/on-post-card-created.function.ts rename to packages/twenty-apps/fixtures/postcard-app/src/logic-functions/on-post-card-created.function.ts index 09a8bdb02f..b30c24f9d0 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/on-post-card-created.function.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/logic-functions/on-post-card-created.function.ts @@ -1,4 +1,4 @@ -import { defineLogicFunction } from '@/sdk'; +import { defineLogicFunction } from 'twenty-sdk'; const handler = async () => { return { processed: true }; diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/test-function-2.function.ts b/packages/twenty-apps/fixtures/postcard-app/src/logic-functions/test-function-2.function.ts similarity index 85% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/test-function-2.function.ts rename to packages/twenty-apps/fixtures/postcard-app/src/logic-functions/test-function-2.function.ts index f3746c9590..dd80779a6a 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/test-function-2.function.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/logic-functions/test-function-2.function.ts @@ -1,4 +1,4 @@ -import { defineLogicFunction } from '@/sdk'; +import { defineLogicFunction } from 'twenty-sdk'; import { testFunction2 } from '../utils/test-function-2.util'; export default defineLogicFunction({ diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/test-function.function.ts b/packages/twenty-apps/fixtures/postcard-app/src/logic-functions/test-function.function.ts similarity index 89% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/test-function.function.ts rename to packages/twenty-apps/fixtures/postcard-app/src/logic-functions/test-function.function.ts index 11db08e00f..110ccb351e 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/test-function.function.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/logic-functions/test-function.function.ts @@ -1,4 +1,4 @@ -import { defineLogicFunction } from '@/sdk'; +import { defineLogicFunction } from 'twenty-sdk'; import { formatFarewell } from '../utils/greeting.util'; const handler = () => { diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/post-card-recipients.navigation-menu-item.ts b/packages/twenty-apps/fixtures/postcard-app/src/navigation-menu-items/post-card-recipients.navigation-menu-item.ts similarity index 51% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/post-card-recipients.navigation-menu-item.ts rename to packages/twenty-apps/fixtures/postcard-app/src/navigation-menu-items/post-card-recipients.navigation-menu-item.ts index 5735595cdb..34e1124a9c 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/post-card-recipients.navigation-menu-item.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/navigation-menu-items/post-card-recipients.navigation-menu-item.ts @@ -1,5 +1,5 @@ -import { defineNavigationMenuItem } from '@/sdk'; -import { ALL_POST_CARD_RECIPIENTS_VIEW_ID } from '@/cli/__tests__/apps/rich-app/src/views/all-post-card-recipients.view'; +import { defineNavigationMenuItem } from 'twenty-sdk'; +import { ALL_POST_CARD_RECIPIENTS_VIEW_ID } from '../views/all-post-card-recipients.view'; export default defineNavigationMenuItem({ universalIdentifier: 'c1a2b3c4-0003-4a7b-8c9d-0e1f2a3b4c5d', diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/post-cards.navigation-menu-item.ts b/packages/twenty-apps/fixtures/postcard-app/src/navigation-menu-items/post-cards.navigation-menu-item.ts similarity index 53% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/post-cards.navigation-menu-item.ts rename to packages/twenty-apps/fixtures/postcard-app/src/navigation-menu-items/post-cards.navigation-menu-item.ts index d10c4ac1f9..a4d4f6c181 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/post-cards.navigation-menu-item.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/navigation-menu-items/post-cards.navigation-menu-item.ts @@ -1,5 +1,5 @@ -import { defineNavigationMenuItem } from '@/sdk'; -import { ALL_POST_CARDS_VIEW_ID } from '@/cli/__tests__/apps/rich-app/src/views/all-post-cards.view'; +import { defineNavigationMenuItem } from 'twenty-sdk'; +import { ALL_POST_CARDS_VIEW_ID } from '../views/all-post-cards.view'; export default defineNavigationMenuItem({ universalIdentifier: 'c1a2b3c4-0001-4a7b-8c9d-0e1f2a3b4c5d', diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/recipients.navigation-menu-item.ts b/packages/twenty-apps/fixtures/postcard-app/src/navigation-menu-items/recipients.navigation-menu-item.ts similarity index 53% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/recipients.navigation-menu-item.ts rename to packages/twenty-apps/fixtures/postcard-app/src/navigation-menu-items/recipients.navigation-menu-item.ts index 290311fe6b..c0b1b9a397 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/recipients.navigation-menu-item.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/navigation-menu-items/recipients.navigation-menu-item.ts @@ -1,5 +1,5 @@ -import { defineNavigationMenuItem } from '@/sdk'; -import { ALL_RECIPIENTS_VIEW_ID } from '@/cli/__tests__/apps/rich-app/src/views/all-recipients.view'; +import { defineNavigationMenuItem } from 'twenty-sdk'; +import { ALL_RECIPIENTS_VIEW_ID } from '../views/all-recipients.view'; export default defineNavigationMenuItem({ universalIdentifier: 'c1a2b3c4-0002-4a7b-8c9d-0e1f2a3b4c5d', diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object.ts b/packages/twenty-apps/fixtures/postcard-app/src/objects/post-card-recipient.object.ts similarity index 93% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object.ts rename to packages/twenty-apps/fixtures/postcard-app/src/objects/post-card-recipient.object.ts index 62deafc4ae..128de41847 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/objects/post-card-recipient.object.ts @@ -1,4 +1,4 @@ -import { defineObject, FieldType } from '@/sdk'; +import { defineObject, FieldType } from 'twenty-sdk'; export const POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER = 'e1a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5e'; diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/post-card.object.ts b/packages/twenty-apps/fixtures/postcard-app/src/objects/post-card.object.ts similarity index 97% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/post-card.object.ts rename to packages/twenty-apps/fixtures/postcard-app/src/objects/post-card.object.ts index 8bd7a6790a..d779ae29c8 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/post-card.object.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/objects/post-card.object.ts @@ -1,4 +1,4 @@ -import { defineObject, FieldType } from '@/sdk'; +import { defineObject, FieldType } from 'twenty-sdk'; enum PostCardStatus { DRAFT = 'DRAFT', diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/recipient.object.ts b/packages/twenty-apps/fixtures/postcard-app/src/objects/recipient.object.ts similarity index 94% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/recipient.object.ts rename to packages/twenty-apps/fixtures/postcard-app/src/objects/recipient.object.ts index e6abb7ff9c..e636f782a0 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/recipient.object.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/objects/recipient.object.ts @@ -1,4 +1,4 @@ -import { defineObject, FieldType } from '@/sdk'; +import { defineObject, FieldType } from 'twenty-sdk'; export const RECIPIENT_UNIVERSAL_IDENTIFIER = 'd1a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5d'; diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/roles/default-function.role.ts b/packages/twenty-apps/fixtures/postcard-app/src/roles/default-function.role.ts similarity index 90% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/roles/default-function.role.ts rename to packages/twenty-apps/fixtures/postcard-app/src/roles/default-function.role.ts index 4852725a84..dc68a1db49 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/roles/default-function.role.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/roles/default-function.role.ts @@ -1,8 +1,8 @@ -import { PermissionFlag, defineRole } from '@/sdk'; +import { PermissionFlag, defineRole } from 'twenty-sdk'; import { CONTENT_FIELD_UNIVERSAL_IDENTIFIER, POST_CARD_UNIVERSAL_IDENTIFIER, -} from '@/cli/__tests__/apps/rich-app/src/objects/post-card.object'; +} from '../objects/post-card.object'; export const DEFAULT_ROLE_UNIVERSAL_IDENTIFIER = 'b648f87b-1d26-4961-b974-0908fd991061'; diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.front-component.tsx b/packages/twenty-apps/fixtures/postcard-app/src/root.front-component.tsx similarity index 87% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.front-component.tsx rename to packages/twenty-apps/fixtures/postcard-app/src/root.front-component.tsx index da55710ec0..3f2c654889 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.front-component.tsx +++ b/packages/twenty-apps/fixtures/postcard-app/src/root.front-component.tsx @@ -1,4 +1,4 @@ -import { defineFrontComponent } from '@/sdk'; +import { defineFrontComponent } from 'twenty-sdk'; export const RootComponent = () => { return ( diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.function.ts b/packages/twenty-apps/fixtures/postcard-app/src/root.function.ts similarity index 87% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.function.ts rename to packages/twenty-apps/fixtures/postcard-app/src/root.function.ts index 340fbe10b8..44b8a8dc83 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.function.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/root.function.ts @@ -1,4 +1,4 @@ -import { defineLogicFunction } from '@/sdk'; +import { defineLogicFunction } from 'twenty-sdk'; const rootHandler = () => { return 'root-function-result'; diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.object.ts b/packages/twenty-apps/fixtures/postcard-app/src/root.object.ts similarity index 92% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.object.ts rename to packages/twenty-apps/fixtures/postcard-app/src/root.object.ts index 5382ead3fa..a93d823a2b 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.object.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/root.object.ts @@ -1,4 +1,4 @@ -import { defineObject, FieldType } from '@/sdk'; +import { defineObject, FieldType } from 'twenty-sdk'; export default defineObject({ universalIdentifier: 'b0b1b2b3-b4b5-4000-8000-000000000001', diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.role.ts b/packages/twenty-apps/fixtures/postcard-app/src/root.role.ts similarity index 91% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.role.ts rename to packages/twenty-apps/fixtures/postcard-app/src/root.role.ts index 70a83fe0c4..9864a73ef3 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/root.role.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/root.role.ts @@ -1,4 +1,4 @@ -import { defineRole } from '@/sdk'; +import { defineRole } from 'twenty-sdk'; export default defineRole({ universalIdentifier: 'c0c1c2c3-c4c5-4000-8000-000000000001', diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/utils/card-display.component.tsx b/packages/twenty-apps/fixtures/postcard-app/src/utils/card-display.component.tsx similarity index 100% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/utils/card-display.component.tsx rename to packages/twenty-apps/fixtures/postcard-app/src/utils/card-display.component.tsx diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/utils/greeting.util.ts b/packages/twenty-apps/fixtures/postcard-app/src/utils/greeting.util.ts similarity index 100% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/utils/greeting.util.ts rename to packages/twenty-apps/fixtures/postcard-app/src/utils/greeting.util.ts diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/utils/test-function-2.util.ts b/packages/twenty-apps/fixtures/postcard-app/src/utils/test-function-2.util.ts similarity index 100% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/utils/test-function-2.util.ts rename to packages/twenty-apps/fixtures/postcard-app/src/utils/test-function-2.util.ts diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-post-card-recipients.view.ts b/packages/twenty-apps/fixtures/postcard-app/src/views/all-post-card-recipients.view.ts similarity index 86% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-post-card-recipients.view.ts rename to packages/twenty-apps/fixtures/postcard-app/src/views/all-post-card-recipients.view.ts index 8dac15d3a5..944789b9fb 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-post-card-recipients.view.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/views/all-post-card-recipients.view.ts @@ -1,8 +1,8 @@ import { POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER, SENT_AT_FIELD_UNIVERSAL_IDENTIFIER, -} from '@/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object'; -import { defineView } from '@/sdk'; +} from '../objects/post-card-recipient.object'; +import { defineView } from 'twenty-sdk'; import { ViewType } from 'twenty-shared/types'; export const ALL_POST_CARD_RECIPIENTS_VIEW_ID = diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-post-cards.view.ts b/packages/twenty-apps/fixtures/postcard-app/src/views/all-post-cards.view.ts similarity index 89% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-post-cards.view.ts rename to packages/twenty-apps/fixtures/postcard-app/src/views/all-post-cards.view.ts index 21e1288df6..1f2520c113 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-post-cards.view.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/views/all-post-cards.view.ts @@ -1,8 +1,8 @@ -import { defineView } from '@/sdk'; +import { defineView } from 'twenty-sdk'; import { CONTENT_FIELD_UNIVERSAL_IDENTIFIER, POST_CARD_UNIVERSAL_IDENTIFIER, -} from '@/cli/__tests__/apps/rich-app/src/objects/post-card.object'; +} from '../objects/post-card.object'; import { ViewType } from 'twenty-shared/types'; export const ALL_POST_CARDS_VIEW_ID = 'b1a2b3c4-0001-4a7b-8c9d-0e1f2a3b4c5d'; diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-recipients.view.ts b/packages/twenty-apps/fixtures/postcard-app/src/views/all-recipients.view.ts similarity index 86% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-recipients.view.ts rename to packages/twenty-apps/fixtures/postcard-app/src/views/all-recipients.view.ts index 7fd86807c2..1d8a7f8816 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-recipients.view.ts +++ b/packages/twenty-apps/fixtures/postcard-app/src/views/all-recipients.view.ts @@ -1,8 +1,8 @@ import { RECIPIENT_EMAIL_FIELD_UNIVERSAL_IDENTIFIER, RECIPIENT_UNIVERSAL_IDENTIFIER, -} from '@/cli/__tests__/apps/rich-app/src/objects/recipient.object'; -import { defineView } from '@/sdk'; +} from '../objects/recipient.object'; +import { defineView } from 'twenty-sdk'; import { ViewType } from 'twenty-shared/types'; export const ALL_RECIPIENTS_VIEW_ID = 'b1a2b3c4-0002-4a7b-8c9d-0e1f2a3b4c5d'; diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/tsconfig.json b/packages/twenty-apps/fixtures/postcard-app/tsconfig.json similarity index 72% rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/tsconfig.json rename to packages/twenty-apps/fixtures/postcard-app/tsconfig.json index b6520539e5..97050faf75 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/tsconfig.json +++ b/packages/twenty-apps/fixtures/postcard-app/tsconfig.json @@ -9,8 +9,9 @@ "jsx": "react-jsx", "baseUrl": ".", "paths": { - "@/*": ["../../../../../src/*"] + "src/*": ["./src/*"] } }, - "include": ["**/*"] + "include": ["**/*"], + "exclude": ["node_modules", "dist", ".twenty"] } diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/yarn.lock b/packages/twenty-apps/fixtures/postcard-app/yarn.lock similarity index 100% rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/yarn.lock rename to packages/twenty-apps/fixtures/postcard-app/yarn.lock diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/fixture-paths.ts b/packages/twenty-sdk/src/cli/__tests__/apps/fixture-paths.ts new file mode 100644 index 0000000000..677edd575b --- /dev/null +++ b/packages/twenty-sdk/src/cli/__tests__/apps/fixture-paths.ts @@ -0,0 +1,11 @@ +import { resolve } from 'path'; + +const FIXTURES_ROOT = resolve(__dirname, '../../../../../twenty-apps/fixtures'); + +export const POSTCARD_APP_PATH = resolve(FIXTURES_ROOT, 'postcard-app'); +export const MINIMAL_APP_PATH = resolve(FIXTURES_ROOT, 'minimal-app'); +export const INVALID_APP_PATH = resolve(FIXTURES_ROOT, 'invalid-app'); +export const FUNCTION_EXECUTE_APP_PATH = resolve( + FIXTURES_ROOT, + 'function-execute-app', +); diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/__e2e__/function-execute.e2e-spec.ts b/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/__e2e__/function-execute.e2e-spec.ts index 7b1d8e90ba..b9b4bef5e3 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/__e2e__/function-execute.e2e-spec.ts +++ b/packages/twenty-sdk/src/cli/__tests__/apps/function-execute-app/__e2e__/function-execute.e2e-spec.ts @@ -1,12 +1,13 @@ -import { resolve } from 'path'; import { vi } from 'vitest'; import { appBuild } from '@/cli/public-operations/app-build'; import { appUninstall } from '@/cli/public-operations/app-uninstall'; import { functionExecute } from '@/cli/public-operations/function-execute'; -import { ADD_NUMBERS_UNIVERSAL_IDENTIFIER } from '../src/logic-functions/add-numbers.function'; +import { FUNCTION_EXECUTE_APP_PATH } from '@/cli/__tests__/apps/fixture-paths'; -const APP_PATH = resolve(__dirname, '../'); +const ADD_NUMBERS_UNIVERSAL_IDENTIFIER = 'f9e5589c-e951-4d99-85db-0a305ab53502'; + +const APP_PATH = FUNCTION_EXECUTE_APP_PATH; describe('functionExecute E2E', () => { beforeAll(async () => { @@ -18,8 +19,6 @@ describe('functionExecute E2E', () => { ); } - // The server may need a moment to make uploaded files readable - // by the execution engine. Retry until the handler becomes available. await vi.waitFor( async () => { const result = await functionExecute({ diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/__integration__/manifest.integration.spec.ts b/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/__integration__/manifest.integration.spec.ts index 18ab3e7f50..96b5e0c2ee 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/__integration__/manifest.integration.spec.ts +++ b/packages/twenty-sdk/src/cli/__tests__/apps/invalid-app/__integration__/manifest.integration.spec.ts @@ -3,14 +3,18 @@ import { OUTPUT_DIR } from 'twenty-shared/application'; import { runAppDevInProcess } from '@/cli/__tests__/integration/utils/run-app-dev-in-process.util'; import { pathExists } from '@/cli/utilities/file/fs-utils'; +import { INVALID_APP_PATH } from '@/cli/__tests__/apps/fixture-paths'; -const APP_PATH = join(__dirname, '..'); -const MANIFEST_OUTPUT_PATH = join(APP_PATH, OUTPUT_DIR, 'manifest.json'); +const MANIFEST_OUTPUT_PATH = join( + INVALID_APP_PATH, + OUTPUT_DIR, + 'manifest.json', +); describe('invalid-app manifest', () => { it('should fail to build manifest due to duplicate universalIdentifier', async () => { const result = await runAppDevInProcess({ - appPath: APP_PATH, + appPath: INVALID_APP_PATH, timeout: 10000, }); diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/app-dev.integration.spec.ts b/packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/app-dev.integration.spec.ts similarity index 66% rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/app-dev.integration.spec.ts rename to packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/app-dev.integration.spec.ts index 310e029b34..33ef13e9a4 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/app-dev.integration.spec.ts +++ b/packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/app-dev.integration.spec.ts @@ -1,15 +1,13 @@ -import { join } from 'path'; - import { runAppDevInProcess } from '@/cli/__tests__/integration/utils/run-app-dev-in-process.util'; +import { MINIMAL_APP_PATH } from '@/cli/__tests__/apps/fixture-paths'; + import { defineFrontComponentsTests } from './tests/front-components.tests'; import { defineLogicFunctionsTests } from './tests/logic-functions.tests'; import { defineManifestTests } from './tests/manifest.tests'; -const APP_PATH = join(__dirname, '../..'); - -describe('root-app app:dev', () => { +describe('minimal-app app:dev', () => { beforeAll(async () => { - const result = await runAppDevInProcess({ appPath: APP_PATH }); + const result = await runAppDevInProcess({ appPath: MINIMAL_APP_PATH }); if (!result.success) { const diagnostics = JSON.stringify( @@ -24,7 +22,7 @@ describe('root-app app:dev', () => { } }, 60000); - defineManifestTests(APP_PATH); - defineLogicFunctionsTests(APP_PATH); - defineFrontComponentsTests(APP_PATH); + defineManifestTests(MINIMAL_APP_PATH); + defineLogicFunctionsTests(MINIMAL_APP_PATH); + defineFrontComponentsTests(MINIMAL_APP_PATH); }); diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/expected-manifest.ts b/packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/expected-manifest.ts similarity index 100% rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/expected-manifest.ts rename to packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/expected-manifest.ts diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/tests/console-output.tests.ts b/packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/tests/console-output.tests.ts similarity index 100% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/tests/console-output.tests.ts rename to packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/tests/console-output.tests.ts diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/tests/front-components.tests.ts b/packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/tests/front-components.tests.ts similarity index 100% rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/tests/front-components.tests.ts rename to packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/tests/front-components.tests.ts diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/tests/logic-functions.tests.ts b/packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/tests/logic-functions.tests.ts similarity index 100% rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/tests/logic-functions.tests.ts rename to packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/tests/logic-functions.tests.ts diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/tests/manifest.tests.ts b/packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/tests/manifest.tests.ts similarity index 89% rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/tests/manifest.tests.ts rename to packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/tests/manifest.tests.ts index bc86510a41..c7075b5ffb 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/tests/manifest.tests.ts +++ b/packages/twenty-sdk/src/cli/__tests__/apps/minimal-app/__integration__/app-dev/tests/manifest.tests.ts @@ -1,7 +1,7 @@ import { join } from 'path'; import { type Manifest } from 'twenty-shared/application'; -import { EXPECTED_MANIFEST } from '@/cli/__tests__/apps/root-app/__integration__/app-dev/expected-manifest'; +import { EXPECTED_MANIFEST } from '@/cli/__tests__/apps/minimal-app/__integration__/app-dev/expected-manifest'; import { normalizeManifestForComparison } from '@/cli/__tests__/integration/utils/normalize-manifest.util'; import { pathExists, readJson } from '@/cli/utilities/file/fs-utils'; diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__e2e__/applications-install-delete-reinstall.e2e-spec.ts b/packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__e2e__/applications-install-delete-reinstall.e2e-spec.ts similarity index 84% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__e2e__/applications-install-delete-reinstall.e2e-spec.ts rename to packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__e2e__/applications-install-delete-reinstall.e2e-spec.ts index 69926ef5fa..7bfb84568f 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__e2e__/applications-install-delete-reinstall.e2e-spec.ts +++ b/packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__e2e__/applications-install-delete-reinstall.e2e-spec.ts @@ -1,14 +1,15 @@ import { OUTPUT_DIR } from 'twenty-shared/application'; import { existsSync } from 'fs'; -import { join, resolve } from 'path'; +import { join } from 'path'; import { inspect } from 'util'; import { runCliCommand } from '@/cli/__tests__/integration/utils/run-cli-command.util'; +import { POSTCARD_APP_PATH } from '@/cli/__tests__/apps/fixture-paths'; inspect.defaultOptions.depth = 10; -describe('Application: install delete and reinstall rich-app', () => { - const applicationName = 'rich-app'; - const appPath = resolve(__dirname, '../'); +describe('Application: install delete and reinstall postcard-app', () => { + const applicationName = 'postcard-app'; + const appPath = POSTCARD_APP_PATH; beforeAll(async () => { expect(existsSync(appPath)).toBe(true); diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__e2e__/health.e2e-spec.ts b/packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__e2e__/health.e2e-spec.ts similarity index 100% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__e2e__/health.e2e-spec.ts rename to packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__e2e__/health.e2e-spec.ts diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/app-dev.integration.spec.ts b/packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__integration__/app-dev/app-dev.integration.spec.ts similarity index 67% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/app-dev.integration.spec.ts rename to packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__integration__/app-dev/app-dev.integration.spec.ts index 58e986655f..b8c3835f4d 100644 --- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/app-dev.integration.spec.ts +++ b/packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__integration__/app-dev/app-dev.integration.spec.ts @@ -1,14 +1,12 @@ import { runAppDevInProcess } from '@/cli/__tests__/integration/utils/run-app-dev-in-process.util'; -import { join } from 'path'; +import { POSTCARD_APP_PATH } from '@/cli/__tests__/apps/fixture-paths'; import { defineEntitiesTests } from './tests/entities.tests'; import { defineManifestTests } from './tests/manifest.tests'; -const APP_PATH = join(__dirname, '../..'); - -describe('rich-app app:dev', () => { +describe('postcard-app app:dev', () => { beforeAll(async () => { - const result = await runAppDevInProcess({ appPath: APP_PATH }); + const result = await runAppDevInProcess({ appPath: POSTCARD_APP_PATH }); if (!result.success) { const diagnostics = JSON.stringify( @@ -23,6 +21,6 @@ describe('rich-app app:dev', () => { } }, 60000); - defineManifestTests(APP_PATH); - defineEntitiesTests(APP_PATH); + defineManifestTests(POSTCARD_APP_PATH); + defineEntitiesTests(POSTCARD_APP_PATH); }); diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/expected-manifest.ts b/packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__integration__/app-dev/expected-manifest.ts similarity index 100% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/expected-manifest.ts rename to packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__integration__/app-dev/expected-manifest.ts diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/tests/console-output.tests.ts b/packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__integration__/app-dev/tests/console-output.tests.ts similarity index 100% rename from packages/twenty-sdk/src/cli/__tests__/apps/root-app/__integration__/app-dev/tests/console-output.tests.ts rename to packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__integration__/app-dev/tests/console-output.tests.ts diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/tests/entities.tests.ts b/packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__integration__/app-dev/tests/entities.tests.ts similarity index 100% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/tests/entities.tests.ts rename to packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__integration__/app-dev/tests/entities.tests.ts diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/tests/manifest.tests.ts b/packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__integration__/app-dev/tests/manifest.tests.ts similarity index 100% rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/tests/manifest.tests.ts rename to packages/twenty-sdk/src/cli/__tests__/apps/postcard-app/__integration__/app-dev/tests/manifest.tests.ts diff --git a/packages/twenty-sdk/src/cli/commands/app/app-build.ts b/packages/twenty-sdk/src/cli/commands/app/app-build.ts index 5dd3b98b15..a874a8631c 100644 --- a/packages/twenty-sdk/src/cli/commands/app/app-build.ts +++ b/packages/twenty-sdk/src/cli/commands/app/app-build.ts @@ -1,5 +1,6 @@ import { appBuild } from '@/cli/public-operations/app-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 = { @@ -11,6 +12,8 @@ export class AppBuildCommand { async execute(options: AppBuildCommandOptions): Promise { 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(''); diff --git a/packages/twenty-sdk/src/cli/commands/app/app-dev.ts b/packages/twenty-sdk/src/cli/commands/app/app-dev.ts index 5072feb60c..cb2c65c765 100644 --- a/packages/twenty-sdk/src/cli/commands/app/app-dev.ts +++ b/packages/twenty-sdk/src/cli/commands/app/app-dev.ts @@ -1,8 +1,9 @@ import { CURRENT_EXECUTION_DIRECTORY } from '@/cli/utilities/config/current-execution-directory'; -import { renderDevUI } from '@/cli/utilities/dev/ui/components/dev-ui'; -import { DevUiStateManager } from '@/cli/utilities/dev/ui/dev-ui-state-manager'; import { DevModeOrchestrator } from '@/cli/utilities/dev/orchestrator/dev-mode-orchestrator'; import { OrchestratorState } from '@/cli/utilities/dev/orchestrator/dev-mode-orchestrator-state'; +import { renderDevUI } from '@/cli/utilities/dev/ui/components/dev-ui'; +import { DevUiStateManager } from '@/cli/utilities/dev/ui/dev-ui-state-manager'; +import { checkSdkVersionCompatibility } from '@/cli/utilities/version/check-sdk-version-compatibility'; export type AppDevOptions = { appPath?: string; @@ -25,6 +26,8 @@ export class AppDevCommand { async execute(options: AppDevOptions): Promise { const appPath = options.appPath ?? CURRENT_EXECUTION_DIRECTORY; + await checkSdkVersionCompatibility(appPath); + const orchestratorState = new OrchestratorState({ appPath, frontendUrl: process.env.FRONTEND_URL, diff --git a/packages/twenty-sdk/src/cli/commands/app/app-publish.ts b/packages/twenty-sdk/src/cli/commands/app/app-publish.ts index 25ed83abb3..b0943ddc32 100644 --- a/packages/twenty-sdk/src/cli/commands/app/app-publish.ts +++ b/packages/twenty-sdk/src/cli/commands/app/app-publish.ts @@ -1,5 +1,6 @@ import { appPublish } from '@/cli/public-operations/app-publish'; 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 AppPublishCommandOptions = { @@ -12,6 +13,9 @@ export type AppPublishCommandOptions = { export class AppPublishCommand { async execute(options: AppPublishCommandOptions): Promise { const appPath = options.appPath ?? CURRENT_EXECUTION_DIRECTORY; + + await checkSdkVersionCompatibility(appPath); + const isServerPublish = !!options.server; console.log( diff --git a/packages/twenty-sdk/src/cli/utilities/version/check-sdk-version-compatibility.ts b/packages/twenty-sdk/src/cli/utilities/version/check-sdk-version-compatibility.ts new file mode 100644 index 0000000000..420959c1f4 --- /dev/null +++ b/packages/twenty-sdk/src/cli/utilities/version/check-sdk-version-compatibility.ts @@ -0,0 +1,81 @@ +import { readFile } from 'node:fs/promises'; +import { join } from 'path'; + +import { pathExists } from '@/cli/utilities/file/fs-utils'; +import chalk from 'chalk'; +import sdkPackageJson from '../../../../package.json'; + +const getAppDeclaredSdkVersion = async ( + appPath: string, +): Promise => { + const pkgPath = join(appPath, 'package.json'); + + if (!(await pathExists(pkgPath))) { + return undefined; + } + + try { + const content = await readFile(pkgPath, 'utf-8'); + const pkg = JSON.parse(content) as { + dependencies?: Record; + devDependencies?: Record; + }; + + return ( + pkg.dependencies?.['twenty-sdk'] ?? + pkg.devDependencies?.['twenty-sdk'] ?? + undefined + ); + } catch { + return undefined; + } +}; + +// Extracts the major version number from a semver string or range. +// Handles: "4.2.0", "^4.2.0", "~4.2.0", ">=4.0.0", "4.x", "4" +// Returns null for unparseable values like "latest", "*", "workspace:*" +const parseMajorVersion = (versionOrRange: string): number | null => { + const match = versionOrRange.match(/(\d+)\./); + + if (match) { + return parseInt(match[1], 10); + } + + const exactMatch = versionOrRange.match(/^[~^>=<]*(\d+)$/); + + if (exactMatch) { + return parseInt(exactMatch[1], 10); + } + + return null; +}; + +export const checkSdkVersionCompatibility = async ( + appPath: string, +): Promise => { + const cliVersion = sdkPackageJson.version; + const appDeclaredVersion = await getAppDeclaredSdkVersion(appPath); + + if (!cliVersion || !appDeclaredVersion) { + return; + } + + const cliMajor = parseMajorVersion(cliVersion); + const appMajor = parseMajorVersion(appDeclaredVersion); + + if (cliMajor === null || appMajor === null) { + return; + } + + if (cliMajor !== appMajor) { + console.warn( + chalk.yellow( + `⚠ Version mismatch: your app requires twenty-sdk@${appMajor}.x ` + + `but the CLI running is v${cliVersion}. ` + + `Major version mismatches may cause unexpected behavior.\n` + + ` Update with: npm install -g twenty-sdk@${appMajor}`, + ), + ); + console.warn(''); + } +};