052aecccc7
## 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
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
// Auth
|
|
export { authLogin } from './login';
|
|
export type { AuthLoginOptions } from './login';
|
|
export { authLoginOAuth } from './login-oauth';
|
|
export type { AuthLoginOAuthOptions } from './login-oauth';
|
|
export { authLogout } from './logout';
|
|
export type { AuthLogoutOptions } from './logout';
|
|
|
|
// App
|
|
export { appBuild } from './build';
|
|
export type { AppBuildOptions, AppBuildResult } from './build';
|
|
export { appDeploy } from './deploy';
|
|
export type { AppDeployOptions, AppDeployResult } from './deploy';
|
|
export { appInstall } from './install';
|
|
export type { AppInstallOptions } from './install';
|
|
export { appPublish } from './publish';
|
|
export type { AppPublishOptions, AppPublishResult } from './publish';
|
|
export { appUninstall } from './uninstall';
|
|
export type { AppUninstallOptions } from './uninstall';
|
|
|
|
// Functions
|
|
export { functionExecute } from './execute';
|
|
export type { FunctionExecuteOptions } from './execute';
|
|
|
|
// Server
|
|
export { serverStart } from './server-start';
|
|
export type { ServerStartOptions, ServerStartResult } from './server-start';
|
|
|
|
// Shared types and error codes
|
|
export {
|
|
APP_ERROR_CODES,
|
|
AUTH_ERROR_CODES,
|
|
FUNCTION_ERROR_CODES,
|
|
SERVER_ERROR_CODES,
|
|
} from '@/cli/types';
|
|
export type {
|
|
AuthListRemote,
|
|
AuthStatusResult,
|
|
CommandError,
|
|
CommandResult,
|
|
FunctionExecutionResult,
|
|
TypecheckResult,
|
|
} from '@/cli/types';
|