mirror of
https://github.com/twentyhq/twenty
synced 2026-04-21 13:37:22 +00:00
## Summary
### Externalize `twenty-client-sdk` from `twenty-sdk`
Previously, `twenty-client-sdk` was listed as a `devDependency` of
`twenty-sdk`, which caused Vite to bundle it inline into the dist
output. This meant end-user apps had two copies of `twenty-client-sdk`:
one hidden inside `twenty-sdk`'s bundle, and one installed explicitly in
their `node_modules`. These copies could drift apart since they weren't
guaranteed to be the same version.
**Change:** Moved `twenty-client-sdk` from `devDependencies` to
`dependencies` in `twenty-sdk/package.json`. Vite's `external` function
now recognizes it and keeps it as an external `require`/`import` in the
dist output. End users get a single deduplicated copy resolved by their
package manager.
### Externalize `twenty-sdk` from `create-twenty-app`
Similarly, `create-twenty-app` had `twenty-sdk` as a `devDependency`
(bundled inline). After refactoring `create-twenty-app` to
programmatically import operations from `twenty-sdk` (instead of
shelling out via `execSync`), it became a proper runtime dependency.
**Change:** Moved `twenty-sdk` from `devDependencies` to `dependencies`
in `create-twenty-app/package.json`.
### Switch E2E CI to `yarn npm publish`
The `workspace:*` protocol in `dependencies` is a Yarn-specific feature.
`npm publish` publishes it as-is (which breaks for consumers), while
`yarn npm publish` automatically replaces `workspace:*` with the
resolved version at publish time (e.g., `workspace:*` becomes `=1.2.3`).
**Change:** Replaced `npm publish` with `yarn npm publish` in
`.github/workflows/ci-create-app-e2e.yaml`.
### Replace `execSync` with programmatic SDK calls in
`create-twenty-app`
`create-twenty-app` was shelling out to `yarn twenty remote add` and
`yarn twenty server start` via `execSync`, which assumed the `twenty`
binary was already installed in the scaffolded app. This was fragile and
created an implicit circular dependency.
**Changes:**
- Replaced `execSync('yarn twenty remote add ...')` with a direct call
to `authLoginOAuth()` from `twenty-sdk/cli`
- Replaced `execSync('yarn twenty server start')` with a direct call to
`serverStart()` from `twenty-sdk/cli`
- Deleted the duplicated `setup-local-instance.ts` from
`create-twenty-app`
### Centralize `serverStart` as a dedicated operation
The Docker server start logic was previously inline in the `server
start` CLI command handler (`server.ts`), and `setup-local-instance.ts`
was shelling out to `yarn twenty server start` to invoke it -- meaning
`twenty-sdk` was calling itself via a child process.
**Changes:**
- Extracted the Docker container management logic into a new
`serverStart` operation (`cli/operations/server-start.ts`)
- Merged the detect-or-start flow from `setup-local-instance.ts` into
`serverStart` (detect across multiple ports, start Docker if needed,
poll for health)
- Deleted `setup-local-instance.ts` from `twenty-sdk`
- Added `onProgress` callback (consistent with other operations like
`appBuild`) instead of direct `console.log` calls
- Both the `server start` CLI command and `create-twenty-app` now call
`serverStart()` programmatically
related to https://github.com/twentyhq/twenty-infra/pull/525
62 lines
2.2 KiB
Markdown
62 lines
2.2 KiB
Markdown
This is a [Twenty](https://twenty.com) application project bootstrapped with [`create-twenty-app`](https://www.npmjs.com/package/create-twenty-app).
|
|
|
|
## Getting Started
|
|
|
|
First, authenticate to your workspace:
|
|
|
|
```bash
|
|
yarn twenty remote add http://localhost:2020 --as local
|
|
```
|
|
|
|
Then, start development mode to sync your app and watch for changes:
|
|
|
|
```bash
|
|
yarn twenty dev
|
|
```
|
|
|
|
Open your Twenty instance and go to `/settings/applications` section to see the result.
|
|
|
|
## Available Commands
|
|
|
|
Run `yarn twenty help` to list all available commands. Common commands:
|
|
|
|
```bash
|
|
# Remotes & Authentication
|
|
yarn twenty remote add http://localhost:2020 --as local # Authenticate with Twenty
|
|
yarn twenty remote status # Check auth status
|
|
yarn twenty remote switch # Switch default remote
|
|
yarn twenty remote list # List all configured remotes
|
|
yarn twenty remote remove <name> # Remove a remote
|
|
|
|
# Application
|
|
yarn twenty dev # Start dev mode (watch, build, sync, and auto-generate typed client)
|
|
yarn twenty add # Add a new entity (object, field, function, front-component, role, view, navigation-menu-item)
|
|
yarn twenty logs # Stream function logs
|
|
yarn twenty exec # Execute a function with JSON payload
|
|
yarn twenty uninstall # Uninstall app from workspace
|
|
```
|
|
|
|
## Integration Tests
|
|
|
|
If your project includes the example integration test (`src/__tests__/app-install.integration-test.ts`), you can run it with:
|
|
|
|
```bash
|
|
# Make sure a Twenty server is running at http://localhost:3000
|
|
yarn test
|
|
```
|
|
|
|
The test builds and installs the app, then verifies it appears in the applications list. Test configuration (API URL and API key) is defined in `vitest.config.ts`.
|
|
|
|
## LLMs instructions
|
|
|
|
Main docs and pitfalls are available in LLMS.md file.
|
|
|
|
## Learn More
|
|
|
|
To learn more about Twenty applications, take a look at the following resources:
|
|
|
|
- [twenty-sdk](https://www.npmjs.com/package/twenty-sdk) - learn about `twenty-sdk` tool.
|
|
- [Twenty doc](https://docs.twenty.com/) - Twenty's documentation.
|
|
- Join our [Discord](https://discord.gg/cx5n4Jzs57)
|
|
|
|
You can check out [the Twenty GitHub repository](https://github.com/twentyhq/twenty) - your feedback and contributions are welcome!
|