twenty 0.2.0 → 2.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +166 -0
- package/LICENSE +21 -0
- package/README.md +64 -57
- package/dist/app-template/.nvmrc +1 -0
- package/dist/app-template/.oxlintrc.json +37 -0
- package/dist/app-template/AGENTS.md +70 -0
- package/dist/app-template/CHANGELOG.md +7 -0
- package/dist/app-template/README.md +34 -0
- package/dist/app-template/SETUP.md +47 -0
- package/dist/app-template/github/workflows/cd.yml +42 -0
- package/dist/app-template/github/workflows/ci.yml +60 -0
- package/dist/app-template/github/workflows/publish.yml +52 -0
- package/dist/app-template/gitignore +43 -0
- package/dist/app-template/locales/en.json +1 -0
- package/dist/app-template/package.json +36 -0
- package/dist/app-template/public/logo.svg +7 -0
- package/dist/app-template/src/__tests__/application-config.test.ts +14 -0
- package/dist/app-template/src/__tests__/global-setup.ts +56 -0
- package/dist/app-template/src/__tests__/run-twenty.ts +66 -0
- package/dist/app-template/src/__tests__/schema.integration-test.ts +46 -0
- package/dist/app-template/src/application-config.ts +13 -0
- package/dist/app-template/src/constants/universal-identifiers.ts +12 -0
- package/dist/app-template/src/default-role.ts +16 -0
- package/dist/app-template/src/front-components/main-page.tsx +287 -0
- package/dist/app-template/src/logic-functions/health-check.ts +11 -0
- package/dist/app-template/src/navigation-menu-items/main-page.navigation-menu-item.ts +19 -0
- package/dist/app-template/src/page-layouts/main-page.page-layout.ts +42 -0
- package/dist/app-template/tsconfig.json +37 -0
- package/dist/app-template/tsconfig.spec.json +9 -0
- package/dist/app-template/vitest.config.ts +31 -0
- package/dist/app-template/vitest.unit.config.ts +14 -0
- package/dist/app-template/yarn.lock +3374 -0
- package/dist/app-template/yarnrc.yml +1 -0
- package/dist/app-worker.cjs +1 -0
- package/dist/chunks/application-DuIJE2qG.cjs +5 -0
- package/dist/chunks/assert-pull-paths-BuQ1ZRvQ.cjs +1 -0
- package/dist/chunks/build-CX6FBrbu.cjs +1 -0
- package/dist/chunks/build-pull-entities-zwArrVMk.cjs +5 -0
- package/dist/chunks/build-source-manifest-CLKH5vzc.cjs +2 -0
- package/dist/chunks/build-source-snapshot-CbGsy1-v.cjs +206 -0
- package/dist/chunks/check-node-requirement-mqwNPktb.cjs +1 -0
- package/dist/chunks/cli-error-CSsayo0u.cjs +1 -0
- package/dist/chunks/cli-version.constant-aSp8WZDh.cjs +1 -0
- package/dist/chunks/collect-watch-inputs-B9jWG4W0.cjs +1 -0
- package/dist/chunks/compile-application-translations-B59jYVWc.cjs +1 -0
- package/dist/chunks/config-file-mode.constant-DLBzKKUl.cjs +1 -0
- package/dist/chunks/confirm-in-terminal-BxEM5lxE.cjs +1 -0
- package/dist/chunks/constants-CL6mrTMT-B748cNNG.cjs +23 -0
- package/dist/chunks/constants-Cf5-CwMu.cjs +1 -0
- package/dist/chunks/convert-to-label-BPBLtc_O.cjs +1 -0
- package/dist/chunks/create-app-not-installed-error-Cc8YZqI7.cjs +1 -0
- package/dist/chunks/create-cancelled-error-DgrNfOv2.cjs +1 -0
- package/dist/chunks/create-http-status-error-D3gy3DzB.cjs +1 -0
- package/dist/chunks/create-metadata-client-ChjDalSi.cjs +6 -0
- package/dist/chunks/create-pull-base-write-rxjcKtD-.cjs +1 -0
- package/dist/chunks/create-rest-client-eAfOFfDA.cjs +58 -0
- package/dist/chunks/create-tooling-failure-DLI5FlQP.cjs +1 -0
- package/dist/chunks/credential-kind-labels.constant-CKdoQF8o.cjs +1 -0
- package/dist/chunks/extract-manifest-from-file-j-Y9wNas.cjs +1 -0
- package/dist/chunks/fetch-metadata-inspection-Dp034TpK.cjs +1 -0
- package/dist/chunks/fetch-signed-in-identity-BhvaL3zp.cjs +1 -0
- package/dist/chunks/fetch-workspace-id-DJStmf_V.cjs +1 -0
- package/dist/chunks/find-remote-D48r20g0.cjs +1 -0
- package/dist/chunks/format-app-duration-gu2oRLB4.cjs +1 -0
- package/dist/chunks/format-body-VcKL4WXt.cjs +1 -0
- package/dist/chunks/format-data-value-B6rIbpJv.cjs +1 -0
- package/dist/chunks/format-details-COEwKz_M.cjs +2 -0
- package/dist/chunks/format-metadata-fields-DJnTg1R9.cjs +2 -0
- package/dist/chunks/format-metadata-owner-yUeocnwY.cjs +1 -0
- package/dist/chunks/format-table-4drtI5sP.cjs +2 -0
- package/dist/chunks/fs-utils-Bl1fQcaJ.cjs +2 -0
- package/dist/chunks/generate-application-client-CCVLjxTj.cjs +1 -0
- package/dist/chunks/get-app-plan-summary-B0uwHXbO.cjs +8 -0
- package/dist/chunks/get-config-path-C-D-QHuX.cjs +1 -0
- package/dist/chunks/get-credential-kind-JI9heHe2.cjs +1 -0
- package/dist/chunks/get-function-input-schema-GNk3NRLJ-Bfph1o9z.cjs +1 -0
- package/dist/chunks/get-tooling-error-context-C69TBSej.cjs +1 -0
- package/dist/chunks/global-flags.constant-8GfW0sNU.cjs +1 -0
- package/dist/chunks/has-yarn-plug-and-play-X3ay5Xl0.cjs +1 -0
- package/dist/chunks/is-access-token-expiring-gICPXsbO.cjs +1 -0
- package/dist/chunks/is-application-not-found-error-mNeGbxmT.cjs +1 -0
- package/dist/chunks/is-exported-manifest-CriNOWvx.cjs +1 -0
- package/dist/chunks/is-inside-directory-t3ixLQDr.cjs +1 -0
- package/dist/chunks/is-interaction-allowed-ycbAFMIj.cjs +1 -0
- package/dist/chunks/is-same-universal-identifier-BCBib3RP.cjs +1 -0
- package/dist/chunks/is-supported-locale-BAjnKnKj.cjs +20 -0
- package/dist/chunks/kebab-case-D0usAzG-.cjs +1 -0
- package/dist/chunks/list-application-source-files-jEau5Rie.cjs +1 -0
- package/dist/chunks/metadata-D9sQOTRK.cjs +1 -0
- package/dist/chunks/metadata-page.constant-BkG4ndrO.cjs +1 -0
- package/dist/chunks/oauth-timing.constant-BClMQcKn.cjs +1 -0
- package/dist/chunks/open-browser-LPuVspT7.cjs +1 -0
- package/dist/chunks/package-CdYv4LEx.cjs +1 -0
- package/dist/chunks/parse-api-url-BllxRdpE.cjs +1 -0
- package/dist/chunks/parse-app-export-BkfflyUY.cjs +1 -0
- package/dist/chunks/parse-graphql-response-CtP9KTS2.cjs +1 -0
- package/dist/chunks/parse-json-input-CvMTKAWw.cjs +1 -0
- package/dist/chunks/print-typescript-value-DhElcFzI.cjs +3 -0
- package/dist/chunks/pull-source-eoiJwFb9.cjs +1 -0
- package/dist/chunks/read-app-identity-SeleQ_D6.cjs +1 -0
- package/dist/chunks/read-application-identity-BFg_p84F.cjs +1 -0
- package/dist/chunks/read-command-values-uSJqBG_E.cjs +1 -0
- package/dist/chunks/read-config-DUJ27809.cjs +1 -0
- package/dist/chunks/read-input-value-Cxgh_r2g.cjs +1 -0
- package/dist/chunks/read-source-identity-C8LG1v6U.cjs +1 -0
- package/dist/chunks/read-watch-input-stamp-BxeOb0vI.cjs +1 -0
- package/dist/chunks/record-pull-base-BbxvlnU8.cjs +1 -0
- package/dist/chunks/record-typecheck-config-inputs-BDqkKCrj.cjs +1 -0
- package/dist/chunks/request-oauth-tokens-C4KKlTQT.cjs +1 -0
- package/dist/chunks/request-timeout-milliseconds.constant-DtyQHrll.cjs +1 -0
- package/dist/chunks/require-approval-fhegB1ap.cjs +1 -0
- package/dist/chunks/resolve-app-project-D5ZXIpsG.cjs +1 -0
- package/dist/chunks/resolve-inside-sdk-p-16gKb4.cjs +1 -0
- package/dist/chunks/resolve-metadata-object-QoDi-Aik.cjs +1 -0
- package/dist/chunks/resolve-project-typescript-CDY8BbmP.cjs +1 -0
- package/dist/chunks/resolve-request-url-jC5kYwkn.cjs +1 -0
- package/dist/chunks/resolve-source-sdk-mK-f4q55.cjs +1 -0
- package/dist/chunks/result-item-limit.constant-CDrOhiWD.cjs +1 -0
- package/dist/chunks/run-api-graphql-command-Biy0WqXa.cjs +1 -0
- package/dist/chunks/run-api-rest-command-D9kdQceV.cjs +1 -0
- package/dist/chunks/run-app-add-command-DcTQg7Si.cjs +163 -0
- package/dist/chunks/run-app-apply-command-DwLPPJ-Y.cjs +2 -0
- package/dist/chunks/run-app-build-command-BRYb0one.cjs +2 -0
- package/dist/chunks/run-app-dev-command-CVeh9Gab.cjs +2 -0
- package/dist/chunks/run-app-exec-command-DKLNLbL5.cjs +3 -0
- package/dist/chunks/run-app-init-command-CJj8_spC.cjs +2 -0
- package/dist/chunks/run-app-logs-command-Dusb8K-W.cjs +9 -0
- package/dist/chunks/run-app-operation-BWrY9YZK.cjs +1 -0
- package/dist/chunks/run-app-plan-command-C0_3e332.cjs +1 -0
- package/dist/chunks/run-app-pull-command-DcZqs8gR.cjs +3 -0
- package/dist/chunks/run-app-typecheck-command-C8LqpOej.cjs +1 -0
- package/dist/chunks/run-app-uninstall-command-ncWS_k-p.cjs +2 -0
- package/dist/chunks/run-auth-login-command-_zDgRcth.cjs +1 -0
- package/dist/chunks/run-auth-logout-command-BO6O7GVi.cjs +2 -0
- package/dist/chunks/run-auth-status-command-Cj-vqoHg.cjs +1 -0
- package/dist/chunks/run-auth-token-command-D4geJ-rx.cjs +1 -0
- package/dist/chunks/run-cli-c9TOR0zj.cjs +23 -0
- package/dist/chunks/run-commands-command-C6gvMpQ_.cjs +2 -0
- package/dist/chunks/run-data-get-command-jDEU4EG1.cjs +1 -0
- package/dist/chunks/run-data-list-command-EnCdbuzc.cjs +1 -0
- package/dist/chunks/run-doctor-command-DnJ6io-m.cjs +2 -0
- package/dist/chunks/run-metadata-field-describe-command-vJngpw2S.cjs +3 -0
- package/dist/chunks/run-metadata-field-list-command-CR4w7fI6.cjs +3 -0
- package/dist/chunks/run-metadata-object-describe-command-CHP8K-W2.cjs +3 -0
- package/dist/chunks/run-metadata-object-list-command-BqXMcAp6.cjs +2 -0
- package/dist/chunks/run-open-command-DKl8acw0.cjs +1 -0
- package/dist/chunks/run-remote-list-command-DeAzr5Mn.cjs +1 -0
- package/dist/chunks/run-remote-remove-command-D0C5sWjP.cjs +2 -0
- package/dist/chunks/run-remote-rename-command-Byq9WRHd.cjs +1 -0
- package/dist/chunks/run-remote-use-command-B6VVDlMG.cjs +1 -0
- package/dist/chunks/run-version-command-BmSk8PUV.cjs +1 -0
- package/dist/chunks/select-target-C1VZjf-A.cjs +1 -0
- package/dist/chunks/sign-in-to-remote-again-CW8HPSTP.cjs +1 -0
- package/dist/chunks/sign-in-with-browser-C3kC6uP2.cjs +1 -0
- package/dist/chunks/style-BR52fK4V.cjs +1 -0
- package/dist/chunks/target-environment-variable.constant-D7z8AihP.cjs +1 -0
- package/dist/chunks/to-cli-error-BBYf_wqo.cjs +1 -0
- package/dist/chunks/to-public-target-CIAwoOKL.cjs +1 -0
- package/dist/chunks/to-worker-output-diagnostics-lprh9b0l.cjs +2 -0
- package/dist/chunks/typecheck-application-DGrovgX9.cjs +2 -0
- package/dist/chunks/undici-D3mKdfwl.cjs +95 -0
- package/dist/chunks/update-config-BkKBEfAp.cjs +1 -0
- package/dist/chunks/utils-B8EXJeaX-DK3gCslL.cjs +33 -0
- package/dist/chunks/validate-app-path-Dau-PC0a.cjs +1 -0
- package/dist/chunks/validate-remote-name-w-qnr43w.cjs +1 -0
- package/dist/chunks/write-config-atomically-DRWTukU-.cjs +1 -0
- package/dist/cli.cjs +2 -0
- package/docs/commands.md +564 -0
- package/package.json +41 -18
- package/src/app/README.md +43 -0
- package/src/app/add/README.md +69 -0
- package/src/app/bundles/README.md +85 -0
- package/src/app/client/README.md +62 -0
- package/src/app/dev/README.md +35 -0
- package/src/app/exec/README.md +48 -0
- package/src/app/function-logs/README.md +44 -0
- package/src/app/manifest/README.md +74 -0
- package/src/app/pull/README.md +28 -0
- package/src/app/source/README.md +33 -0
- package/src/app/typecheck/README.md +67 -0
- package/.npmignore +0 -2
- package/bin/twenty +0 -2
- package/index.js +0 -118
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Contributing to Twenty CLI
|
|
2
|
+
|
|
3
|
+
This package is the `twenty` executable in the Twenty monorepo. Its Nx project
|
|
4
|
+
is named `twenty-cli`; its Yarn workspace and npm package are named `twenty`.
|
|
5
|
+
Follow the repository's development instructions and nearby code conventions.
|
|
6
|
+
|
|
7
|
+
## Build and verify
|
|
8
|
+
|
|
9
|
+
Run these from the repository root after installing its dependencies:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
yarn nx build twenty-cli
|
|
13
|
+
node packages/twenty-cli/dist/cli.cjs --help
|
|
14
|
+
yarn nx lint twenty-cli
|
|
15
|
+
yarn exec tsgo -p packages/twenty-cli/tsconfig.json --noEmit
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Tests that use real applications or SDK parity references require the repository
|
|
19
|
+
SDK to be built. Its Nx target builds its dependencies:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
yarn nx build twenty-sdk
|
|
23
|
+
cd packages/twenty-cli
|
|
24
|
+
yarn exec vitest run --maxWorkers=2
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
For a focused change, pass its test file or directory to `vitest run`. Command
|
|
28
|
+
tests execute the public command runner with local HTTP fixtures. Worker tests
|
|
29
|
+
exercise subprocess output, cancellation and snapshot lifetime. Parity suites
|
|
30
|
+
compare generated source and artifacts against the SDK implementation;
|
|
31
|
+
the SDK is a test reference, not a runtime tooling dependency.
|
|
32
|
+
|
|
33
|
+
Rebuild `twenty-shared` with `--skip-nx-cache` after switching branches or changing
|
|
34
|
+
shared exports. Generated `dist` directories are not tracked, and stale outputs
|
|
35
|
+
can invalidate dependent test and typecheck results. Use the direct TypeScript
|
|
36
|
+
command above when checking a fix rather than relying on an Nx cache hit.
|
|
37
|
+
|
|
38
|
+
No live workspace is required for the unit suite. Passing it does not establish
|
|
39
|
+
live authorization, remote upload or server-version compatibility. Exercise
|
|
40
|
+
changed server workflows against a disposable workspace when appropriate.
|
|
41
|
+
|
|
42
|
+
## Package map
|
|
43
|
+
|
|
44
|
+
| Location | Responsibility |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| `src/catalog` | Command definitions, topics and lazy handler loading |
|
|
47
|
+
| `src/commands` | Command orchestration and user-visible results |
|
|
48
|
+
| `src/program` | Argument parsing, target setup, interaction and command lifecycle |
|
|
49
|
+
| `src/config`, `src/target`, `src/oauth` | Saved connections, target selection and authentication |
|
|
50
|
+
| `src/transport` | HTTP/GraphQL requests, proxy routing, limits and cancellation |
|
|
51
|
+
| `src/metadata`, `src/data` | Workspace metadata inspection and record reads |
|
|
52
|
+
| `src/doctor` | Read-only setup and connection diagnostics |
|
|
53
|
+
| `src/app` | Project tooling and application lifecycle, see its [module map](src/app/README.md) |
|
|
54
|
+
| `src/input`, `src/output` | Input parsing, human/JSON/NDJSON output and error contracts |
|
|
55
|
+
| `app-template` | App source, configuration and CLI-based integration-test harness copied by `app init` |
|
|
56
|
+
|
|
57
|
+
Command definitions are the source for help and `twenty commands`. Keep handlers
|
|
58
|
+
lazy so discovery does not load compiler or app code. Put a workflow's rules in
|
|
59
|
+
its owning module; a command handler should connect parsed input, that module
|
|
60
|
+
and output. Preserve meaningful behavior tests when moving implementation files.
|
|
61
|
+
|
|
62
|
+
## Application tooling guarantees
|
|
63
|
+
|
|
64
|
+
The [application module documentation](src/app/README.md) describes each stage.
|
|
65
|
+
Changes must preserve these contracts:
|
|
66
|
+
|
|
67
|
+
- App definitions execute as trusted code in a disposable worker. The worker
|
|
68
|
+
contains process exits, filters CLI credentials and captures bounded output;
|
|
69
|
+
it is not a filesystem or network sandbox. Executable configs stay in the
|
|
70
|
+
worker, and only serializable requests and results cross IPC.
|
|
71
|
+
- A build's immutable snapshot stays alive until its consumers finish. Uploads
|
|
72
|
+
verify containment, size and checksums. Failed or cancelled work must release
|
|
73
|
+
the snapshots it owns without removing another build's files.
|
|
74
|
+
- Apply reports which remote phases completed and whether the outcome is known.
|
|
75
|
+
Do not retry writes or claim rollback when the server's result is unknown.
|
|
76
|
+
Each apply uses a fresh plan; approval does not carry across dev revisions.
|
|
77
|
+
- Pull stages source writes and its target-bound baseline together. Ordinary
|
|
78
|
+
failures restore originals; interrupted workers and failed rollback report
|
|
79
|
+
uncertainty and retain recovery information. Unsupported definitions remain
|
|
80
|
+
visible in coverage reports.
|
|
81
|
+
- JSON emits one result envelope. Streaming commands honor backpressure, bound
|
|
82
|
+
buffering and emit a terminal result or error. Cancellation exits 130 unless
|
|
83
|
+
the operation has already acknowledged its completed result.
|
|
84
|
+
|
|
85
|
+
## Packaging
|
|
86
|
+
|
|
87
|
+
Vite builds the CLI, its worker and lazy chunks into `dist`. It also copies the
|
|
88
|
+
CLI-owned `app-template` there. Chokidar,
|
|
89
|
+
esbuild, tinyglobby and the CLI's TypeScript parser are runtime dependencies;
|
|
90
|
+
other imported libraries are bundled. The parser is separate from the app's
|
|
91
|
+
compiler used for typechecking.
|
|
92
|
+
|
|
93
|
+
The archive includes the command reference, contributor guide and application
|
|
94
|
+
module READMEs so their relative links also work outside a repository checkout.
|
|
95
|
+
It does not include the CLI's TypeScript implementation or tests.
|
|
96
|
+
|
|
97
|
+
For packaging changes, run the build and installation checks:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
yarn nx run twenty-cli:test:package
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
This runs the binary declared in the workspace's `package.json` directly, packs
|
|
104
|
+
the CLI, and installs the archive with only its production dependencies in a
|
|
105
|
+
temporary directory outside the monorepo. It checks help, offline doctor, app initialization including the
|
|
106
|
+
integration-test harness, and a compiler diagnostic from the installed worker. npm
|
|
107
|
+
registry access is required for installation; the commands do not contact a
|
|
108
|
+
Twenty workspace. Temporary files are removed afterward, and nothing is
|
|
109
|
+
published. CI runs the same target for CLI and dependency changes.
|
|
110
|
+
|
|
111
|
+
## Releases
|
|
112
|
+
|
|
113
|
+
Publish the CLI when its changes warrant a release. A server release does not
|
|
114
|
+
require a CLI release; skip versions when the CLI has no changes worth shipping.
|
|
115
|
+
When publishing, aim to align the CLI version with the corresponding Twenty
|
|
116
|
+
server, SDK and UI version.
|
|
117
|
+
|
|
118
|
+
Publishing is independent through the `cli/` tag family: `cli/v2.46.0` publishes
|
|
119
|
+
only `twenty@2.46.0`. The tag version must match
|
|
120
|
+
`packages/twenty-cli/package.json`. Bumping the package version alone does not
|
|
121
|
+
publish the CLI.
|
|
122
|
+
|
|
123
|
+
`app init` pins `twenty-client-sdk`, `twenty-sdk` and `twenty-ui` to the
|
|
124
|
+
`twenty-sdk` version of the commit the CLI was built from. `main` moves
|
|
125
|
+
to the next, unpublished SDK version right after each SDK release:
|
|
126
|
+
|
|
127
|
+
1. Start from the matching `sdk/vA.B.C` release commit. If a CLI version bump
|
|
128
|
+
is still needed, make it on a branch from that commit.
|
|
129
|
+
2. Once the SDK, client SDK and UI packages at `A.B.C` are on npm, tag the
|
|
130
|
+
prepared commit `cli/vA.B.C`.
|
|
131
|
+
3. Run the `Publish npm packages` workflow in `twenty-infra` with that tag as
|
|
132
|
+
its `ref`. Creating the tag alone does not publish the package.
|
|
133
|
+
|
|
134
|
+
`yarn npm publish` first runs `scripts/check-publish.mjs`, which needs a fresh
|
|
135
|
+
build and npm registry access. It fails when the executable, worker, lazy chunks
|
|
136
|
+
or templates are missing, when `dist` was built for another version, when one of
|
|
137
|
+
its CLI runs fails or times out, or when `app init` would pin versions that are
|
|
138
|
+
not on npm. An unreachable registry is reported separately from a missing
|
|
139
|
+
version. The check does not read tags: it confirms that the pinned versions are
|
|
140
|
+
published. Selecting the matching SDK release remains a release step.
|
|
141
|
+
|
|
142
|
+
`prepublish` then runs `scripts/generate-template-lock.mjs`. It resolves the app
|
|
143
|
+
template's dependencies with the repository's Yarn against the public registry,
|
|
144
|
+
under a 3-day minimum release age that exempts the pinned Twenty packages, and
|
|
145
|
+
writes `dist/app-template/yarn.lock`. Apps created with `app init` then install
|
|
146
|
+
exact, integrity-checked versions, including for people who enforce a minimum
|
|
147
|
+
release age. The lockfile keeps the template's placeholder name, and the first
|
|
148
|
+
`yarn install` renames that root entry.
|
|
149
|
+
|
|
150
|
+
The tests of both scripts run with `twenty-cli:test:package`. To run the scripts
|
|
151
|
+
before tagging:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
yarn nx build twenty-cli
|
|
155
|
+
node packages/twenty-cli/scripts/check-publish.mjs
|
|
156
|
+
node packages/twenty-cli/scripts/generate-template-lock.mjs
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## App integration tests
|
|
160
|
+
|
|
161
|
+
`app-template/src/__tests__` supplies the integration-test setup for CLI-created apps.
|
|
162
|
+
It deploys the app before tests and uninstalls it afterward by invoking the
|
|
163
|
+
installed CLI with `--json`. Apps invoke the executable rather than import the
|
|
164
|
+
CLI as a library or add it as a dependency. See the
|
|
165
|
+
[template contract](docs/commands.md#create-an-app) for executable selection and
|
|
166
|
+
the [compiler requirements](src/app/typecheck/README.md) for project setup.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-present Twenty.com, PBC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,82 +1,89 @@
|
|
|
1
|
-
# Twenty
|
|
1
|
+
# Twenty CLI
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Work with [Twenty](https://twenty.com) from your terminal: connect to workspaces,
|
|
4
|
+
inspect metadata and records, send API requests, and develop applications.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
## Install
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Installation
|
|
11
|
-
Twenty can be installed as a project dependency or global CLI tool:
|
|
8
|
+
The CLI needs Node.js 24.5 or later.
|
|
12
9
|
|
|
13
10
|
```bash
|
|
14
|
-
|
|
11
|
+
npm install -g twenty
|
|
12
|
+
twenty --version
|
|
15
13
|
```
|
|
16
14
|
|
|
17
|
-
##
|
|
18
|
-
There are two ways to use this package: through the command line or by within your code.
|
|
15
|
+
## Get started
|
|
19
16
|
|
|
20
|
-
### Command Line
|
|
21
17
|
```bash
|
|
22
|
-
|
|
18
|
+
twenty doctor --offline
|
|
19
|
+
twenty auth login --url https://acme.twenty.com --use
|
|
20
|
+
twenty metadata object list
|
|
21
|
+
twenty data list companies --limit 5
|
|
22
|
+
twenty open
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Replace the example URL with your workspace's address. `--use` makes this
|
|
26
|
+
connection the default, even when another saved connection already is one. Use
|
|
27
|
+
`--remote <name>` to select another saved connection and `--json` for a
|
|
28
|
+
structured result. Saved connections live in `~/.twenty/config.json`.
|
|
26
29
|
|
|
27
|
-
|
|
30
|
+
Browser sign-in is supported on Twenty 2.42 and later. On older servers, sign in
|
|
31
|
+
with an [API key](docs/commands.md#connections-and-authentication) instead.
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
$ twenty stackabuse.com -j
|
|
31
|
-
{
|
|
32
|
-
"ip": "54.173.122.231",
|
|
33
|
-
"hostname": "ec2-54-173-122-231.compute-1.amazonaws.com",
|
|
34
|
-
"city": "Ashburn",
|
|
35
|
-
"region": "Virginia",
|
|
36
|
-
"country": "US",
|
|
37
|
-
"loc": "39.0437,-77.4875",
|
|
38
|
-
"org": "AS14618 Amazon.com, Inc.",
|
|
39
|
-
"postal": "20147"
|
|
40
|
-
}
|
|
41
|
-
```
|
|
33
|
+
## Develop an application
|
|
42
34
|
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
App projects pin Yarn 4 in `packageManager`. Run `corepack enable` once so
|
|
36
|
+
`yarn` uses that version; if `corepack` is missing, install it with
|
|
37
|
+
`npm install -g corepack`. These steps use the default connection;
|
|
38
|
+
`twenty auth status` shows which one that is:
|
|
45
39
|
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
```bash
|
|
41
|
+
twenty app init my-app
|
|
42
|
+
cd my-app
|
|
43
|
+
yarn install
|
|
44
|
+
twenty app build
|
|
45
|
+
twenty app apply --create
|
|
46
|
+
twenty app dev
|
|
47
|
+
```
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
`app init` writes files without installing dependencies. `app build` checks the
|
|
50
|
+
project locally. `app apply --create` registers and installs a new development
|
|
51
|
+
app, uploads its build and synchronizes its metadata. Once registered, inspect
|
|
52
|
+
changes with `twenty app plan` before applying them. `app dev` watches inputs and
|
|
53
|
+
syncs successful builds.
|
|
50
54
|
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
Missing definitions imply remote deletions by default. Pass `--no-delete` to
|
|
56
|
+
preserve them. Object and field deletions require confirmation because they
|
|
57
|
+
also delete stored data. Pull can overwrite local edits; read its
|
|
58
|
+
[reconciliation rules](docs/commands.md#pull-an-app) before using it.
|
|
53
59
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
Apps created with `app init` declare the oldest Twenty version they support in
|
|
61
|
+
`engines.twenty`. `app exec` runs functions as the signed-in user, so it needs a
|
|
62
|
+
browser sign-in and Twenty 2.46 or later. With a browser sign-in, `app uninstall`
|
|
63
|
+
also needs Twenty 2.46 or later; on earlier versions, use an API key for it.
|
|
57
64
|
|
|
58
|
-
|
|
59
|
-
console.log('Distance between Google\'s DNS and stackabuse.com server (km):', distance);
|
|
60
|
-
});
|
|
61
|
-
```
|
|
65
|
+
## CLI and app dependencies
|
|
62
66
|
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
The CLI is installed globally, separately from each app. Apps keep `twenty-sdk`
|
|
68
|
+
as a development dependency for authoring and build-time APIs, `typescript` for
|
|
69
|
+
checks, and `twenty-client-sdk` when they use a generated API client. Neither
|
|
70
|
+
apps nor SDK packages need `twenty` in their dependencies or devDependencies. In
|
|
71
|
+
CI, install a pinned version with `npm install -g twenty@<version>`.
|
|
65
72
|
|
|
66
|
-
|
|
67
|
-
|
|
73
|
+
The CLI owns builds and filesystem operations. It uses the app's installed
|
|
74
|
+
SDK authoring exports and TypeScript compiler. Configuration and project-reference
|
|
75
|
+
errors fail builds. See [build requirements](docs/commands.md#build-and-check-an-app)
|
|
76
|
+
for supported SDK exports and compiler configuration.
|
|
68
77
|
|
|
69
|
-
##
|
|
70
|
-
Copyright (c) 2016 Scott Robinson
|
|
78
|
+
## Documentation
|
|
71
79
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
furnished to do so, subject to the following conditions:
|
|
80
|
+
- [Command reference](docs/commands.md), authentication, flags, output, permissions
|
|
81
|
+
and recovery for each workflow.
|
|
82
|
+
- [Contributing](CONTRIBUTING.md), building from source, package structure, tests
|
|
83
|
+
and releases.
|
|
84
|
+
- [Application tooling](src/app/README.md), module responsibilities and invariants.
|
|
78
85
|
|
|
79
|
-
|
|
80
|
-
|
|
86
|
+
Run `twenty commands` for the command inventory or `twenty <command> --help` for
|
|
87
|
+
its arguments and options.
|
|
81
88
|
|
|
82
|
-
|
|
89
|
+
Generated next-step commands use PowerShell on Windows and POSIX shell syntax on macOS/Linux.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
24.5.0
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
+
"plugins": ["typescript"],
|
|
4
|
+
"categories": {
|
|
5
|
+
"correctness": "off"
|
|
6
|
+
},
|
|
7
|
+
"ignorePatterns": ["node_modules", "dist"],
|
|
8
|
+
"rules": {
|
|
9
|
+
"no-unused-vars": "off",
|
|
10
|
+
|
|
11
|
+
"typescript/no-unused-vars": [
|
|
12
|
+
"warn",
|
|
13
|
+
{
|
|
14
|
+
"argsIgnorePattern": "^_"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"typescript/no-explicit-any": "off"
|
|
18
|
+
},
|
|
19
|
+
"overrides": [
|
|
20
|
+
{
|
|
21
|
+
"files": ["**/*.logic-function.ts", "**/logic-functions/**/*.ts"],
|
|
22
|
+
"rules": {
|
|
23
|
+
"no-restricted-imports": [
|
|
24
|
+
"error",
|
|
25
|
+
{
|
|
26
|
+
"patterns": [
|
|
27
|
+
{
|
|
28
|
+
"group": ["twenty-shared", "twenty-shared/*"],
|
|
29
|
+
"message": "Logic functions must not import from twenty-shared directly. Import runtime types and helpers from `twenty-sdk/logic-function` instead so the logic-function bundle stays minimal."
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
## Base documentation
|
|
2
|
+
|
|
3
|
+
- Getting started:
|
|
4
|
+
- https://docs.twenty.com/developers/extend/apps/getting-started/quick-start.md
|
|
5
|
+
- https://docs.twenty.com/developers/extend/apps/getting-started/concepts.md
|
|
6
|
+
- https://docs.twenty.com/developers/extend/apps/getting-started/project-structure.md
|
|
7
|
+
- https://docs.twenty.com/developers/extend/apps/getting-started/local-server.md
|
|
8
|
+
- https://docs.twenty.com/developers/extend/apps/getting-started/scaffolding.md
|
|
9
|
+
- https://docs.twenty.com/developers/extend/apps/getting-started/troubleshooting.md
|
|
10
|
+
- Config:
|
|
11
|
+
- https://docs.twenty.com/developers/extend/apps/config/overview.md
|
|
12
|
+
- https://docs.twenty.com/developers/extend/apps/config/application.md
|
|
13
|
+
- https://docs.twenty.com/developers/extend/apps/config/roles.md
|
|
14
|
+
- https://docs.twenty.com/developers/extend/apps/config/install-hooks.md
|
|
15
|
+
- https://docs.twenty.com/developers/extend/apps/config/public-assets.md
|
|
16
|
+
- Data:
|
|
17
|
+
- https://docs.twenty.com/developers/extend/apps/data/overview.md
|
|
18
|
+
- https://docs.twenty.com/developers/extend/apps/data/objects.md
|
|
19
|
+
- https://docs.twenty.com/developers/extend/apps/data/extending-objects.md
|
|
20
|
+
- https://docs.twenty.com/developers/extend/apps/data/relations.md
|
|
21
|
+
- Logic:
|
|
22
|
+
- https://docs.twenty.com/developers/extend/apps/logic/overview.md
|
|
23
|
+
- https://docs.twenty.com/developers/extend/apps/logic/logic-functions.md
|
|
24
|
+
- https://docs.twenty.com/developers/extend/apps/logic/skills-and-agents.md
|
|
25
|
+
- https://docs.twenty.com/developers/extend/apps/logic/connections.md
|
|
26
|
+
- Layout:
|
|
27
|
+
- https://docs.twenty.com/developers/extend/apps/layout/overview.md
|
|
28
|
+
- https://docs.twenty.com/developers/extend/apps/layout/views.md
|
|
29
|
+
- https://docs.twenty.com/developers/extend/apps/layout/navigation-menu-items.md
|
|
30
|
+
- https://docs.twenty.com/developers/extend/apps/layout/page-layouts.md
|
|
31
|
+
- https://docs.twenty.com/developers/extend/apps/layout/front-components.md
|
|
32
|
+
- https://docs.twenty.com/developers/extend/apps/layout/command-menu-items.md
|
|
33
|
+
- Operations:
|
|
34
|
+
- https://docs.twenty.com/developers/extend/apps/operations/overview.md
|
|
35
|
+
- https://docs.twenty.com/developers/extend/apps/operations/cli.md
|
|
36
|
+
- https://docs.twenty.com/developers/extend/apps/operations/testing.md
|
|
37
|
+
- https://docs.twenty.com/developers/extend/apps/operations/publishing.md
|
|
38
|
+
- Rich app example: https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/examples/postcard
|
|
39
|
+
|
|
40
|
+
## UUID requirement
|
|
41
|
+
|
|
42
|
+
- All generated UUIDs must be valid UUID v4.
|
|
43
|
+
|
|
44
|
+
## Common Pitfalls
|
|
45
|
+
|
|
46
|
+
- Creating a view without a navigationMenuItem associated. This will make the view available on the left sidebar.
|
|
47
|
+
- Creating a front-end component that has a scroll instead of being responsive to its fixed widget height and width, unless it is specifically meant to be used in a canvas tab.
|
|
48
|
+
|
|
49
|
+
## Best practice
|
|
50
|
+
|
|
51
|
+
It's highly recommended to create new app entities using `yarn twenty dev:add`. These are the options:
|
|
52
|
+
|
|
53
|
+
| Entity type | Command | Generated file |
|
|
54
|
+
| -------------------- | ---------------------------------------- | ------------------------------------- |
|
|
55
|
+
| Object | `yarn twenty dev:add object` | `src/objects/<name>.ts` |
|
|
56
|
+
| Field | `yarn twenty dev:add field` | `src/fields/<name>.ts` |
|
|
57
|
+
| Logic function | `yarn twenty dev:add logicFunction` | `src/logic-functions/<name>.ts` |
|
|
58
|
+
| Front component | `yarn twenty dev:add frontComponent` | `src/front-components/<name>.tsx` |
|
|
59
|
+
| Role | `yarn twenty dev:add role` | `src/roles/<name>.ts` |
|
|
60
|
+
| Skill | `yarn twenty dev:add skill` | `src/skills/<name>.ts` |
|
|
61
|
+
| Agent | `yarn twenty dev:add agent` | `src/agents/<name>.ts` |
|
|
62
|
+
| View | `yarn twenty dev:add view` | `src/views/<name>.ts` |
|
|
63
|
+
| Navigation menu item | `yarn twenty dev:add navigationMenuItem` | `src/navigation-menu-items/<name>.ts` |
|
|
64
|
+
| Page layout | `yarn twenty dev:add pageLayout` | `src/page-layouts/<name>.ts` |
|
|
65
|
+
| Page layout tab | `yarn twenty dev:add pageLayoutTab` | `src/page-layout-tabs/<name>.ts` |
|
|
66
|
+
| Command menu item | `yarn twenty dev:add commandMenuItem` | `src/command-menu-items/<name>.ts` |
|
|
67
|
+
| View field | `yarn twenty dev:add viewField` | `src/view-fields/<name>.ts` |
|
|
68
|
+
| Connection provider | `yarn twenty dev:add connectionProvider` | `src/connection-providers/<name>.ts` |
|
|
69
|
+
|
|
70
|
+
This helps automatically generate required IDs etc.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# My Twenty App
|
|
2
|
+
|
|
3
|
+
Describe your app in one or two sentences.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
List the top things your app does, for example:
|
|
8
|
+
|
|
9
|
+
- Feature one
|
|
10
|
+
- Feature two
|
|
11
|
+
- Feature three
|
|
12
|
+
|
|
13
|
+
## Getting started
|
|
14
|
+
|
|
15
|
+
Setup instructions live in [SETUP.md](SETUP.md).
|
|
16
|
+
|
|
17
|
+
## Publishing
|
|
18
|
+
|
|
19
|
+
The `Publish` workflow (`.github/workflows/publish.yml`) publishes the app to npm with provenance using [npm trusted publishing](https://docs.npmjs.com/trusted-publishers). To publish:
|
|
20
|
+
|
|
21
|
+
1. On npmjs.com register this repository as a trusted publisher of your package, pointing at the `publish.yml` workflow.
|
|
22
|
+
2. Bump the version in `package.json`, then push a version tag (e.g. `git tag v1.0.0 && git push --tags`) or run the workflow manually from the Actions tab.
|
|
23
|
+
|
|
24
|
+
Publishing with provenance is also how you prove ownership when claiming your app in a Twenty marketplace.
|
|
25
|
+
|
|
26
|
+
## Changelog
|
|
27
|
+
|
|
28
|
+
Notable changes are documented in [CHANGELOG.md](CHANGELOG.md).
|
|
29
|
+
|
|
30
|
+
## Learn more
|
|
31
|
+
|
|
32
|
+
- [Twenty Apps documentation](https://docs.twenty.com/developers/extend/apps/getting-started/quick-start)
|
|
33
|
+
- [twenty-sdk CLI reference](https://www.npmjs.com/package/twenty-sdk)
|
|
34
|
+
- [Discord](https://discord.gg/cx5n4Jzs57)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Setup
|
|
2
|
+
|
|
3
|
+
Follow these steps to get your app running locally.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- Node.js (version specified in `.nvmrc`)
|
|
8
|
+
- Yarn 4
|
|
9
|
+
- Docker (to run the local Twenty server)
|
|
10
|
+
|
|
11
|
+
## Steps
|
|
12
|
+
|
|
13
|
+
1. Install dependencies:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
yarn install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The committed `yarn.lock` pins exact, integrity-checked versions, so this
|
|
20
|
+
resolves nothing from the registry.
|
|
21
|
+
|
|
22
|
+
2. Start the local Twenty server:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
yarn twenty docker:start
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Check the server status at any time with `yarn twenty docker:status`.
|
|
29
|
+
|
|
30
|
+
3. Start the development server and sync your app:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
yarn twenty dev
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
4. Open [http://localhost:2020](http://localhost:2020) and log in with the default development credentials: `tim@apple.dev` / `tim@apple.dev`.
|
|
37
|
+
|
|
38
|
+
## Verifying your setup
|
|
39
|
+
|
|
40
|
+
- `yarn lint` - Lint the project with oxlint
|
|
41
|
+
- `yarn typecheck` - Type-check the project
|
|
42
|
+
- `yarn test:unit` - Run unit tests
|
|
43
|
+
- `yarn test` - Run integration tests
|
|
44
|
+
|
|
45
|
+
## Troubleshooting
|
|
46
|
+
|
|
47
|
+
See the [troubleshooting guide](https://docs.twenty.com/developers/extend/apps/getting-started/troubleshooting) or ask on [Discord](https://discord.gg/cx5n4Jzs57).
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: CD
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
types: [labeled]
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
env:
|
|
14
|
+
TWENTY_DEPLOY_URL: http://localhost:2020
|
|
15
|
+
|
|
16
|
+
concurrency:
|
|
17
|
+
group: cd-${{ github.ref }}
|
|
18
|
+
cancel-in-progress: true
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
deploy-and-install:
|
|
22
|
+
if: >-
|
|
23
|
+
github.event_name == 'push' ||
|
|
24
|
+
(github.event_name == 'pull_request' && github.event.label.name == 'deploy')
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
steps:
|
|
27
|
+
- name: Checkout
|
|
28
|
+
uses: actions/checkout@v4
|
|
29
|
+
with:
|
|
30
|
+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
31
|
+
|
|
32
|
+
- name: Deploy
|
|
33
|
+
uses: twentyhq/twenty/.github/actions/deploy-twenty-app@main
|
|
34
|
+
with:
|
|
35
|
+
api-url: ${{ env.TWENTY_DEPLOY_URL }}
|
|
36
|
+
api-key: ${{ secrets.TWENTY_DEPLOY_API_KEY }}
|
|
37
|
+
|
|
38
|
+
- name: Install
|
|
39
|
+
uses: twentyhq/twenty/.github/actions/install-twenty-app@main
|
|
40
|
+
with:
|
|
41
|
+
api-url: ${{ env.TWENTY_DEPLOY_URL }}
|
|
42
|
+
api-key: ${{ secrets.TWENTY_DEPLOY_API_KEY }}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request: {}
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
env:
|
|
13
|
+
TWENTY_VERSION: latest
|
|
14
|
+
|
|
15
|
+
concurrency:
|
|
16
|
+
group: ci-${{ github.ref }}
|
|
17
|
+
cancel-in-progress: true
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
test:
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
steps:
|
|
23
|
+
- name: Checkout
|
|
24
|
+
uses: actions/checkout@v4
|
|
25
|
+
|
|
26
|
+
- name: Spawn Twenty test instance
|
|
27
|
+
id: twenty
|
|
28
|
+
uses: twentyhq/twenty/.github/actions/spawn-twenty-app-dev-test@main
|
|
29
|
+
with:
|
|
30
|
+
twenty-version: ${{ env.TWENTY_VERSION }}
|
|
31
|
+
|
|
32
|
+
- name: Enable Corepack
|
|
33
|
+
run: corepack enable
|
|
34
|
+
|
|
35
|
+
- name: Setup Node.js
|
|
36
|
+
uses: actions/setup-node@v4
|
|
37
|
+
with:
|
|
38
|
+
node-version-file: '.nvmrc'
|
|
39
|
+
cache: yarn
|
|
40
|
+
|
|
41
|
+
- name: Install Twenty CLI
|
|
42
|
+
run: npm install -g twenty@CLI-VERSION-TO-BE-GENERATED
|
|
43
|
+
|
|
44
|
+
- name: Install dependencies
|
|
45
|
+
run: yarn install --immutable
|
|
46
|
+
|
|
47
|
+
- name: Lint
|
|
48
|
+
run: yarn lint
|
|
49
|
+
|
|
50
|
+
- name: Typecheck
|
|
51
|
+
run: yarn typecheck
|
|
52
|
+
|
|
53
|
+
- name: Unit tests
|
|
54
|
+
run: yarn test:unit
|
|
55
|
+
|
|
56
|
+
- name: Run integration tests
|
|
57
|
+
run: yarn test
|
|
58
|
+
env:
|
|
59
|
+
TWENTY_API_URL: ${{ steps.twenty.outputs.server-url }}
|
|
60
|
+
TWENTY_API_KEY: ${{ steps.twenty.outputs.api-key }}
|