create-twenty-app 2.6.0 → 2.7.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/README.md +3 -3
- package/dist/cli.cjs +7 -7
- package/dist/cli.mjs +13 -23
- package/dist/constants/template/AGENTS.md +13 -13
- package/dist/constants/template/README.md +2 -2
- package/dist/constants/template/src/__tests__/global-setup.ts +1 -1
- package/dist/create-app.command.d.ts +1 -1
- package/package.json +2 -2
- package/src/constants/template/README.md +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import p9 from "lodash.kebabcase";
|
|
|
11
11
|
import { execSync as m9, spawn as Hu } from "node:child_process";
|
|
12
12
|
import { DEV_API_URL as Gf, checkDockerRunning as Wf, serverStart as g9, ConfigService as dr, authLogin as v9, DEV_API_KEY as $9, authLoginOAuth as _9 } from "twenty-sdk/cli";
|
|
13
13
|
import "lodash.camelcase";
|
|
14
|
-
const y9 = "create-twenty-app", b9 = "2.
|
|
14
|
+
const y9 = "create-twenty-app", b9 = "2.7.0", Wo = {
|
|
15
15
|
name: y9,
|
|
16
16
|
version: b9
|
|
17
17
|
}, S9 = "src", w9 = async ({
|
|
@@ -18681,7 +18681,7 @@ const mp = {
|
|
|
18681
18681
|
" Then run this command again.",
|
|
18682
18682
|
"",
|
|
18683
18683
|
" Alternatively, connect to an existing Twenty instance:",
|
|
18684
|
-
" npx create-twenty-app@latest my-twenty-app --
|
|
18684
|
+
" npx create-twenty-app@latest my-twenty-app --url <your-instance-url>"
|
|
18685
18685
|
].join(`
|
|
18686
18686
|
`), gp = process.env.INIT_CWD || process.cwd(), ck = "twentycrm/twenty-app-dev:latest";
|
|
18687
18687
|
class dk {
|
|
@@ -18689,7 +18689,7 @@ class dk {
|
|
|
18689
18689
|
this.stepCounter = 0, this.totalSteps = 0;
|
|
18690
18690
|
}
|
|
18691
18691
|
async execute(n = {}) {
|
|
18692
|
-
const { appName: i, appDisplayName: u, appDirectory: t, appDescription: a } = this.getAppInfos(n), l = n.
|
|
18692
|
+
const { appName: i, appDisplayName: u, appDirectory: t, appDescription: a } = this.getAppInfos(n), l = n.serverUrl ?? Gf, p = l !== Gf;
|
|
18693
18693
|
!p && !sk() && (console.log(me.yellow(`
|
|
18694
18694
|
` + lk() + `
|
|
18695
18695
|
`)), process.exit(1)), p && n.authenticationMethod === "apiKey" && console.log(
|
|
@@ -18931,13 +18931,13 @@ Creating Twenty Application
|
|
|
18931
18931
|
remote: "local"
|
|
18932
18932
|
})).success ? (await new dr().setDefaultRemote("local"), this.logDetail("Authenticated as tim@apple.dev (development API key)"), !0) : (console.log(
|
|
18933
18933
|
me.yellow(
|
|
18934
|
-
" Authentication failed. Run `yarn twenty remote
|
|
18934
|
+
" Authentication failed. Run `yarn twenty remote:add --local` manually."
|
|
18935
18935
|
)
|
|
18936
18936
|
), !1);
|
|
18937
18937
|
} catch {
|
|
18938
18938
|
return console.log(
|
|
18939
18939
|
me.yellow(
|
|
18940
|
-
" Authentication failed. Run `yarn twenty remote
|
|
18940
|
+
" Authentication failed. Run `yarn twenty remote:add --local` manually."
|
|
18941
18941
|
)
|
|
18942
18942
|
), !1;
|
|
18943
18943
|
}
|
|
@@ -18957,13 +18957,13 @@ Creating Twenty Application
|
|
|
18957
18957
|
return u.success ? (await new dr().setDefaultRemote(i), this.logDetail(`Authenticated via OAuth to ${n}`), !0) : (console.log(
|
|
18958
18958
|
me.yellow(
|
|
18959
18959
|
` OAuth failed: ${u.error.message}
|
|
18960
|
-
Run \`yarn twenty remote
|
|
18960
|
+
Run \`yarn twenty remote:add --url ${n}\` manually.`
|
|
18961
18961
|
)
|
|
18962
18962
|
), !1);
|
|
18963
18963
|
} catch {
|
|
18964
18964
|
return console.log(
|
|
18965
18965
|
me.yellow(
|
|
18966
|
-
` Authentication failed. Run \`yarn twenty remote
|
|
18966
|
+
` Authentication failed. Run \`yarn twenty remote:add --url ${n}\` manually.`
|
|
18967
18967
|
)
|
|
18968
18968
|
), !1;
|
|
18969
18969
|
}
|
|
@@ -18977,10 +18977,8 @@ Creating Twenty Application
|
|
|
18977
18977
|
let a = 1;
|
|
18978
18978
|
console.log(me.white(` ${a}. Navigate to your project`)), console.log(me.cyan(` cd ${t}
|
|
18979
18979
|
`)), a++, u || (console.log(me.white(` ${a}. Connect to a Twenty instance`)), console.log(
|
|
18980
|
-
me.cyan(
|
|
18981
|
-
|
|
18982
|
-
`
|
|
18983
|
-
)
|
|
18980
|
+
me.cyan(` yarn twenty remote:add --url <your-instance-url>
|
|
18981
|
+
`)
|
|
18984
18982
|
), a++), console.log(me.white(` ${a}. Start developing`)), console.log(me.cyan(` yarn twenty dev
|
|
18985
18983
|
`)), a++, console.log(me.white(` ${a}. Open your twenty instance`)), console.log(me.cyan(` ${i}
|
|
18986
18984
|
`)), console.log(
|
|
@@ -18994,10 +18992,7 @@ const bg = new d9(Wo.name).description("CLI tool to initialize a new Twenty appl
|
|
|
18994
18992
|
Wo.version,
|
|
18995
18993
|
"-v, --version",
|
|
18996
18994
|
"Output the current version of create-twenty-app."
|
|
18997
|
-
).argument("[directory]").option("-n, --name <name>", "Application name").option("-d, --display-name <displayName>", "Application display name").option("--description <description>", "Application description").option(
|
|
18998
|
-
"--workspace-url <workspaceUrl>",
|
|
18999
|
-
"Twenty workspace URL (default: http://localhost:2020)"
|
|
19000
|
-
).option("--api-url <apiUrl>", "[deprecated: use --workspace-url]").option(
|
|
18995
|
+
).argument("[directory]").option("-n, --name <name>", "Application name").option("-d, --display-name <displayName>", "Application display name").option("--description <description>", "Application description").option("--url <url>", "Twenty server URL (default: http://localhost:2020)").option("--api-url <apiUrl>", "[deprecated: use --url]").option(
|
|
19001
18996
|
"--authentication-method <method>",
|
|
19002
18997
|
"Authentication method: oauth or apiKey (default: apiKey for local, oauth for remote)"
|
|
19003
18998
|
).helpOption("-h, --help", "Display this help message.").action(
|
|
@@ -19011,20 +19006,15 @@ const bg = new d9(Wo.name).description("CLI tool to initialize a new Twenty appl
|
|
|
19011
19006
|
'Error: --authentication-method must be "oauth" or "apiKey".'
|
|
19012
19007
|
)
|
|
19013
19008
|
), process.exit(1)), n?.apiUrl && console.warn(
|
|
19014
|
-
me.yellow(
|
|
19015
|
-
"Warning: --api-url is deprecated. Use --workspace-url instead."
|
|
19016
|
-
)
|
|
19017
|
-
);
|
|
19018
|
-
const i = (n?.workspaceUrl ?? n?.apiUrl)?.replace(
|
|
19019
|
-
/\/+$/,
|
|
19020
|
-
""
|
|
19009
|
+
me.yellow("Warning: --api-url is deprecated. Use --url instead.")
|
|
19021
19010
|
);
|
|
19011
|
+
const i = (n?.url ?? n?.apiUrl)?.replace(/\/+$/, "");
|
|
19022
19012
|
await new dk().execute({
|
|
19023
19013
|
directory: e,
|
|
19024
19014
|
name: n?.name,
|
|
19025
19015
|
displayName: n?.displayName,
|
|
19026
19016
|
description: n?.description,
|
|
19027
|
-
|
|
19017
|
+
serverUrl: i,
|
|
19028
19018
|
authenticationMethod: n?.authenticationMethod
|
|
19029
19019
|
});
|
|
19030
19020
|
}
|
|
@@ -49,19 +49,19 @@
|
|
|
49
49
|
|
|
50
50
|
## Best practice
|
|
51
51
|
|
|
52
|
-
It's highly recommended to create new app entities using `yarn twenty add`. These are the options:
|
|
52
|
+
It's highly recommended to create new app entities using `yarn twenty dev:add`. These are the options:
|
|
53
53
|
|
|
54
|
-
| Entity type | Command
|
|
55
|
-
| -------------------- |
|
|
56
|
-
| Object | `yarn twenty add object` | `src/objects/<name>.ts` |
|
|
57
|
-
| Field | `yarn twenty add field` | `src/fields/<name>.ts` |
|
|
58
|
-
| Logic function | `yarn twenty add logicFunction` | `src/logic-functions/<name>.ts` |
|
|
59
|
-
| Front component | `yarn twenty add frontComponent` | `src/front-components/<name>.tsx` |
|
|
60
|
-
| Role | `yarn twenty add role` | `src/roles/<name>.ts` |
|
|
61
|
-
| Skill | `yarn twenty add skill` | `src/skills/<name>.ts` |
|
|
62
|
-
| Agent | `yarn twenty add agent` | `src/agents/<name>.ts` |
|
|
63
|
-
| View | `yarn twenty add view` | `src/views/<name>.ts` |
|
|
64
|
-
| Navigation menu item | `yarn twenty add navigationMenuItem` | `src/navigation-menu-items/<name>.ts` |
|
|
65
|
-
| Page layout | `yarn twenty add pageLayout` | `src/page-layouts/<name>.ts` |
|
|
54
|
+
| Entity type | Command | Generated file |
|
|
55
|
+
| -------------------- | ---------------------------------------- | ------------------------------------- |
|
|
56
|
+
| Object | `yarn twenty dev:add object` | `src/objects/<name>.ts` |
|
|
57
|
+
| Field | `yarn twenty dev:add field` | `src/fields/<name>.ts` |
|
|
58
|
+
| Logic function | `yarn twenty dev:add logicFunction` | `src/logic-functions/<name>.ts` |
|
|
59
|
+
| Front component | `yarn twenty dev:add frontComponent` | `src/front-components/<name>.tsx` |
|
|
60
|
+
| Role | `yarn twenty dev:add role` | `src/roles/<name>.ts` |
|
|
61
|
+
| Skill | `yarn twenty dev:add skill` | `src/skills/<name>.ts` |
|
|
62
|
+
| Agent | `yarn twenty dev:add agent` | `src/agents/<name>.ts` |
|
|
63
|
+
| View | `yarn twenty dev:add view` | `src/views/<name>.ts` |
|
|
64
|
+
| Navigation menu item | `yarn twenty dev:add navigationMenuItem` | `src/navigation-menu-items/<name>.ts` |
|
|
65
|
+
| Page layout | `yarn twenty dev:add pageLayout` | `src/page-layouts/<name>.ts` |
|
|
66
66
|
|
|
67
67
|
This helps automatically generate required IDs etc.
|
|
@@ -11,8 +11,8 @@ Run `yarn twenty help` to list all available commands.
|
|
|
11
11
|
## Useful Commands
|
|
12
12
|
|
|
13
13
|
- `yarn twenty dev` - Start the development server and sync your app
|
|
14
|
-
- `yarn twenty
|
|
15
|
-
- `yarn twenty
|
|
14
|
+
- `yarn twenty docker:status` - Check the local Twenty server status
|
|
15
|
+
- `yarn twenty docker:start` - Start the local Twenty server
|
|
16
16
|
- `yarn test` - Run integration tests
|
|
17
17
|
|
|
18
18
|
## Learn More
|
|
@@ -14,7 +14,7 @@ function validateEnv(): { apiUrl: string; apiKey: string } {
|
|
|
14
14
|
if (!apiUrl || !apiKey) {
|
|
15
15
|
throw new Error(
|
|
16
16
|
'TWENTY_API_URL and TWENTY_API_KEY must be set.\n' +
|
|
17
|
-
'Start a local server: yarn twenty
|
|
17
|
+
'Start a local server: yarn twenty docker:start\n' +
|
|
18
18
|
'Or set them in vitest env config.',
|
|
19
19
|
);
|
|
20
20
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-twenty-app",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "Command-line interface to create Twenty application",
|
|
5
5
|
"main": "dist/cli.cjs",
|
|
6
6
|
"bin": "dist/cli.cjs",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"lodash.camelcase": "^4.3.0",
|
|
36
36
|
"lodash.kebabcase": "^4.1.1",
|
|
37
37
|
"lodash.startcase": "^4.4.0",
|
|
38
|
-
"twenty-sdk": "2.
|
|
38
|
+
"twenty-sdk": "2.7.0",
|
|
39
39
|
"uuid": "^13.0.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
@@ -11,8 +11,8 @@ Run `yarn twenty help` to list all available commands.
|
|
|
11
11
|
## Useful Commands
|
|
12
12
|
|
|
13
13
|
- `yarn twenty dev` - Start the development server and sync your app
|
|
14
|
-
- `yarn twenty
|
|
15
|
-
- `yarn twenty
|
|
14
|
+
- `yarn twenty docker:status` - Check the local Twenty server status
|
|
15
|
+
- `yarn twenty docker:start` - Start the local Twenty server
|
|
16
16
|
- `yarn test` - Run integration tests
|
|
17
17
|
|
|
18
18
|
## Learn More
|