Fix twenty sdk and create twenty app (#16282)

As title
This commit is contained in:
martmull
2025-12-03 15:12:34 +01:00
committed by GitHub
parent e79046618b
commit ea79425fc0
14 changed files with 510 additions and 105 deletions
+1 -1
View File
@@ -44,7 +44,7 @@
"@types/lodash.startcase": "^4",
"@types/node": "^20.0.0",
"vite": "^7.0.0",
"vite-plugin-dts": "3.8.1",
"vite-plugin-dts": "^4.5.4",
"vite-tsconfig-paths": "^4.2.1"
},
"engines": {
@@ -123,6 +123,6 @@ export class CreateAppCommand {
console.log('');
console.log(chalk.blue('Next steps:'));
console.log(`cd ${appDirectory.split('/').reverse()[0] ?? ''}`);
console.log('twenty app dev');
console.log('yarn auth');
}
}
@@ -125,7 +125,7 @@ const createPackageJson = async ({
auth: 'twenty auth login',
},
dependencies: {
'twenty-sdk': '0.1.0',
'twenty-sdk': '0.1.1',
},
devDependencies: {
'@types/node': '^24.7.2',
@@ -5,6 +5,7 @@
},
"include": [
"**/__mocks__/**/*",
"vite.config.ts",
"jest.config.mjs",
"src/**/*.d.ts",
"src/**/*.spec.ts",
+19 -8
View File
@@ -34,6 +34,20 @@ const entryFileNames = (chunk: any, extension: 'cjs' | 'mjs') => {
return `${moduleDirectory}.${extension}`;
};
const copyAssetPlugin = (targets: { src: string; dest: string }[]) => {
return {
name: 'copy-assets',
closeBundle: async () => {
for (const target of targets) {
await fs.copy(
path.resolve(__dirname, target.src),
path.resolve(__dirname, target.dest),
);
}
},
};
};
export default defineConfig(() => {
const tsConfigPath = path.resolve(__dirname, './tsconfig.lib.json');
@@ -45,15 +59,12 @@ export default defineConfig(() => {
root: __dirname,
}),
dts({ entryRoot: './src', tsconfigPath: tsConfigPath }),
{
name: 'copy-assets',
closeBundle: async () => {
await fs.copy(
path.resolve(__dirname, 'src/constants/base-application'),
path.resolve(__dirname, 'dist/constants/base-application'),
);
copyAssetPlugin([
{
src: 'src/constants/base-application',
dest: 'dist/constants/base-application',
},
},
]),
],
build: {
outDir: 'dist',
+22 -18
View File
@@ -1,12 +1,17 @@
{
"name": "twenty-sdk",
"version": "0.1.0",
"license": "AGPL-3.0",
"version": "0.1.1",
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"bin": {
"twenty": "dist/cli/cli.js"
"twenty": "dist/cli.cjs"
},
"files": [
"dist"
],
"scripts": {
"build": "npx rimraf dist && npx vite build"
},
"keywords": [
"twenty",
@@ -16,12 +21,17 @@
"application",
"development"
],
"files": [
"dist"
],
"scripts": {
"build": "vite build && tsc --project tsconfig.cli.json"
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"typesVersions": {
"*": {}
},
"license": "AGPL-3.0",
"dependencies": {
"@genql/cli": "^3.0.3",
"axios": "^1.6.0",
@@ -52,18 +62,12 @@
"jest": "^29.5.0",
"tsx": "^4.7.0",
"vite": "^7.0.0",
"vite-plugin-dts": "3.8.1",
"vite-plugin-dts": "^4.5.4",
"vite-tsconfig-paths": "^4.2.1",
"wait-on": "^7.2.0"
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"typesVersions": {
"*": {}
"engines": {
"node": "^24.5.0",
"yarn": "^4.0.2"
}
}
+1 -1
View File
@@ -23,7 +23,7 @@
],
"options": {
"cwd": "packages/twenty-sdk",
"command": "node dist/cli/cli.js"
"command": "node dist/cli.cjs"
}
},
"generateBarrels": {
+1 -1
View File
@@ -8,7 +8,7 @@ import { AuthCommand } from './commands/auth.command';
import { ConfigService } from './services/config.service';
const packageJson = JSON.parse(
readFileSync(join(__dirname, '../../package.json'), 'utf-8'),
readFileSync(join(__dirname, '../package.json'), 'utf-8'),
);
const program = new Command();
-28
View File
@@ -1,28 +0,0 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist-e2e",
"rootDir": "./src",
"module": "commonjs",
"target": "ES2022",
"moduleResolution": "node",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"declarationMap": false,
"types": ["jest", "node"]
},
"include": [
"src/**/*",
"src/**/__tests__/**/*.e2e-spec.ts"
],
"exclude": [
"node_modules",
"dist",
"dist-e2e",
"**/*.test.ts",
"**/*.spec.ts"
]
}
+14 -24
View File
@@ -1,36 +1,26 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"moduleResolution": "bundler",
"strict": true,
"noEmit": true,
"isolatedModules": true,
"esModuleInterop": true,
"allowJs": false,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"declaration": true,
"declarationMap": true,
"rootDir": "src"
"strictNullChecks": true,
"alwaysStrict": true,
"noImplicitAny": true,
"strictBindCallApply": false,
"noEmit": true,
"paths": {
"@/*": ["./src/*"]
}
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.cli.json"
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.e2e.json"
"path": "./tsconfig.spec.json"
}
],
"include": ["src/**/*.ts", "vite.config.ts"],
"exclude": [
"src/cli/**",
"node_modules",
"dist",
"**/*.test.ts",
"**/*.spec.ts",
"**/*.e2e-spec.ts",
"**/__tests__/**"
]
"extends": "../../tsconfig.base.json",
}
@@ -1,20 +1,18 @@
{
"extends": "../../tsconfig.base.json",
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./dist/cli",
"rootDir": "./src/cli",
"moduleResolution": "bundler",
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"noEmit": false,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"declaration": false,
"declarationMap": false,
"isolatedModules": false
"sourceMap": true
},
"include": ["src/cli/**/*.ts"],
"include": ["src"],
"exclude": [
"node_modules",
"dist",
+17
View File
@@ -0,0 +1,17 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"types": ["jest", "node"]
},
"include": [
"**/__mocks__/**/*",
"vite.config.ts",
"jest.config.mjs",
"src/**/*.d.ts",
"src/**/*.spec.ts",
"src/**/*.spec.tsx",
"src/**/*.test.ts",
"src/**/*.test.tsx",
"src/**/*.e2e-spec.ts"
]
}
+2 -2
View File
@@ -10,7 +10,7 @@ const moduleEntries = Object.keys((packageJson as any).exports || {})
)
.map((module) => `src/${module.replace(/^\.\//, '')}/index.ts`);
const entries = ['src/index.ts', ...moduleEntries];
const entries = ['src/index.ts', 'src/cli/cli.ts', ...moduleEntries];
const entryFileNames = (chunk: any, extension: 'cjs' | 'mjs') => {
if (!chunk.isEntry) {
@@ -33,7 +33,7 @@ const entryFileNames = (chunk: any, extension: 'cjs' | 'mjs') => {
return `${moduleDirectory}.${extension}`;
};
export default defineConfig(() => {
const tsConfigPath = path.resolve(__dirname, './tsconfig.json');
const tsConfigPath = path.resolve(__dirname, './tsconfig.lib.json');
return {
root: __dirname,