Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ad35b39ed | ||
|
|
db9a906130 | ||
|
|
218cb798e6 | ||
|
|
a364692925 | ||
|
|
1991f0d3c0 | ||
|
|
ce428985aa |
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"install": "yarn install && echo 'Setting up Docker Compose environment...' && cd packages/twenty-docker && cp -n docker-compose.yml docker-compose.dev.yml || true && echo 'Dependencies installed and docker-compose prepared'",
|
||||
"start": "sudo service docker start && echo 'Docker service started' && cd packages/twenty-docker && echo 'Installing yq for YAML processing...' && sudo apt-get update -qq && sudo apt-get install -y wget && wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 && sudo chmod +x /usr/local/bin/yq && echo 'Patching docker-compose for local development...' && yq eval 'del(.services.server.image)' -i docker-compose.dev.yml && yq eval '.services.server.build.context = \"../../\"' -i docker-compose.dev.yml && yq eval '.services.server.build.dockerfile = \"./packages/twenty-docker/twenty/Dockerfile\"' -i docker-compose.dev.yml && yq eval 'del(.services.worker.image)' -i docker-compose.dev.yml && yq eval '.services.worker.build.context = \"../../\"' -i docker-compose.dev.yml && yq eval '.services.worker.build.dockerfile = \"./packages/twenty-docker/twenty/Dockerfile\"' -i docker-compose.dev.yml && echo 'Setting up .env file with database configuration...' && echo 'SERVER_URL=http://localhost:3000' > .env && echo 'APP_SECRET='$(openssl rand -base64 32) >> .env && echo 'PG_DATABASE_PASSWORD='$(openssl rand -hex 16) >> .env && echo 'PG_DATABASE_URL=postgres://postgres:password@localhost:5432/postgres' >> .env && echo 'SIGN_IN_PREFILLED=true' >> .env && echo 'Building and starting services...' && docker-compose -f docker-compose.dev.yml up -d --build && echo 'Waiting for services to initialize...' && sleep 30 && echo 'Checking service health...' && docker-compose -f docker-compose.dev.yml ps && echo 'Environment setup complete!'",
|
||||
"terminals": [
|
||||
{
|
||||
"name": "Database Setup & Seed",
|
||||
"command": "sleep 40 && cd packages/twenty-docker && echo 'Waiting for PostgreSQL to be ready...' && until docker-compose -f docker-compose.dev.yml exec -T db pg_isready -U postgres; do echo 'Waiting for PostgreSQL...'; sleep 5; done && echo 'PostgreSQL is ready!' && echo 'Waiting for Twenty server to be healthy...' && until docker-compose -f docker-compose.dev.yml exec -T server curl --fail http://localhost:3000/healthz 2>/dev/null; do echo 'Waiting for server...'; sleep 5; done && echo 'Server is healthy!' && echo 'Running database setup and seeding...' && docker-compose -f docker-compose.dev.yml exec -T server npx nx database:reset twenty-server && echo 'Database seeded successfully!' && bash"
|
||||
},
|
||||
{
|
||||
"name": "Application Logs",
|
||||
"command": "sleep 35 && cd packages/twenty-docker && echo 'Following application logs...' && docker-compose -f docker-compose.dev.yml logs -f server worker"
|
||||
},
|
||||
{
|
||||
"name": "Service Monitor",
|
||||
"command": "sleep 15 && cd packages/twenty-docker && echo '=== Service Status Monitor ===' && while true; do clear; echo '=== Service Status at $(date) ===' && docker-compose -f docker-compose.dev.yml ps && echo '\\n=== Health Status ===' && (docker-compose -f docker-compose.dev.yml exec -T server curl -s http://localhost:3000/healthz 2>/dev/null && echo '✅ Twenty Server: Healthy') || echo '❌ Twenty Server: Not Ready' && (docker-compose -f docker-compose.dev.yml exec -T db pg_isready -U postgres 2>/dev/null && echo '✅ PostgreSQL: Ready') || echo '❌ PostgreSQL: Not Ready' && echo '\\n=== Database Connection Test ===' && docker-compose -f docker-compose.dev.yml exec -T server node -e \"const { Client } = require('pg'); const client = new Client({connectionString: process.env.PG_DATABASE_URL}); client.connect().then(() => {console.log('✅ Database Connection: OK'); client.end();}).catch(e => console.log('❌ Database Connection: Failed -', e.message));\" || echo 'Connection test failed' && sleep 45; done"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"install": "yarn install && echo 'Installing dependencies complete'",
|
||||
"start": "sudo service docker start && echo 'Docker service started' && sleep 3 && echo 'Starting PostgreSQL and Redis containers...' && make postgres-on-docker && make redis-on-docker && echo 'Waiting for containers to initialize...' && sleep 20 && echo 'Checking container status...' && docker ps --filter name=twenty_ && echo 'Waiting for PostgreSQL to be ready...' && until docker exec twenty_pg pg_isready -U postgres -h localhost; do echo 'PostgreSQL not ready yet, waiting...'; sleep 3; done && echo 'PostgreSQL is ready!' && echo 'Setting up database...' && cd packages/twenty-server && npm run database:init || echo 'Database already initialized' && echo 'Environment setup complete!'",
|
||||
"terminals": [
|
||||
{
|
||||
"name": "Development Server",
|
||||
"command": "echo 'Waiting for database to be fully ready...' && sleep 30 && until docker exec twenty_pg pg_isready -U postgres -h localhost; do echo 'Waiting for PostgreSQL...'; sleep 2; done && echo 'Starting Twenty development server...' && export SERVER_URL=http://localhost:3000 && export PG_DATABASE_URL=postgres://postgres:password@localhost:5432/postgres && yarn start"
|
||||
},
|
||||
{
|
||||
"name": "Database Management",
|
||||
"command": "sleep 25 && echo 'Database management terminal ready' && echo 'Waiting for PostgreSQL to be available...' && until docker exec twenty_pg pg_isready -U postgres -h localhost; do echo 'Waiting for PostgreSQL...'; sleep 2; done && echo 'PostgreSQL is ready for database operations!' && echo 'You can now run database commands like:' && echo ' npx nx database:reset twenty-server' && echo ' npx nx database:migrate twenty-server' && bash"
|
||||
},
|
||||
{
|
||||
"name": "Container Logs & Status",
|
||||
"command": "sleep 10 && echo '=== Container Status Monitor ===' && while true; do echo '\\n=== Container Status at $(date) ===' && docker ps --filter name=twenty_ --format 'table {{.Names}}\\t{{.Status}}\\t{{.Ports}}' && echo '\\n=== PostgreSQL Status ===' && (docker exec twenty_pg pg_isready -U postgres -h localhost && echo 'PostgreSQL: ✅ Ready') || echo 'PostgreSQL: ❌ Not Ready' && echo '\\n=== Redis Status ===' && (docker exec twenty_redis redis-cli ping && echo 'Redis: ✅ Ready') || echo 'Redis: ❌ Not Ready' && sleep 30; done"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
---
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: false
|
||||
---
|
||||
# Twenty Development Rules
|
||||
|
||||
This directory contains Twenty's development guidelines and best practices in the modern Cursor Rules format (MDC). These rules are automatically applied based on file patterns and provide context-aware guidance to AI assistants.
|
||||
|
||||
## Rules Overview
|
||||
|
||||
### Core Guidelines
|
||||
- **architecture.mdc** - Project overview, technology stack, and infrastructure setup (Always Applied)
|
||||
- **nx-rules.mdc** - Nx workspace guidelines and best practices (Auto-attached to Nx files)
|
||||
|
||||
### Code Quality
|
||||
- **typescript-guidelines.mdc** - TypeScript best practices and conventions (Auto-attached to .ts/.tsx files)
|
||||
- **code-style.mdc** - General coding standards and style guide (Auto-attached to code files)
|
||||
- **file-structure.mdc** - File and directory organization patterns (Auto-attached to config files)
|
||||
|
||||
### React Development
|
||||
- **react-general-guidelines.mdc** - Core React development principles (Auto-attached to React files)
|
||||
- **react-state-management.mdc** - State management approaches with Recoil (Auto-attached to state files)
|
||||
|
||||
### Testing & Quality
|
||||
- **testing-guidelines.mdc** - Testing strategies and best practices (Auto-attached to test files)
|
||||
|
||||
### Internationalization
|
||||
- **translations.mdc** - Translation workflow and i18n setup (Auto-attached to locale files)
|
||||
|
||||
## How Rules Work
|
||||
|
||||
### Automatic Attachment
|
||||
Rules are automatically included in your AI context based on file patterns (globs). When you work on TypeScript files, the TypeScript guidelines are automatically loaded.
|
||||
|
||||
### Manual Reference
|
||||
You can manually reference any rule using the `@ruleName` syntax:
|
||||
- `@nx-rules` - Include Nx-specific guidance
|
||||
- `@react-general-guidelines` - Load React best practices
|
||||
- `@testing-guidelines` - Get testing recommendations
|
||||
|
||||
### Rule Types Used
|
||||
- **Always Applied** - Loaded in every context (architecture.mdc, README.mdc)
|
||||
- **Auto Attached** - Loaded when matching file patterns are referenced
|
||||
- **Agent Requested** - Available for AI to include when relevant
|
||||
- **Manual** - Only included when explicitly mentioned
|
||||
|
||||
## Development Commands
|
||||
|
||||
### Frontend Commands
|
||||
```bash
|
||||
# Testing
|
||||
npx nx test twenty-front # Run unit tests
|
||||
npx nx storybook:build twenty-front # Build Storybook
|
||||
npx nx storybook:serve-and-test:static # Run Storybook tests
|
||||
|
||||
# Development
|
||||
npx nx lint twenty-front # Run linter
|
||||
npx nx typecheck twenty-front # Type checking
|
||||
npx nx run twenty-front:graphql:generate # Generate GraphQL types
|
||||
```
|
||||
|
||||
### Backend Commands
|
||||
```bash
|
||||
# Database
|
||||
npx nx database:reset twenty-server # Reset database
|
||||
npx nx run twenty-server:database:init:prod # Initialize database
|
||||
npx nx run twenty-server:database:migrate:prod # Run migrations
|
||||
|
||||
# Development
|
||||
npx nx run twenty-server:start # Start the server
|
||||
npx nx run twenty-server:lint # Run linter (add --fix to auto-fix)
|
||||
npx nx run twenty-server:typecheck # Type checking
|
||||
npx nx run twenty-server:test # Run unit tests
|
||||
npx nx run twenty-server:test:integration:with-db-reset # Run integration tests
|
||||
|
||||
# Migrations
|
||||
npx nx run twenty-server:typeorm migration:generate src/database/typeorm/core/migrations/[name] -d src/database/typeorm/core/core.datasource.ts
|
||||
|
||||
# Workspace
|
||||
npx nx run twenty-server:command workspace:sync-metadata -f # Sync metadata
|
||||
```
|
||||
|
||||
## Usage Guidelines
|
||||
|
||||
### For Developers
|
||||
- Rules are automatically applied based on file context
|
||||
- Check rule descriptions to understand when they're activated
|
||||
- Use manual references (`@ruleName`) for additional context
|
||||
- Keep rules updated as the codebase evolves
|
||||
|
||||
### For AI Assistants
|
||||
- Rules provide consistent guidance across conversations
|
||||
- Use rule context to maintain coding standards
|
||||
- Reference specific rules when making recommendations
|
||||
- Apply rule principles in code suggestions and reviews
|
||||
|
||||
## Contributing to Rules
|
||||
|
||||
### Adding New Rules
|
||||
1. Create a new `.mdc` file in this directory
|
||||
2. Include proper metadata headers with description and globs
|
||||
3. Write clear, actionable guidelines with examples
|
||||
4. Test the rule with relevant file patterns
|
||||
5. Update this README if needed
|
||||
|
||||
### Updating Existing Rules
|
||||
1. Modify the rule content while preserving metadata
|
||||
2. Test changes with affected file patterns
|
||||
3. Ensure consistency with other rules
|
||||
4. Update examples and best practices as needed
|
||||
|
||||
## Rule Format Reference
|
||||
|
||||
Each rule file uses the MDC format with metadata:
|
||||
|
||||
```markdown
|
||||
---
|
||||
description: Brief description of the rule's purpose
|
||||
globs: ["**/*.ts", "**/*.tsx"] # File patterns for auto-attachment
|
||||
alwaysApply: false # Whether to always include this rule
|
||||
---
|
||||
|
||||
# Rule Title
|
||||
|
||||
Rule content in Markdown format...
|
||||
```
|
||||
|
||||
## Migration from Legacy Format
|
||||
|
||||
The rules have been migrated from the legacy `.md` format to the modern `.mdc` format, providing:
|
||||
- Better context awareness through file pattern matching
|
||||
- Improved organization with metadata headers
|
||||
- More flexible rule application strategies
|
||||
- Enhanced integration with Cursor's AI features
|
||||
|
||||
For the most up-to-date version of these guidelines, always refer to the files in this directory.
|
||||
@@ -1,35 +0,0 @@
|
||||
---
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: false
|
||||
---
|
||||
---
|
||||
description: Twenty CRM architecture overview - monorepo structure, tech stack, and development principles
|
||||
globs: []
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Twenty Architecture
|
||||
|
||||
## Tech Stack
|
||||
- **Frontend**: React 18, TypeScript, Recoil, Styled Components, Vite
|
||||
- **Backend**: NestJS, TypeORM, PostgreSQL, Redis, GraphQL
|
||||
- **Monorepo**: Nx workspace with yarn
|
||||
|
||||
## Package Structure
|
||||
```
|
||||
packages/
|
||||
├── twenty-front/ # React app
|
||||
├── twenty-server/ # NestJS API
|
||||
├── twenty-ui/ # Shared components
|
||||
├── twenty-shared/ # Common types/utils
|
||||
└── twenty-emails/ # Email templates
|
||||
```
|
||||
|
||||
## Key Principles
|
||||
- **Functional components only** (no classes)
|
||||
- **Named exports only** (no default exports)
|
||||
- **Types over interfaces** (except for extending third-party)
|
||||
- **String literals over enums** (except GraphQL)
|
||||
- **No 'any' type allowed**
|
||||
- **Event handlers over useEffect** for state updates
|
||||
@@ -1,103 +0,0 @@
|
||||
---
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: false
|
||||
---
|
||||
# Code Style Guidelines
|
||||
|
||||
## Formatting Standards
|
||||
- **Prettier**: 2-space indentation, single quotes, trailing commas, semicolons
|
||||
- **Print width**: 80 characters
|
||||
- **ESLint**: No unused imports, consistent import ordering, prefer const over let
|
||||
|
||||
## Naming Conventions
|
||||
```typescript
|
||||
// ✅ Variables and functions - camelCase
|
||||
const userAccountBalance = 1000;
|
||||
const calculateMonthlyPayment = () => {};
|
||||
|
||||
// ✅ Constants - SCREAMING_SNAKE_CASE
|
||||
const API_ENDPOINTS = {
|
||||
USERS: '/api/users',
|
||||
ORDERS: '/api/orders',
|
||||
} as const;
|
||||
|
||||
// ✅ Types and Classes - PascalCase
|
||||
class UserService {}
|
||||
type UserAccountData = {};
|
||||
type ButtonProps = {}; // Component props suffix with 'Props'
|
||||
|
||||
// ✅ Files and directories - kebab-case
|
||||
// user-profile.component.tsx
|
||||
// user-profile.styles.ts
|
||||
```
|
||||
|
||||
## Import Organization
|
||||
```typescript
|
||||
// ✅ Correct import order
|
||||
// 1. External libraries
|
||||
import React from 'react';
|
||||
import { useCallback } from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
// 2. Internal modules (absolute paths)
|
||||
import { Button } from '@/components/ui';
|
||||
import { UserService } from '@/services';
|
||||
|
||||
// 3. Relative imports
|
||||
import { UserCardProps } from './types';
|
||||
```
|
||||
|
||||
## Function Structure
|
||||
```typescript
|
||||
// ✅ Small, focused functions
|
||||
// ✅ Required parameters first, optional last
|
||||
const processUserData = (
|
||||
user: User,
|
||||
options: ProcessingOptions,
|
||||
callback?: (result: ProcessedUser) => void
|
||||
): ProcessedUser => {
|
||||
const processedUser = transformUserData(user);
|
||||
applyOptions(processedUser, options);
|
||||
|
||||
if (callback) {
|
||||
callback(processedUser);
|
||||
}
|
||||
|
||||
return processedUser;
|
||||
};
|
||||
```
|
||||
|
||||
## Comments
|
||||
```typescript
|
||||
// ✅ Explain business logic and non-obvious intentions
|
||||
// Apply 15% discount for premium users with orders > $100
|
||||
const discount = isPremiumUser && orderTotal > 100 ? 0.15 : 0;
|
||||
|
||||
// TODO: Replace with proper authentication service
|
||||
const isAuthenticated = localStorage.getItem('token') !== null;
|
||||
|
||||
/**
|
||||
* JSDoc for public APIs
|
||||
* @param basePrice - The base price before modifications
|
||||
* @returns The final price after tax and discount
|
||||
*/
|
||||
const calculateTotalPrice = (basePrice: number): number => {
|
||||
// Implementation
|
||||
};
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
```typescript
|
||||
// ✅ Proper error types and meaningful messages
|
||||
try {
|
||||
const user = await userService.findById(userId);
|
||||
if (!user) {
|
||||
throw new UserNotFoundError(`User with ID ${userId} not found`);
|
||||
}
|
||||
return user;
|
||||
} catch (error) {
|
||||
logger.error('Failed to fetch user', { userId, error });
|
||||
throw error;
|
||||
}
|
||||
```
|
||||
@@ -1,107 +0,0 @@
|
||||
---
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: false
|
||||
---
|
||||
# File Structure Guidelines
|
||||
|
||||
## Directory Organization
|
||||
```
|
||||
packages/twenty-front/src/
|
||||
├── components/ # Reusable UI components
|
||||
├── pages/ # Route components
|
||||
├── modules/ # Feature modules
|
||||
├── hooks/ # Custom hooks
|
||||
├── services/ # API services
|
||||
└── types/ # Type definitions
|
||||
|
||||
packages/twenty-server/src/
|
||||
├── modules/ # Feature modules
|
||||
├── entities/ # Database entities
|
||||
├── dto/ # Data transfer objects
|
||||
└── utils/ # Helper functions
|
||||
```
|
||||
|
||||
## File Naming
|
||||
- **kebab-case** for all files and directories
|
||||
- **Descriptive suffixes** for clarity
|
||||
```
|
||||
// ✅ Correct naming
|
||||
user-profile.component.tsx
|
||||
user-profile.styles.ts
|
||||
user-profile.test.tsx
|
||||
user.service.ts
|
||||
user.entity.ts
|
||||
create-user.dto.ts
|
||||
```
|
||||
|
||||
## Index Files & Barrel Exports
|
||||
```typescript
|
||||
// ✅ Clean barrel exports in index.ts
|
||||
export { UserCard } from './user-card.component';
|
||||
export { UserList } from './user-list.component';
|
||||
export type { UserCardProps, UserListProps } from './types';
|
||||
|
||||
// ✅ Usage - clean imports
|
||||
import { UserCard, UserList } from '@/components/user';
|
||||
```
|
||||
|
||||
## Module Structure
|
||||
```
|
||||
src/modules/user/
|
||||
├── components/ # Module-specific components
|
||||
├── hooks/ # Module hooks
|
||||
├── services/ # API services
|
||||
├── types/ # Type definitions
|
||||
└── index.ts # Module exports
|
||||
```
|
||||
|
||||
## Import/Export Patterns
|
||||
```typescript
|
||||
// ✅ Import organization
|
||||
// 1. External libraries
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
// 2. Internal modules (absolute paths)
|
||||
import { Button } from '@/components/ui';
|
||||
import { UserService } from '@/services';
|
||||
|
||||
// 3. Relative imports
|
||||
import { UserCardProps } from './types';
|
||||
|
||||
// ✅ Named exports only (no default exports)
|
||||
export const UserComponent = ({ user }: UserProps) => {
|
||||
// Component implementation
|
||||
};
|
||||
```
|
||||
|
||||
## File Size Guidelines
|
||||
- **Components**: Under 300 lines
|
||||
- **Services**: Under 500 lines
|
||||
- **Extract logic** into hooks/utilities when files grow large
|
||||
- **Use composition** over large monolithic components
|
||||
|
||||
## Configuration Files
|
||||
|
||||
### Project Configuration
|
||||
```
|
||||
.vscode/ # VSCode settings
|
||||
├── settings.json
|
||||
├── extensions.json
|
||||
└── launch.json
|
||||
|
||||
.github/ # GitHub workflows
|
||||
├── workflows/
|
||||
└── templates/
|
||||
|
||||
.cursor/ # Cursor rules
|
||||
├── rules/
|
||||
└── environment.json
|
||||
```
|
||||
|
||||
### Build Configuration
|
||||
- Keep build configs in root or package directories
|
||||
- Use consistent naming for config files
|
||||
- Comment complex configurations
|
||||
- Version control all configuration files
|
||||
@@ -1,83 +0,0 @@
|
||||
---
|
||||
description: Guidelines and best practices for working with Nx in the Twenty workspace, including workspace architecture understanding, configuration management, and generator usage.
|
||||
globs:
|
||||
alwaysApply: false
|
||||
---
|
||||
---
|
||||
description: Guidelines and best practices for working with Nx in the Twenty workspace, including workspace architecture understanding, configuration management, and generator usage.
|
||||
globs: ["**/nx.json", "**/project.json", "**/workspace.json"]
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Nx Guidelines
|
||||
|
||||
## Core Commands
|
||||
```bash
|
||||
# Run target for specific project
|
||||
npx nx run twenty-front:build
|
||||
npx nx run twenty-server:test
|
||||
|
||||
# Run target for all projects
|
||||
npx nx run-many --target=build --all
|
||||
npx nx run-many --target=test --projects=twenty-front,twenty-server
|
||||
|
||||
# Generate/modify projects
|
||||
npx nx g @nx/react:app my-app
|
||||
npx nx g @nx/react:component my-component
|
||||
```
|
||||
|
||||
## Project Structure
|
||||
- Each package has a `project.json` with targets
|
||||
- Dependencies managed through `tsconfig.json` path mappings
|
||||
- Shared libraries in `packages/` directory
|
||||
|
||||
## Build Targets
|
||||
```json
|
||||
// project.json
|
||||
{
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/vite:build",
|
||||
"options": { "outputPath": "dist/packages/twenty-front" }
|
||||
},
|
||||
"test": {
|
||||
"executor": "@nx/jest:jest",
|
||||
"options": { "jestConfig": "packages/twenty-front/jest.config.ts" }
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Dependency Graph
|
||||
```bash
|
||||
# View project dependencies
|
||||
npx nx graph
|
||||
|
||||
# Check what's affected by changes
|
||||
npx nx affected --target=test
|
||||
npx nx affected --target=build --base=main
|
||||
```
|
||||
|
||||
## Library Management
|
||||
- Use `npx nx g @nx/workspace:library` generator for shared libs
|
||||
- Internal imports use `@/` path mapping
|
||||
- Libraries must export through index.ts barrel files
|
||||
|
||||
## Cache Configuration
|
||||
- Nx caches build outputs and test results
|
||||
- Configure `outputs` in project.json targets
|
||||
- Use `inputs` to define what invalidates cache
|
||||
|
||||
```json
|
||||
{
|
||||
"build": {
|
||||
"outputs": ["dist/packages/my-app"],
|
||||
"inputs": ["source", "^source"],
|
||||
"cache": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
---
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: false
|
||||
---
|
||||
# React Guidelines
|
||||
|
||||
## Core Rules
|
||||
- **Functional components only** (no classes)
|
||||
- **Named exports only** (no default exports)
|
||||
- **Event handlers over useEffect** for state updates
|
||||
|
||||
## Component Structure
|
||||
```typescript
|
||||
// ✅ Correct
|
||||
export const UserProfile = ({ user, onEdit }: UserProfileProps) => {
|
||||
const handleEdit = () => onEdit(user.id);
|
||||
|
||||
return (
|
||||
<StyledContainer>
|
||||
<h1>{user.name}</h1>
|
||||
<Button onClick={handleEdit}>Edit</Button>
|
||||
</StyledContainer>
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
## Props & Event Handlers
|
||||
```typescript
|
||||
// ✅ Correct - Destructure props
|
||||
const Button = ({ onClick, isDisabled, children }: ButtonProps) => (
|
||||
<button onClick={onClick} disabled={isDisabled}>
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
|
||||
// ✅ Correct - Event handlers over useEffect
|
||||
const UserForm = ({ onSubmit }: UserFormProps) => {
|
||||
const handleSubmit = async (data: FormData) => {
|
||||
await onSubmit(data);
|
||||
// Direct event handling, not useEffect
|
||||
};
|
||||
|
||||
return <Form onSubmit={handleSubmit} />;
|
||||
};
|
||||
```
|
||||
|
||||
## Component Design
|
||||
- **Small, focused components** - Single responsibility
|
||||
- **Composition over inheritance** - Combine simple components
|
||||
- **Extract complex logic** into custom hooks
|
||||
|
||||
```typescript
|
||||
// ✅ Good - Composed from smaller components
|
||||
const UserCard = ({ user }: UserCardProps) => (
|
||||
<StyledCard>
|
||||
<UserAvatar user={user} />
|
||||
<UserInfo user={user} />
|
||||
<UserActions user={user} />
|
||||
</StyledCard>
|
||||
);
|
||||
```
|
||||
|
||||
## Performance
|
||||
```typescript
|
||||
// ✅ Use memo for expensive components only
|
||||
const ExpensiveChart = memo(({ data }: ChartProps) => {
|
||||
// Complex rendering logic
|
||||
return <ComplexChart data={data} />;
|
||||
});
|
||||
|
||||
// ✅ Memoize callbacks when needed
|
||||
const UserList = ({ users, onUserSelect }: UserListProps) => {
|
||||
const handleUserSelect = useCallback((user: User) => {
|
||||
onUserSelect(user);
|
||||
}, [onUserSelect]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
{users.map(user => (
|
||||
<UserItem key={user.id} user={user} onSelect={handleUserSelect} />
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
```
|
||||
@@ -1,81 +0,0 @@
|
||||
---
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: false
|
||||
---
|
||||
# React State Management
|
||||
|
||||
## Recoil Patterns
|
||||
```typescript
|
||||
// ✅ Atoms for primitive state
|
||||
export const currentUserState = atom<User | null>({
|
||||
key: 'currentUserState',
|
||||
default: null,
|
||||
});
|
||||
|
||||
// ✅ Selectors for derived state
|
||||
export const userDisplayNameSelector = selector({
|
||||
key: 'userDisplayNameSelector',
|
||||
get: ({ get }) => {
|
||||
const user = get(currentUserState);
|
||||
return user ? `${user.firstName} ${user.lastName}` : 'Guest';
|
||||
},
|
||||
});
|
||||
|
||||
// ✅ Atom families for dynamic atoms
|
||||
export const userByIdState = atomFamily<User | null, string>({
|
||||
key: 'userByIdState',
|
||||
default: null,
|
||||
});
|
||||
```
|
||||
|
||||
## Local State Guidelines
|
||||
```typescript
|
||||
// ✅ Multiple useState for unrelated state
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [data, setData] = useState<User[]>([]);
|
||||
|
||||
// ✅ useReducer for complex state logic
|
||||
type FormAction =
|
||||
| { type: 'SET_FIELD'; field: string; value: string }
|
||||
| { type: 'SET_ERRORS'; errors: Record<string, string> }
|
||||
| { type: 'RESET' };
|
||||
|
||||
const formReducer = (state: FormState, action: FormAction): FormState => {
|
||||
switch (action.type) {
|
||||
case 'SET_FIELD':
|
||||
return { ...state, [action.field]: action.value };
|
||||
case 'SET_ERRORS':
|
||||
return { ...state, errors: action.errors };
|
||||
case 'RESET':
|
||||
return initialFormState;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## Data Flow Rules
|
||||
- **Props down, events up** - Unidirectional data flow
|
||||
- **Avoid bidirectional binding** - Use callback functions
|
||||
- **Normalize complex data** - Use lookup tables over nested objects
|
||||
|
||||
```typescript
|
||||
// ✅ Normalized state structure
|
||||
type UsersState = {
|
||||
byId: Record<string, User>;
|
||||
allIds: string[];
|
||||
};
|
||||
|
||||
// ✅ Functional state updates
|
||||
const increment = useCallback(() => {
|
||||
setCount(prev => prev + 1);
|
||||
}, []);
|
||||
```
|
||||
|
||||
## Performance Tips
|
||||
- Use atom families for dynamic data collections
|
||||
- Implement proper selector caching
|
||||
- Avoid heavy computations in selectors
|
||||
- Batch state updates when possible
|
||||
@@ -1,89 +0,0 @@
|
||||
---
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: false
|
||||
---
|
||||
# Testing Guidelines
|
||||
|
||||
## Test Structure (AAA Pattern)
|
||||
```typescript
|
||||
describe('UserService', () => {
|
||||
describe('when getting user by ID', () => {
|
||||
it('should return user data for valid ID', async () => {
|
||||
// Arrange
|
||||
const userId = '123';
|
||||
const expectedUser = { id: '123', name: 'John' };
|
||||
mockUserRepository.findById.mockResolvedValue(expectedUser);
|
||||
|
||||
// Act
|
||||
const result = await userService.getUserById(userId);
|
||||
|
||||
// Assert
|
||||
expect(result).toEqual(expectedUser);
|
||||
});
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## React Component Testing
|
||||
```typescript
|
||||
// ✅ Test user behavior, not implementation
|
||||
describe('LoginForm', () => {
|
||||
it('should display error message for invalid credentials', async () => {
|
||||
const mockOnSubmit = jest.fn().mockRejectedValue(new Error('Invalid credentials'));
|
||||
render(<LoginForm onSubmit={mockOnSubmit} />);
|
||||
|
||||
await user.type(screen.getByLabelText(/email/i), 'invalid@example.com');
|
||||
await user.type(screen.getByLabelText(/password/i), 'wrongpassword');
|
||||
await user.click(screen.getByRole('button', { name: /sign in/i }));
|
||||
|
||||
expect(await screen.findByText(/invalid credentials/i)).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## Mocking Patterns
|
||||
```typescript
|
||||
// ✅ Service mocking
|
||||
const mockEmailService = {
|
||||
sendEmail: jest.fn().mockResolvedValue({ success: true }),
|
||||
validateEmail: jest.fn().mockReturnValue(true),
|
||||
};
|
||||
|
||||
// ✅ Test data factories
|
||||
const createTestUser = (overrides = {}) => ({
|
||||
id: uuid(),
|
||||
email: 'test@example.com',
|
||||
name: 'Test User',
|
||||
...overrides,
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
```
|
||||
|
||||
## Testing Principles
|
||||
- **Test behavior, not implementation** - Focus on what users see/do
|
||||
- **Use descriptive test names** - "should [behavior] when [condition]"
|
||||
- **Query by user-visible elements** - text, roles, labels over test IDs
|
||||
- **Keep tests isolated** - Independent and repeatable
|
||||
- **70% unit, 20% integration, 10% E2E** - Test pyramid
|
||||
|
||||
## Common Patterns
|
||||
```typescript
|
||||
// Async testing
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Loading...')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
// User interactions
|
||||
await user.click(screen.getByRole('button'));
|
||||
await user.type(screen.getByLabelText(/search/i), 'query');
|
||||
|
||||
// API integration tests
|
||||
const response = await request(app)
|
||||
.post('/api/users')
|
||||
.send(userData)
|
||||
.expect(201);
|
||||
```
|
||||
@@ -1,291 +0,0 @@
|
||||
---
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: false
|
||||
---
|
||||
# Translation Guidelines
|
||||
|
||||
## Internationalization (i18n) Overview
|
||||
|
||||
### Supported Languages
|
||||
- English (en) - Primary language
|
||||
- French (fr) - Secondary language
|
||||
- German (de) - Planned
|
||||
- Spanish (es) - Planned
|
||||
- Additional languages based on community contributions
|
||||
|
||||
### i18n Architecture
|
||||
- Use react-i18next for React components
|
||||
- Store translations in JSON files
|
||||
- Implement namespace-based organization
|
||||
- Support for interpolation and pluralization
|
||||
|
||||
## File Structure
|
||||
|
||||
### Translation Files
|
||||
```
|
||||
src/locales/
|
||||
├── en/ # English translations
|
||||
│ ├── common.json # Common UI strings
|
||||
│ ├── auth.json # Authentication strings
|
||||
│ ├── dashboard.json # Dashboard specific
|
||||
│ ├── forms.json # Form labels and validation
|
||||
│ └── errors.json # Error messages
|
||||
├── fr/ # French translations
|
||||
│ ├── common.json
|
||||
│ ├── auth.json
|
||||
│ └── ...
|
||||
└── index.ts # i18n configuration
|
||||
```
|
||||
|
||||
### Translation Keys
|
||||
- Use nested objects for organization
|
||||
- Follow consistent naming patterns
|
||||
- Include context in key names
|
||||
```json
|
||||
{
|
||||
"auth": {
|
||||
"login": {
|
||||
"title": "Sign In",
|
||||
"email": "Email Address",
|
||||
"password": "Password",
|
||||
"submit": "Sign In",
|
||||
"forgotPassword": "Forgot Password?"
|
||||
},
|
||||
"register": {
|
||||
"title": "Create Account",
|
||||
"confirmPassword": "Confirm Password"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Translation Implementation
|
||||
|
||||
### React Components
|
||||
- Use useTranslation hook
|
||||
- Specify namespaces for better organization
|
||||
- Handle loading states properly
|
||||
```typescript
|
||||
// ✅ Correct
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const LoginForm = () => {
|
||||
const { t } = useTranslation('auth');
|
||||
|
||||
return (
|
||||
<form>
|
||||
<h1>{t('login.title')}</h1>
|
||||
<input
|
||||
placeholder={t('login.email')}
|
||||
type="email"
|
||||
/>
|
||||
<input
|
||||
placeholder={t('login.password')}
|
||||
type="password"
|
||||
/>
|
||||
<button type="submit">
|
||||
{t('login.submit')}
|
||||
</button>
|
||||
</form>
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
### Interpolation
|
||||
- Use interpolation for dynamic content
|
||||
- Pass variables through t() function
|
||||
- Keep interpolation simple and readable
|
||||
```typescript
|
||||
// ✅ Correct
|
||||
const WelcomeMessage = ({ userName }: { userName: string }) => {
|
||||
const { t } = useTranslation('common');
|
||||
|
||||
return (
|
||||
<h1>{t('welcome.message', { name: userName })}</h1>
|
||||
);
|
||||
};
|
||||
|
||||
// Translation file
|
||||
{
|
||||
"welcome": {
|
||||
"message": "Welcome back, {{name}}!"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Pluralization
|
||||
- Handle singular/plural forms correctly
|
||||
- Use count-based pluralization
|
||||
- Support different plural rules per language
|
||||
```typescript
|
||||
// ✅ Correct
|
||||
const ItemCount = ({ count }: { count: number }) => {
|
||||
const { t } = useTranslation('common');
|
||||
|
||||
return (
|
||||
<span>{t('items.count', { count })}</span>
|
||||
);
|
||||
};
|
||||
|
||||
// Translation file
|
||||
{
|
||||
"items": {
|
||||
"count_one": "{{count}} item",
|
||||
"count_other": "{{count}} items"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Translation Management
|
||||
|
||||
### Adding New Strings
|
||||
1. Add English translation first
|
||||
2. Use descriptive keys that indicate context
|
||||
3. Include comments for translators when needed
|
||||
4. Test with long translations to ensure UI flexibility
|
||||
```json
|
||||
{
|
||||
"user": {
|
||||
"profile": {
|
||||
// Displayed in user profile header
|
||||
"displayName": "Display Name",
|
||||
// Used in forms when editing profile
|
||||
"editDisplayName": "Edit Display Name",
|
||||
// Confirmation message after profile update
|
||||
"updateSuccess": "Profile updated successfully"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Translation Validation
|
||||
- Use TypeScript for translation key validation
|
||||
- Implement automated checks for missing translations
|
||||
- Validate interpolation parameters
|
||||
```typescript
|
||||
// ✅ Correct - Type-safe translations
|
||||
type TranslationKey =
|
||||
| 'auth.login.title'
|
||||
| 'auth.login.email'
|
||||
| 'auth.login.password'
|
||||
| 'common.welcome.message';
|
||||
|
||||
const t = (key: TranslationKey, options?: any) => {
|
||||
// Translation implementation
|
||||
};
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
### Key Naming
|
||||
- Use descriptive, hierarchical keys
|
||||
- Avoid abbreviations
|
||||
- Group related translations
|
||||
- Keep keys consistent across languages
|
||||
```json
|
||||
// ✅ Correct
|
||||
{
|
||||
"dashboard": {
|
||||
"header": {
|
||||
"title": "Dashboard",
|
||||
"subtitle": "Welcome to your workspace"
|
||||
},
|
||||
"actions": {
|
||||
"createNew": "Create New",
|
||||
"refresh": "Refresh Data",
|
||||
"export": "Export"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ❌ Incorrect
|
||||
{
|
||||
"dash_title": "Dashboard",
|
||||
"newBtn": "New",
|
||||
"refreshData": "Refresh"
|
||||
}
|
||||
```
|
||||
|
||||
### String Guidelines
|
||||
- Write clear, concise text
|
||||
- Use consistent terminology
|
||||
- Consider character limits for UI elements
|
||||
- Avoid concatenating translated strings
|
||||
```json
|
||||
// ✅ Correct
|
||||
{
|
||||
"user": {
|
||||
"status": {
|
||||
"online": "Online",
|
||||
"offline": "Offline",
|
||||
"away": "Away"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ❌ Incorrect - Don't concatenate
|
||||
{
|
||||
"user": {
|
||||
"statusPrefix": "User is ",
|
||||
"statusOnline": "online"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Context Information
|
||||
- Provide context for translators
|
||||
- Include character limits when relevant
|
||||
- Explain when/where text appears
|
||||
- Note any technical constraints
|
||||
```json
|
||||
{
|
||||
"button": {
|
||||
// Primary action button, max 20 characters
|
||||
"save": "Save Changes",
|
||||
// Secondary button in modal footer
|
||||
"cancel": "Cancel",
|
||||
// Destructive action, should sound cautious
|
||||
"delete": "Delete Permanently"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Workflow
|
||||
|
||||
### Development Process
|
||||
1. Develop features with English translations
|
||||
2. Use placeholder keys during development
|
||||
3. Finalize translation keys before feature completion
|
||||
4. Add translations to all supported languages
|
||||
5. Test with different language strings
|
||||
|
||||
### Translation Updates
|
||||
1. Create translation tasks for new features
|
||||
2. Provide context and screenshots to translators
|
||||
3. Review translations for consistency
|
||||
4. Test UI with translated strings
|
||||
5. Update documentation when needed
|
||||
|
||||
### Quality Assurance
|
||||
- Review translations in context
|
||||
- Test with longest expected translations
|
||||
- Verify formatting with interpolation
|
||||
- Check for cultural appropriateness
|
||||
- Ensure accessibility with screen readers
|
||||
|
||||
## Maintenance
|
||||
|
||||
### Regular Tasks
|
||||
- Review and update outdated translations
|
||||
- Check for unused translation keys
|
||||
- Maintain consistency across languages
|
||||
- Update translation documentation
|
||||
- Monitor for missing translations in new features
|
||||
|
||||
### Tools and Automation
|
||||
- Use automated translation validation
|
||||
- Implement missing translation detection
|
||||
- Set up continuous integration checks
|
||||
- Maintain translation coverage reports
|
||||
- Use translation management platforms when needed
|
||||
@@ -1,183 +0,0 @@
|
||||
---
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: false
|
||||
---
|
||||
---
|
||||
description: TypeScript best practices and conventions for the Twenty codebase, including strict typing, naming conventions, and type safety guidelines.
|
||||
globs: ["**/*.ts", "**/*.tsx"]
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# TypeScript Guidelines
|
||||
|
||||
## Core TypeScript Principles
|
||||
Twenty enforces strict TypeScript usage to ensure type safety and maintainable code. This document outlines our TypeScript conventions and best practices.
|
||||
|
||||
## Type Safety
|
||||
|
||||
### Strict Typing
|
||||
- **No 'any' type allowed**
|
||||
- TypeScript strict mode enabled
|
||||
- noImplicitAny enabled
|
||||
```typescript
|
||||
// ✅ Correct
|
||||
function processUser(user: User) {
|
||||
return user.name;
|
||||
}
|
||||
|
||||
// ❌ Incorrect
|
||||
function processUser(user: any) {
|
||||
return user.name;
|
||||
}
|
||||
```
|
||||
|
||||
### Type Definitions
|
||||
|
||||
#### Types over Interfaces
|
||||
- Use `type` for all type definitions
|
||||
- Exception: When extending third-party interfaces
|
||||
```typescript
|
||||
// ✅ Correct
|
||||
type User = {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
};
|
||||
|
||||
// ❌ Incorrect
|
||||
interface User {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
}
|
||||
```
|
||||
|
||||
### String Literals over Enums
|
||||
- Use string literal unions instead of enums
|
||||
- Exception: GraphQL enums
|
||||
```typescript
|
||||
// ✅ Correct
|
||||
type UserRole = 'admin' | 'user' | 'guest';
|
||||
|
||||
// ❌ Incorrect
|
||||
enum UserRole {
|
||||
Admin = 'admin',
|
||||
User = 'user',
|
||||
Guest = 'guest',
|
||||
}
|
||||
```
|
||||
|
||||
## Naming Conventions
|
||||
|
||||
### Component Props
|
||||
- Suffix component prop types with 'Props'
|
||||
- Keep props focused and single-purpose
|
||||
```typescript
|
||||
// ✅ Correct
|
||||
type ButtonProps = {
|
||||
label: string;
|
||||
onClick: () => void;
|
||||
variant?: 'primary' | 'secondary';
|
||||
};
|
||||
|
||||
// ❌ Incorrect
|
||||
type ButtonParameters = {
|
||||
label: string;
|
||||
onClick: () => void;
|
||||
variant?: 'primary' | 'secondary';
|
||||
};
|
||||
```
|
||||
|
||||
## Type Inference
|
||||
|
||||
### Leverage TypeScript Inference
|
||||
- Use type inference when types are clear
|
||||
- Explicitly type when inference is ambiguous
|
||||
```typescript
|
||||
// ✅ Correct - Clear inference
|
||||
const users = ['John', 'Jane']; // inferred as string[]
|
||||
|
||||
// ✅ Correct - Explicit typing needed
|
||||
const processUser = (user: User): UserResponse => {
|
||||
// Complex processing
|
||||
return response;
|
||||
};
|
||||
|
||||
// ❌ Incorrect - Unnecessary explicit typing
|
||||
const users: string[] = ['John', 'Jane'];
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
### Type Guards
|
||||
- Use type guards for runtime type checking
|
||||
- Prefer discriminated unions
|
||||
```typescript
|
||||
// ✅ Correct
|
||||
type Success = {
|
||||
type: 'success';
|
||||
data: User;
|
||||
};
|
||||
|
||||
type Error = {
|
||||
type: 'error';
|
||||
message: string;
|
||||
};
|
||||
|
||||
type Result = Success | Error;
|
||||
|
||||
function handleResult(result: Result) {
|
||||
if (result.type === 'success') {
|
||||
// TypeScript knows result.data exists
|
||||
console.log(result.data);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Generics
|
||||
- Use generics for reusable type patterns
|
||||
- Keep generic names descriptive
|
||||
```typescript
|
||||
// ✅ Correct
|
||||
type ApiResponse<TData> = {
|
||||
data: TData;
|
||||
status: number;
|
||||
message: string;
|
||||
};
|
||||
|
||||
// ❌ Incorrect
|
||||
type ApiResponse<T> = {
|
||||
data: T;
|
||||
status: number;
|
||||
message: string;
|
||||
};
|
||||
```
|
||||
|
||||
### Type Exports
|
||||
- Export types when they're used across files
|
||||
- Keep type definitions close to their usage
|
||||
```typescript
|
||||
// types.ts
|
||||
export type User = {
|
||||
id: string;
|
||||
name: string;
|
||||
};
|
||||
|
||||
// UserComponent.tsx
|
||||
import { type User } from './types';
|
||||
```
|
||||
|
||||
### Utility Types
|
||||
- Leverage TypeScript utility types
|
||||
- Create custom utility types for repeated patterns
|
||||
```typescript
|
||||
// Built-in utility types
|
||||
type UserPartial = Partial<User>;
|
||||
type UserReadonly = Readonly<User>;
|
||||
|
||||
// Custom utility types
|
||||
type NonNullableProperties<T> = {
|
||||
[P in keyof T]: NonNullable<T[P]>;
|
||||
};
|
||||
```
|
||||
@@ -0,0 +1,99 @@
|
||||
# Twenty Development Rules
|
||||
|
||||
## General
|
||||
- Twenty is an open source CRM built with Typescript (React, NestJS)
|
||||
|
||||
### Main Packages / folders
|
||||
- packages/twenty-front: Main Frontend (React)
|
||||
- packages/twenty-server: Main Backend (NestJS)
|
||||
- packages/twenty-website: Marketing website + docs (NextJS)
|
||||
- packages/twenty-ui: UI library (React)
|
||||
- packages/twenty-shared: Shared utils, constants, types
|
||||
|
||||
### Development Stack
|
||||
- Package Manager: yarn
|
||||
- Monorepo: nx
|
||||
- Database: PostgreSQL + TypeORM (core, metadata schemas)
|
||||
- State Management: Recoil
|
||||
- Data Management: Apollo / GraphQL
|
||||
- Cache: redis
|
||||
- Auth: JWT
|
||||
- Queue: BullMQ
|
||||
- Storage: S3/local filesystem
|
||||
- Testing Backend: Jest, Supertest
|
||||
- Testing Frontend: Jest, Storybook, MSW
|
||||
- Testing E2E: Playwright
|
||||
|
||||
## Styling
|
||||
- Use @emotion/styled, never CSS classes/Tailwind
|
||||
- Prefix styled components with 'Styled'
|
||||
- Keep styled components at top of file
|
||||
- Use Theme object for colors/spacing/typography
|
||||
- Use Theme values instead of px/rem
|
||||
- Use mq helper for media queries
|
||||
|
||||
## TypeScript
|
||||
- No 'any' type - use proper typing
|
||||
- Use type over interface
|
||||
- String literals over enums (except GraphQL)
|
||||
- Props suffix for component props types
|
||||
- Use type inference when possible
|
||||
- Enable strict mode and noImplicitAny
|
||||
|
||||
## React
|
||||
- Only functional components
|
||||
- Named exports only
|
||||
- No useEffect, prefer event handlers
|
||||
- Small focused components
|
||||
- Proper prop naming (onClick, isActive)
|
||||
- Destructure props with types
|
||||
|
||||
## State Management
|
||||
- Recoil for global state
|
||||
- Apollo Client for GraphQL/server state
|
||||
- Atoms in states/ directory
|
||||
- Multiple small atoms over prop drilling
|
||||
- No useRef for state
|
||||
- Extract data fetching to siblings
|
||||
- useRecoilValue/useRecoilState appropriately
|
||||
|
||||
## File Structure
|
||||
- One component per file
|
||||
- Features in modules/
|
||||
- Hooks in hooks/
|
||||
- States in states/
|
||||
- Types in types/
|
||||
- PascalCase components, camelCase others
|
||||
|
||||
## Translation
|
||||
- Use @lingui/react/macro
|
||||
- Use <Trans> within components
|
||||
- Use t`string` elsewhere (from useLingui hook)
|
||||
- Don't translate metadata (field names, object names, etc)
|
||||
- Don't translate mocks
|
||||
|
||||
## Code Style
|
||||
- Early returns
|
||||
- No nested ternaries
|
||||
- No else-if
|
||||
- Optional chaining over &&
|
||||
- Small focused functions
|
||||
- Clear variable names
|
||||
- No console.logs in commits
|
||||
- Few comments, prefer code readability
|
||||
|
||||
## GraphQL
|
||||
- Use gql tag
|
||||
- Separate operation files
|
||||
- Proper codegen typing
|
||||
- Consistent naming (getX, updateX)
|
||||
- Use fragments
|
||||
- Use generated types
|
||||
|
||||
## Testing
|
||||
- Test every feature
|
||||
- React Testing Library
|
||||
- Test behavior not implementation
|
||||
- Mock external deps
|
||||
- Use data-testid
|
||||
- Follow naming conventions
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['plugin:prettier/recommended', 'plugin:lingui/recommended'],
|
||||
plugins: [
|
||||
'@nx',
|
||||
'prefer-arrow',
|
||||
'import',
|
||||
'unused-imports',
|
||||
'unicorn',
|
||||
'lingui',
|
||||
],
|
||||
rules: {
|
||||
'lingui/no-single-variables-to-translate': 'off',
|
||||
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
|
||||
'no-console': ['warn', { allow: ['group', 'groupCollapsed', 'groupEnd'] }],
|
||||
'no-control-regex': 0,
|
||||
'no-debugger': 'error',
|
||||
'no-duplicate-imports': 'error',
|
||||
'no-undef': 'off',
|
||||
'no-unused-vars': 'off',
|
||||
|
||||
'@nx/enforce-module-boundaries': [
|
||||
'error',
|
||||
{
|
||||
enforceBuildableLibDependency: true,
|
||||
allow: [],
|
||||
depConstraints: [
|
||||
{
|
||||
sourceTag: 'scope:shared',
|
||||
onlyDependOnLibsWithTags: ['scope:shared'],
|
||||
},
|
||||
{
|
||||
sourceTag: 'scope:backend',
|
||||
onlyDependOnLibsWithTags: ['scope:shared', 'scope:backend'],
|
||||
},
|
||||
{
|
||||
sourceTag: 'scope:frontend',
|
||||
onlyDependOnLibsWithTags: ['scope:shared', 'scope:frontend'],
|
||||
},
|
||||
{
|
||||
sourceTag: 'scope:zapier',
|
||||
onlyDependOnLibsWithTags: ['scope:shared'],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
'import/no-relative-packages': 'error',
|
||||
'import/no-useless-path-segments': 'error',
|
||||
'import/no-duplicates': ['error', { considerQueryString: true }],
|
||||
|
||||
'prefer-arrow/prefer-arrow-functions': [
|
||||
'error',
|
||||
{
|
||||
disallowPrototype: true,
|
||||
singleReturnOnly: false,
|
||||
classPropertiesAllowed: false,
|
||||
},
|
||||
],
|
||||
|
||||
'unused-imports/no-unused-imports': 'warn',
|
||||
'unused-imports/no-unused-vars': [
|
||||
'warn',
|
||||
{
|
||||
vars: 'all',
|
||||
varsIgnorePattern: '^_',
|
||||
args: 'after-used',
|
||||
argsIgnorePattern: '^_',
|
||||
},
|
||||
],
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['**/*.ts', '**/*.tsx'],
|
||||
extends: ['plugin:@nx/typescript'],
|
||||
rules: {
|
||||
'@typescript-eslint/ban-ts-comment': 'error',
|
||||
'@typescript-eslint/consistent-type-imports': [
|
||||
'error',
|
||||
{ prefer: 'no-type-imports' },
|
||||
],
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/interface-name-prefix': 'off',
|
||||
'@typescript-eslint/no-empty-interface': [
|
||||
'error',
|
||||
{
|
||||
allowSingleExtends: true,
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'warn',
|
||||
{
|
||||
vars: 'all',
|
||||
varsIgnorePattern: '^_',
|
||||
args: 'after-used',
|
||||
argsIgnorePattern: '^_',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['*.js', '*.jsx'],
|
||||
extends: ['plugin:@nx/javascript'],
|
||||
rules: {},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
'*.spec.@(ts|tsx|js|jsx)',
|
||||
'*.integration-spec.@(ts|tsx|js|jsx)',
|
||||
'*.test.@(ts|tsx|js|jsx)',
|
||||
],
|
||||
env: {
|
||||
jest: true,
|
||||
},
|
||||
rules: {
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/constants/*.ts', '**/*.constants.ts'],
|
||||
rules: {
|
||||
'@typescript-eslint/naming-convention': [
|
||||
'error',
|
||||
{
|
||||
selector: 'variable',
|
||||
format: ['UPPER_CASE'],
|
||||
},
|
||||
],
|
||||
'unicorn/filename-case': [
|
||||
'warn',
|
||||
{
|
||||
cases: {
|
||||
pascalCase: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
'@nx/workspace-max-consts-per-file': ['error', { max: 1 }],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['*.json'],
|
||||
parser: 'jsonc-eslint-parser',
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -1,149 +0,0 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['plugin:prettier/recommended', 'plugin:lingui/recommended'],
|
||||
ignorePatterns: ['node_modules'],
|
||||
plugins: [
|
||||
'@nx',
|
||||
'prefer-arrow',
|
||||
'import',
|
||||
'unused-imports',
|
||||
'unicorn',
|
||||
'lingui',
|
||||
],
|
||||
rules: {
|
||||
'lingui/no-single-variables-to-translate': 'off',
|
||||
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
|
||||
'no-console': ['warn', { allow: ['group', 'groupCollapsed', 'groupEnd'] }],
|
||||
'no-control-regex': 0,
|
||||
'no-debugger': 'error',
|
||||
'no-duplicate-imports': 'error',
|
||||
'no-undef': 'off',
|
||||
'no-unused-vars': 'off',
|
||||
|
||||
'@nx/enforce-module-boundaries': [
|
||||
'error',
|
||||
{
|
||||
enforceBuildableLibDependency: true,
|
||||
allow: [],
|
||||
depConstraints: [
|
||||
{
|
||||
sourceTag: 'scope:shared',
|
||||
onlyDependOnLibsWithTags: ['scope:shared'],
|
||||
},
|
||||
{
|
||||
sourceTag: 'scope:backend',
|
||||
onlyDependOnLibsWithTags: ['scope:shared', 'scope:backend'],
|
||||
},
|
||||
{
|
||||
sourceTag: 'scope:frontend',
|
||||
onlyDependOnLibsWithTags: ['scope:shared', 'scope:frontend'],
|
||||
},
|
||||
{
|
||||
sourceTag: 'scope:zapier',
|
||||
onlyDependOnLibsWithTags: ['scope:shared'],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
'import/no-relative-packages': 'error',
|
||||
'import/no-useless-path-segments': 'error',
|
||||
'import/no-duplicates': ['error', { considerQueryString: true }],
|
||||
|
||||
'prefer-arrow/prefer-arrow-functions': [
|
||||
'error',
|
||||
{
|
||||
disallowPrototype: true,
|
||||
singleReturnOnly: false,
|
||||
classPropertiesAllowed: false,
|
||||
},
|
||||
],
|
||||
|
||||
'unused-imports/no-unused-imports': 'warn',
|
||||
'unused-imports/no-unused-vars': [
|
||||
'warn',
|
||||
{
|
||||
vars: 'all',
|
||||
varsIgnorePattern: '^_',
|
||||
args: 'after-used',
|
||||
argsIgnorePattern: '^_',
|
||||
},
|
||||
],
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['**/*.ts', '**/*.tsx'],
|
||||
extends: ['plugin:@nx/typescript'],
|
||||
rules: {
|
||||
'@typescript-eslint/ban-ts-comment': 'error',
|
||||
'@typescript-eslint/consistent-type-imports': [
|
||||
'error',
|
||||
{ prefer: 'no-type-imports' },
|
||||
],
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/interface-name-prefix': 'off',
|
||||
'@typescript-eslint/no-empty-interface': [
|
||||
'error',
|
||||
{
|
||||
allowSingleExtends: true,
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'warn',
|
||||
{
|
||||
vars: 'all',
|
||||
varsIgnorePattern: '^_',
|
||||
args: 'after-used',
|
||||
argsIgnorePattern: '^_',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['*.js', '*.jsx'],
|
||||
extends: ['plugin:@nx/javascript'],
|
||||
rules: {},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
'*.spec.@(ts|tsx|js|jsx)',
|
||||
'*.integration-spec.@(ts|tsx|js|jsx)',
|
||||
'*.test.@(ts|tsx|js|jsx)',
|
||||
],
|
||||
env: {
|
||||
jest: true,
|
||||
},
|
||||
rules: {
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/constants/*.ts', '**/*.constants.ts'],
|
||||
rules: {
|
||||
'@typescript-eslint/naming-convention': [
|
||||
'error',
|
||||
{
|
||||
selector: 'variable',
|
||||
format: ['UPPER_CASE'],
|
||||
},
|
||||
],
|
||||
'unicorn/filename-case': [
|
||||
'warn',
|
||||
{
|
||||
cases: {
|
||||
pascalCase: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
'@nx/workspace-max-consts-per-file': ['error', { max: 1 }],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['*.json'],
|
||||
parser: 'jsonc-eslint-parser',
|
||||
},
|
||||
],
|
||||
};
|
||||
+5
-114
@@ -6,74 +6,14 @@ module.exports = {
|
||||
'plugin:react/recommended',
|
||||
'plugin:react-hooks/recommended',
|
||||
'plugin:storybook/recommended',
|
||||
'plugin:prettier/recommended',
|
||||
'plugin:lingui/recommended',
|
||||
'plugin:@nx/typescript'
|
||||
],
|
||||
plugins: ['react-hooks', 'react-refresh', '@nx', 'prefer-arrow', 'import', 'unused-imports', 'unicorn', 'lingui'],
|
||||
rules: {
|
||||
'lingui/no-single-variables-to-translate': 'off',
|
||||
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
|
||||
'no-console': ['warn', { allow: ['group', 'groupCollapsed', 'groupEnd'] }],
|
||||
'no-control-regex': 0,
|
||||
'no-debugger': 'error',
|
||||
'no-duplicate-imports': 'error',
|
||||
'no-undef': 'off',
|
||||
'no-unused-vars': 'off',
|
||||
|
||||
'@nx/enforce-module-boundaries': [
|
||||
'error',
|
||||
{
|
||||
enforceBuildableLibDependency: true,
|
||||
allow: [],
|
||||
depConstraints: [
|
||||
{
|
||||
sourceTag: 'scope:shared',
|
||||
onlyDependOnLibsWithTags: ['scope:shared'],
|
||||
},
|
||||
{
|
||||
sourceTag: 'scope:backend',
|
||||
onlyDependOnLibsWithTags: ['scope:shared', 'scope:backend'],
|
||||
},
|
||||
{
|
||||
sourceTag: 'scope:frontend',
|
||||
onlyDependOnLibsWithTags: ['scope:shared', 'scope:frontend'],
|
||||
},
|
||||
{
|
||||
sourceTag: 'scope:zapier',
|
||||
onlyDependOnLibsWithTags: ['scope:shared'],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
'import/no-relative-packages': 'error',
|
||||
'import/no-useless-path-segments': 'error',
|
||||
'import/no-duplicates': ['error', { considerQueryString: true }],
|
||||
|
||||
'prefer-arrow/prefer-arrow-functions': [
|
||||
'error',
|
||||
{
|
||||
disallowPrototype: true,
|
||||
singleReturnOnly: false,
|
||||
classPropertiesAllowed: false,
|
||||
},
|
||||
],
|
||||
|
||||
'unused-imports/no-unused-imports': 'warn',
|
||||
'unused-imports/no-unused-vars': [
|
||||
'warn',
|
||||
{
|
||||
vars: 'all',
|
||||
varsIgnorePattern: '^_',
|
||||
args: 'after-used',
|
||||
argsIgnorePattern: '^_',
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: ['react-hooks', 'react-refresh'],
|
||||
overrides: [
|
||||
{
|
||||
files: ['**/*.ts', '**/*.tsx'],
|
||||
files: ['*.ts', '*.tsx'],
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.base.{json,*.json}'],
|
||||
},
|
||||
rules: {
|
||||
'no-restricted-imports': [
|
||||
'error',
|
||||
@@ -97,14 +37,6 @@ module.exports = {
|
||||
],
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-empty-interface': [
|
||||
'error',
|
||||
{
|
||||
allowSingleExtends: true,
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@nx/workspace-effect-components': 'error',
|
||||
'@nx/workspace-no-hardcoded-colors': 'error',
|
||||
'@nx/workspace-matching-state-variable': 'error',
|
||||
@@ -154,46 +86,5 @@ module.exports = {
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['*.js', '*.jsx'],
|
||||
extends: ['plugin:@nx/javascript'],
|
||||
rules: {},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
'*.test.@(ts|tsx|js|jsx)',
|
||||
],
|
||||
env: {
|
||||
jest: true,
|
||||
},
|
||||
rules: {
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.constants.ts'],
|
||||
rules: {
|
||||
'@typescript-eslint/naming-convention': [
|
||||
'error',
|
||||
{
|
||||
selector: 'variable',
|
||||
format: ['UPPER_CASE'],
|
||||
},
|
||||
],
|
||||
'unicorn/filename-case': [
|
||||
'warn',
|
||||
{
|
||||
cases: {
|
||||
pascalCase: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
'@nx/workspace-max-consts-per-file': ['error', { max: 1 }],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['*.json'],
|
||||
parser: 'jsonc-eslint-parser',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -13,10 +13,14 @@ Good first issues are a great way to start contributing and get familiar with th
|
||||
|
||||
## Issue assignment
|
||||
|
||||
To avoid conflicts, we follow these guidelines:
|
||||
Having multiple contributors address the same issue can cause frustration.
|
||||
|
||||
1. For `Good First Issue` and `Experienced Contributor` issues without `size: long` labels, we'll merge the first PRs that meet our [code quality standards](https://twenty.com/developers). **We don't assign contributors to these issues**. For `priority: high` issues, our core team will step in within days if no adequate contributions are received.
|
||||
2. For `size: long` Issues, assigned contributors have one week to submit their first draft PR.
|
||||
To avoid conflicts, we follow these guidelines:
|
||||
1. If a core team member assigned you the issue within the last three days, your PR takes priority.
|
||||
2. Otherwise, the first submitted PR is prioritized.
|
||||
3. For "size: long" PRs, the assignment period extends to one week.
|
||||
|
||||
Please ensure you're assigned to an issue before starting work.
|
||||
|
||||
## How to Contribute
|
||||
|
||||
@@ -63,4 +67,4 @@ git push origin your-branch-name
|
||||
|
||||
## Reporting Issues
|
||||
|
||||
If you face any issues or have suggestions, please feel free to (create an issue on Twenty's GitHub repository)[https://github.com/twentyhq/twenty/issues/new]. Please provide as much detail as possible.
|
||||
If you face any issues or have suggestions, please feel free to (create an issue on Twenty's GitHub repository)[https://github.com/twentyhq/twenty/issues/new]. Please provide as much detail as possible.
|
||||
@@ -7,11 +7,7 @@ inputs:
|
||||
required: false
|
||||
tasks:
|
||||
required: true
|
||||
configuration:
|
||||
required: false
|
||||
default: 'ci'
|
||||
args:
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
@@ -19,4 +15,4 @@ runs:
|
||||
uses: nrwl/nx-set-shas@v4
|
||||
- name: Run affected command
|
||||
shell: bash
|
||||
run: npx nx affected --nxBail --configuration=${{ inputs.configuration }} -t=${{ inputs.tasks }} --parallel=${{ inputs.parallel }} --exclude='*,!tag:${{ inputs.tag }}' ${{ inputs.args }}
|
||||
run: npx nx affected --nxBail --configuration=ci -t=${{ inputs.tasks }} --parallel=${{ inputs.parallel }} --exclude='*,!tag:${{ inputs.tag }}'
|
||||
@@ -20,7 +20,7 @@ runs:
|
||||
id: cache-primary-key-builder
|
||||
shell: bash
|
||||
run: |
|
||||
echo "CACHE_PRIMARY_KEY_PREFIX=v3-${{ inputs.key }}-${{ github.ref_name }}" >> "${GITHUB_OUTPUT}"
|
||||
echo "CACHE_PRIMARY_KEY_PREFIX=${{ inputs.key }}-${{ github.ref_name }}" >> "${GITHUB_OUTPUT}"
|
||||
- name: Restore cache
|
||||
uses: actions/cache/restore@v4
|
||||
id: restore-cache
|
||||
|
||||
@@ -2,7 +2,7 @@ name: Yarn Install
|
||||
inputs:
|
||||
node-version:
|
||||
required: false
|
||||
default: '22'
|
||||
default: '18'
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
@@ -25,8 +25,8 @@ runs:
|
||||
id: cache-node-modules
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
key: v3-${{ steps.globals.outputs.CACHE_KEY_PREFIX }}-${{github.sha}}
|
||||
restore-keys: v3-${{ steps.globals.outputs.CACHE_KEY_PREFIX }}-
|
||||
key: ${{ steps.globals.outputs.CACHE_KEY_PREFIX }}-${{github.sha}}
|
||||
restore-keys: ${{ steps.globals.outputs.CACHE_KEY_PREFIX }}-
|
||||
path: ${{ steps.globals.outputs.PATH_TO_CACHE }}
|
||||
- name: Install Dependencies
|
||||
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' && steps.cache-node-modules.outputs.cache-matched-key == '' }}
|
||||
|
||||
@@ -1,777 +0,0 @@
|
||||
name: GraphQL and OpenAPI Breaking Changes Detection
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, edited]
|
||||
branches:
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
MAIN_SERVER_PORT: 3000
|
||||
CURRENT_SERVER_PORT: 3002
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
checks: write
|
||||
|
||||
jobs:
|
||||
changed-files-check:
|
||||
uses: ./.github/workflows/changed-files.yaml
|
||||
with:
|
||||
files: |
|
||||
package.json
|
||||
packages/twenty-server/**
|
||||
packages/twenty-emails/**
|
||||
packages/twenty-shared/**
|
||||
|
||||
api-breaking-changes:
|
||||
needs: changed-files-check
|
||||
if: needs.changed-files-check.outputs.any_changed == 'true'
|
||||
timeout-minutes: 45
|
||||
runs-on: depot-ubuntu-24.04-8
|
||||
env:
|
||||
NX_REJECT_UNKNOWN_LOCAL_CACHE: 0
|
||||
services:
|
||||
postgres:
|
||||
image: twentycrm/twenty-postgres-spilo
|
||||
env:
|
||||
PGUSER_SUPERUSER: postgres
|
||||
PGPASSWORD_SUPERUSER: postgres
|
||||
ALLOW_NOSSL: 'true'
|
||||
SPILO_PROVIDER: 'local'
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
redis:
|
||||
image: redis
|
||||
ports:
|
||||
- 6379:6379
|
||||
clickhouse:
|
||||
image: clickhouse/clickhouse-server:latest
|
||||
env:
|
||||
CLICKHOUSE_PASSWORD: clickhousePassword
|
||||
CLICKHOUSE_URL: "http://default:clickhousePassword@localhost:8123/twenty"
|
||||
ports:
|
||||
- 8123:8123
|
||||
- 9000:9000
|
||||
options: >-
|
||||
--health-cmd "clickhouse-client --host=localhost --port=9000 --user=default --password=clickhousePassword --query='SELECT 1'"
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
steps:
|
||||
- name: Checkout current branch
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ./.github/workflows/actions/yarn-install
|
||||
|
||||
- name: Build shared dependencies
|
||||
run: |
|
||||
npx nx build twenty-shared
|
||||
npx nx build twenty-emails
|
||||
|
||||
- name: Build current branch server
|
||||
run: npx nx build twenty-server
|
||||
|
||||
- name: Setup databases
|
||||
run: |
|
||||
PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d postgres -c 'CREATE DATABASE "current_branch";'
|
||||
PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d postgres -c 'CREATE DATABASE "main_branch";'
|
||||
|
||||
- name: Run ClickHouse migrations
|
||||
run: npx nx clickhouse:migrate twenty-server
|
||||
env:
|
||||
CLICKHOUSE_URL: http://default:clickhousePassword@localhost:8123/twenty
|
||||
CLICKHOUSE_PASSWORD: clickhousePassword
|
||||
|
||||
- name: Setup current branch database
|
||||
run: |
|
||||
npx nx reset:env twenty-server
|
||||
# Function to set or update environment variable
|
||||
set_env_var() {
|
||||
local var_name="$1"
|
||||
local var_value="$2"
|
||||
local env_file="packages/twenty-server/.env"
|
||||
|
||||
if grep -q "^${var_name}=" "$env_file"; then
|
||||
sed -i "s|^${var_name}=.*|${var_name}=${var_value}|" "$env_file"
|
||||
else
|
||||
echo "${var_name}=${var_value}" >> "$env_file"
|
||||
fi
|
||||
}
|
||||
|
||||
set_env_var "PG_DATABASE_URL" "postgres://postgres:postgres@localhost:5432/current_branch"
|
||||
set_env_var "NODE_PORT" "${{ env.CURRENT_SERVER_PORT }}"
|
||||
set_env_var "REDIS_URL" "redis://localhost:6379"
|
||||
set_env_var "CLICKHOUSE_URL" "http://default:clickhousePassword@localhost:8123/twenty"
|
||||
set_env_var "CLICKHOUSE_PASSWORD" "clickhousePassword"
|
||||
|
||||
npx nx run twenty-server:database:init:prod
|
||||
npx nx run twenty-server:database:migrate:prod
|
||||
|
||||
- name: Seed current branch database with test data
|
||||
run: |
|
||||
npx nx command-no-deps twenty-server -- workspace:seed:dev
|
||||
|
||||
- name: Start current branch server in background
|
||||
run: |
|
||||
echo "=== Current branch .env file contents ==="
|
||||
cat packages/twenty-server/.env
|
||||
echo "=== Starting current branch server ==="
|
||||
nohup npx nx run twenty-server:start:prod > /tmp/current-server.log 2>&1 &
|
||||
echo $! > /tmp/current-server.pid
|
||||
echo "Current server PID: $(cat /tmp/current-server.pid)"
|
||||
|
||||
- name: Wait for current branch server to be ready
|
||||
run: |
|
||||
echo "Waiting for current branch server to start..."
|
||||
timeout=300
|
||||
interval=5
|
||||
elapsed=0
|
||||
|
||||
while [ $elapsed -lt $timeout ]; do
|
||||
if curl -s "http://localhost:${{ env.CURRENT_SERVER_PORT }}/graphql" > /dev/null 2>&1 && \
|
||||
curl -s "http://localhost:${{ env.CURRENT_SERVER_PORT }}/rest/open-api/core" > /dev/null 2>&1; then
|
||||
echo "Current branch server is ready!"
|
||||
break
|
||||
fi
|
||||
|
||||
echo "Current branch server not ready yet, waiting ${interval}s..."
|
||||
sleep $interval
|
||||
elapsed=$((elapsed + interval))
|
||||
done
|
||||
|
||||
if [ $elapsed -ge $timeout ]; then
|
||||
echo "Timeout waiting for current branch server to start"
|
||||
echo "Current server log:"
|
||||
cat /tmp/current-server.log || echo "No current server log found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Download GraphQL and REST responses from current branch
|
||||
run: |
|
||||
# Admin token from jest-integration.config.ts
|
||||
ADMIN_TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyMDIwMjAyMC05ZTNiLTQ2ZDQtYTU1Ni04OGI5ZGRjMmIwMzQiLCJ3b3Jrc3BhY2VJZCI6IjIwMjAyMDIwLTFjMjUtNGQwMi1iZjI1LTZhZWNjZjdlYTQxOSIsIndvcmtzcGFjZU1lbWJlcklkIjoiMjAyMDIwMjAtMDY4Ny00YzQxLWI3MDctZWQxYmZjYTk3MmE3IiwidXNlcldvcmtzcGFjZUlkIjoiMjAyMDIwMjAtOWUzYi00NmQ0LWE1NTYtODhiOWRkYzJiMDM1IiwiaWF0IjoxNzM5NTQ3NjYxLCJleHAiOjMzMjk3MTQ3NjYxfQ.fbOM9yhr3jWDicPZ1n771usUURiPGmNdeFApsgrbxOw"
|
||||
|
||||
# Load introspection query from file
|
||||
INTROSPECTION_QUERY=$(cat packages/twenty-utils/graphql-introspection-query.graphql)
|
||||
|
||||
# Prepare the query payload
|
||||
QUERY_PAYLOAD=$(echo "$INTROSPECTION_QUERY" | tr '\n' ' ' | sed 's/"/\\"/g')
|
||||
|
||||
echo "Downloading GraphQL schema from current server..."
|
||||
curl -X POST "http://localhost:${{ env.CURRENT_SERVER_PORT }}/graphql" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer ${ADMIN_TOKEN}" \
|
||||
-d "{\"query\":\"${QUERY_PAYLOAD}\"}" \
|
||||
-o current-schema-introspection.json \
|
||||
-w "HTTP Status: %{http_code}\n" \
|
||||
-s
|
||||
|
||||
echo "Downloading GraphQL metadata schema from current server..."
|
||||
curl -X POST "http://localhost:${{ env.CURRENT_SERVER_PORT }}/metadata" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer ${ADMIN_TOKEN}" \
|
||||
-d "{\"query\":\"${QUERY_PAYLOAD}\"}" \
|
||||
-o current-metadata-schema-introspection.json \
|
||||
-w "HTTP Status: %{http_code}\n" \
|
||||
-s
|
||||
|
||||
# Download current branch OpenAPI specs
|
||||
echo "Downloading OpenAPI specifications from current server..."
|
||||
curl -s "http://localhost:${{ env.CURRENT_SERVER_PORT }}/rest/open-api/core" \
|
||||
-H "Authorization: Bearer ${ADMIN_TOKEN}" \
|
||||
-o current-rest-api.json \
|
||||
-w "HTTP Status: %{http_code}\n"
|
||||
|
||||
curl -s "http://localhost:${{ env.CURRENT_SERVER_PORT }}/rest/open-api/metadata" \
|
||||
-H "Authorization: Bearer ${ADMIN_TOKEN}" \
|
||||
-o current-rest-metadata-api.json \
|
||||
-w "HTTP Status: %{http_code}\n"
|
||||
|
||||
# Verify the downloads
|
||||
echo "Current branch files downloaded:"
|
||||
ls -la current-*
|
||||
|
||||
|
||||
- name: Preserve current branch files
|
||||
run: |
|
||||
# Create a temp directory to store current branch files
|
||||
mkdir -p /tmp/current-branch-files
|
||||
|
||||
# Move current branch files to temp directory
|
||||
mv current-* /tmp/current-branch-files/ 2>/dev/null || echo "No current-* files to preserve"
|
||||
|
||||
echo "Preserved current branch files for later restoration"
|
||||
|
||||
- name: Stop current branch server
|
||||
run: |
|
||||
if [ -f /tmp/current-server.pid ]; then
|
||||
echo "Stopping current branch server..."
|
||||
kill $(cat /tmp/current-server.pid) || true
|
||||
# Wait a bit for graceful shutdown
|
||||
sleep 5
|
||||
# Force kill if still running
|
||||
kill -9 $(cat /tmp/current-server.pid) 2>/dev/null || true
|
||||
rm -f /tmp/current-server.pid
|
||||
fi
|
||||
|
||||
- name: Checkout main branch
|
||||
run: |
|
||||
git stash
|
||||
git checkout origin/main
|
||||
git clean -fd
|
||||
|
||||
- name: Install dependencies for main branch
|
||||
uses: ./.github/workflows/actions/yarn-install
|
||||
|
||||
- name: Build main branch dependencies
|
||||
run: |
|
||||
npx nx build twenty-shared
|
||||
npx nx build twenty-emails
|
||||
|
||||
- name: Build main branch server
|
||||
run: npx nx build twenty-server
|
||||
|
||||
- name: Setup main branch database
|
||||
run: |
|
||||
# Function to set or update environment variable
|
||||
set_env_var() {
|
||||
local var_name="$1"
|
||||
local var_value="$2"
|
||||
local env_file="packages/twenty-server/.env"
|
||||
|
||||
if grep -q "^${var_name}=" "$env_file"; then
|
||||
sed -i "s|^${var_name}=.*|${var_name}=${var_value}|" "$env_file"
|
||||
else
|
||||
echo "${var_name}=${var_value}" >> "$env_file"
|
||||
fi
|
||||
}
|
||||
|
||||
set_env_var "PG_DATABASE_URL" "postgres://postgres:postgres@localhost:5432/main_branch"
|
||||
set_env_var "NODE_PORT" "${{ env.MAIN_SERVER_PORT }}"
|
||||
|
||||
npx nx run twenty-server:database:init:prod
|
||||
npx nx run twenty-server:database:migrate:prod
|
||||
|
||||
- name: Seed main branch database with test data
|
||||
run: |
|
||||
npx nx command-no-deps twenty-server -- workspace:seed:dev
|
||||
|
||||
- name: Start main branch server in background
|
||||
run: |
|
||||
echo "=== Main branch .env file contents ==="
|
||||
cat packages/twenty-server/.env
|
||||
echo "=== Starting main branch server ==="
|
||||
nohup npx nx run twenty-server:start:prod > /tmp/main-server.log 2>&1 &
|
||||
echo $! > /tmp/main-server.pid
|
||||
echo "Main server PID: $(cat /tmp/main-server.pid)"
|
||||
|
||||
- name: Wait for main branch server to be ready
|
||||
run: |
|
||||
echo "Waiting for main branch server to start..."
|
||||
timeout=300
|
||||
interval=5
|
||||
elapsed=0
|
||||
|
||||
while [ $elapsed -lt $timeout ]; do
|
||||
if curl -s "http://localhost:${{ env.MAIN_SERVER_PORT }}/graphql" > /dev/null 2>&1 && \
|
||||
curl -s "http://localhost:${{ env.MAIN_SERVER_PORT }}/rest/open-api/core" > /dev/null 2>&1; then
|
||||
echo "Main branch server is ready!"
|
||||
break
|
||||
fi
|
||||
|
||||
echo "Main branch server not ready yet, waiting ${interval}s..."
|
||||
sleep $interval
|
||||
elapsed=$((elapsed + interval))
|
||||
done
|
||||
|
||||
if [ $elapsed -ge $timeout ]; then
|
||||
echo "Timeout waiting for main branch server to start"
|
||||
echo "Main server log:"
|
||||
cat /tmp/main-server.log || echo "No main server log found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Download GraphQL and REST responses from main branch
|
||||
run: |
|
||||
# Admin token from jest-integration.config.ts
|
||||
ADMIN_TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyMDIwMjAyMC05ZTNiLTQ2ZDQtYTU1Ni04OGI5ZGRjMmIwMzQiLCJ3b3Jrc3BhY2VJZCI6IjIwMjAyMDIwLTFjMjUtNGQwMi1iZjI1LTZhZWNjZjdlYTQxOSIsIndvcmtzcGFjZU1lbWJlcklkIjoiMjAyMDIwMjAtMDY4Ny00YzQxLWI3MDctZWQxYmZjYTk3MmE3IiwidXNlcldvcmtzcGFjZUlkIjoiMjAyMDIwMjAtOWUzYi00NmQ0LWE1NTYtODhiOWRkYzJiMDM1IiwiaWF0IjoxNzM5NTQ3NjYxLCJleHAiOjMzMjk3MTQ3NjYxfQ.fbOM9yhr3jWDicPZ1n771usUURiPGmNdeFApsgrbxOw"
|
||||
|
||||
# Load introspection query from file
|
||||
INTROSPECTION_QUERY=$(cat packages/twenty-utils/graphql-introspection-query.graphql)
|
||||
|
||||
# Prepare the query payload
|
||||
QUERY_PAYLOAD=$(echo "$INTROSPECTION_QUERY" | tr '\n' ' ' | sed 's/"/\\"/g')
|
||||
|
||||
echo "Downloading GraphQL schema from main server..."
|
||||
curl -X POST "http://localhost:${{ env.MAIN_SERVER_PORT }}/graphql" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer ${ADMIN_TOKEN}" \
|
||||
-d "{\"query\":\"${QUERY_PAYLOAD}\"}" \
|
||||
-o main-schema-introspection.json \
|
||||
-w "HTTP Status: %{http_code}\n" \
|
||||
-s
|
||||
|
||||
echo "Downloading GraphQL metadata schema from main server..."
|
||||
curl -X POST "http://localhost:${{ env.MAIN_SERVER_PORT }}/metadata" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer ${ADMIN_TOKEN}" \
|
||||
-d "{\"query\":\"${QUERY_PAYLOAD}\"}" \
|
||||
-o main-metadata-schema-introspection.json \
|
||||
-w "HTTP Status: %{http_code}\n" \
|
||||
-s
|
||||
|
||||
# Download main branch OpenAPI specs
|
||||
echo "Downloading OpenAPI specifications from main server..."
|
||||
curl -s "http://localhost:${{ env.MAIN_SERVER_PORT }}/rest/open-api/core" \
|
||||
-H "Authorization: Bearer ${ADMIN_TOKEN}" \
|
||||
-o main-rest-api.json \
|
||||
-w "HTTP Status: %{http_code}\n"
|
||||
|
||||
curl -s "http://localhost:${{ env.MAIN_SERVER_PORT }}/rest/open-api/metadata" \
|
||||
-H "Authorization: Bearer ${ADMIN_TOKEN}" \
|
||||
-o main-rest-metadata-api.json \
|
||||
-w "HTTP Status: %{http_code}\n"
|
||||
|
||||
# Verify the downloads
|
||||
echo "Main branch files downloaded:"
|
||||
ls -la main-*
|
||||
|
||||
|
||||
- name: Restore current branch files
|
||||
run: |
|
||||
# Move current branch files back to working directory
|
||||
mv /tmp/current-branch-files/* . 2>/dev/null || echo "No files to restore"
|
||||
|
||||
# Verify all files are present
|
||||
echo "All API files restored:"
|
||||
ls -la current-* main-* 2>/dev/null || echo "Some files may be missing"
|
||||
|
||||
# Clean up temp directory
|
||||
rm -rf /tmp/current-branch-files
|
||||
|
||||
- name: Install OpenAPI Diff Tool
|
||||
run: |
|
||||
# Using the Java-based OpenAPITools/openapi-diff via Docker
|
||||
echo "Using OpenAPITools/openapi-diff via Docker"
|
||||
|
||||
- name: Generate GraphQL Schema Diff Reports
|
||||
run: |
|
||||
echo "=== INSTALLING GRAPHQL INSPECTOR CLI ==="
|
||||
npm install -g @graphql-inspector/cli
|
||||
|
||||
echo "=== GENERATING GRAPHQL DIFF REPORTS ==="
|
||||
|
||||
# Check if GraphQL schema has changes
|
||||
echo "Checking GraphQL schema for changes..."
|
||||
if graphql-inspector diff main-schema-introspection.json current-schema-introspection.json >/dev/null 2>&1; then
|
||||
echo "✅ No changes in GraphQL schema"
|
||||
# Don't create a diff file for no changes
|
||||
else
|
||||
echo "⚠️ Changes detected in GraphQL schema, generating report..."
|
||||
echo "# GraphQL Schema Changes" > graphql-schema-diff.md
|
||||
echo "" >> graphql-schema-diff.md
|
||||
graphql-inspector diff main-schema-introspection.json current-schema-introspection.json >> graphql-schema-diff.md 2>&1 || {
|
||||
echo "⚠️ **Breaking changes or errors detected in GraphQL schema**" >> graphql-schema-diff.md
|
||||
echo "" >> graphql-schema-diff.md
|
||||
echo "\`\`\`" >> graphql-schema-diff.md
|
||||
graphql-inspector diff main-schema-introspection.json current-schema-introspection.json 2>&1 >> graphql-schema-diff.md || echo "Error generating diff" >> graphql-schema-diff.md
|
||||
echo "\`\`\`" >> graphql-schema-diff.md
|
||||
}
|
||||
fi
|
||||
|
||||
# Check if GraphQL metadata schema has changes
|
||||
echo "Checking GraphQL metadata schema for changes..."
|
||||
if graphql-inspector diff main-metadata-schema-introspection.json current-metadata-schema-introspection.json >/dev/null 2>&1; then
|
||||
echo "✅ No changes in GraphQL metadata schema"
|
||||
# Don't create a diff file for no changes
|
||||
else
|
||||
echo "⚠️ Changes detected in GraphQL metadata schema, generating report..."
|
||||
echo "# GraphQL Metadata Schema Changes" > graphql-metadata-diff.md
|
||||
echo "" >> graphql-metadata-diff.md
|
||||
graphql-inspector diff main-metadata-schema-introspection.json current-metadata-schema-introspection.json >> graphql-metadata-diff.md 2>&1 || {
|
||||
echo "⚠️ **Breaking changes or errors detected in GraphQL metadata schema**" >> graphql-metadata-diff.md
|
||||
echo "" >> graphql-metadata-diff.md
|
||||
echo "\`\`\`" >> graphql-metadata-diff.md
|
||||
graphql-inspector diff main-metadata-schema-introspection.json current-metadata-schema-introspection.json 2>&1 >> graphql-metadata-diff.md || echo "Error generating diff" >> graphql-metadata-diff.md
|
||||
echo "\`\`\`" >> graphql-metadata-diff.md
|
||||
}
|
||||
fi
|
||||
|
||||
# Show summary
|
||||
echo "Generated diff files:"
|
||||
ls -la *-diff.md 2>/dev/null || echo "No diff files generated (no changes detected)"
|
||||
|
||||
- name: Check REST API Breaking Changes
|
||||
run: |
|
||||
echo "=== CHECKING REST API FOR BREAKING CHANGES ==="
|
||||
|
||||
# Use the Java-based openapi-diff via Docker
|
||||
docker run --rm -v "$(pwd):/specs" openapitools/openapi-diff:latest \
|
||||
--json /specs/rest-api-diff.json \
|
||||
/specs/main-rest-api.json /specs/current-rest-api.json || echo "OpenAPI diff completed with exit code $?"
|
||||
|
||||
# Check if the output file was created and is valid JSON
|
||||
if [ -f "rest-api-diff.json" ] && jq empty rest-api-diff.json 2>/dev/null; then
|
||||
# Check for breaking changes using Java openapi-diff JSON structure
|
||||
incompatible=$(jq -r '.incompatible // false' rest-api-diff.json)
|
||||
different=$(jq -r '.different // false' rest-api-diff.json)
|
||||
|
||||
# Count changes
|
||||
new_endpoints=$(jq -r '.newEndpoints | length' rest-api-diff.json 2>/dev/null || echo "0")
|
||||
missing_endpoints=$(jq -r '.missingEndpoints | length' rest-api-diff.json 2>/dev/null || echo "0")
|
||||
changed_operations=$(jq -r '.changedOperations | length' rest-api-diff.json 2>/dev/null || echo "0")
|
||||
|
||||
if [ "$incompatible" = "true" ]; then
|
||||
echo "❌ Breaking changes detected in REST API"
|
||||
|
||||
# Generate breaking changes report
|
||||
echo "# REST API Breaking Changes" > rest-api-diff.md
|
||||
echo "" >> rest-api-diff.md
|
||||
echo "⚠️ **Breaking changes detected that may affect existing API consumers**" >> rest-api-diff.md
|
||||
echo "" >> rest-api-diff.md
|
||||
|
||||
# Parse and format the changes from Java openapi-diff
|
||||
jq -r '
|
||||
if (.missingEndpoints | length) > 0 then
|
||||
"## 🚨 Removed Endpoints (" + (.missingEndpoints | length | tostring) + ")\n" +
|
||||
(.missingEndpoints | map("- **" + .method + " " + .pathUrl + "**: " + (.summary // "")) | join("\n"))
|
||||
else "" end,
|
||||
if (.changedOperations | length) > 0 then
|
||||
"\n## ⚠️ Changed Operations (" + (.changedOperations | length | tostring) + ")\n" +
|
||||
(.changedOperations | map("- **" + .method + " " + .pathUrl + "**: " + (.summary // "Modified operation")) | join("\n"))
|
||||
else "" end,
|
||||
if (.newEndpoints | length) > 0 then
|
||||
"\n## ✅ New Endpoints (" + (.newEndpoints | length | tostring) + ")\n" +
|
||||
(.newEndpoints | map("- " + .method + " " + .pathUrl + ": " + (.summary // "")) | join("\n"))
|
||||
else "" end
|
||||
' rest-api-diff.json >> rest-api-diff.md
|
||||
|
||||
elif [ "$different" = "true" ]; then
|
||||
echo "📝 Non-breaking changes detected ($new_endpoints new endpoints, $missing_endpoints removed, $changed_operations changed)"
|
||||
|
||||
# Generate non-breaking changes report
|
||||
echo "# REST API Changes" > rest-api-diff.md
|
||||
echo "" >> rest-api-diff.md
|
||||
echo "## Summary" >> rest-api-diff.md
|
||||
|
||||
jq -r '
|
||||
if (.newEndpoints | length) > 0 then
|
||||
"### ✅ New Endpoints (" + (.newEndpoints | length | tostring) + ")\n" +
|
||||
(.newEndpoints | map("- " + .method + " " + .pathUrl + ": " + (.summary // "")) | join("\n"))
|
||||
else "" end,
|
||||
if (.changedOperations | length) > 0 then
|
||||
"\n### 🔄 Changed Operations (" + (.changedOperations | length | tostring) + ")\n" +
|
||||
(.changedOperations | map("- " + .method + " " + .pathUrl + ": " + (.summary // "Modified operation")) | join("\n"))
|
||||
else "" end
|
||||
' rest-api-diff.json >> rest-api-diff.md
|
||||
else
|
||||
echo "✅ No changes detected in REST API"
|
||||
# Don't create diff file for no changes
|
||||
fi
|
||||
else
|
||||
echo "⚠️ OpenAPI diff tool could not process the files"
|
||||
|
||||
echo "# REST API Analysis Error" > rest-api-diff.md
|
||||
echo "" >> rest-api-diff.md
|
||||
echo "⚠️ **Error occurred while analyzing REST API changes**" >> rest-api-diff.md
|
||||
echo "" >> rest-api-diff.md
|
||||
echo "## Error Output" >> rest-api-diff.md
|
||||
echo "\`\`\`" >> rest-api-diff.md
|
||||
docker run --rm -v "$(pwd):/specs" openapitools/openapi-diff:latest /specs/main-rest-api.json /specs/current-rest-api.json 2>&1 >> rest-api-diff.md || echo "Could not capture error output"
|
||||
echo "\`\`\`" >> rest-api-diff.md
|
||||
|
||||
# Don't fail the workflow for tool errors
|
||||
echo "::warning::REST API analysis tool error - continuing workflow"
|
||||
fi
|
||||
|
||||
- name: Check REST Metadata API Breaking Changes
|
||||
run: |
|
||||
echo "=== CHECKING REST METADATA API FOR BREAKING CHANGES ==="
|
||||
|
||||
# Use the Java-based openapi-diff for metadata API as well
|
||||
docker run --rm -v "$(pwd):/specs" openapitools/openapi-diff:latest \
|
||||
--json /specs/rest-metadata-api-diff.json \
|
||||
/specs/main-rest-metadata-api.json /specs/current-rest-metadata-api.json || echo "OpenAPI diff completed with exit code $?"
|
||||
|
||||
# Check if the output file was created and is valid JSON
|
||||
if [ -f "rest-metadata-api-diff.json" ] && jq empty rest-metadata-api-diff.json 2>/dev/null; then
|
||||
# Check for breaking changes using Java openapi-diff JSON structure
|
||||
incompatible=$(jq -r '.incompatible // false' rest-metadata-api-diff.json)
|
||||
different=$(jq -r '.different // false' rest-metadata-api-diff.json)
|
||||
|
||||
# Count changes
|
||||
new_endpoints=$(jq -r '.newEndpoints | length' rest-metadata-api-diff.json 2>/dev/null || echo "0")
|
||||
missing_endpoints=$(jq -r '.missingEndpoints | length' rest-metadata-api-diff.json 2>/dev/null || echo "0")
|
||||
changed_operations=$(jq -r '.changedOperations | length' rest-metadata-api-diff.json 2>/dev/null || echo "0")
|
||||
|
||||
if [ "$incompatible" = "true" ]; then
|
||||
echo "❌ Breaking changes detected in REST Metadata API"
|
||||
|
||||
# Generate breaking changes report
|
||||
echo "# REST Metadata API Breaking Changes" > rest-metadata-api-diff.md
|
||||
echo "" >> rest-metadata-api-diff.md
|
||||
echo "⚠️ **Breaking changes detected that may affect existing API consumers**" >> rest-metadata-api-diff.md
|
||||
echo "" >> rest-metadata-api-diff.md
|
||||
|
||||
# Parse and format the changes from Java openapi-diff
|
||||
jq -r '
|
||||
if (.missingEndpoints | length) > 0 then
|
||||
"## 🚨 Removed Endpoints (" + (.missingEndpoints | length | tostring) + ")\n" +
|
||||
(.missingEndpoints | map("- **" + .method + " " + .pathUrl + "**: " + (.summary // "")) | join("\n"))
|
||||
else "" end,
|
||||
if (.changedOperations | length) > 0 then
|
||||
"\n## ⚠️ Changed Operations (" + (.changedOperations | length | tostring) + ")\n" +
|
||||
(.changedOperations | map("- **" + .method + " " + .pathUrl + "**: " + (.summary // "Modified operation")) | join("\n"))
|
||||
else "" end,
|
||||
if (.newEndpoints | length) > 0 then
|
||||
"\n## ✅ New Endpoints (" + (.newEndpoints | length | tostring) + ")\n" +
|
||||
(.newEndpoints | map("- " + .method + " " + .pathUrl + ": " + (.summary // "")) | join("\n"))
|
||||
else "" end
|
||||
' rest-metadata-api-diff.json >> rest-metadata-api-diff.md
|
||||
|
||||
elif [ "$different" = "true" ]; then
|
||||
echo "📝 Non-breaking changes detected ($new_endpoints new endpoints, $missing_endpoints removed, $changed_operations changed)"
|
||||
|
||||
# Generate non-breaking changes report
|
||||
echo "# REST Metadata API Changes" > rest-metadata-api-diff.md
|
||||
echo "" >> rest-metadata-api-diff.md
|
||||
echo "## Summary" >> rest-metadata-api-diff.md
|
||||
|
||||
jq -r '
|
||||
if (.newEndpoints | length) > 0 then
|
||||
"### ✅ New Endpoints (" + (.newEndpoints | length | tostring) + ")\n" +
|
||||
(.newEndpoints | map("- " + .method + " " + .pathUrl + ": " + (.summary // "")) | join("\n"))
|
||||
else "" end,
|
||||
if (.changedOperations | length) > 0 then
|
||||
"\n### 🔄 Changed Operations (" + (.changedOperations | length | tostring) + ")\n" +
|
||||
(.changedOperations | map("- " + .method + " " + .pathUrl + ": " + (.summary // "Modified operation")) | join("\n"))
|
||||
else "" end
|
||||
' rest-metadata-api-diff.json >> rest-metadata-api-diff.md
|
||||
else
|
||||
echo "✅ No changes detected in REST Metadata API"
|
||||
# Don't create diff file for no changes
|
||||
fi
|
||||
else
|
||||
echo "⚠️ OpenAPI diff tool could not process the metadata API files"
|
||||
|
||||
echo "# REST Metadata API Analysis Error" > rest-metadata-api-diff.md
|
||||
echo "" >> rest-metadata-api-diff.md
|
||||
echo "⚠️ **Error occurred while analyzing REST Metadata API changes**" >> rest-metadata-api-diff.md
|
||||
echo "" >> rest-metadata-api-diff.md
|
||||
echo "## Error Output" >> rest-metadata-api-diff.md
|
||||
echo "\`\`\`" >> rest-metadata-api-diff.md
|
||||
docker run --rm -v "$(pwd):/specs" openapitools/openapi-diff:latest /specs/main-rest-metadata-api.json /specs/current-rest-metadata-api.json 2>&1 >> rest-metadata-api-diff.md || echo "Could not capture error output"
|
||||
echo "\`\`\`" >> rest-metadata-api-diff.md
|
||||
|
||||
# Don't fail the workflow for tool errors
|
||||
echo "::warning::REST Metadata API analysis tool error - continuing workflow"
|
||||
fi
|
||||
|
||||
- name: Comment API Changes on PR
|
||||
if: always()
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
let hasChanges = false;
|
||||
let comment = '';
|
||||
|
||||
try {
|
||||
if (fs.existsSync('graphql-schema-diff.md')) {
|
||||
const graphqlDiff = fs.readFileSync('graphql-schema-diff.md', 'utf8');
|
||||
if (graphqlDiff.trim()) {
|
||||
if (!hasChanges) {
|
||||
comment = '## 📊 API Changes Report\n\n';
|
||||
hasChanges = true;
|
||||
}
|
||||
comment += '### GraphQL Schema Changes\n' + graphqlDiff + '\n\n';
|
||||
}
|
||||
}
|
||||
|
||||
if (fs.existsSync('graphql-metadata-diff.md')) {
|
||||
const graphqlMetadataDiff = fs.readFileSync('graphql-metadata-diff.md', 'utf8');
|
||||
if (graphqlMetadataDiff.trim()) {
|
||||
if (!hasChanges) {
|
||||
comment = '## 📊 API Changes Report\n\n';
|
||||
hasChanges = true;
|
||||
}
|
||||
comment += '### GraphQL Metadata Schema Changes\n' + graphqlMetadataDiff + '\n\n';
|
||||
}
|
||||
}
|
||||
|
||||
if (fs.existsSync('rest-api-diff.md')) {
|
||||
const restDiff = fs.readFileSync('rest-api-diff.md', 'utf8');
|
||||
if (restDiff.trim()) {
|
||||
if (!hasChanges) {
|
||||
comment = '## 📊 API Changes Report\n\n';
|
||||
hasChanges = true;
|
||||
}
|
||||
comment += restDiff + '\n\n';
|
||||
}
|
||||
}
|
||||
|
||||
if (fs.existsSync('rest-metadata-api-diff.md')) {
|
||||
const metadataDiff = fs.readFileSync('rest-metadata-api-diff.md', 'utf8');
|
||||
if (metadataDiff.trim()) {
|
||||
if (!hasChanges) {
|
||||
comment = '## 📊 API Changes Report\n\n';
|
||||
hasChanges = true;
|
||||
}
|
||||
comment += metadataDiff + '\n\n';
|
||||
}
|
||||
}
|
||||
|
||||
// Only post comment if there are changes
|
||||
if (hasChanges) {
|
||||
// Check if there are any breaking changes detected
|
||||
let hasBreakingChanges = false;
|
||||
let breakingChangeNote = '';
|
||||
|
||||
// Check for breaking changes in any of the diff files
|
||||
if (fs.existsSync('rest-api-diff.md')) {
|
||||
const restDiff = fs.readFileSync('rest-api-diff.md', 'utf8');
|
||||
if (restDiff.includes('Breaking Changes') || restDiff.includes('🚨') ||
|
||||
restDiff.includes('Removed Endpoints') || restDiff.includes('Changed Operations')) {
|
||||
hasBreakingChanges = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fs.existsSync('rest-metadata-api-diff.md')) {
|
||||
const metadataDiff = fs.readFileSync('rest-metadata-api-diff.md', 'utf8');
|
||||
if (metadataDiff.includes('Breaking Changes') || metadataDiff.includes('🚨') ||
|
||||
metadataDiff.includes('Removed Endpoints') || metadataDiff.includes('Changed Operations')) {
|
||||
hasBreakingChanges = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Also check GraphQL changes for breaking changes indicators
|
||||
if (fs.existsSync('graphql-schema-diff.md')) {
|
||||
const graphqlDiff = fs.readFileSync('graphql-schema-diff.md', 'utf8');
|
||||
if (graphqlDiff.includes('Breaking changes') || graphqlDiff.includes('BREAKING')) {
|
||||
hasBreakingChanges = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fs.existsSync('graphql-metadata-diff.md')) {
|
||||
const graphqlMetadataDiff = fs.readFileSync('graphql-metadata-diff.md', 'utf8');
|
||||
if (graphqlMetadataDiff.includes('Breaking changes') || graphqlMetadataDiff.includes('BREAKING')) {
|
||||
hasBreakingChanges = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Check PR title for "breaking"
|
||||
const prTitle = "${{ github.event.pull_request.title }}";
|
||||
const titleContainsBreaking = prTitle.toLowerCase().includes('breaking');
|
||||
|
||||
if (hasBreakingChanges) {
|
||||
if (titleContainsBreaking) {
|
||||
breakingChangeNote = '\n\n## ✅ Breaking Change Protocol\n\n' +
|
||||
'**This PR title contains "breaking" and breaking changes were detected - the CI will fail as expected.**\n\n' +
|
||||
'📝 **Action Required**: Please add `BREAKING CHANGE:` to your commit message to trigger a major version bump.\n\n' +
|
||||
'Example:\n```\nfeat: add new API endpoint\n\nBREAKING CHANGE: removed deprecated field from User schema\n```';
|
||||
} else {
|
||||
breakingChangeNote = '\n\n## ⚠️ Breaking Change Protocol\n\n' +
|
||||
'**Breaking changes detected but PR title does not contain "breaking" - CI will pass but action needed.**\n\n' +
|
||||
'🔄 **Options**:\n' +
|
||||
'1. **If this IS a breaking change**: Add "breaking" to your PR title and add `BREAKING CHANGE:` to your commit message\n' +
|
||||
'2. **If this is NOT a breaking change**: The API diff tool may have false positives - please review carefully\n\n' +
|
||||
'For breaking changes, add to commit message:\n```\nfeat: add new API endpoint\n\nBREAKING CHANGE: removed deprecated field from User schema\n```';
|
||||
}
|
||||
}
|
||||
|
||||
const COMMENT_MARKER = '<!-- API_CHANGES_REPORT -->';
|
||||
const commentBody = COMMENT_MARKER + '\n' + comment + '⚠️ **Please review these API changes carefully before merging.**' + breakingChangeNote;
|
||||
|
||||
// Get all comments to find existing API changes comment
|
||||
const {data: comments} = await github.rest.issues.listComments({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
});
|
||||
|
||||
// Find our existing comment
|
||||
const botComment = comments.find(comment => comment.body.includes(COMMENT_MARKER));
|
||||
|
||||
if (botComment) {
|
||||
// Update existing comment
|
||||
await github.rest.issues.updateComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
comment_id: botComment.id,
|
||||
body: commentBody
|
||||
});
|
||||
console.log('Updated existing API changes comment');
|
||||
} else {
|
||||
// Create new comment
|
||||
await github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: commentBody
|
||||
});
|
||||
console.log('Created new API changes comment');
|
||||
}
|
||||
} else {
|
||||
console.log('No API changes detected - skipping PR comment');
|
||||
|
||||
// Check if there's an existing comment to remove
|
||||
const {data: comments} = await github.rest.issues.listComments({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
});
|
||||
|
||||
const COMMENT_MARKER = '<!-- API_CHANGES_REPORT -->';
|
||||
const botComment = comments.find(comment => comment.body.includes(COMMENT_MARKER));
|
||||
|
||||
if (botComment) {
|
||||
await github.rest.issues.deleteComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
comment_id: botComment.id,
|
||||
});
|
||||
console.log('Deleted existing API changes comment (no changes detected)');
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('Could not post comment:', error);
|
||||
}
|
||||
|
||||
- name: Cleanup servers
|
||||
if: always()
|
||||
run: |
|
||||
if [ -f /tmp/current-server.pid ]; then
|
||||
kill $(cat /tmp/current-server.pid) || true
|
||||
fi
|
||||
if [ -f /tmp/main-server.pid ]; then
|
||||
kill $(cat /tmp/main-server.pid) || true
|
||||
fi
|
||||
|
||||
- name: Upload API specifications and diffs
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: api-specifications-and-diffs
|
||||
path: |
|
||||
/tmp/main-server.log
|
||||
/tmp/current-server.log
|
||||
*-api.json
|
||||
*-schema-introspection.json
|
||||
*-diff.md
|
||||
*-diff.json
|
||||
|
||||
@@ -39,7 +39,7 @@ jobs:
|
||||
run: npx nx build twenty-chrome-extension
|
||||
ci-chrome-extension-status-check:
|
||||
if: always() && !cancelled()
|
||||
timeout-minutes: 5
|
||||
timeout-minutes: 1
|
||||
runs-on: ubuntu-latest
|
||||
needs: [changed-files-check, chrome-extension-build]
|
||||
steps:
|
||||
|
||||
@@ -124,7 +124,7 @@ jobs:
|
||||
retention-days: 30
|
||||
ci-e2e-status-check:
|
||||
if: always() && !cancelled()
|
||||
timeout-minutes: 5
|
||||
timeout-minutes: 1
|
||||
runs-on: ubuntu-latest
|
||||
needs: [changed-files-check, test]
|
||||
steps:
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
name: CI Emails
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
changed-files-check:
|
||||
uses: ./.github/workflows/changed-files.yaml
|
||||
with:
|
||||
files: |
|
||||
package.json
|
||||
packages/twenty-emails/**
|
||||
emails-test:
|
||||
needs: changed-files-check
|
||||
if: needs.changed-files-check.outputs.any_changed == 'true'
|
||||
timeout-minutes: 10
|
||||
runs-on: depot-ubuntu-24.04-8
|
||||
env:
|
||||
NX_REJECT_UNKNOWN_LOCAL_CACHE: 0
|
||||
steps:
|
||||
- name: Fetch custom Github Actions and base branch history
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install dependencies
|
||||
uses: ./.github/workflows/actions/yarn-install
|
||||
- name: Build twenty-emails
|
||||
run: npx nx build twenty-emails
|
||||
- name: Run email tests
|
||||
run: |
|
||||
# Start the email server in the background
|
||||
npx nx run twenty-emails:start &
|
||||
SERVER_PID=$!
|
||||
|
||||
# Wait for server to start
|
||||
sleep 20
|
||||
|
||||
# Check if server is running
|
||||
if ! curl -s http://localhost:4001/preview/test.email > /dev/null; then
|
||||
echo "Email server failed to start"
|
||||
kill $SERVER_PID
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Kill the server
|
||||
kill $SERVER_PID
|
||||
ci-emails-status-check:
|
||||
if: always() && !cancelled()
|
||||
timeout-minutes: 5
|
||||
runs-on: depot-ubuntu-24.04-8
|
||||
needs: [changed-files-check, emails-test]
|
||||
steps:
|
||||
- name: Fail job if any needs failed
|
||||
if: contains(needs.*.result, 'failure')
|
||||
run: exit 1
|
||||
@@ -189,7 +189,7 @@ jobs:
|
||||
key: ${{ steps.restore-task-cache.outputs.cache-primary-key }}
|
||||
ci-front-status-check:
|
||||
if: always() && !cancelled()
|
||||
timeout-minutes: 5
|
||||
timeout-minutes: 1
|
||||
runs-on: depot-ubuntu-24.04-8
|
||||
needs:
|
||||
[
|
||||
|
||||
@@ -89,29 +89,34 @@ jobs:
|
||||
fi
|
||||
- name: Server / Check for Pending Migrations
|
||||
run: |
|
||||
METADATA_MIGRATION_OUTPUT=$(npx nx run twenty-server:typeorm migration:generate metadata-migration-check -d src/database/typeorm/metadata/metadata.datasource.ts || true)
|
||||
|
||||
CORE_MIGRATION_OUTPUT=$(npx nx run twenty-server:typeorm migration:generate core-migration-check -d src/database/typeorm/core/core.datasource.ts || true)
|
||||
|
||||
METADATA_MIGRATION_FILE=$(ls packages/twenty-server/*metadata-migration-check.ts 2>/dev/null || echo "")
|
||||
CORE_MIGRATION_FILE=$(ls packages/twenty-server/*core-migration-check.ts 2>/dev/null || echo "")
|
||||
|
||||
if [ -n "$CORE_MIGRATION_FILE" ]; then
|
||||
if [ -n "$METADATA_MIGRATION_FILE" ] || [ -n "$CORE_MIGRATION_FILE" ]; then
|
||||
echo "::error::Unexpected migration files were generated. Please create a proper migration manually."
|
||||
echo "$METADATA_MIGRATION_OUTPUT"
|
||||
echo "$CORE_MIGRATION_OUTPUT"
|
||||
|
||||
rm -f packages/twenty-server/*core-migration-check.ts
|
||||
rm -f packages/twenty-server/*metadata-migration-check.ts packages/twenty-server/*core-migration-check.ts
|
||||
|
||||
exit 1
|
||||
fi
|
||||
- name: GraphQL / Check for Pending Generation
|
||||
if: steps.changed-files.outputs.any_changed == 'true'
|
||||
run: |
|
||||
# Run GraphQL generation commands
|
||||
npx nx run twenty-front:graphql:generate
|
||||
npx nx run twenty-front:graphql:generate --configuration=metadata
|
||||
|
||||
# Check if any files were modified
|
||||
if ! git diff --quiet; then
|
||||
echo "::error::GraphQL schema changes detected. Please run 'npx nx run twenty-front:graphql:generate' and 'npx nx run twenty-front:graphql:generate --configuration=metadata' and commit the changes."
|
||||
exit 1
|
||||
GRAPHQL_GENERATE_OUTPUT=$(npx nx run twenty-front:graphql:generate || true)
|
||||
GRAPHQL_METADATA_OUTPUT=$(npx nx run twenty-front:graphql:generate --configuration=metadata || true)
|
||||
if [[ $GRAPHQL_GENERATE_OUTPUT == *"No changes detected"* && $GRAPHQL_METADATA_OUTPUT == *"No changes detected"* ]]; then
|
||||
echo "GraphQL generation check passed."
|
||||
else
|
||||
echo "::error::Unexpected GraphQL changes detected. Please run the required commands and commit the changes."
|
||||
echo "$GRAPHQL_GENERATE_OUTPUT"
|
||||
echo "$GRAPHQL_METADATA_OUTPUT"
|
||||
exit 1
|
||||
fi
|
||||
- name: Save server setup
|
||||
uses: ./.github/workflows/actions/save-cache
|
||||
@@ -145,10 +150,6 @@ jobs:
|
||||
timeout-minutes: 30
|
||||
runs-on: depot-ubuntu-24.04-8
|
||||
needs: server-setup
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shard: [1, 2, 3, 4]
|
||||
services:
|
||||
postgres:
|
||||
image: twentycrm/twenty-postgres-spilo
|
||||
@@ -168,26 +169,8 @@ jobs:
|
||||
image: redis
|
||||
ports:
|
||||
- 6379:6379
|
||||
clickhouse:
|
||||
image: clickhouse/clickhouse-server:latest
|
||||
env:
|
||||
CLICKHOUSE_PASSWORD: clickhousePassword
|
||||
CLICKHOUSE_URL: "http://default:clickhousePassword@localhost:8123/twenty"
|
||||
ports:
|
||||
- 8123:8123
|
||||
- 9000:9000
|
||||
options: >-
|
||||
--health-cmd "clickhouse-client --host=localhost --port=9000 --user=default --password=clickhousePassword --query='SELECT 1'"
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
env:
|
||||
NX_REJECT_UNKNOWN_LOCAL_CACHE: 0
|
||||
NODE_ENV: test
|
||||
ANALYTICS_ENABLED: true
|
||||
CLICKHOUSE_URL: "http://default:clickhousePassword@localhost:8123/twenty"
|
||||
CLICKHOUSE_PASSWORD: clickhousePassword
|
||||
SHARD_COUNTER: 4
|
||||
steps:
|
||||
- name: Fetch custom Github Actions and base branch history
|
||||
uses: actions/checkout@v4
|
||||
@@ -195,13 +178,12 @@ jobs:
|
||||
fetch-depth: 0
|
||||
- name: Install dependencies
|
||||
uses: ./.github/workflows/actions/yarn-install
|
||||
- name: Update .env.test for integrations tests
|
||||
- name: Update .env.test for billing
|
||||
run: |
|
||||
echo "IS_BILLING_ENABLED=true" >> .env.test
|
||||
echo "BILLING_STRIPE_API_KEY=test-api-key" >> .env.test
|
||||
echo "BILLING_STRIPE_BASE_PLAN_PRODUCT_ID=test-base-plan-product-id" >> .env.test
|
||||
echo "BILLING_STRIPE_WEBHOOK_SECRET=test-webhook-secret" >> .env.test
|
||||
echo "BILLING_PLAN_REQUIRED_LINK=http://localhost:3001/stripe-redirection" >> .env.test
|
||||
- name: Restore server setup
|
||||
uses: ./.github/workflows/actions/restore-cache
|
||||
with:
|
||||
@@ -213,22 +195,24 @@ jobs:
|
||||
npx nx build twenty-shared
|
||||
npx nx build twenty-emails
|
||||
- name: Server / Create Test DB
|
||||
env:
|
||||
NODE_ENV: test
|
||||
run: |
|
||||
PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d postgres -c 'CREATE DATABASE "test";'
|
||||
- name: Run ClickHouse migrations
|
||||
run: npx nx clickhouse:migrate twenty-server
|
||||
- name: Run ClickHouse seeds
|
||||
run: npx nx clickhouse:seed twenty-server
|
||||
- name: Server / Run Integration Tests
|
||||
uses: ./.github/workflows/actions/nx-affected
|
||||
with:
|
||||
tag: scope:backend
|
||||
tasks: 'test:integration'
|
||||
configuration: 'with-db-reset'
|
||||
args: --shard=${{ matrix.shard }}/${{ env.SHARD_COUNTER }}
|
||||
tasks: 'test:integration:with-db-reset'
|
||||
- name: Server / Upload reset-logs file
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: reset-logs
|
||||
path: reset-logs.log
|
||||
ci-server-status-check:
|
||||
if: always() && !cancelled()
|
||||
timeout-minutes: 5
|
||||
timeout-minutes: 1
|
||||
runs-on: depot-ubuntu-24.04-8
|
||||
needs: [changed-files-check, server-setup, server-test, server-integration-test]
|
||||
steps:
|
||||
|
||||
@@ -44,7 +44,7 @@ jobs:
|
||||
tasks: ${{ matrix.task }}
|
||||
ci-shared-status-check:
|
||||
if: always() && !cancelled()
|
||||
timeout-minutes: 5
|
||||
timeout-minutes: 1
|
||||
runs-on: ubuntu-latest
|
||||
needs: [changed-files-check, shared-test]
|
||||
steps:
|
||||
|
||||
@@ -30,6 +30,10 @@ jobs:
|
||||
yq eval '.services.server.build.dockerfile = "./packages/twenty-docker/twenty/Dockerfile"' -i docker-compose.yml
|
||||
yq eval '.services.server.restart = "no"' -i docker-compose.yml
|
||||
|
||||
yq eval 'del(.services.db.image)' -i docker-compose.yml
|
||||
yq eval '.services.db.build.context = "../../"' -i docker-compose.yml
|
||||
yq eval '.services.db.build.dockerfile = "./packages/twenty-docker/twenty-postgres-spilo/Dockerfile"' -i docker-compose.yml
|
||||
|
||||
echo "Setting up .env file..."
|
||||
cp .env.example .env
|
||||
echo "Generating secrets..."
|
||||
@@ -84,7 +88,7 @@ jobs:
|
||||
working-directory: ./packages/twenty-docker/
|
||||
ci-test-docker-compose-status-check:
|
||||
if: always() && !cancelled()
|
||||
timeout-minutes: 5
|
||||
timeout-minutes: 1
|
||||
runs-on: ubuntu-latest
|
||||
needs: [changed-files-check, test]
|
||||
steps:
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
name: CI Tinybird
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'package.json'
|
||||
- 'packages/twenty-tinybird/**'
|
||||
|
||||
pull_request:
|
||||
paths:
|
||||
- 'package.json'
|
||||
- 'packages/twenty-tinybird/**'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
uses: tinybirdco/ci/.github/workflows/ci.yml@main
|
||||
with:
|
||||
data_project_dir: packages/twenty-tinybird
|
||||
secrets:
|
||||
tb_admin_token: ${{ secrets.TB_ADMIN_TOKEN }}
|
||||
tb_host: https://api.eu-central-1.aws.tinybird.co
|
||||
@@ -21,7 +21,7 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
danger-js:
|
||||
timeout-minutes: 5
|
||||
timeout-minutes: 3
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.action != 'closed'
|
||||
steps:
|
||||
|
||||
@@ -20,7 +20,7 @@ jobs:
|
||||
website-build:
|
||||
needs: changed-files-check
|
||||
if: needs.changed-files-check.outputs.any_changed == 'true'
|
||||
timeout-minutes: 10
|
||||
timeout-minutes: 3
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
postgres:
|
||||
@@ -56,13 +56,9 @@ jobs:
|
||||
run: npx nx build twenty-website
|
||||
env:
|
||||
DATABASE_PG_URL: postgres://postgres:postgres@localhost:5432/default
|
||||
KEYSTATIC_GITHUB_CLIENT_ID: xxx
|
||||
KEYSTATIC_GITHUB_CLIENT_SECRET: xxx
|
||||
KEYSTATIC_SECRET: xxx
|
||||
NEXT_PUBLIC_KEYSTATIC_GITHUB_APP_SLUG: xxx
|
||||
ci-website-status-check:
|
||||
if: always() && !cancelled()
|
||||
timeout-minutes: 5
|
||||
timeout-minutes: 1
|
||||
runs-on: ubuntu-latest
|
||||
needs: [changed-files-check, website-build]
|
||||
steps:
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
name: 'Preview Environment Dispatch'
|
||||
|
||||
on:
|
||||
# Using pull_request_target instead of pull_request to have access to secrets for external contributors
|
||||
# Security note: This is safe because we're only using the repository-dispatch action with limited scope
|
||||
# and not checking out or running any code from the external contributor's PR
|
||||
pull_request_target:
|
||||
types: [opened, synchronize, reopened, labeled]
|
||||
paths:
|
||||
- packages/twenty-docker/**
|
||||
- packages/twenty-server/**
|
||||
- packages/twenty-front/**
|
||||
- .github/workflows/preview-env-dispatch.yaml
|
||||
- .github/workflows/preview-env-keepalive.yaml
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
trigger-preview:
|
||||
permissions:
|
||||
contents: write
|
||||
actions: write
|
||||
pull-requests: read
|
||||
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.action == 'reopened' || (github.event.action == 'labeled' && github.event.label.name == 'preview-app')
|
||||
timeout-minutes: 5
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Trigger preview environment workflow
|
||||
uses: peter-evans/repository-dispatch@v2
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
repository: ${{ github.repository }}
|
||||
event-type: preview-environment
|
||||
client-payload: '{"pr_number": "${{ github.event.pull_request.number }}", "pr_head_sha": "${{ github.event.pull_request.head.sha }}", "repo_full_name": "${{ github.repository }}"}'
|
||||
@@ -1,150 +0,0 @@
|
||||
name: 'Preview Environment Keep Alive'
|
||||
|
||||
on:
|
||||
repository_dispatch:
|
||||
types: [preview-environment]
|
||||
|
||||
jobs:
|
||||
preview-environment:
|
||||
timeout-minutes: 310
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout PR
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.client_payload.pr_head_sha }}
|
||||
|
||||
- name: Run compose setup
|
||||
run: |
|
||||
echo "Patching docker-compose.yml..."
|
||||
# change image to localbuild using yq
|
||||
yq eval 'del(.services.server.image)' -i packages/twenty-docker/docker-compose.yml
|
||||
yq eval '.services.server.build.context = "../../"' -i packages/twenty-docker/docker-compose.yml
|
||||
yq eval '.services.server.build.dockerfile = "./packages/twenty-docker/twenty/Dockerfile"' -i packages/twenty-docker/docker-compose.yml
|
||||
|
||||
yq eval 'del(.services.worker.image)' -i packages/twenty-docker/docker-compose.yml
|
||||
yq eval '.services.worker.build.context = "../../"' -i packages/twenty-docker/docker-compose.yml
|
||||
yq eval '.services.worker.build.dockerfile = "./packages/twenty-docker/twenty/Dockerfile"' -i packages/twenty-docker/docker-compose.yml
|
||||
|
||||
echo "Setting up .env file..."
|
||||
cp packages/twenty-docker/.env.example packages/twenty-docker/.env
|
||||
|
||||
echo "Generating secrets..."
|
||||
echo "# === Randomly generated secrets ===" >> packages/twenty-docker/.env
|
||||
echo "APP_SECRET=$(openssl rand -base64 32)" >> packages/twenty-docker/.env
|
||||
echo "PG_DATABASE_PASSWORD=$(openssl rand -hex 16)" >> packages/twenty-docker/.env
|
||||
echo "SIGN_IN_PREFILLED=true" >> packages/twenty-docker/.env
|
||||
echo "Docker compose build..."
|
||||
cd packages/twenty-docker/
|
||||
docker compose build
|
||||
working-directory: ./
|
||||
|
||||
- name: Create Tunnel
|
||||
id: expose-tunnel
|
||||
uses: codetalkio/expose-tunnel@v1.5.0
|
||||
with:
|
||||
service: bore.pub
|
||||
port: 3000
|
||||
|
||||
- name: Start services with correct SERVER_URL
|
||||
run: |
|
||||
cd packages/twenty-docker/
|
||||
|
||||
# Update the SERVER_URL with the tunnel URL
|
||||
echo "Setting SERVER_URL to ${{ steps.expose-tunnel.outputs.tunnel-url }}"
|
||||
sed -i '/SERVER_URL=/d' .env
|
||||
echo "SERVER_URL=${{ steps.expose-tunnel.outputs.tunnel-url }}" >> .env
|
||||
|
||||
# Start the services
|
||||
echo "Docker compose up..."
|
||||
docker compose up -d || {
|
||||
echo "Docker compose failed to start"
|
||||
docker compose logs
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo "Waiting for services to be ready..."
|
||||
count=0
|
||||
while [ ! $(docker inspect --format='{{.State.Health.Status}}' twenty-db-1) = "healthy" ] || [ ! $(docker inspect --format='{{.State.Health.Status}}' twenty-server-1) = "healthy" ]; do
|
||||
sleep 5
|
||||
count=$((count+1))
|
||||
if [ $count -gt 60 ]; then
|
||||
echo "Timeout waiting for services to be ready"
|
||||
docker compose logs
|
||||
exit 1
|
||||
fi
|
||||
echo "Still waiting for services... ($count/60)"
|
||||
done
|
||||
|
||||
echo "All services are up and running!"
|
||||
working-directory: ./
|
||||
|
||||
- name: Seed Dev Workspace
|
||||
run: |
|
||||
cd packages/twenty-docker/
|
||||
echo "Seeding full dev workspace..."
|
||||
if ! docker compose exec -T server yarn command:prod -- workspace:seed:dev; then
|
||||
echo "❌ Seeding full dev workspace failed. Dumping server logs..."
|
||||
docker compose logs server
|
||||
exit 1
|
||||
fi
|
||||
working-directory: ./
|
||||
|
||||
- name: Output tunnel URL to logs
|
||||
run: |
|
||||
echo "✅ Preview Environment Ready!"
|
||||
echo "🔗 Preview URL: ${{ steps.expose-tunnel.outputs.tunnel-url }}"
|
||||
echo "⏱️ This environment will be available for 5 hours"
|
||||
|
||||
- name: Post comment on PR
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
const COMMENT_MARKER = '<!-- PR_PREVIEW_ENV -->';
|
||||
const commentBody = `${COMMENT_MARKER}
|
||||
🚀 **Preview Environment Ready!**
|
||||
|
||||
Your preview environment is available at: ${{ steps.expose-tunnel.outputs.tunnel-url }}
|
||||
|
||||
This environment will automatically shut down when the PR is closed or after 5 hours.`;
|
||||
|
||||
// Get all comments
|
||||
const {data: comments} = await github.rest.issues.listComments({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: ${{ github.event.client_payload.pr_number }},
|
||||
});
|
||||
|
||||
// Find our comment
|
||||
const botComment = comments.find(comment => comment.body.includes(COMMENT_MARKER));
|
||||
|
||||
if (botComment) {
|
||||
// Update existing comment
|
||||
await github.rest.issues.updateComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
comment_id: botComment.id,
|
||||
body: commentBody
|
||||
});
|
||||
console.log('Updated existing comment');
|
||||
} else {
|
||||
// Create new comment
|
||||
await github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: ${{ github.event.client_payload.pr_number }},
|
||||
body: commentBody
|
||||
});
|
||||
console.log('Created new comment');
|
||||
}
|
||||
|
||||
- name: Keep tunnel alive for 5 hours
|
||||
run: timeout 300m sleep 18000 # Stop on whichever we reach first (300m or 5hour sleep)
|
||||
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
run: |
|
||||
cd packages/twenty-docker/
|
||||
docker compose down -v
|
||||
working-directory: ./
|
||||
+1
-4
@@ -42,7 +42,4 @@ dump.rdb
|
||||
/flake.lock
|
||||
/flake.nix
|
||||
|
||||
.crowdin.yml
|
||||
.react-email/
|
||||
|
||||
mcp.json
|
||||
.crowdin.yml
|
||||
Vendored
+1
-1
@@ -37,7 +37,7 @@
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "npx",
|
||||
"runtimeVersion": "^22.12.0",
|
||||
"runtimeVersion": "18",
|
||||
"runtimeArgs": [
|
||||
"nx",
|
||||
"run",
|
||||
|
||||
Vendored
+2
-1
@@ -43,11 +43,12 @@
|
||||
],
|
||||
"typescript.preferences.importModuleSpecifier": "non-relative",
|
||||
"search.exclude": {
|
||||
"**/.yarn": true
|
||||
"**/.yarn": true,
|
||||
},
|
||||
"eslint.debug": true,
|
||||
"files.associations": {
|
||||
".cursorrules": "markdown"
|
||||
},
|
||||
"jestrunner.codeLensSelector": "**/*.{test,spec,integration-spec}.{js,jsx,ts,tsx}"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
enableConstraintsChecks: true
|
||||
|
||||
enableHardenedMode: true
|
||||
|
||||
enableInlineHunks: true
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
postgres-on-docker:
|
||||
docker run -d \
|
||||
--name twenty_pg \
|
||||
-e POSTGRES_USER=postgres \
|
||||
-e POSTGRES_PASSWORD=postgres \
|
||||
-e PGUSER_SUPERUSER=postgres \
|
||||
-e PGPASSWORD_SUPERUSER=postgres \
|
||||
-e ALLOW_NOSSL=true \
|
||||
-v twenty_db_data:/var/lib/postgresql/data \
|
||||
-v twenty_db_data:/home/postgres/pgdata \
|
||||
-p 5432:5432 \
|
||||
postgres:16
|
||||
twentycrm/twenty-postgres-spilo:latest
|
||||
@echo "Waiting for PostgreSQL to be ready..."
|
||||
@until docker exec twenty_pg psql -U postgres -d postgres \
|
||||
-c 'SELECT pg_is_in_recovery();' 2>/dev/null | grep -q 'f'; do \
|
||||
@@ -17,7 +17,4 @@ postgres-on-docker:
|
||||
-c "CREATE DATABASE \"test\" WITH OWNER postgres;"
|
||||
|
||||
redis-on-docker:
|
||||
docker run -d --name twenty_redis -p 6379:6379 redis/redis-stack-server:latest
|
||||
|
||||
clickhouse-on-docker:
|
||||
docker run -d --name twenty_clickhouse -p 8123:8123 -p 9000:9000 -e CLICKHOUSE_PASSWORD=clickhousePassword clickhouse/clickhouse-server:latest \
|
||||
docker run -d --name twenty_redis -p 6379:6379 redis/redis-stack-server:latest
|
||||
@@ -1,28 +1,28 @@
|
||||
|
||||
<br />
|
||||
<br>
|
||||
<p align="center">
|
||||
<a href="https://www.twenty.com">
|
||||
<img src="./packages/twenty-website/public/images/core/logo.svg" width="100px" alt="Twenty logo" />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<h2 align="center" >The #1 Open-Source CRM </h2>
|
||||
<h2 align="center" >The #1 Open-Source CRM </h3>
|
||||
|
||||
<p align="center"><a href="https://twenty.com">🌐 Website</a> · <a href="https://twenty.com/developers">📚 Documentation</a> · <a href="https://github.com/orgs/twentyhq/projects/1"><img src="./packages/twenty-website/public/images/readme/planner-icon.svg" width="12" height="12"/> Roadmap </a> · <a href="https://discord.gg/cx5n4Jzs57"><img src="./packages/twenty-website/public/images/readme/discord-icon.svg" width="12" height="12"/> Discord</a> · <a href="https://www.figma.com/file/xt8O9mFeLl46C5InWwoMrN/Twenty"><img src="./packages/twenty-website/public/images/readme/figma-icon.png" width="12" height="12"/> Figma</a></p>
|
||||
<p align="center"><a href="https://twenty.com">🌐 Website</a> · <a href="https://twenty.com/developers">📚 Documentation</a> · <a href="https://github.com/orgs/twentyhq/projects/1"><img src="./packages/twenty-website/public/images/readme/planner-icon.svg" width="12" height="12"/> Roadmap </a> · <a href="https://discord.gg/cx5n4Jzs57"><img src="./packages/twenty-website/public/images/readme/discord-icon.svg" width="12" height="12"/> Discord</a> · <a href="https://www.figma.com/file/xt8O9mFeLl46C5InWwoMrN/Twenty"><img src="./packages/twenty-website/public/images/readme/figma-icon.png" width="12" height="12"/> Figma</a><p>
|
||||
<br />
|
||||
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.twenty.com">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/preview-dark.png" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/preview-light.png" />
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/preview-dark.png">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/preview-light.png">
|
||||
<img src="./packages/twenty-docs/static/img/preview-light.png" alt="Companies view" />
|
||||
</picture>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<br />
|
||||
<br>
|
||||
|
||||
# Installation
|
||||
|
||||
@@ -40,7 +40,7 @@ We built Twenty for three reasons:
|
||||
|
||||
**We believe in Open-source and community.** Hundreds of developers are already building Twenty together. Once we have plugin capabilities, a whole ecosystem will grow around it.
|
||||
|
||||
<br />
|
||||
<br>
|
||||
|
||||
# What You Can Do With Twenty
|
||||
We're currently developing Twenty's beta version.
|
||||
@@ -60,8 +60,8 @@ Below are a few features we have implemented to date:
|
||||
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/index-dark.png" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/index-light.png" />
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/index-dark.png">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/index-light.png">
|
||||
<img src="./packages/twenty-docs/static/img/visualise-customer-light.png" alt="Companies view" />
|
||||
</picture>
|
||||
</p>
|
||||
@@ -70,9 +70,9 @@ Below are a few features we have implemented to date:
|
||||
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/kanban-dark.png" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/kanban-light.png" />
|
||||
<img src="./packages/twenty-docs/static/img/follow-your-deals-light.png" alt="Opportunities view" />
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/kanban-dark.png">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/kanban-light.png">
|
||||
<img src="./packages/twenty-docs/static/img/follow-your-deals-light.png" alt="Companies view" />
|
||||
</picture>
|
||||
</p>
|
||||
|
||||
@@ -80,9 +80,9 @@ Below are a few features we have implemented to date:
|
||||
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/emails-dark.png" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/emails-light.png" />
|
||||
<img src="./packages/twenty-docs/static/img/emails-light.png" alt="Emails" />
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/emails-dark.png">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/emails-light.png">
|
||||
<img src="./packages/twenty-docs/static/img/rich-notes-light.png" alt="Companies view" />
|
||||
</picture>
|
||||
</p>
|
||||
|
||||
@@ -90,9 +90,9 @@ Below are a few features we have implemented to date:
|
||||
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/data-dark.png" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/data-light.png" />
|
||||
<img src="./packages/twenty-docs/static/img/data-light.png" alt="Data model" />
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/data-dark.png">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/data-light.png">
|
||||
<img src="./packages/twenty-docs/static/img/rich-notes-light.png" alt="Companies view" />
|
||||
</picture>
|
||||
</p>
|
||||
|
||||
@@ -100,9 +100,9 @@ Below are a few features we have implemented to date:
|
||||
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/notes-dark.png" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/notes-light.png" />
|
||||
<img src="./packages/twenty-docs/static/img/notes-light.png" alt="Rich notes" />
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/notes-dark.png">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/notes-light.png">
|
||||
<img src="./packages/twenty-docs/static/img/rich-notes-light.png" alt="Companies view" />
|
||||
</picture>
|
||||
</p>
|
||||
|
||||
@@ -110,9 +110,9 @@ Below are a few features we have implemented to date:
|
||||
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/tasks-dark.png" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/tasks-light.png" />
|
||||
<img src="./packages/twenty-docs/static/img/create-tasks-light.png" alt="Tasks" />
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/tasks-dark.png">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/tasks-light.png">
|
||||
<img src="./packages/twenty-docs/static/img/create-tasks-light.png" alt="Companies view" />
|
||||
</picture>
|
||||
</p>
|
||||
|
||||
@@ -120,9 +120,9 @@ Below are a few features we have implemented to date:
|
||||
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/keyboard-dark.png" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/keyboard-light.png" />
|
||||
<img src="./packages/twenty-docs/static/img/keyboard-dark.png" alt="Keyboard shortcuts" />
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/keyboard-dark.png">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/keyboard-light.png">
|
||||
<img src="./packages/twenty-docs/static/img/shortcut-navigation-light.png" alt="Companies view" />
|
||||
</picture>
|
||||
</p>
|
||||
|
||||
@@ -130,33 +130,22 @@ Below are a few features we have implemented to date:
|
||||
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/api-dark.png" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/api-light.png" />
|
||||
<img src="./packages/twenty-docs/static/img/api-light.png" alt="API" />
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/api-dark.png">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/twentyhq/twenty/v0.12.0/packages/twenty-docs/static/img/api-light.png">
|
||||
<img src="./packages/twenty-docs/static/img/shortcut-navigation-light.png" alt="Companies view" />
|
||||
</picture>
|
||||
</p>
|
||||
|
||||
|
||||
<br />
|
||||
<br>
|
||||
|
||||
# Stack
|
||||
- [TypeScript](https://www.typescriptlang.org/)
|
||||
- [Nx](https://nx.dev/)
|
||||
- [NestJS](https://nestjs.com/), with [BullMQ](https://bullmq.io/), [PostgreSQL](https://www.postgresql.org/), [Redis](https://redis.io/)
|
||||
- [React](https://reactjs.org/), with [Recoil](https://recoiljs.org/), [Emotion](https://emotion.sh/) and [Lingui](https://lingui.dev/)
|
||||
|
||||
|
||||
|
||||
# Thanks
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.chromatic.com/"><img src="./packages/twenty-website/public/images/readme/chromatic.png" height="30" alt="Chromatic" /></a>
|
||||
<a href="https://greptile.com"><img src="./packages/twenty-website/public/images/readme/greptile.png" height="30" alt="Greptile" /></a>
|
||||
<a href="https://sentry.io/"><img src="./packages/twenty-website/public/images/readme/sentry.png" height="30" alt="Sentry" /></a>
|
||||
<a href="https://crowdin.com/"><img src="./packages/twenty-website/public/images/readme/crowdin.png" height="30" alt="Crowdin" /></a>
|
||||
</p>
|
||||
|
||||
Thanks to these amazing services that we use and recommend for UI testing (Chromatic), code review (Greptile), catching bugs (Sentry) and translating (Crowdin).
|
||||
- [React](https://reactjs.org/), with [Recoil](https://recoiljs.org/) and [Emotion](https://emotion.sh/)
|
||||
- [Greptile](https://greptile.com) for code reviews.
|
||||
- [Lingui](https://lingui.dev/) and [Crowdin](https://twenty.crowdin.com/twenty) for translations.
|
||||
|
||||
|
||||
# Join the Community
|
||||
|
||||
+31
-28
@@ -1,13 +1,15 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@air/react-drag-to-select": "^5.0.8",
|
||||
"@apollo/client": "^3.7.17",
|
||||
"@apollo/server": "^4.7.3",
|
||||
"@aws-sdk/client-lambda": "^3.700.0",
|
||||
"@aws-sdk/client-s3": "^3.700.0",
|
||||
"@aws-sdk/client-sts": "^3.700.0",
|
||||
"@aws-sdk/credential-providers": "^3.700.0",
|
||||
"@calcom/embed-react": "^1.5.3",
|
||||
"@aws-sdk/client-lambda": "^3.614.0",
|
||||
"@aws-sdk/client-s3": "^3.363.0",
|
||||
"@aws-sdk/client-sts": "^3.744.0",
|
||||
"@aws-sdk/credential-providers": "^3.363.0",
|
||||
"@blocknote/mantine": "^0.22.0",
|
||||
"@blocknote/react": "^0.22.0",
|
||||
"@blocknote/server-util": "0.17.1",
|
||||
"@codesandbox/sandpack-react": "^2.13.5",
|
||||
"@dagrejs/dagre": "^1.1.2",
|
||||
"@emotion/react": "^11.11.1",
|
||||
@@ -22,6 +24,8 @@
|
||||
"@jsdevtools/rehype-toc": "^3.0.2",
|
||||
"@linaria/core": "^6.2.0",
|
||||
"@linaria/react": "^6.2.1",
|
||||
"@lingui/core": "^5.1.2",
|
||||
"@lingui/react": "^5.1.2",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"@microsoft/microsoft-graph-client": "^3.0.7",
|
||||
"@nestjs/apollo": "^11.0.5",
|
||||
@@ -41,15 +45,15 @@
|
||||
"@octokit/graphql": "^7.0.2",
|
||||
"@ptc-org/nestjs-query-core": "^4.2.0",
|
||||
"@ptc-org/nestjs-query-typeorm": "4.2.1-alpha.2",
|
||||
"@react-email/components": "0.0.35",
|
||||
"@react-email/components": "0.0.32",
|
||||
"@react-email/render": "0.0.17",
|
||||
"@sentry/node": "^9.26.0",
|
||||
"@sentry/profiling-node": "^9.26.0",
|
||||
"@sentry/react": "^9.26.0",
|
||||
"@sentry/node": "^8",
|
||||
"@sentry/profiling-node": "^8",
|
||||
"@sentry/react": "^8",
|
||||
"@sniptt/guards": "^0.2.0",
|
||||
"@stoplight/elements": "^8.0.5",
|
||||
"@swc/jest": "^0.2.29",
|
||||
"@tabler/icons-react": "^3.31.0",
|
||||
"@tabler/icons-react": "^2.44.0",
|
||||
"@types/dompurify": "^3.0.5",
|
||||
"@types/facepaint": "^1.2.5",
|
||||
"@types/lodash.camelcase": "^4.3.7",
|
||||
@@ -68,12 +72,12 @@
|
||||
"archiver": "^7.0.1",
|
||||
"axios": "^1.6.2",
|
||||
"bcrypt": "^5.1.1",
|
||||
"better-sqlite3": "^9.2.2",
|
||||
"body-parser": "^1.20.2",
|
||||
"bullmq": "^5.40.0",
|
||||
"bytes": "^3.1.2",
|
||||
"class-transformer": "^0.5.1",
|
||||
"clsx": "^2.1.1",
|
||||
"cron-parser": "^5.1.1",
|
||||
"cron-validate": "^1.4.5",
|
||||
"cross-env": "^7.0.3",
|
||||
"css-loader": "^7.1.2",
|
||||
@@ -90,16 +94,13 @@
|
||||
"facepaint": "^1.2.1",
|
||||
"file-type": "16.5.4",
|
||||
"framer-motion": "^11.18.0",
|
||||
"fuse.js": "^7.1.0",
|
||||
"googleapis": "105",
|
||||
"graphiql": "^3.1.1",
|
||||
"graphql": "16.8.0",
|
||||
"graphql-fields": "^2.0.3",
|
||||
"graphql-middleware": "^6.1.35",
|
||||
"graphql-rate-limit": "^3.3.0",
|
||||
"graphql-redis-subscriptions": "^2.7.0",
|
||||
"graphql-scalars": "^1.23.0",
|
||||
"graphql-sse": "^2.5.4",
|
||||
"graphql-subscriptions": "2.0.0",
|
||||
"graphql-tag": "^2.12.6",
|
||||
"graphql-type-json": "^0.3.2",
|
||||
@@ -140,6 +141,8 @@
|
||||
"next-mdx-remote": "^4.4.1",
|
||||
"nodemailer": "^6.9.8",
|
||||
"openapi-types": "^12.1.3",
|
||||
"overlayscrollbars": "^2.6.1",
|
||||
"overlayscrollbars-react": "^0.5.4",
|
||||
"passport": "^0.7.0",
|
||||
"passport-google-oauth20": "^2.0.0",
|
||||
"passport-jwt": "^4.0.1",
|
||||
@@ -181,13 +184,13 @@
|
||||
"semver": "^7.5.4",
|
||||
"sharp": "^0.32.1",
|
||||
"slash": "^5.1.0",
|
||||
"storybook-addon-mock-date": "^0.6.0",
|
||||
"stripe": "^17.3.1",
|
||||
"ts-key-enum": "^2.0.12",
|
||||
"tslib": "^2.3.0",
|
||||
"tsup": "^8.2.4",
|
||||
"type-fest": "4.10.1",
|
||||
"typescript": "5.3.3",
|
||||
"use-context-selector": "^2.0.0",
|
||||
"use-debounce": "^10.0.0",
|
||||
"uuid": "^9.0.0",
|
||||
"vite-tsconfig-paths": "^4.2.1",
|
||||
@@ -204,6 +207,9 @@
|
||||
"@graphql-codegen/typescript": "^3.0.4",
|
||||
"@graphql-codegen/typescript-operations": "^3.0.4",
|
||||
"@graphql-codegen/typescript-react-apollo": "^3.3.7",
|
||||
"@lingui/cli": "^5.1.2",
|
||||
"@lingui/swc-plugin": "^5.1.0",
|
||||
"@lingui/vite-plugin": "^5.1.2",
|
||||
"@microsoft/microsoft-graph-types": "^2.40.0",
|
||||
"@nestjs/cli": "^9.0.0",
|
||||
"@nestjs/schematics": "^9.0.0",
|
||||
@@ -218,7 +224,7 @@
|
||||
"@nx/vite": "18.3.3",
|
||||
"@nx/web": "18.3.3",
|
||||
"@playwright/test": "^1.46.0",
|
||||
"@sentry/types": "^8",
|
||||
"@sentry/types": "^7.109.0",
|
||||
"@storybook/addon-actions": "^7.6.3",
|
||||
"@storybook/addon-coverage": "^1.0.0",
|
||||
"@storybook/addon-essentials": "^7.6.7",
|
||||
@@ -239,11 +245,12 @@
|
||||
"@swc/cli": "^0.3.12",
|
||||
"@swc/core": "1.7.42",
|
||||
"@swc/helpers": "~0.5.2",
|
||||
"@testing-library/jest-dom": "^6.6.3",
|
||||
"@testing-library/react": "^16.3.0",
|
||||
"@testing-library/jest-dom": "^6.1.5",
|
||||
"@testing-library/react": "14.0.0",
|
||||
"@types/addressparser": "^1.0.3",
|
||||
"@types/apollo-upload-client": "^17.0.2",
|
||||
"@types/bcrypt": "^5.0.0",
|
||||
"@types/better-sqlite3": "^7.6.8",
|
||||
"@types/bytes": "^3.1.1",
|
||||
"@types/chrome": "^0.0.267",
|
||||
"@types/deep-equal": "^1.0.1",
|
||||
@@ -270,7 +277,7 @@
|
||||
"@types/lodash.upperfirst": "^4.3.7",
|
||||
"@types/luxon": "^3.3.0",
|
||||
"@types/ms": "^0.7.31",
|
||||
"@types/node": "^22.0.0",
|
||||
"@types/node": "18.19.26",
|
||||
"@types/passport-google-oauth20": "^2.0.11",
|
||||
"@types/passport-jwt": "^3.0.8",
|
||||
"@types/pluralize": "^0.0.33",
|
||||
@@ -286,7 +293,6 @@
|
||||
"@typescript-eslint/utils": "6.21.0",
|
||||
"@vitejs/plugin-react-swc": "^3.5.0",
|
||||
"@vitest/ui": "1.4.0",
|
||||
"@yarnpkg/types": "^4.0.0",
|
||||
"chromatic": "^6.18.0",
|
||||
"concurrently": "^8.2.2",
|
||||
"cross-var": "^1.1.0",
|
||||
@@ -312,7 +318,7 @@
|
||||
"eslint-plugin-unused-imports": "^3.0.0",
|
||||
"http-server": "^14.1.1",
|
||||
"jest": "29.7.0",
|
||||
"jest-environment-jsdom": "30.0.0-beta.3",
|
||||
"jest-environment-jsdom": "29.7.0",
|
||||
"jest-environment-node": "^29.4.1",
|
||||
"jest-fetch-mock": "^3.0.3",
|
||||
"jsdom": "~22.1.0",
|
||||
@@ -334,15 +340,14 @@
|
||||
"ts-node": "10.9.1",
|
||||
"tsconfig-paths": "^4.2.0",
|
||||
"tsx": "^4.17.0",
|
||||
"vite": "^6.3.5",
|
||||
"vite": "^5.4.0",
|
||||
"vite-plugin-checker": "^0.6.2",
|
||||
"vite-plugin-cjs-interop": "^2.2.0",
|
||||
"vite-plugin-dts": "3.8.1",
|
||||
"vite-plugin-svgr": "^4.2.0",
|
||||
"vitest": "1.4.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^22.12.0",
|
||||
"node": "^18.17.1",
|
||||
"npm": "please-use-yarn",
|
||||
"yarn": ">=4.0.2"
|
||||
},
|
||||
@@ -353,9 +358,7 @@
|
||||
"graphql": "16.8.0",
|
||||
"type-fest": "4.10.1",
|
||||
"typescript": "5.3.3",
|
||||
"graphql-redis-subscriptions/ioredis": "^5.6.0",
|
||||
"prosemirror-view": "1.40.0",
|
||||
"prosemirror-transform": "1.10.4"
|
||||
"prosemirror-model": "1.23.0"
|
||||
},
|
||||
"version": "0.2.1",
|
||||
"nx": {},
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['../../.eslintrc.global.cjs', '../../.eslintrc.react.cjs'],
|
||||
ignorePatterns: [
|
||||
'node_modules',
|
||||
'dist',
|
||||
'**/generated/*',
|
||||
],
|
||||
extends: ['../../.eslintrc.cjs', '../../.eslintrc.react.cjs'],
|
||||
ignorePatterns: ['!**/*', 'node_modules', 'dist', '**/generated/*'],
|
||||
overrides: [
|
||||
{
|
||||
files: ['**/*.ts', '**/*.tsx'],
|
||||
files: ['*.ts', '*.tsx'],
|
||||
parserOptions: {
|
||||
project: ['packages/twenty-chrome-extension/tsconfig.*.json'],
|
||||
project: ['packages/twenty-chrome-extension/tsconfig.{json,*.json}'],
|
||||
},
|
||||
rules: {
|
||||
'@nx/workspace-explicit-boolean-predicates-in-if': 'warn',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="images/icons/android/android-launchericon-48-48.png" />
|
||||
<link rel="icon" href="/icons/android/android-launchericon-48-48.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Twenty</title>
|
||||
</head>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="images/icons/android/android-launchericon-48-48.png" />
|
||||
<link rel="icon" href="/icons/android/android-launchericon-48-48.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Twenty</title>
|
||||
</head>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="images/icons/android/android-launchericon-48-48.png" />
|
||||
<link rel="icon" href="/icons/android/android-launchericon-48-48.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Twenty</title>
|
||||
<style>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
// Open options page programmatically in a new tab.
|
||||
// chrome.runtime.onInstalled.addListener((details) => {
|
||||
// if (details.reason === 'install') {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
interface CustomDiv extends HTMLDivElement {
|
||||
onClickHandler: (newHandler: () => void) => void;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { createDefaultButton } from '~/contentScript/createButton';
|
||||
import changeSidePanelUrl from '~/contentScript/utils/changeSidepanelUrl';
|
||||
import extractCompanyLinkedinLink from '~/contentScript/utils/extractCompanyLinkedinLink';
|
||||
import extractDomain from '~/contentScript/utils/extractDomain';
|
||||
import { createCompany, fetchCompany } from '~/db/company.db';
|
||||
import { CompanyInput } from '~/db/types/company.types';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
export const checkIfCompanyExists = async () => {
|
||||
const { tab: activeTab } = await chrome.runtime.sendMessage({
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { createDefaultButton } from '~/contentScript/createButton';
|
||||
import changeSidePanelUrl from '~/contentScript/utils/changeSidepanelUrl';
|
||||
import extractFirstAndLastName from '~/contentScript/utils/extractFirstAndLastName';
|
||||
import { createPerson, fetchPerson } from '~/db/person.db';
|
||||
import { PersonInput } from '~/db/types/person.types';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
export const checkIfPersonExists = async () => {
|
||||
const { tab: activeTab } = await chrome.runtime.sendMessage({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { insertButtonForCompany } from '~/contentScript/extractCompanyProfile';
|
||||
import { insertButtonForPerson } from '~/contentScript/extractPersonProfile';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
// Inject buttons into the DOM when SPA is reloaded on the resource url.
|
||||
// e.g. reload the page when on https://www.linkedin.com/in/mabdullahabaid/
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
const btn = document.getElementById('twenty-settings-btn');
|
||||
if (!isDefined(btn)) {
|
||||
const div = document.createElement('div');
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
const changeSidePanelUrl = async (url: string) => {
|
||||
if (isDefined(url)) {
|
||||
chrome.storage.local.set({ navigateSidepanel: 'sidepanel' });
|
||||
|
||||
+4
-1
@@ -1,4 +1,7 @@
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
// Extract "https://www.linkedin.com/company/twenty/" from any of the following urls, which the user can visit while on the company page.
|
||||
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
// "https://www.linkedin.com/company/twenty/" "https://www.linkedin.com/company/twenty/about/" "https://www.linkedin.com/company/twenty/people/".
|
||||
const extractCompanyLinkedinLink = (activeTabUrl: string) => {
|
||||
// Regular expression to match the company ID
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import {
|
||||
ExchangeAuthCodeInput,
|
||||
ExchangeAuthCodeResponse,
|
||||
@@ -5,7 +6,6 @@ import {
|
||||
} from '~/db/types/auth.types';
|
||||
import { EXCHANGE_AUTHORIZATION_CODE } from '~/graphql/auth/mutations';
|
||||
import { callMutation } from '~/utils/requestDb';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
export const exchangeAuthorizationCode = async (
|
||||
exchangeAuthCodeInput: ExchangeAuthCodeInput,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import {
|
||||
CompanyInput,
|
||||
CreateCompanyResponse,
|
||||
@@ -8,7 +9,6 @@ import { CREATE_COMPANY } from '~/graphql/company/mutations';
|
||||
import { FIND_COMPANY } from '~/graphql/company/queries';
|
||||
|
||||
import { callMutation, callQuery } from '../utils/requestDb';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
export const fetchCompany = async (
|
||||
companyfilerInput: CompanyFilterInput,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import {
|
||||
CreatePersonResponse,
|
||||
FindPersonResponse,
|
||||
@@ -8,7 +9,6 @@ import { CREATE_PERSON } from '~/graphql/person/mutations';
|
||||
import { FIND_PERSON } from '~/graphql/person/queries';
|
||||
|
||||
import { callMutation, callQuery } from '../utils/requestDb';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
export const fetchPerson = async (
|
||||
personFilterData: PersonFilterInput,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { ApolloClient, InMemoryCache } from '@apollo/client';
|
||||
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { Tokens } from '~/db/types/auth.types';
|
||||
import { RENEW_TOKEN } from '~/graphql/auth/mutations';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
export const renewToken = async (
|
||||
appToken: string,
|
||||
|
||||
@@ -6358,7 +6358,7 @@ export type RelationConnection = {
|
||||
};
|
||||
|
||||
export type RelationDefinition = {
|
||||
direction: RelationType;
|
||||
direction: RelationDefinitionType;
|
||||
relationId: Scalars['UUID'];
|
||||
sourceFieldMetadata: Field;
|
||||
sourceObjectMetadata: Object;
|
||||
@@ -6367,7 +6367,7 @@ export type RelationDefinition = {
|
||||
};
|
||||
|
||||
/** Relation definition type */
|
||||
export enum RelationType {
|
||||
export enum RelationDefinitionType {
|
||||
ManyToMany = 'MANY_TO_MANY',
|
||||
ManyToOne = 'MANY_TO_ONE',
|
||||
OneToMany = 'ONE_TO_MANY',
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import Settings from '~/options/Settings';
|
||||
import Sidepanel from '~/options/Sidepanel';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
const App = () => {
|
||||
const [currentScreen, setCurrentScreen] = useState('');
|
||||
|
||||
@@ -3,8 +3,8 @@ import { useEffect, useState } from 'react';
|
||||
|
||||
import { MainButton } from '@/ui/input/button/MainButton';
|
||||
import { TextInput } from '@/ui/input/components/TextInput';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { clearStore } from '~/utils/apolloClient';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
const StyledWrapper = styled.div`
|
||||
align-items: center;
|
||||
|
||||
@@ -2,7 +2,7 @@ import styled from '@emotion/styled';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
|
||||
import { MainButton } from '@/ui/input/button/MainButton';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
const StyledIframe = styled.iframe`
|
||||
display: block;
|
||||
|
||||
@@ -42,6 +42,7 @@ const StyledInput = styled.input`
|
||||
flex: 1;
|
||||
border: none;
|
||||
outline: none;
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
|
||||
&::placeholder {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import styled from '@emotion/styled';
|
||||
import { motion } from 'framer-motion';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
export type ToggleSize = 'small' | 'medium';
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { ApolloClient, from, HttpLink, InMemoryCache } from '@apollo/client';
|
||||
import { setContext } from '@apollo/client/link/context';
|
||||
import { onError } from '@apollo/client/link/error';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
export const clearStore = () => {
|
||||
chrome.storage.local.remove([
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { OperationVariables } from '@apollo/client';
|
||||
import { DocumentNode } from 'graphql';
|
||||
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import getApolloClient from '~/utils/apolloClient';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
export const callQuery = async <T>(
|
||||
query: DocumentNode,
|
||||
|
||||
@@ -7,6 +7,7 @@ TAG=latest
|
||||
#REDIS_URL=redis://redis:6379
|
||||
|
||||
SERVER_URL=http://localhost:3000
|
||||
SIGN_IN_PREFILLED=false
|
||||
|
||||
# Use openssl rand -base64 32 for each secret
|
||||
# APP_SECRET=replace_me_with_a_random_string
|
||||
|
||||
@@ -1,27 +1,14 @@
|
||||
# Makefile for building Twenty CRM docker images.
|
||||
# Set the tag and/or target build platform using make command-line variables assignments.
|
||||
#
|
||||
# Optional make variables:
|
||||
# PLATFORM - defaults to 'linux/amd64'
|
||||
# TAG - defaults to 'latest'
|
||||
#
|
||||
# Example: make
|
||||
# Example: make PLATFORM=linux/aarch64 TAG=my-tag
|
||||
|
||||
PLATFORM ?= linux/amd64
|
||||
TAG ?= latest
|
||||
|
||||
prod-build:
|
||||
@cd ../.. && docker build -f ./packages/twenty-docker/twenty/Dockerfile --platform $(PLATFORM) --tag twenty:$(TAG) . && cd -
|
||||
@cd ../.. && docker build -f ./packages/twenty-docker/twenty/Dockerfile --tag twenty . && cd -
|
||||
|
||||
prod-run:
|
||||
@docker run -d -p 3000:3000 --name twenty twenty:$(TAG)
|
||||
@docker run -d -p 3000:3000 --name twenty twenty
|
||||
|
||||
prod-postgres-run:
|
||||
@docker run -d -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres --name twenty-postgres twenty-postgres:$(TAG)
|
||||
@docker run -d -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres --name twenty-postgres twenty-postgres
|
||||
|
||||
prod-website-build:
|
||||
@cd ../.. && docker build -f ./packages/twenty-docker/twenty-website/Dockerfile --platform $(PLATFORM) --tag twenty-website:$(TAG) . && cd -
|
||||
@cd ../.. && docker build -f ./packages/twenty-docker/twenty-website/Dockerfile --tag twenty-website . && cd -
|
||||
|
||||
prod-website-run:
|
||||
@docker run -d -p 3000:3000 --name twenty-website twenty-website:$(TAG)
|
||||
@docker run -d -p 3000:3000 --name twenty-website twenty-website
|
||||
|
||||
@@ -1,10 +1,22 @@
|
||||
name: twenty
|
||||
|
||||
services:
|
||||
change-vol-ownership:
|
||||
image: ubuntu
|
||||
user: root
|
||||
volumes:
|
||||
- server-local-data:/tmp/server-local-data
|
||||
- docker-data:/tmp/docker-data
|
||||
command: >
|
||||
bash -c "
|
||||
chown -R 1000:1000 /tmp/server-local-data
|
||||
&& chown -R 1000:1000 /tmp/docker-data"
|
||||
|
||||
server:
|
||||
image: twentycrm/twenty:${TAG:-latest}
|
||||
volumes:
|
||||
- server-local-data:/app/packages/twenty-server/.local-storage
|
||||
- server-local-data:/app/packages/twenty-server/${STORAGE_LOCAL_PATH:-.local-storage}
|
||||
- docker-data:/app/docker-data
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
@@ -18,45 +30,21 @@ services:
|
||||
STORAGE_S3_NAME: ${STORAGE_S3_NAME}
|
||||
STORAGE_S3_ENDPOINT: ${STORAGE_S3_ENDPOINT}
|
||||
|
||||
APP_SECRET: ${APP_SECRET:-replace_me_with_a_random_string}
|
||||
# MESSAGING_PROVIDER_GMAIL_ENABLED: ${MESSAGING_PROVIDER_GMAIL_ENABLED}
|
||||
# CALENDAR_PROVIDER_GOOGLE_ENABLED: ${CALENDAR_PROVIDER_GOOGLE_ENABLED}
|
||||
# AUTH_GOOGLE_CLIENT_ID: ${AUTH_GOOGLE_CLIENT_ID}
|
||||
# AUTH_GOOGLE_CLIENT_SECRET: ${AUTH_GOOGLE_CLIENT_SECRET}
|
||||
# AUTH_GOOGLE_CALLBACK_URL: ${AUTH_GOOGLE_CALLBACK_URL}
|
||||
# AUTH_GOOGLE_APIS_CALLBACK_URL: ${AUTH_GOOGLE_APIS_CALLBACK_URL}
|
||||
|
||||
# CALENDAR_PROVIDER_MICROSOFT_ENABLED: ${CALENDAR_PROVIDER_MICROSOFT_ENABLED}
|
||||
# MESSAGING_PROVIDER_MICROSOFT_ENABLED: ${MESSAGING_PROVIDER_MICROSOFT_ENABLED}
|
||||
# AUTH_MICROSOFT_ENABLED: ${AUTH_MICROSOFT_ENABLED}
|
||||
# AUTH_MICROSOFT_CLIENT_ID: ${AUTH_MICROSOFT_CLIENT_ID}
|
||||
# AUTH_MICROSOFT_CLIENT_SECRET: ${AUTH_MICROSOFT_CLIENT_SECRET}
|
||||
# AUTH_MICROSOFT_CALLBACK_URL: ${AUTH_MICROSOFT_CALLBACK_URL}
|
||||
# AUTH_MICROSOFT_APIS_CALLBACK_URL: ${AUTH_MICROSOFT_APIS_CALLBACK_URL}
|
||||
|
||||
# EMAIL_FROM_ADDRESS: ${EMAIL_FROM_ADDRESS:-contact@yourdomain.com}
|
||||
# EMAIL_FROM_NAME: ${EMAIL_FROM_NAME:-"John from YourDomain"}
|
||||
# EMAIL_SYSTEM_ADDRESS: ${EMAIL_SYSTEM_ADDRESS:-system@yourdomain.com}
|
||||
# EMAIL_DRIVER: ${EMAIL_DRIVER:-smtp}
|
||||
# EMAIL_SMTP_HOST: ${EMAIL_SMTP_HOST:-smtp.gmail.com}
|
||||
# EMAIL_SMTP_PORT: ${EMAIL_SMTP_PORT:-465}
|
||||
# EMAIL_SMTP_USER: ${EMAIL_SMTP_USER:-}
|
||||
# EMAIL_SMTP_PASSWORD: ${EMAIL_SMTP_PASSWORD:-}
|
||||
|
||||
APP_SECRET: ${APP_SECRET}
|
||||
depends_on:
|
||||
change-vol-ownership:
|
||||
condition: service_completed_successfully
|
||||
db:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: curl --fail http://localhost:3000/healthz
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 20
|
||||
retries: 10
|
||||
restart: always
|
||||
|
||||
worker:
|
||||
image: twentycrm/twenty:${TAG:-latest}
|
||||
volumes:
|
||||
- server-local-data:/app/packages/twenty-server/.local-storage
|
||||
command: ["yarn", "worker:prod"]
|
||||
environment:
|
||||
PG_DATABASE_URL: postgres://${PG_DATABASE_USER:-postgres}:${PG_DATABASE_PASSWORD:-postgres}@${PG_DATABASE_HOST:-db}:${PG_DATABASE_PORT:-5432}/default
|
||||
@@ -69,31 +57,7 @@ services:
|
||||
STORAGE_S3_NAME: ${STORAGE_S3_NAME}
|
||||
STORAGE_S3_ENDPOINT: ${STORAGE_S3_ENDPOINT}
|
||||
|
||||
APP_SECRET: ${APP_SECRET:-replace_me_with_a_random_string}
|
||||
# MESSAGING_PROVIDER_GMAIL_ENABLED: ${MESSAGING_PROVIDER_GMAIL_ENABLED}
|
||||
# CALENDAR_PROVIDER_GOOGLE_ENABLED: ${CALENDAR_PROVIDER_GOOGLE_ENABLED}
|
||||
# AUTH_GOOGLE_CLIENT_ID: ${AUTH_GOOGLE_CLIENT_ID}
|
||||
# AUTH_GOOGLE_CLIENT_SECRET: ${AUTH_GOOGLE_CLIENT_SECRET}
|
||||
# AUTH_GOOGLE_CALLBACK_URL: ${AUTH_GOOGLE_CALLBACK_URL}
|
||||
# AUTH_GOOGLE_APIS_CALLBACK_URL: ${AUTH_GOOGLE_APIS_CALLBACK_URL}
|
||||
|
||||
# CALENDAR_PROVIDER_MICROSOFT_ENABLED: ${CALENDAR_PROVIDER_MICROSOFT_ENABLED}
|
||||
# MESSAGING_PROVIDER_MICROSOFT_ENABLED: ${MESSAGING_PROVIDER_MICROSOFT_ENABLED}
|
||||
# AUTH_MICROSOFT_ENABLED: ${AUTH_MICROSOFT_ENABLED}
|
||||
# AUTH_MICROSOFT_CLIENT_ID: ${AUTH_MICROSOFT_CLIENT_ID}
|
||||
# AUTH_MICROSOFT_CLIENT_SECRET: ${AUTH_MICROSOFT_CLIENT_SECRET}
|
||||
# AUTH_MICROSOFT_CALLBACK_URL: ${AUTH_MICROSOFT_CALLBACK_URL}
|
||||
# AUTH_MICROSOFT_APIS_CALLBACK_URL: ${AUTH_MICROSOFT_APIS_CALLBACK_URL}
|
||||
|
||||
# EMAIL_FROM_ADDRESS: ${EMAIL_FROM_ADDRESS:-contact@yourdomain.com}
|
||||
# EMAIL_FROM_NAME: ${EMAIL_FROM_NAME:-"John from YourDomain"}
|
||||
# EMAIL_SYSTEM_ADDRESS: ${EMAIL_SYSTEM_ADDRESS:-system@yourdomain.com}
|
||||
# EMAIL_DRIVER: ${EMAIL_DRIVER:-smtp}
|
||||
# EMAIL_SMTP_HOST: ${EMAIL_SMTP_HOST:-smtp.gmail.com}
|
||||
# EMAIL_SMTP_PORT: ${EMAIL_SMTP_PORT:-465}
|
||||
# EMAIL_SMTP_USER: ${EMAIL_SMTP_USER:-}
|
||||
# EMAIL_SMTP_PASSWORD: ${EMAIL_SMTP_PASSWORD:-}
|
||||
|
||||
APP_SECRET: ${APP_SECRET}
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
@@ -102,12 +66,14 @@ services:
|
||||
restart: always
|
||||
|
||||
db:
|
||||
image: postgres:16
|
||||
image: twentycrm/twenty-postgres-spilo:${TAG:-latest}
|
||||
volumes:
|
||||
- db-data:/var/lib/postgresql/data
|
||||
- db-data:/home/postgres/pgdata
|
||||
environment:
|
||||
POSTGRES_USER: ${PG_DATABASE_USER:-postgres}
|
||||
POSTGRES_PASSWORD: ${PG_DATABASE_PASSWORD:-postgres}
|
||||
PGUSER_SUPERUSER: ${PG_DATABASE_USER:-postgres}
|
||||
PGPASSWORD_SUPERUSER: ${PG_DATABASE_PASSWORD:-postgres}
|
||||
ALLOW_NOSSL: "true"
|
||||
SPILO_PROVIDER: "local"
|
||||
healthcheck:
|
||||
test: pg_isready -U ${PG_DATABASE_USER:-postgres} -h localhost -d postgres
|
||||
interval: 5s
|
||||
@@ -118,8 +84,8 @@ services:
|
||||
redis:
|
||||
image: redis
|
||||
restart: always
|
||||
command: ["--maxmemory-policy", "noeviction"]
|
||||
|
||||
volumes:
|
||||
docker-data:
|
||||
db-data:
|
||||
server-local-data:
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
# README
|
||||
DISCLAIMER: The k8s and podman deployments are not maintained by the core team.
|
||||
These files are provided and maintained by the community. Twenty core team
|
||||
maintains support for docker deployment.
|
||||
|
||||
## Overview
|
||||
|
||||
|
||||
@@ -25,10 +25,9 @@ spec:
|
||||
- name: redis
|
||||
image: redis/redis-stack-server:latest
|
||||
imagePullPolicy: Always
|
||||
args: ["--maxmemory-policy", "noeviction"]
|
||||
env:
|
||||
- name: PORT
|
||||
value: "6379"
|
||||
value: 6379
|
||||
ports:
|
||||
- containerPort: 6379
|
||||
name: redis
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
# How to deploy twenty on podman
|
||||
|
||||
DISCLAIMER: The k8s and podman deployments are not maintained by the core team.
|
||||
These files are provided and maintained by the community. Twenty core team
|
||||
maintains support for docker deployment.
|
||||
|
||||
|
||||
## How to use
|
||||
|
||||
1. Edit `.env` file. At the minimum set `POSTGRES_PASSWORD`, `SERVER_URL`, and `APP_SECRET`.
|
||||
2. Start twenty by running `podman-compose up -d`.
|
||||
|
||||
If you need to stop twenty, you can do so by running `podman-compose down`.
|
||||
|
||||
|
||||
### Install systemd service (optional)
|
||||
|
||||
If you want to install a systemd service to run twenty, you can use the provided systemd service.
|
||||
|
||||
Edit `twentycrm.service` and change these two variables:
|
||||
|
||||
|
||||
WorkingDirectory=/opt/apps/twenty
|
||||
EnvironmentFile=/opt/apps/twenty/.env
|
||||
|
||||
`WorkingDirectory` should be changed to the path in which `podman-compose.yml` is located.
|
||||
|
||||
`EnvironmentFile` should be changed to the path in which your `.env`file is located.
|
||||
|
||||
You can run the script `install-systemd-user-service` to install the systemd service under the current user.
|
||||
|
||||
|
||||
./install-systemd-user-service
|
||||
|
||||
Note: this script will enable the service and also start it. So it will assume that twenty is not currently running.
|
||||
If you started it previously, bring it down using:
|
||||
|
||||
podman-compose down
|
||||
|
||||
|
||||
|
||||
## Compatibility
|
||||
|
||||
These files should be compatible with podman 4.3+.
|
||||
|
||||
I have tested this on Debian GNU/Linux 12 (bookworm) and with the podman that is distributed with the official Debian stable mirrors (podman v4.3.1+ds1-8+deb12u1, podman-compose v1.0.3-3).
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
mkdir -p ~/.config/systemd/user
|
||||
[ -f twentycrm.service ] || { echo "Error: twentycrm.service not found"; exit 1; }
|
||||
cp twentycrm.service ~/.config/systemd/user
|
||||
|
||||
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user enable twentycrm.service
|
||||
systemctl --user start twentycrm.service
|
||||
@@ -1,71 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
if [ ! -f "$(dirname "$0")/.env" ]; then
|
||||
echo "Error: .env file not found"
|
||||
exit 1
|
||||
fi
|
||||
source "$(dirname "$0")/.env"
|
||||
|
||||
## steps to cleanup and start over from scratch - useful when testing
|
||||
#podman pod stop twenty-pod
|
||||
#podman pod rm twenty-pod
|
||||
#podman volume rm twenty-db-data twenty-server-data twenty-redis-data
|
||||
# end of cleanup
|
||||
|
||||
podman volume create twenty-db-data
|
||||
podman volume create twenty-server-data
|
||||
podman volume create twenty-redis-data
|
||||
|
||||
podman pod create --name twenty-pod -p 127.0.0.1:8080:3000
|
||||
|
||||
podman run -d --pod twenty-pod --name twenty-db \
|
||||
-e POSTGRES_DB=twenty \
|
||||
-e POSTGRES_USER=twenty \
|
||||
-e POSTGRES_PASSWORD="$POSTGRES_PASSWORD" \
|
||||
-v twenty-db-data:/var/lib/postgresql/data:Z \
|
||||
docker.io/library/postgres:16
|
||||
|
||||
podman run -d --pod twenty-pod --name twenty-redis \
|
||||
-v twenty-redis-data:/data:Z \
|
||||
docker.io/library/redis:latest
|
||||
|
||||
podman run -d --pod twenty-pod --name twenty-server \
|
||||
-e NODE_PORT=3000 \
|
||||
-e SERVER_URL="$SERVER_URL" \
|
||||
-e PG_DATABASE_URL="postgresql://twenty:$POSTGRES_PASSWORD@twenty-db:5432/twenty" \
|
||||
-e REDIS_URL="redis://twenty-redis:6379" \
|
||||
-e APP_SECRET="$APP_SECRET" \
|
||||
-e NODE_ENV=production \
|
||||
-e LOG_LEVEL=info \
|
||||
-v twenty-server-data:/app/docker-data:Z \
|
||||
docker.io/twentycrm/twenty:latest
|
||||
|
||||
podman run -d --pod twenty-pod --name twenty-worker \
|
||||
--init \
|
||||
-e SERVER_URL="$SERVER_URL" \
|
||||
-e PG_DATABASE_URL="postgresql://twenty:$POSTGRES_PASSWORD@twenty-db:5432/twenty" \
|
||||
-e REDIS_URL="redis://twenty-redis:6379" \
|
||||
-e APP_SECRET="$APP_SECRET" \
|
||||
-e DISABLE_DB_MIGRATIONS=true \
|
||||
-e NODE_ENV=production \
|
||||
-e LOG_LEVEL=info \
|
||||
-v twenty-server-data:/app/docker-data:Z \
|
||||
docker.io/twentycrm/twenty:latest \
|
||||
yarn worker:prod
|
||||
|
||||
# wait some time, check status
|
||||
sleep 30
|
||||
podman ps --pod -f name=twenty-pod
|
||||
|
||||
|
||||
mkdir -p ~/.config/systemd/user
|
||||
if [ ! -f "twentycrm.service" ]; then
|
||||
echo "Error: twentycrm.service file not found"
|
||||
exit 1
|
||||
fi
|
||||
cp twentycrm.service ~/.config/systemd/user
|
||||
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user enable twentycrm.service
|
||||
systemctl --user start twentycrm.service
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
db:
|
||||
container_name: twenty-db
|
||||
image: postgres:16
|
||||
environment:
|
||||
POSTGRES_DB: twenty
|
||||
POSTGRES_USER: twenty
|
||||
POSTGRES_PASSWORD: ${PG_DATABASE_PASSWORD}
|
||||
volumes:
|
||||
- twenty-db-data:/var/lib/postgresql/data:Z
|
||||
|
||||
redis:
|
||||
container_name: twenty-redis
|
||||
image: redis:latest
|
||||
command: ["--maxmemory-policy", "noeviction"]
|
||||
volumes:
|
||||
- twenty-redis-data:/data:Z
|
||||
|
||||
server:
|
||||
container_name: twenty-server
|
||||
image: twentycrm/twenty:latest
|
||||
environment:
|
||||
NODE_PORT: "3000"
|
||||
SERVER_URL: ${SERVER_URL}
|
||||
PG_DATABASE_URL: "postgresql://twenty:${PG_DATABASE_PASSWORD}@twenty-db:5432/twenty"
|
||||
REDIS_URL: "redis://twenty-redis:6379"
|
||||
APP_SECRET: ${APP_SECRET}
|
||||
NODE_ENV: production
|
||||
LOG_LEVEL: info
|
||||
volumes:
|
||||
- twenty-server-data:/app/docker-data:Z
|
||||
ports:
|
||||
- 127.0.0.1:8080:3000
|
||||
|
||||
worker:
|
||||
container_name: twenty-worker
|
||||
image: twentycrm/twenty:latest
|
||||
command: yarn worker:prod
|
||||
environment:
|
||||
SERVER_URL: ${SERVER_URL}
|
||||
PG_DATABASE_URL: "postgresql://twenty:${PG_DATABASE_PASSWORD}@twenty-db:5432/twenty"
|
||||
REDIS_URL: "redis://twenty-redis:6379"
|
||||
APP_SECRET: ${APP_SECRET}
|
||||
DISABLE_DB_MIGRATIONS: "true"
|
||||
NODE_ENV: production
|
||||
LOG_LEVEL: info
|
||||
volumes:
|
||||
- twenty-server-data:/app/docker-data:Z
|
||||
init: true
|
||||
|
||||
volumes:
|
||||
twenty-db-data:
|
||||
twenty-server-data:
|
||||
twenty-redis-data:
|
||||
@@ -1,15 +0,0 @@
|
||||
[Unit]
|
||||
Description=TwentyCRM Container Stack via Podman-Compose
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/opt/apps/twenty
|
||||
EnvironmentFile=/opt/apps/twenty/.env
|
||||
ExecStart=/usr/bin/podman-compose -f podman-compose.yml up -d
|
||||
ExecStop=/usr/bin/podman-compose -f podman-compose.yml down
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM node:22-alpine as twenty-website-build
|
||||
FROM node:18.17.1-alpine as twenty-website-build
|
||||
|
||||
|
||||
WORKDIR /app
|
||||
@@ -8,22 +8,14 @@ COPY ./yarn.lock .
|
||||
COPY ./.yarnrc.yml .
|
||||
COPY ./.yarn/releases /app/.yarn/releases
|
||||
COPY ./tools/eslint-rules /app/tools/eslint-rules
|
||||
COPY ./packages/twenty-ui/package.json /app/packages/twenty-ui/
|
||||
COPY ./packages/twenty-shared/package.json /app/packages/twenty-shared/
|
||||
COPY ./packages/twenty-website/package.json /app/packages/twenty-website/package.json
|
||||
|
||||
RUN yarn
|
||||
|
||||
ENV KEYSTATIC_GITHUB_CLIENT_ID="<fake build value>"
|
||||
ENV KEYSTATIC_GITHUB_CLIENT_SECRET="<fake build value>"
|
||||
ENV KEYSTATIC_SECRET="<fake build value>"
|
||||
ENV NEXT_PUBLIC_KEYSTATIC_GITHUB_APP_SLUG="<fake build value>"
|
||||
|
||||
COPY ./packages/twenty-ui /app/packages/twenty-ui
|
||||
COPY ./packages/twenty-website /app/packages/twenty-website
|
||||
RUN npx nx build twenty-website
|
||||
|
||||
FROM node:22-alpine as twenty-website
|
||||
FROM node:18.17.1-alpine as twenty-website
|
||||
|
||||
WORKDIR /app/packages/twenty-website
|
||||
|
||||
@@ -34,9 +26,4 @@ WORKDIR /app/packages/twenty-website
|
||||
LABEL org.opencontainers.image.source=https://github.com/twentyhq/twenty
|
||||
LABEL org.opencontainers.image.description="This image provides a consistent and reproducible environment for the website."
|
||||
|
||||
RUN chown -R 1000 /app
|
||||
|
||||
# Use non root user with uid 1000
|
||||
USER 1000
|
||||
|
||||
CMD ["/bin/sh", "-c", "npx nx start"]
|
||||
@@ -1,5 +1,5 @@
|
||||
# Base image for common dependencies
|
||||
FROM node:22-alpine as common-deps
|
||||
FROM node:18.17.1-alpine as common-deps
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -7,7 +7,6 @@ WORKDIR /app
|
||||
COPY ./package.json ./yarn.lock ./.yarnrc.yml ./tsconfig.base.json ./nx.json /app/
|
||||
COPY ./.yarn/releases /app/.yarn/releases
|
||||
|
||||
COPY ./.prettierrc /app/
|
||||
COPY ./packages/twenty-emails/package.json /app/packages/twenty-emails/
|
||||
COPY ./packages/twenty-server/package.json /app/packages/twenty-server/
|
||||
COPY ./packages/twenty-server/patches /app/packages/twenty-server/patches
|
||||
@@ -49,7 +48,7 @@ RUN npx nx build twenty-front
|
||||
|
||||
|
||||
# Final stage: Run the application
|
||||
FROM node:22-alpine as twenty
|
||||
FROM node:18.17.1-alpine as twenty
|
||||
|
||||
# Used to run healthcheck in docker
|
||||
RUN apk add --no-cache curl jq
|
||||
@@ -64,9 +63,8 @@ WORKDIR /app/packages/twenty-server
|
||||
|
||||
ARG REACT_APP_SERVER_BASE_URL
|
||||
ENV REACT_APP_SERVER_BASE_URL $REACT_APP_SERVER_BASE_URL
|
||||
|
||||
ARG APP_VERSION
|
||||
ENV APP_VERSION $APP_VERSION
|
||||
ARG SENTRY_RELEASE
|
||||
ENV SENTRY_RELEASE $SENTRY_RELEASE
|
||||
|
||||
# Copy built applications from previous stages
|
||||
COPY --chown=1000 --from=twenty-server-build /app /app
|
||||
@@ -77,8 +75,8 @@ COPY --chown=1000 --from=twenty-front-build /app/packages/twenty-front/build /ap
|
||||
LABEL org.opencontainers.image.source=https://github.com/twentyhq/twenty
|
||||
LABEL org.opencontainers.image.description="This image provides a consistent and reproducible environment for the backend and frontend, ensuring it deploys faster and runs the same way regardless of the deployment environment."
|
||||
|
||||
RUN mkdir -p /app/.local-storage /app/packages/twenty-server/.local-storage && \
|
||||
chown -R 1000:1000 /app
|
||||
RUN mkdir /app/.local-storage
|
||||
RUN chown -R 1000 /app
|
||||
|
||||
# Use non root user with uid 1000
|
||||
USER 1000
|
||||
|
||||
@@ -1,34 +1,26 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
setup_and_migrate_db() {
|
||||
if [ "${DISABLE_DB_MIGRATIONS}" = "true" ]; then
|
||||
echo "Database setup and migrations are disabled, skipping..."
|
||||
return
|
||||
fi
|
||||
|
||||
# Check if the initialization has already been done and that we enabled automatic migration
|
||||
if [ "${DISABLE_DB_MIGRATIONS}" != "true" ] && [ ! -f /app/docker-data/db_status ]; then
|
||||
echo "Running database setup and migrations..."
|
||||
|
||||
# Creating the database if it doesn't exist
|
||||
PGUSER=$(echo $PG_DATABASE_URL | awk -F '//' '{print $2}' | awk -F ':' '{print $1}')
|
||||
PGPASS=$(echo $PG_DATABASE_URL | awk -F ':' '{print $3}' | awk -F '@' '{print $1}')
|
||||
PGHOST=$(echo $PG_DATABASE_URL | awk -F '@' '{print $2}' | awk -F ':' '{print $1}')
|
||||
PGPORT=$(echo $PG_DATABASE_URL | awk -F ':' '{print $4}' | awk -F '/' '{print $1}')
|
||||
PGDATABASE=$(echo $PG_DATABASE_URL | awk -F ':' '{print $4}' | awk -F '/' '{print $2}')
|
||||
PGPASSWORD=${PGPASS} psql -h ${PGHOST} -p ${PGPORT} -U ${PGUSER} -d postgres -tc "SELECT 1 FROM pg_database WHERE datname = 'default'" | grep -q 1 || \
|
||||
PGPASSWORD=${PGPASS} psql -h ${PGHOST} -p ${PGPORT} -U ${PGUSER} -d postgres -c "CREATE DATABASE \"default\""
|
||||
|
||||
# Creating the database if it doesn't exist
|
||||
db_count=$(PGPASSWORD=${PGPASS} psql -h ${PGHOST} -p ${PGPORT} -U ${PGUSER} -d postgres -tAc "SELECT COUNT(*) FROM pg_database WHERE datname = '${PGDATABASE}'")
|
||||
if [ "$db_count" = "0" ]; then
|
||||
echo "Database ${PGDATABASE} does not exist, creating..."
|
||||
PGPASSWORD=${PGPASS} psql -h ${PGHOST} -p ${PGPORT} -U ${PGUSER} -d postgres -c "CREATE DATABASE \"${PGDATABASE}\""
|
||||
# Run setup and migration scripts
|
||||
NODE_OPTIONS="--max-old-space-size=1500" tsx ./scripts/setup-db.ts
|
||||
yarn database:migrate:prod
|
||||
|
||||
# Run setup and migration scripts
|
||||
NODE_OPTIONS="--max-old-space-size=1500" tsx ./scripts/setup-db.ts
|
||||
yarn database:migrate:prod
|
||||
fi
|
||||
|
||||
yarn command:prod upgrade
|
||||
echo "Successfully migrated DB!"
|
||||
}
|
||||
setup_and_migrate_db
|
||||
# Mark initialization as done
|
||||
echo "Successfuly migrated DB!"
|
||||
touch /app/docker-data/db_status
|
||||
fi
|
||||
|
||||
# Continue with the original Docker command
|
||||
exec "$@"
|
||||
|
||||
@@ -2,5 +2,19 @@
|
||||
FRONTEND_BASE_URL=http://localhost:3001
|
||||
BACKEND_BASE_URL=http://localhost:3000
|
||||
DEFAULT_LOGIN=tim@apple.dev
|
||||
DEFAULT_PASSWORD=tim@apple.dev
|
||||
WEBSITE_URL=https://twenty.com
|
||||
DEFAULT_PASSWORD=Applecar2025
|
||||
WEBSITE_URL=https://twenty.com
|
||||
|
||||
# === DO NOT USE, WORK IN PROGRESS ===
|
||||
# This URL must have trailing forward slash as all REST API endpoints have object after it
|
||||
# Documentation for REST API: https://twenty.com/developers/rest-api/core#/
|
||||
# REST_API_BASE_URL=http://localhost:3000/rest/
|
||||
|
||||
# Documentation for GraphQL API: https://twenty.com/developers/graphql/core
|
||||
# GRAPHQL_BASE_URL=http://localhost:3000/graphql
|
||||
|
||||
# Without this key, all API tests will fail, to generate this key
|
||||
# Log in to Twenty workspace, go to Settings > Developers, generate new key and paste it here
|
||||
# In order to use it, header Authorization: Bearer token must be used
|
||||
# This key works for both REST and GraphQL API
|
||||
# API_DEV_KEY=fill_with_proper_key
|
||||
@@ -17,15 +17,12 @@ export class WorkflowVisualizerPage {
|
||||
readonly deactivateWorkflowButton: Locator;
|
||||
readonly addTriggerButton: Locator;
|
||||
readonly commandMenu: Locator;
|
||||
readonly stepHeaderInCommandMenu: Locator;
|
||||
readonly workflowNameLabel: Locator;
|
||||
readonly triggerNode: Locator;
|
||||
readonly background: Locator;
|
||||
readonly useAsDraftButton: Locator;
|
||||
readonly overrideDraftButton: Locator;
|
||||
readonly discardDraftButton: Locator;
|
||||
readonly seeRunsButton: Locator;
|
||||
readonly goBackInCommandMenu: Locator;
|
||||
|
||||
#actionNames: Record<WorkflowActionType, string> = {
|
||||
'create-record': 'Create Record',
|
||||
@@ -33,7 +30,6 @@ export class WorkflowVisualizerPage {
|
||||
'delete-record': 'Delete Record',
|
||||
code: 'Code',
|
||||
'send-email': 'Send Email',
|
||||
form: 'Form',
|
||||
};
|
||||
|
||||
#createdActionNames: Record<WorkflowActionType, string> = {
|
||||
@@ -42,7 +38,6 @@ export class WorkflowVisualizerPage {
|
||||
'delete-record': 'Delete Record',
|
||||
code: 'Code - Serverless Function',
|
||||
'send-email': 'Send Email',
|
||||
form: 'Form',
|
||||
};
|
||||
|
||||
#triggerNames: Record<WorkflowTriggerType, string> = {
|
||||
@@ -56,7 +51,7 @@ export class WorkflowVisualizerPage {
|
||||
'record-created': 'Record is Created',
|
||||
'record-updated': 'Record is Updated',
|
||||
'record-deleted': 'Record is Deleted',
|
||||
manual: 'Launch manually',
|
||||
manual: 'Manual Trigger',
|
||||
};
|
||||
|
||||
constructor({ page, workflowName }: { page: Page; workflowName: string }) {
|
||||
@@ -73,9 +68,6 @@ export class WorkflowVisualizerPage {
|
||||
});
|
||||
this.addTriggerButton = page.getByText('Add a Trigger');
|
||||
this.commandMenu = page.getByTestId('command-menu');
|
||||
this.stepHeaderInCommandMenu = this.commandMenu.getByTestId(
|
||||
'workflow-step-header',
|
||||
);
|
||||
this.workflowNameLabel = page
|
||||
.getByTestId('top-bar-title')
|
||||
.getByText(this.workflowName);
|
||||
@@ -88,10 +80,6 @@ export class WorkflowVisualizerPage {
|
||||
this.discardDraftButton = page.getByRole('button', {
|
||||
name: 'Discard Draft',
|
||||
});
|
||||
this.seeRunsButton = page.getByRole('link', { name: 'See runs' });
|
||||
this.goBackInCommandMenu = this.commandMenu
|
||||
.getByRole('button')
|
||||
.and(this.commandMenu.getByTestId('command-menu-go-back-button'));
|
||||
}
|
||||
|
||||
async createOneWorkflow() {
|
||||
@@ -116,19 +104,11 @@ export class WorkflowVisualizerPage {
|
||||
}
|
||||
|
||||
async goToWorkflowVisualizerPage() {
|
||||
await this.#page.goto(`/`);
|
||||
await Promise.all([
|
||||
this.#page.goto(`/object/workflow/${this.workflowId}`),
|
||||
|
||||
const workflowsLink = this.#page.getByRole('link', { name: 'Workflows' });
|
||||
|
||||
await workflowsLink.click();
|
||||
|
||||
const workflowLink = this.#page
|
||||
.getByTestId(`row-id-${this.workflowId}`)
|
||||
.getByRole('link', { name: this.workflowName });
|
||||
|
||||
await workflowLink.click({ force: true });
|
||||
|
||||
await this.waitForWorkflowVisualizerLoad();
|
||||
this.waitForWorkflowVisualizerLoad(),
|
||||
]);
|
||||
}
|
||||
|
||||
async createInitialTrigger(trigger: WorkflowTriggerType) {
|
||||
@@ -250,72 +230,35 @@ export class WorkflowVisualizerPage {
|
||||
}
|
||||
|
||||
async closeSidePanel() {
|
||||
const closeButton = this.#page.getByRole('button', {
|
||||
name: 'Close command menu',
|
||||
});
|
||||
const closeButton = this.#page.getByTestId(
|
||||
'page-header-command-menu-button',
|
||||
);
|
||||
|
||||
await closeButton.click();
|
||||
|
||||
await expect(this.#page.getByTestId('command-menu')).not.toBeVisible();
|
||||
}
|
||||
|
||||
async goToWorkflowsIndexPage() {
|
||||
await this.#page.goto('/objects/workflows');
|
||||
}
|
||||
|
||||
async setWorkflowsOpenInMode(mode: 'side-panel' | 'record-page') {
|
||||
const recordTableOptionsButton = this.#page.getByText('Options');
|
||||
await recordTableOptionsButton.click();
|
||||
|
||||
const layoutButton = this.#page.getByText('Layout');
|
||||
await layoutButton.click();
|
||||
|
||||
const openInButton = this.#page.getByText('Open in');
|
||||
await openInButton.click();
|
||||
|
||||
if (mode === 'side-panel') {
|
||||
const openInSidePanelOption = this.#page.getByRole('option', {
|
||||
name: 'Side Panel',
|
||||
});
|
||||
|
||||
await openInSidePanelOption.click();
|
||||
} else {
|
||||
const openInRecordPageOption = this.#page.getByRole('option', {
|
||||
name: 'Record Page',
|
||||
});
|
||||
|
||||
await openInRecordPageOption.click();
|
||||
}
|
||||
|
||||
// Close the dropdown
|
||||
await recordTableOptionsButton.click();
|
||||
}
|
||||
}
|
||||
|
||||
export const test = base.extend<{
|
||||
workflowVisualizer: WorkflowVisualizerPage;
|
||||
}>({
|
||||
workflowVisualizer: async ({ page }, use) => {
|
||||
const workflowVisualizer = new WorkflowVisualizerPage({
|
||||
page,
|
||||
workflowName: 'Test Workflow',
|
||||
});
|
||||
export const test = base.extend<{ workflowVisualizer: WorkflowVisualizerPage }>(
|
||||
{
|
||||
workflowVisualizer: async ({ page }, use) => {
|
||||
const workflowVisualizer = new WorkflowVisualizerPage({
|
||||
page,
|
||||
workflowName: 'Test Workflow',
|
||||
});
|
||||
|
||||
await workflowVisualizer.createOneWorkflow();
|
||||
await workflowVisualizer.goToWorkflowVisualizerPage();
|
||||
await workflowVisualizer.createOneWorkflow();
|
||||
await workflowVisualizer.goToWorkflowVisualizerPage();
|
||||
|
||||
await use(workflowVisualizer);
|
||||
await use(workflowVisualizer);
|
||||
|
||||
await deleteWorkflow({
|
||||
page,
|
||||
workflowId: workflowVisualizer.workflowId,
|
||||
});
|
||||
await destroyWorkflow({
|
||||
page,
|
||||
workflowId: workflowVisualizer.workflowId,
|
||||
});
|
||||
|
||||
await workflowVisualizer.goToWorkflowsIndexPage();
|
||||
await workflowVisualizer.setWorkflowsOpenInMode('record-page');
|
||||
await deleteWorkflow({
|
||||
page,
|
||||
workflowId: workflowVisualizer.workflowId,
|
||||
});
|
||||
await destroyWorkflow({
|
||||
page,
|
||||
workflowId: workflowVisualizer.workflowId,
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
);
|
||||
|
||||
@@ -25,7 +25,7 @@ export const test = base.extend<{ screenshotHook: void }>({
|
||||
),
|
||||
});
|
||||
},
|
||||
{ auto: true },
|
||||
{ auto: true }, // automatic fixture runs with every test
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ export class InsertFieldData {
|
||||
'//label[contains(., "POST CODE")]/../div[last()]/input',
|
||||
);
|
||||
this.countrySelect = page.locator(
|
||||
'//span[contains(., "COUNTRY")]/../div[last()]/div',
|
||||
'//span[contains(., "COUNTRY")]/../div[last()]/input',
|
||||
);
|
||||
this.arrayValueInput = page.locator("//input[@placeholder='Enter value']");
|
||||
this.arrayAddValueButton = page.locator(
|
||||
|
||||
@@ -1,55 +1,5 @@
|
||||
import { Locator, Page } from '@playwright/test';
|
||||
|
||||
export class StripePage {
|
||||
private readonly cardNumberInput: Locator;
|
||||
private readonly cardExpiryInput: Locator;
|
||||
private readonly cardCvcInput: Locator;
|
||||
private readonly cardholderNameInput: Locator;
|
||||
private readonly startTrialButton: Locator;
|
||||
private readonly cancelSubscriptionButton: Locator;
|
||||
private readonly confirmButton: Locator;
|
||||
private readonly returnToTwentyLink: Locator;
|
||||
|
||||
constructor(public readonly page: Page) {
|
||||
this.cardNumberInput = page.getByPlaceholder('1234 1234 1234 1234');
|
||||
this.cardExpiryInput = page.getByPlaceholder('MM / YY');
|
||||
this.cardCvcInput = page.getByPlaceholder('CVC');
|
||||
this.cardholderNameInput = page.getByPlaceholder('Full name on card');
|
||||
this.startTrialButton = page.getByTestId('hosted-payment-submit-button');
|
||||
this.cancelSubscriptionButton = page.locator(
|
||||
'a[data-test="cancel-subscription"]',
|
||||
);
|
||||
this.confirmButton = page.getByTestId('confirm');
|
||||
this.returnToTwentyLink = page.getByTestId('return-to-business-link');
|
||||
}
|
||||
|
||||
async fillCardNumber(number: string) {
|
||||
await this.cardNumberInput.fill(number);
|
||||
}
|
||||
|
||||
async fillCardExpiry(expiry: string) {
|
||||
await this.cardExpiryInput.fill(expiry);
|
||||
}
|
||||
|
||||
async fillCardCvc(cvc: string) {
|
||||
await this.cardCvcInput.fill(cvc);
|
||||
}
|
||||
|
||||
async fillCardholderName(name: string) {
|
||||
await this.cardholderNameInput.fill(name);
|
||||
}
|
||||
|
||||
async startTrial() {
|
||||
await this.startTrialButton.click();
|
||||
}
|
||||
|
||||
async clickCancelSubscription() {
|
||||
await this.cancelSubscriptionButton.click();
|
||||
await this.confirmButton.click();
|
||||
await this.page.getByTestId('cancellation_reason_cancel').click();
|
||||
}
|
||||
|
||||
async returnToTwenty() {
|
||||
await this.returnToTwentyLink.click();
|
||||
}
|
||||
// TODO: implement all necessary methods (staging/sandbox page - does it differ anyhow from normal page?)
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ export class MainPage {
|
||||
private readonly hiddenFieldsButton: Locator;
|
||||
private readonly editFieldsButton: Locator;
|
||||
private readonly importButton: Locator;
|
||||
private readonly exportButton: Locator;
|
||||
private readonly deletedRecordsButton: Locator;
|
||||
private readonly createNewRecordButton: Locator;
|
||||
private readonly addToFavoritesButton: Locator;
|
||||
@@ -66,12 +67,16 @@ export class MainPage {
|
||||
this.importButton = page
|
||||
.getByTestId('tooltip')
|
||||
.filter({ hasText: /^Import$/ });
|
||||
this.exportButton = page
|
||||
.getByTestId('tooltip')
|
||||
.filter({ hasText: /^Export$/ });
|
||||
this.deletedRecordsButton = page
|
||||
.getByTestId('tooltip')
|
||||
.filter({ hasText: /^Deleted */ });
|
||||
this.createNewRecordButton = page.getByTestId('add-button');
|
||||
this.addToFavoritesButton = page.getByText('Add to favorites');
|
||||
this.deleteFromFavoritesButton = page.getByText('Delete from favorites');
|
||||
this.exportBottomBarButton = page.getByText('Export');
|
||||
this.deleteRecordsButton = page.getByText('Delete');
|
||||
}
|
||||
|
||||
@@ -161,6 +166,10 @@ export class MainPage {
|
||||
await this.importButton.click();
|
||||
}
|
||||
|
||||
async clickExportButton() {
|
||||
await this.exportButton.click();
|
||||
}
|
||||
|
||||
async clickDeletedRecordsButton() {
|
||||
await this.deletedRecordsButton.click();
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ export class AccountsSection {
|
||||
private readonly addBlocklistField: Locator;
|
||||
private readonly addBlocklistButton: Locator;
|
||||
private readonly connectWithGoogleButton: Locator;
|
||||
private readonly connectWithMicrosoftButton: Locator;
|
||||
|
||||
constructor(public readonly page: Page) {
|
||||
this.page = page;
|
||||
@@ -23,9 +22,6 @@ export class AccountsSection {
|
||||
this.connectWithGoogleButton = page.getByRole('button', {
|
||||
name: 'Connect with Google',
|
||||
});
|
||||
this.connectWithMicrosoftButton = page.getByRole('button', {
|
||||
name: 'Connect with Microsoft',
|
||||
});
|
||||
}
|
||||
|
||||
async clickAddAccount() {
|
||||
@@ -55,8 +51,4 @@ export class AccountsSection {
|
||||
async linkGoogleAccount() {
|
||||
await this.connectWithGoogleButton.click();
|
||||
}
|
||||
|
||||
async linkMicrosoftAccount() {
|
||||
await this.connectWithMicrosoftButton.click();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
import { Locator, Page } from '@playwright/test';
|
||||
|
||||
export class APIsSection {
|
||||
private readonly createAPIKeyButton: Locator;
|
||||
private readonly regenerateAPIKeyButton: Locator;
|
||||
private readonly nameOfAPIKeyInput: Locator;
|
||||
private readonly expirationDateAPIKeySelect: Locator;
|
||||
private readonly cancelButton: Locator;
|
||||
private readonly saveButton: Locator;
|
||||
private readonly deleteButton: Locator;
|
||||
|
||||
constructor(public readonly page: Page) {
|
||||
this.page = page;
|
||||
this.createAPIKeyButton = page.getByRole('link', {
|
||||
name: 'Create API Key',
|
||||
});
|
||||
this.nameOfAPIKeyInput = page
|
||||
.getByPlaceholder('E.g. backoffice integration')
|
||||
.first();
|
||||
this.expirationDateAPIKeySelect = page.locator(
|
||||
'div[aria-controls="object-field-type-select-options"]',
|
||||
);
|
||||
this.regenerateAPIKeyButton = page.getByRole('button', {
|
||||
name: 'Regenerate Key',
|
||||
});
|
||||
this.cancelButton = page.getByRole('button', { name: 'Cancel' });
|
||||
this.saveButton = page.getByRole('button', { name: 'Save' });
|
||||
this.deleteButton = page.getByRole('button', { name: 'Delete' });
|
||||
}
|
||||
|
||||
async createAPIKey() {
|
||||
await this.createAPIKeyButton.click();
|
||||
}
|
||||
|
||||
async typeAPIKeyName(name: string) {
|
||||
await this.nameOfAPIKeyInput.clear();
|
||||
await this.nameOfAPIKeyInput.fill(name);
|
||||
}
|
||||
|
||||
async selectAPIExpirationDate(date: string) {
|
||||
await this.expirationDateAPIKeySelect.click();
|
||||
await this.page.getByText(date, { exact: true }).click();
|
||||
}
|
||||
|
||||
async regenerateAPIKey() {
|
||||
await this.regenerateAPIKeyButton.click();
|
||||
}
|
||||
|
||||
async deleteAPIKey() {
|
||||
await this.deleteButton.click();
|
||||
}
|
||||
|
||||
async clickCancelButton() {
|
||||
await this.cancelButton.click();
|
||||
}
|
||||
|
||||
async clickSaveButton() {
|
||||
await this.saveButton.click();
|
||||
}
|
||||
|
||||
async checkAPIKeyDetails(name: string) {
|
||||
await this.page.locator(`//a/div[contains(.,'${name}')][first()]`).click();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
import { Locator, Page } from '@playwright/test';
|
||||
|
||||
export class DevelopersSection {
|
||||
private readonly readDocumentationButton: Locator;
|
||||
private readonly createAPIKeyButton: Locator;
|
||||
private readonly regenerateAPIKeyButton: Locator;
|
||||
private readonly nameOfAPIKeyInput: Locator;
|
||||
private readonly expirationDateAPIKeySelect: Locator;
|
||||
private readonly createWebhookButton: Locator;
|
||||
private readonly webhookURLInput: Locator;
|
||||
private readonly webhookDescription: Locator;
|
||||
private readonly webhookFilterObjectSelect: Locator;
|
||||
private readonly webhookFilterActionSelect: Locator;
|
||||
private readonly cancelButton: Locator;
|
||||
private readonly saveButton: Locator;
|
||||
private readonly deleteButton: Locator;
|
||||
|
||||
constructor(public readonly page: Page) {
|
||||
this.page = page;
|
||||
this.readDocumentationButton = page.getByRole('link', {
|
||||
name: 'Read documentation',
|
||||
});
|
||||
this.createAPIKeyButton = page.getByRole('link', {
|
||||
name: 'Create API Key',
|
||||
});
|
||||
this.createWebhookButton = page.getByRole('link', {
|
||||
name: 'Create Webhook',
|
||||
});
|
||||
this.nameOfAPIKeyInput = page
|
||||
.getByPlaceholder('E.g. backoffice integration')
|
||||
.first();
|
||||
this.expirationDateAPIKeySelect = page
|
||||
.locator('div')
|
||||
.filter({ hasText: /^Never$/ })
|
||||
.nth(3); // good enough if expiration date will change only 1 time
|
||||
this.regenerateAPIKeyButton = page.getByRole('button', {
|
||||
name: 'Regenerate Key',
|
||||
});
|
||||
this.webhookURLInput = page.getByPlaceholder('URL');
|
||||
this.webhookDescription = page.getByPlaceholder('Write a description');
|
||||
this.webhookFilterObjectSelect = page
|
||||
.locator('div')
|
||||
.filter({ hasText: /^All Objects$/ })
|
||||
.nth(3); // works only for first filter
|
||||
this.webhookFilterActionSelect = page
|
||||
.locator('div')
|
||||
.filter({ hasText: /^All Actions$/ })
|
||||
.nth(3); // works only for first filter
|
||||
this.cancelButton = page.getByRole('button', { name: 'Cancel' });
|
||||
this.saveButton = page.getByRole('button', { name: 'Save' });
|
||||
this.deleteButton = page.getByRole('button', { name: 'Delete' });
|
||||
}
|
||||
|
||||
async openDocumentation() {
|
||||
await this.readDocumentationButton.click();
|
||||
}
|
||||
|
||||
async createAPIKey() {
|
||||
await this.createAPIKeyButton.click();
|
||||
}
|
||||
|
||||
async typeAPIKeyName(name: string) {
|
||||
await this.nameOfAPIKeyInput.clear();
|
||||
await this.nameOfAPIKeyInput.fill(name);
|
||||
}
|
||||
|
||||
async selectAPIExpirationDate(date: string) {
|
||||
await this.expirationDateAPIKeySelect.click();
|
||||
await this.page.getByText(date, { exact: true }).click();
|
||||
}
|
||||
|
||||
async regenerateAPIKey() {
|
||||
await this.regenerateAPIKeyButton.click();
|
||||
}
|
||||
|
||||
async deleteAPIKey() {
|
||||
await this.deleteButton.click();
|
||||
}
|
||||
|
||||
async deleteWebhook() {
|
||||
await this.deleteButton.click();
|
||||
}
|
||||
|
||||
async createWebhook() {
|
||||
await this.createWebhookButton.click();
|
||||
}
|
||||
|
||||
async typeWebhookURL(url: string) {
|
||||
await this.webhookURLInput.fill(url);
|
||||
}
|
||||
|
||||
async typeWebhookDescription(description: string) {
|
||||
await this.webhookDescription.fill(description);
|
||||
}
|
||||
|
||||
async selectWebhookObject(object: string) {
|
||||
// TODO: finish
|
||||
}
|
||||
|
||||
async selectWebhookAction(action: string) {
|
||||
// TODO: finish
|
||||
}
|
||||
|
||||
async deleteWebhookFilter() {
|
||||
// TODO: finish
|
||||
}
|
||||
|
||||
async clickCancelButton() {
|
||||
await this.cancelButton.click();
|
||||
}
|
||||
|
||||
async clickSaveButton() {
|
||||
await this.saveButton.click();
|
||||
}
|
||||
|
||||
async checkAPIKeyDetails(name: string) {
|
||||
await this.page.locator(`//a/div[contains(.,'${name}')][first()]`).click();
|
||||
}
|
||||
|
||||
async checkWebhookDetails(name: string) {
|
||||
await this.page.locator(`//a/div[contains(.,'${name}')][first()]`).click();
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,11 @@ export class ExperienceSection {
|
||||
private readonly dateFormatDropdown: Locator;
|
||||
private readonly timeFormatDropdown: Locator;
|
||||
private readonly searchInput: Locator;
|
||||
private readonly languageDropdown: Locator;
|
||||
|
||||
constructor(public readonly page: Page) {
|
||||
this.page = page;
|
||||
this.lightThemeButton = page.locator('div[variant="Light"]').first();
|
||||
this.darkThemeButton = page.locator('div[variant="Dark"]').first();
|
||||
this.lightThemeButton = page.getByText('AaLight'); // it works
|
||||
this.darkThemeButton = page.getByText('AaDark');
|
||||
this.timezoneDropdown = page.locator(
|
||||
'//span[contains(., "Time zone")]/../div/div/div',
|
||||
);
|
||||
@@ -23,9 +22,6 @@ export class ExperienceSection {
|
||||
'//span[contains(., "Time format")]/../div/div/div',
|
||||
);
|
||||
this.searchInput = page.getByPlaceholder('Search');
|
||||
this.languageDropdown = page.locator(
|
||||
'//h2[contains(., "Language")]/../../../div/div/div',
|
||||
);
|
||||
}
|
||||
|
||||
async changeThemeToLight() {
|
||||
@@ -56,9 +52,4 @@ export class ExperienceSection {
|
||||
await this.timeFormatDropdown.click();
|
||||
await this.page.getByText(timeFormat, { exact: true }).click();
|
||||
}
|
||||
|
||||
async selectLanguage(language: string) {
|
||||
await this.languageDropdown.click();
|
||||
await this.page.getByText(language, { exact: true }).click();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
import { Locator, Page } from '@playwright/test';
|
||||
|
||||
export class FunctionsSection {
|
||||
private readonly newFunctionButton: Locator;
|
||||
private readonly functionNameInput: Locator;
|
||||
private readonly functionDescriptionInput: Locator;
|
||||
private readonly editorTab: Locator;
|
||||
private readonly codeEditorField: Locator;
|
||||
private readonly resetButton: Locator;
|
||||
private readonly publishButton: Locator;
|
||||
private readonly testButton: Locator;
|
||||
private readonly testTab: Locator;
|
||||
private readonly runFunctionButton: Locator;
|
||||
private readonly inputField: Locator;
|
||||
private readonly settingsTab: Locator;
|
||||
private readonly searchVariableInput: Locator;
|
||||
private readonly addVariableButton: Locator;
|
||||
private readonly nameVariableInput: Locator;
|
||||
private readonly valueVariableInput: Locator;
|
||||
private readonly cancelVariableButton: Locator;
|
||||
private readonly saveVariableButton: Locator;
|
||||
private readonly editVariableButton: Locator;
|
||||
private readonly deleteVariableButton: Locator;
|
||||
private readonly cancelButton: Locator;
|
||||
private readonly saveButton: Locator;
|
||||
private readonly deleteButton: Locator;
|
||||
|
||||
constructor(public readonly page: Page) {
|
||||
this.newFunctionButton = page.getByRole('button', { name: 'New Function' });
|
||||
this.functionNameInput = page.getByPlaceholder('Name');
|
||||
this.functionDescriptionInput = page.getByPlaceholder('Description');
|
||||
this.editorTab = page.getByTestId('tab-editor');
|
||||
this.codeEditorField = page.getByTestId('dummyInput'); // TODO: fix
|
||||
this.resetButton = page.getByRole('button', { name: 'Reset' });
|
||||
this.publishButton = page.getByRole('button', { name: 'Publish' });
|
||||
this.testButton = page.getByRole('button', { name: 'Test' });
|
||||
this.testTab = page.getByTestId('tab-test');
|
||||
this.runFunctionButton = page.getByRole('button', { name: 'Run Function' });
|
||||
this.inputField = page.getByTestId('dummyInput'); // TODO: fix
|
||||
this.settingsTab = page.getByTestId('tab-settings');
|
||||
this.searchVariableInput = page.getByPlaceholder('Search a variable');
|
||||
this.addVariableButton = page.getByRole('button', { name: 'Add Variable' });
|
||||
this.nameVariableInput = page.getByPlaceholder('Name').nth(1);
|
||||
this.valueVariableInput = page.getByPlaceholder('Value');
|
||||
this.cancelVariableButton = page.locator('.css-uwqduk').first(); // TODO: fix
|
||||
this.saveVariableButton = page.locator('.css-uwqduk').nth(1); // TODO: fix
|
||||
this.editVariableButton = page.getByText('Edit', { exact: true });
|
||||
this.deleteVariableButton = page.getByText('Delete', { exact: true });
|
||||
this.cancelButton = page.getByRole('button', { name: 'Cancel' });
|
||||
this.saveButton = page.getByRole('button', { name: 'Save' });
|
||||
this.deleteButton = page.getByRole('button', { name: 'Delete function' });
|
||||
}
|
||||
|
||||
async clickNewFunction() {
|
||||
await this.newFunctionButton.click();
|
||||
}
|
||||
|
||||
async typeFunctionName(name: string) {
|
||||
await this.functionNameInput.fill(name);
|
||||
}
|
||||
|
||||
async typeFunctionDescription(description: string) {
|
||||
await this.functionDescriptionInput.fill(description);
|
||||
}
|
||||
|
||||
async checkFunctionDetails(name: string) {
|
||||
await this.page.getByRole('link', { name: `${name} nodejs18.x` }).click();
|
||||
}
|
||||
|
||||
async clickEditorTab() {
|
||||
await this.editorTab.click();
|
||||
}
|
||||
|
||||
async clickResetButton() {
|
||||
await this.resetButton.click();
|
||||
}
|
||||
|
||||
async clickPublishButton() {
|
||||
await this.publishButton.click();
|
||||
}
|
||||
|
||||
async clickTestButton() {
|
||||
await this.testButton.click();
|
||||
}
|
||||
|
||||
async typeFunctionCode() {
|
||||
// TODO: finish once utils are merged
|
||||
}
|
||||
|
||||
async clickTestTab() {
|
||||
await this.testTab.click();
|
||||
}
|
||||
|
||||
async runFunction() {
|
||||
await this.runFunctionButton.click();
|
||||
}
|
||||
|
||||
async typeFunctionInput() {
|
||||
// TODO: finish once utils are merged
|
||||
}
|
||||
|
||||
async clickSettingsTab() {
|
||||
await this.settingsTab.click();
|
||||
}
|
||||
|
||||
async searchVariable(name: string) {
|
||||
await this.searchVariableInput.fill(name);
|
||||
}
|
||||
|
||||
async addVariable() {
|
||||
await this.addVariableButton.click();
|
||||
}
|
||||
|
||||
async typeVariableName(name: string) {
|
||||
await this.nameVariableInput.fill(name);
|
||||
}
|
||||
|
||||
async typeVariableValue(value: string) {
|
||||
await this.valueVariableInput.fill(value);
|
||||
}
|
||||
|
||||
async editVariable(name: string) {
|
||||
await this.page
|
||||
.locator(
|
||||
`//div[@data-testid='tooltip' and contains(., '${name}')]/../../div[last()]/div/div/button`,
|
||||
)
|
||||
.click();
|
||||
await this.editVariableButton.click();
|
||||
}
|
||||
|
||||
async deleteVariable(name: string) {
|
||||
await this.page
|
||||
.locator(
|
||||
`//div[@data-testid='tooltip' and contains(., '${name}')]/../../div[last()]/div/div/button`,
|
||||
)
|
||||
.click();
|
||||
await this.deleteVariableButton.click();
|
||||
}
|
||||
|
||||
async cancelVariable() {
|
||||
await this.cancelVariableButton.click();
|
||||
}
|
||||
|
||||
async saveVariable() {
|
||||
await this.saveVariableButton.click();
|
||||
}
|
||||
|
||||
async clickCancelButton() {
|
||||
await this.cancelButton.click();
|
||||
}
|
||||
|
||||
async clickSaveButton() {
|
||||
await this.saveButton.click();
|
||||
}
|
||||
|
||||
async clickDeleteButton() {
|
||||
await this.deleteButton.click();
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,6 @@ export class GeneralSection {
|
||||
private readonly workspaceNameField: Locator;
|
||||
private readonly supportSwitch: Locator;
|
||||
private readonly deleteWorkspaceButton: Locator;
|
||||
private readonly customizeDomainButton: Locator;
|
||||
private readonly subdomainInput: Locator;
|
||||
|
||||
constructor(public readonly page: Page) {
|
||||
this.page = page;
|
||||
@@ -14,12 +12,6 @@ export class GeneralSection {
|
||||
this.deleteWorkspaceButton = page.getByRole('button', {
|
||||
name: 'Delete workspace',
|
||||
});
|
||||
this.customizeDomainButton = page.getByRole('button', {
|
||||
name: 'Customize domain',
|
||||
});
|
||||
this.subdomainInput = page.locator(
|
||||
'//div[contains(.,".twenty-main.com")]/../input',
|
||||
);
|
||||
}
|
||||
|
||||
async changeWorkspaceName(workspaceName: string) {
|
||||
@@ -34,10 +26,4 @@ export class GeneralSection {
|
||||
async clickDeleteWorkSpaceButton() {
|
||||
await this.deleteWorkspaceButton.click();
|
||||
}
|
||||
|
||||
async changeSubdomain(subdomain: string) {
|
||||
await this.customizeDomainButton.click();
|
||||
await this.subdomainInput.fill(subdomain);
|
||||
await this.page.getByRole('button', { name: 'Save' }).click();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ export class NewFieldSection {
|
||||
private readonly relationFieldLink: Locator;
|
||||
private readonly relationTypeSelect: Locator;
|
||||
private readonly objectDestinationSelect: Locator;
|
||||
private readonly relationIconSelect: Locator;
|
||||
private readonly relationFieldNameInput: Locator;
|
||||
private readonly fullNameFieldLink: Locator;
|
||||
private readonly UUIDFieldLink: Locator;
|
||||
@@ -226,11 +225,6 @@ export class NewFieldSection {
|
||||
await this.page.getByTestId('tooltip').filter({ hasText: name }).click();
|
||||
}
|
||||
|
||||
async selectRelationIcon(name: string) {
|
||||
await this.relationIconSelect.click();
|
||||
await this.page.getByTitle(name).click();
|
||||
}
|
||||
|
||||
async typeRelationName(name: string) {
|
||||
await this.relationFieldNameInput.clear();
|
||||
await this.relationFieldNameInput.fill(name);
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import { Locator, Page } from '@playwright/test';
|
||||
|
||||
export class RolesSection {
|
||||
private readonly page: Page;
|
||||
private readonly createRoleButton: Locator;
|
||||
private readonly defaultRoleDropdown: Locator;
|
||||
|
||||
constructor(page: Page) {
|
||||
this.page = page;
|
||||
this.createRoleButton = page.getByRole('button', { name: 'Create Role' });
|
||||
this.defaultRoleDropdown = page.getByTestId('tooltip');
|
||||
}
|
||||
|
||||
async clickCreateRoleButton() {
|
||||
await this.createRoleButton.click();
|
||||
}
|
||||
|
||||
async selectDefaultRole(role: string) {
|
||||
await this.defaultRoleDropdown.click();
|
||||
await this.page.getByTestId('tooltip').getByText(role).click();
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,10 @@
|
||||
import { Locator, Page } from '@playwright/test';
|
||||
|
||||
export class SecuritySection {
|
||||
private readonly googleToggle: Locator;
|
||||
private readonly microsoftToggle: Locator;
|
||||
private readonly passwordToggle: Locator;
|
||||
private readonly inviteByLinkToggle: Locator;
|
||||
|
||||
constructor(public readonly page: Page) {
|
||||
this.googleToggle = page.getByLabel('Google');
|
||||
this.microsoftToggle = page.getByLabel('Microsoft');
|
||||
this.passwordToggle = page.getByLabel('Password');
|
||||
this.inviteByLinkToggle = page.getByLabel('Invite by Link');
|
||||
}
|
||||
|
||||
async toggleGoogle() {
|
||||
await this.googleToggle.click();
|
||||
}
|
||||
|
||||
async toggleMicrosoft() {
|
||||
await this.microsoftToggle.click();
|
||||
}
|
||||
|
||||
async togglePassword() {
|
||||
await this.passwordToggle.click();
|
||||
this.inviteByLinkToggle = page.locator('input[type="checkbox"]').nth(1);
|
||||
}
|
||||
|
||||
async toggleInviteByLink() {
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
import { Locator, Page } from '@playwright/test';
|
||||
|
||||
export class WebhooksSection {
|
||||
private readonly createWebhookButton: Locator;
|
||||
private readonly webhookURLInput: Locator;
|
||||
private readonly webhookDescription: Locator;
|
||||
private readonly deleteButton: Locator;
|
||||
|
||||
constructor(public readonly page: Page) {
|
||||
this.page = page;
|
||||
this.createWebhookButton = page.getByRole('link', {
|
||||
name: 'Create Webhook',
|
||||
});
|
||||
this.webhookURLInput = page.getByPlaceholder('URL');
|
||||
this.webhookDescription = page.getByPlaceholder('Write a description');
|
||||
this.deleteButton = page.getByRole('button', { name: 'Delete' });
|
||||
}
|
||||
|
||||
async deleteWebhook() {
|
||||
await this.deleteButton.click();
|
||||
}
|
||||
|
||||
async createWebhook() {
|
||||
await this.createWebhookButton.click();
|
||||
}
|
||||
|
||||
async typeWebhookURL(url: string) {
|
||||
await this.webhookURLInput.clear();
|
||||
await this.webhookURLInput.fill(url);
|
||||
}
|
||||
|
||||
async typeWebhookDescription(description: string) {
|
||||
await this.webhookDescription.fill(description);
|
||||
}
|
||||
|
||||
async selectWebhookObject(index: number, object: string) {
|
||||
await this.page
|
||||
.locator(
|
||||
`//div[aria-controls="object-webhook-type-select-${index}-options"]`,
|
||||
)
|
||||
.click();
|
||||
await this.page.getByRole('option').getByText(object).click();
|
||||
}
|
||||
|
||||
async selectWebhookAction(index: number, action: string) {
|
||||
await this.page
|
||||
.locator(
|
||||
`//div[aria-controls="operation-webhook-type-select-${index}-options"]`,
|
||||
)
|
||||
.click();
|
||||
await this.page.getByRole('option').getByText(action).click();
|
||||
}
|
||||
|
||||
async deleteWebhookFilter(index: number) {
|
||||
await this.page
|
||||
.locator(
|
||||
`//div[aria-controls="object-webhook-type-select-${index}-options"]/../..//button`,
|
||||
)
|
||||
.click();
|
||||
}
|
||||
|
||||
async checkWebhookDetails(name: string) {
|
||||
await this.page.locator(`//a/div[contains(.,'${name}')][first()]`).click();
|
||||
}
|
||||
}
|
||||
@@ -9,15 +9,13 @@ export class SettingsPage {
|
||||
private readonly calendarsLink: Locator;
|
||||
private readonly generalLink: Locator;
|
||||
private readonly membersLink: Locator;
|
||||
private readonly rolesLink: Locator;
|
||||
private readonly dataModelLink: Locator;
|
||||
private readonly integrationsLink: Locator;
|
||||
private readonly developersLink: Locator;
|
||||
private readonly functionsLink: Locator;
|
||||
private readonly securityLink: Locator;
|
||||
private readonly apisLink: Locator;
|
||||
private readonly webhooksLink: Locator;
|
||||
private readonly adminPanelLink: Locator;
|
||||
private readonly labLink: Locator;
|
||||
private readonly integrationsLink: Locator;
|
||||
private readonly releasesLink: Locator;
|
||||
private readonly logoutLink: Locator;
|
||||
private readonly advancedToggle: Locator;
|
||||
|
||||
constructor(public readonly page: Page) {
|
||||
@@ -30,15 +28,13 @@ export class SettingsPage {
|
||||
this.calendarsLink = page.getByRole('link', { name: 'Calendars' });
|
||||
this.generalLink = page.getByRole('link', { name: 'General' });
|
||||
this.membersLink = page.getByRole('link', { name: 'Members' });
|
||||
this.rolesLink = page.getByRole('link', { name: 'Roles' });
|
||||
this.dataModelLink = page.getByRole('link', { name: 'Data model' });
|
||||
this.developersLink = page.getByRole('link', { name: 'Developers' });
|
||||
this.functionsLink = page.getByRole('link', { name: 'Functions' });
|
||||
this.integrationsLink = page.getByRole('link', { name: 'Integrations' });
|
||||
this.securityLink = page.getByRole('link', { name: 'Security' });
|
||||
this.apisLink = page.getByRole('link', { name: 'APIs' });
|
||||
this.webhooksLink = page.getByRole('link', { name: 'Webhooks' });
|
||||
this.adminPanelLink = page.getByRole('link', { name: 'Admin Panel' });
|
||||
this.labLink = page.getByRole('link', { name: 'Lab' });
|
||||
this.releasesLink = page.getByRole('link', { name: 'Releases' });
|
||||
this.logoutLink = page.getByText('Logout');
|
||||
this.advancedToggle = page.locator('input[type="checkbox"]').first();
|
||||
}
|
||||
|
||||
@@ -74,36 +70,24 @@ export class SettingsPage {
|
||||
await this.membersLink.click();
|
||||
}
|
||||
|
||||
async goToRolesSection() {
|
||||
await this.rolesLink.click();
|
||||
}
|
||||
|
||||
async goToDataModelSection() {
|
||||
await this.dataModelLink.click();
|
||||
}
|
||||
|
||||
async goToIntegrationsSection() {
|
||||
await this.integrationsLink.click();
|
||||
async goToDevelopersSection() {
|
||||
await this.developersLink.click();
|
||||
}
|
||||
|
||||
async goToFunctionsSection() {
|
||||
await this.functionsLink.click();
|
||||
}
|
||||
|
||||
async goToSecuritySection() {
|
||||
await this.securityLink.click();
|
||||
}
|
||||
|
||||
async goToAPIsSection() {
|
||||
await this.apisLink.click();
|
||||
}
|
||||
|
||||
async goToWebhooksSection() {
|
||||
await this.webhooksLink.click();
|
||||
}
|
||||
|
||||
async goToAdminPanelSection() {
|
||||
await this.adminPanelLink.click();
|
||||
}
|
||||
|
||||
async goToLabSection() {
|
||||
await this.labLink.click();
|
||||
async goToIntegrationsSection() {
|
||||
await this.integrationsLink.click();
|
||||
}
|
||||
|
||||
async goToReleasesIntegration() {
|
||||
@@ -111,7 +95,7 @@ export class SettingsPage {
|
||||
}
|
||||
|
||||
async logout() {
|
||||
await this.page.getByText('Logout').click();
|
||||
await this.logoutLink.click();
|
||||
}
|
||||
|
||||
async toggleAdvancedSettings() {
|
||||
|
||||
@@ -19,7 +19,7 @@ export const deleteWorkflow = async ({
|
||||
operationName: 'DeleteOneWorkflow',
|
||||
variables: { idToDelete: workflowId },
|
||||
query:
|
||||
'mutation DeleteOneWorkflow($idToDelete: UUID!) {\n deleteWorkflow(id: $idToDelete) {\n __typename\n deletedAt\n id\n }\n}',
|
||||
'mutation DeleteOneWorkflow($idToDelete: ID!) {\n deleteWorkflow(id: $idToDelete) {\n __typename\n deletedAt\n id\n }\n}',
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -19,7 +19,7 @@ export const destroyWorkflow = async ({
|
||||
operationName: 'DestroyOneWorkflow',
|
||||
variables: { idToDestroy: workflowId },
|
||||
query:
|
||||
'mutation DestroyOneWorkflow($idToDestroy: UUID!) {\n destroyWorkflow(id: $idToDestroy) {\n id\n __typename\n }\n}',
|
||||
'mutation DestroyOneWorkflow($idToDestroy: ID!) {\n destroyWorkflow(id: $idToDestroy) {\n id\n __typename\n }\n}',
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -9,5 +9,4 @@ export type WorkflowActionType =
|
||||
| 'update-record'
|
||||
| 'delete-record'
|
||||
| 'code'
|
||||
| 'send-email'
|
||||
| 'form';
|
||||
| 'send-email';
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
{
|
||||
"name": "twenty-e2e-testing",
|
||||
"version": "0.42.17",
|
||||
"description": "",
|
||||
"author": "",
|
||||
"private": true,
|
||||
"license": "AGPL-3.0",
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.51.0"
|
||||
"@playwright/test": "^1.49.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,7 @@ test('Create workflow', async ({ page }) => {
|
||||
const workflowsLink = page.getByRole('link', { name: 'Workflows' });
|
||||
await workflowsLink.click();
|
||||
|
||||
const createWorkflowButton = page.getByRole('button', {
|
||||
name: 'Create new workflow',
|
||||
});
|
||||
const createWorkflowButton = page.getByRole('button', { name: 'New record' });
|
||||
|
||||
const [createWorkflowResponse] = await Promise.all([
|
||||
page.waitForResponse(async (response) => {
|
||||
@@ -28,7 +26,7 @@ test('Create workflow', async ({ page }) => {
|
||||
createWorkflowButton.click(),
|
||||
]);
|
||||
|
||||
const recordName = page.getByTestId('top-bar-title').getByText('Untitled');
|
||||
const recordName = page.getByTestId('top-bar-title').getByTestId('tooltip');
|
||||
await recordName.click();
|
||||
|
||||
const nameInput = page.getByTestId('top-bar-title').getByRole('textbox');
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user