chore: use Nx affected tasks in CI (#5110)

Closes #5097

- Uses "nx affected" to detect what projects need to be checked in the
current PR (for now, `ci-front` and `ci-server` workflows only).
- Caches results of certain tasks (`lint`, `typecheck`, `test`,
`storybook:build`) when a PR pipeline runs. The next runs of the same
PR's pipeline will then be able to reuse the PR's task cache to execute
tasks faster.
- Caches Yarn's cache folder to install dependencies faster in CI jobs.
- Rewrites the node modules cache/install steps as a custom, reusable
Github action.
- Distributes `ci-front` jobs with a "matrix" strategy.
- Sets common tasks config at the root `nx.json`. For instance, to
activate the `typecheck` task in a project, add `typecheck: {}` to its
`project.json` and it'll use the default config set in `nx.json` for the
`typecheck` task. Options can be overridden in each individual
`project.json` if needed.
- Adds "scope" tags to some projects: `scope:frontend`, `scope:backend`,
`scope:shared`. An eslint rule ensures that `scope:frontend` only
depends on `scope:frontent` or `scope:shared` projects, same for
`scope:backend`. These tags are used by `nx affected` to filter projects
by scope and generates different task cache keys according to the
requested scope.
- Enables checks for twenty-emails in the `ci-server` workflow.
This commit is contained in:
Thaïs 2024-04-30 16:28:25 +02:00 committed by GitHub
parent a77cb023c0
commit c193663a71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
44 changed files with 13485 additions and 13474 deletions

View File

@ -24,8 +24,16 @@ module.exports = {
allow: [],
depConstraints: [
{
sourceTag: '*',
onlyDependOnLibsWithTags: ['*'],
sourceTag: 'scope:shared',
onlyDependOnLibsWithTags: ['scope:shared'],
},
{
sourceTag: 'scope:backend',
onlyDependOnLibsWithTags: ['scope:shared', 'scope:backend'],
},
{
sourceTag: 'scope:frontend',
onlyDependOnLibsWithTags: ['scope:shared', 'scope:frontend'],
},
],
},

View File

@ -0,0 +1,21 @@
name: Nx Affected CI
inputs:
parallel:
required: false
types: [number]
default: 3
tag:
required: false
types: [string]
tasks:
required: true
types: [string]
runs:
using: "composite"
steps:
- name: Get last successful commit
uses: nrwl/nx-set-shas@v4
- name: Run affected command
shell: bash
run: npx nx affected --nxBail --configuration=ci -t=${{ inputs.tasks }} --parallel=${{ inputs.parallel }} --exclude='*,!tag:${{ inputs.tag }}'

View File

@ -0,0 +1,29 @@
name: Restore Tasks Cache CI
inputs:
tag:
required: false
types: [string]
tasks:
required: false
types: [string]
default: all
suffix:
required: false
types: [string]
runs:
using: "composite"
steps:
- name: Compute tasks key
id: tasks-key
shell: bash
run: echo "key=${{ inputs.tasks }}" | tr , - >> $GITHUB_OUTPUT
- name: Restore tasks cache
uses: actions/cache@v3
with:
path: |
.cache
.nx/cache
key: tasks-cache-${{ inputs.tag }}-${{ steps.tasks-key.outputs.key }}${{ inputs.suffix }}-${{ github.sha }}
restore-keys: |
tasks-cache-${{ inputs.tag }}-${{ steps.tasks-key.outputs.key }}${{ inputs.suffix }}-

View File

@ -0,0 +1,23 @@
name: Yarn Install
runs:
using: "composite"
steps:
- name: Setup Node.js and get yarn cache
uses: actions/setup-node@v3
with:
node-version: "18"
cache: yarn
- name: Cache node modules
id: node-modules-cache
uses: actions/cache@v3
with:
path: |
node_modules
packages/*/node_modules
key: root-node_modules-${{ hashFiles('yarn.lock') }}
restore-keys: root-node_modules-
- name: Install Dependencies
shell: bash
run: yarn --immutable --check-cache
if: steps.node-modules-cache.outputs.cache-hit != 'true'

View File

@ -27,17 +27,13 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Install dependencies
uses: ./.github/workflows/actions/yarn-install
- name: Front / Write .env
run: |
cd packages/twenty-front
touch .env
echo "REACT_APP_SERVER_BASE_URL: $REACT_APP_SERVER_BASE_URL" >> .env
- name: Front / Install Dependencies
run: yarn
- name: Publish to Chromatic
run: |
cd packages/twenty-front

View File

@ -15,33 +15,7 @@ concurrency:
cancel-in-progress: true
jobs:
chrome-extension-yarn-install:
runs-on: ci-8-cores
env:
VITE_SERVER_BASE_URL: http://localhost:3000
VITE_FRONT_BASE_URL: http://localhost:3001
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Cache chrome extension node modules
uses: actions/cache@v3
with:
path: packages/twenty-chrome-extension/node_modules
key: chrome-extension-node_modules-${{hashFiles('yarn.lock')}}
restore-keys: chrome-extension-node_modules-
- name: Cache root node modules
uses: actions/cache@v3
with:
path: node_modules
key: root-node_modules-${{hashFiles('yarn.lock')}}
restore-keys: root-node_modules-
- name: Chrome Extension / Install Dependencies
run: yarn
chrome-extension-build:
needs: chrome-extension-yarn-install
runs-on: ubuntu-latest
env:
VITE_SERVER_BASE_URL: http://localhost:3000
@ -52,21 +26,7 @@ jobs:
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Cache chrome extension node modules
uses: actions/cache@v3
with:
path: packages/twenty-chrome-extension/node_modules
key: chrome-extension-node_modules-${{hashFiles('yarn.lock')}}
restore-keys: chrome-extension-node_modules-
- name: Cache root node modules
uses: actions/cache@v3
with:
path: node_modules
key: root-node_modules-${{hashFiles('yarn.lock')}}
restore-keys: root-node_modules-
- name: Install dependencies
uses: ./.github/workflows/actions/yarn-install
- name: Chrome Extension / Run build
run: npx nx build twenty-chrome-extension

View File

@ -21,12 +21,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Docs / Install Dependencies
run: yarn
- name: Install dependencies
uses: ./.github/workflows/actions/yarn-install
- name: Docs / Build Documentation
run: npx nx build twenty-docs
vale:

View File

@ -17,109 +17,43 @@ concurrency:
cancel-in-progress: true
jobs:
front-yarn-install:
runs-on: ci-8-cores
env:
REACT_APP_SERVER_BASE_URL: http://localhost:3000
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Cache front node modules
uses: actions/cache@v3
with:
path: packages/twenty-front/node_modules
key: front-node_modules-${{hashFiles('yarn.lock')}}
restore-keys: front-node_modules-
- name: Cache root node modules
uses: actions/cache@v3
with:
path: node_modules
key: root-node_modules-${{hashFiles('yarn.lock')}}
restore-keys: root-node_modules-
- name: Front / Install Dependencies
run: yarn
front-pages-sb-test:
needs: front-yarn-install
front-sb-test:
runs-on: ci-8-cores
strategy:
matrix:
storybook_scope: [pages, modules]
env:
REACT_APP_SERVER_BASE_URL: http://localhost:3000
STORYBOOK_SCOPE: ${{ matrix.storybook_scope }}
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Front / Write .env
run: |
cd packages/twenty-front
cp .env.example .env
- name: Cache front node modules
uses: actions/cache@v3
with:
path: packages/twenty-front/node_modules
key: front-node_modules-${{hashFiles('yarn.lock')}}
restore-keys: front-node_modules-
- name: Cache root node modules
uses: actions/cache@v3
with:
path: node_modules
key: root-node_modules-${{hashFiles('yarn.lock')}}
restore-keys: root-node_modules-
- name: Fetch local actions
uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/workflows/actions/yarn-install
- name: Install Playwright
run: cd packages/twenty-front && npx playwright install
- name: Front / Restore Storybook Task Cache
uses: ./.github/workflows/actions/task-cache
with:
tag: scope:frontend
tasks: storybook:build
suffix: _${{ matrix.storybook_scope }}
- name: Front / Write .env
run: npx nx reset:env twenty-front
- name: Run storybook tests
run: |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"STORYBOOK_SCOPE=pages npx nx run twenty-front:storybook:static:ci" \
"npx wait-on tcp:6006 && STORYBOOK_SCOPE=pages npx nx run twenty-front:storybook:test"
front-modules-sb-test:
needs: front-yarn-install
runs-on: ci-4-cores
env:
REACT_APP_SERVER_BASE_URL: http://localhost:3000
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Front / Write .env
run: |
cd packages/twenty-front
cp .env.example .env
- name: Cache front node modules
uses: actions/cache@v3
with:
path: packages/twenty-front/node_modules
key: front-node_modules-${{hashFiles('yarn.lock')}}
restore-keys: front-node_modules-
- name: Cache root node modules
uses: actions/cache@v3
with:
path: node_modules
key: root-node_modules-${{hashFiles('yarn.lock')}}
restore-keys: root-node_modules-
- name: Install Playwright
run: cd packages/twenty-front && npx playwright install
- name: Run storybook tests
run: |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"STORYBOOK_SCOPE=modules npx nx run twenty-front:storybook:static:ci" \
"npx wait-on tcp:6006 && STORYBOOK_SCOPE=modules npx nx run twenty-front:storybook:test"
front-lint-tsc:
needs: front-yarn-install
"npx nx storybook:static twenty-front" \
"npx wait-on tcp:6006 && npx nx storybook:test twenty-front"
front-task:
runs-on: ubuntu-latest
strategy:
matrix:
task: [lint, typecheck, test]
env:
REACT_APP_SERVER_BASE_URL: http://localhost:3000
steps:
@ -127,57 +61,19 @@ jobs:
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
- name: Fetch local actions and base branch history
uses: actions/checkout@v4
with:
node-version: "18"
- name: Cache front node modules
uses: actions/cache@v3
fetch-depth: 0
- name: Install dependencies
uses: ./.github/workflows/actions/yarn-install
- name: Front / Restore Task Cache
uses: ./.github/workflows/actions/task-cache
with:
path: packages/twenty-front/node_modules
key: front-node_modules-${{hashFiles('yarn.lock')}}
restore-keys: front-node_modules-
- name: Cache root node modules
uses: actions/cache@v3
tag: scope:frontend
tasks: ${{ matrix.task }}
- name: Front / Run task
uses: ./.github/workflows/actions/nx-affected
with:
path: node_modules
key: root-node_modules-${{hashFiles('yarn.lock')}}
restore-keys: root-node_modules-
- name: UI / Run linter
run: npx nx lint twenty-ui
- name: UI / Run Typescript Check
run: npx nx run twenty-ui:typecheck:ci
- name: Front / Run linter
run: npx nx run twenty-front:lint:ci
- name: Front / Run Typescript Check
run: npx nx run twenty-front:typecheck:ci
front-jest:
needs: front-yarn-install
runs-on: ubuntu-latest
env:
REACT_APP_SERVER_BASE_URL: http://localhost:3000
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Cache front node modules
uses: actions/cache@v3
with:
path: packages/twenty-front/node_modules
key: front-node_modules-${{hashFiles('yarn.lock')}}
restore-keys: front-node_modules-
- name: Cache root node modules
uses: actions/cache@v3
with:
path: node_modules
key: root-node_modules-${{hashFiles('yarn.lock')}}
restore-keys: root-node_modules-
- name: Front / Run jest
run: npx nx test twenty-front --configuration=ci
tag: scope:frontend
tasks: ${{ matrix.task }}

View File

@ -28,22 +28,29 @@ jobs:
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
- name: Fetch local actions and base branch history
uses: actions/checkout@v4
with:
node-version: "18"
- name: Server / Install Dependencies
run: yarn
- name: Server / Run linter
run: npx nx lint twenty-server
- name: Server / Run jest tests
run: npx nx test:unit twenty-server
fetch-depth: 0
- name: Install dependencies
uses: ./.github/workflows/actions/yarn-install
- name: Server / Restore Tasks Cache
uses: ./.github/workflows/actions/task-cache
with:
tag: scope:backend
- name: Server / Run lint & typecheck
uses: ./.github/workflows/actions/nx-affected
with:
tag: scope:backend
tasks: lint,typecheck
- name: Server / Run tests
uses: ./.github/workflows/actions/nx-affected
with:
tag: scope:backend
tasks: test
- name: Server / Build
run: npx nx build twenty-server
- name: Server / Write .env
run: |
cd packages/twenty-server
cp .env.example .env
run: npx nx reset:env twenty-server
- name: Worker / Run
run: MESSAGE_QUEUE_TYPE=sync npx nx worker twenty-server

View File

@ -21,12 +21,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Utils / Install Dependencies
run: yarn
- name: Install dependencies
uses: ./.github/workflows/actions/yarn-install
- name: Utils / Run Danger.js
run: cd packages/twenty-utils && npx nx danger:ci
env:

View File

@ -27,12 +27,8 @@ jobs:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Website / Install Dependencies
run: yarn
- name: Install dependencies
uses: ./.github/workflows/actions/yarn-install
- name: Website / Run migrations
run: npx nx database:migrate twenty-website
env:

1
.gitignore vendored
View File

@ -25,3 +25,4 @@ dist
storybook-static
*.tsbuildinfo
.eslintcache
.cache

108
nx.json
View File

@ -1,4 +1,8 @@
{
"namedInputs": {
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"sharedGlobals": ["{workspaceRoot}/.github/workflows/**/*"]
},
"targetDefaults": {
"build": {
"cache": true,
@ -9,17 +13,73 @@
"dependsOn": ["^build"]
},
"lint": {
"cache": true
"executor": "@nx/eslint:lint",
"cache": true,
"outputs": ["{options.outputFile}"],
"options": {
"eslintConfig": "{projectRoot}/.eslintrc.cjs",
"cache": true,
"cacheLocation": "{workspaceRoot}/.cache/eslint",
"ignorePath": "{workspaceRoot}/.gitignore"
},
"configurations": {
"ci": { "cacheStrategy": "content" },
"fix": { "fix": true }
}
},
"fmt": {
"executor": "nx:run-commands",
"cache": true,
"options": {
"cwd": "{projectRoot}",
"command": "prettier {args.files} --check --cache {args.cache} --cache-location {args.cacheLocation} --write {args.write} --cache-strategy {args.cacheStrategy}",
"cache": true,
"cacheLocation": "../../.cache/prettier/{projectRoot}",
"cacheStrategy": "metadata",
"write": false
},
"configurations": {
"ci": { "cacheStrategy": "content" },
"fix": { "write": true }
}
},
"typecheck": {
"executor": "nx:run-commands",
"cache": true,
"options": {
"cwd": "{projectRoot}",
"command": "tsc -b tsconfig.json --incremental"
},
"configurations": {
"watch": { "watch": true }
}
},
"test": {
"executor": "@nx/jest:jest",
"cache": true,
"dependsOn": ["^build"]
"dependsOn": ["^build"],
"outputs": ["{projectRoot}/coverage"],
"options": {
"jestConfig": "{projectRoot}/jest.config.ts",
"coverage": true,
"coverageReporters": ["text-summary"],
"cacheDirectory": "../../.cache/jest/{projectRoot}"
},
"configurations": {
"ci": {
"ci": true,
"maxWorkers": 3
},
"coverage": { "coverageReporters": ["lcov", "text"] },
"watch": { "watch": true }
}
},
"test:e2e": {
"cache": true,
"dependsOn": ["^build"]
},
"storybook:build": {
"executor": "@nx/storybook:build",
"cache": true,
"dependsOn": ["^build"],
"inputs": [
@ -27,11 +87,51 @@
"^default",
"{projectRoot}/.storybook/**/*",
"{projectRoot}/tsconfig.storybook.json"
]
],
"outputs": ["{options.outputDir}"],
"options": {
"outputDir": "{projectRoot}/storybook-static",
"configDir": "{projectRoot}/.storybook"
}
},
"storybook:dev": {
"executor": "@nx/storybook:storybook",
"cache": true,
"dependsOn": ["^build"]
"dependsOn": ["^build"],
"options": {
"configDir": "{projectRoot}/.storybook"
}
},
"storybook:static": {
"executor": "@nx/web:file-server",
"options": {
"staticFilePath": "{projectRoot}/storybook-static",
"watch": false
}
},
"storybook:test": {
"executor": "nx:run-commands",
"options": {
"cwd": "{projectRoot}",
"commands": [
"test-storybook --url {options.url} --maxWorkers=3 --coverage",
"nyc report --reporter=lcov --reporter=text-summary -t coverage/storybook --report-dir coverage/storybook --check-coverage"
],
"parallel": false
}
},
"chromatic": {
"executor": "nx:run-commands",
"options": {
"cwd": "{projectRoot}",
"command": "cross-var chromatic --project-token=$CHROMATIC_PROJECT_TOKEN --build-script-name=storybook:build --exit-zero-on-changes={args.ci}",
"ci": false
},
"configurations": {
"ci": {
"ci": true
}
}
},
"@nx/jest:jest": {
"cache": true,

View File

@ -335,7 +335,7 @@
"version": "0.2.1",
"nx": {},
"scripts": {
"start": "nx run-many -t start -p twenty-server twenty-front"
"start": "npx nx run-many -t start -p twenty-server twenty-front"
},
"workspaces": {
"packages": [

View File

@ -6,9 +6,9 @@
"type": "module",
"scripts": {
"nx": "NX_DEFAULT_PROJECT=twenty-chrome-extension node ../../node_modules/nx/bin/nx.js",
"clean": "rimraf ./dist",
"clean": "npx rimraf ./dist",
"start": "yarn clean && VITE_MODE=development vite",
"build": "yarn clean && tsc && vite build",
"build": "yarn clean && npx tsc && npx vite build",
"lint": "eslint . --report-unused-disable-directives --max-warnings 0 --config .eslintrc.cjs",
"graphql:generate": "graphql-codegen",
"fmt": "prettier --check \"src/**/*.ts\" \"src/**/*.tsx\"",

View File

@ -1,7 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc"
"outDir": "../../.cache/tsc"
},
"exclude": [
"**/*.spec.ts",

View File

@ -1,7 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"outDir": "../../.cache/tsc",
"types": ["jest", "node"]
},
"include": [

View File

@ -7,9 +7,7 @@
"license": "AGPL-3.0",
"main": "./dist/index.js",
"scripts": {
"nx": "NX_DEFAULT_PROJECT=twenty-emails node ../../node_modules/nx/bin/nx.js",
"build": "npx vite build",
"lint": "eslint"
"build": "npx vite build"
},
"exports": {
".": {
@ -21,8 +19,5 @@
"node": "^18.17.1",
"npm": "please-use-yarn",
"yarn": "^4.0.2"
},
"nx": {
"projectType": "library"
}
}

View File

@ -0,0 +1,35 @@
{
"name": "twenty-emails",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"tags": ["scope:backend"],
"targets": {
"build": {
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "{projectRoot}/dist"
}
},
"typecheck": {},
"lint": {
"options": {
"lintFilePatterns": [
"{projectRoot}/src/**/*.{ts,tsx,json}",
"{projectRoot}/package.json"
],
"reportUnusedDisableDirectives": "error"
},
"configurations": {
"fix": {}
}
},
"fmt": {
"options": {
"files": "src"
},
"configurations": {
"fix": {}
}
}
}
}

View File

@ -1,3 +1,5 @@
/* eslint-disable @nx/workspace-no-hardcoded-colors */
const grayScale = {
gray100: '#000000',
gray90: '#141414',

View File

@ -1,5 +1,6 @@
import { PropsWithChildren } from 'react';
import { Container, Html } from '@react-email/components';
import { BaseHead } from 'src/components/BaseHead';
import { Logo } from 'src/components/Logo';

View File

@ -1,4 +1,5 @@
import { Font, Head } from '@react-email/components';
import { emailTheme } from 'src/common-style';
export const BaseHead = () => {

View File

@ -1,5 +1,6 @@
import { ReactNode } from 'react';
import { Button } from '@react-email/button';
import { emailTheme } from 'src/common-style';
const callToActionStyle = {

View File

@ -2,6 +2,7 @@ import { ReactNode } from 'react';
import { Column } from '@react-email/components';
import { Row } from '@react-email/row';
import { Text } from '@react-email/text';
import { emailTheme } from 'src/common-style';
const rowStyle = {

View File

@ -1,5 +1,6 @@
import { ReactNode } from 'react';
import { Link as EmailLink } from '@react-email/components';
import { emailTheme } from 'src/common-style';
const linkStyle = {

View File

@ -1,5 +1,6 @@
import { PropsWithChildren } from 'react';
import { PropsWithChildren as MainTextProps } from 'react';
import { Text } from '@react-email/text';
import { emailTheme } from 'src/common-style';
const mainTextStyle = {
@ -8,6 +9,6 @@ const mainTextStyle = {
color: emailTheme.font.colors.primary,
};
export const MainText = ({ children }: PropsWithChildren) => {
export const MainText = ({ children }: MainTextProps) => {
return <Text style={mainTextStyle}>{children}</Text>;
};

View File

@ -4,7 +4,7 @@ import { HighlightedText } from 'src/components/HighlightedText';
import { MainText } from 'src/components/MainText';
import { Title } from 'src/components/Title';
type CleanInactiveWorkspaceEmailData = {
type CleanInactiveWorkspaceEmailProps = {
daysLeft: number;
userName: string;
workspaceDisplayName: string;
@ -14,7 +14,7 @@ export const CleanInactiveWorkspaceEmail = ({
daysLeft,
userName,
workspaceDisplayName,
}: CleanInactiveWorkspaceEmailData) => {
}: CleanInactiveWorkspaceEmailProps) => {
const dayOrDays = daysLeft > 1 ? 'days' : 'day';
const remainingDays = daysLeft > 1 ? `${daysLeft} ` : '';

View File

@ -1,4 +1,5 @@
import { Column, Row, Section } from '@react-email/components';
import { BaseEmail } from 'src/components/BaseEmail';
import { MainText } from 'src/components/MainText';
import { Title } from 'src/components/Title';

View File

@ -1,4 +1,5 @@
import { format } from 'date-fns';
import { BaseEmail } from 'src/components/BaseEmail';
import { CallToAction } from 'src/components/CallToAction';
import { MainText } from 'src/components/MainText';

View File

@ -1,7 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"outDir": "../../.cache/tsc",
"types": [
"node",
"@nx/react/typings/image.d.ts",

View File

@ -2,6 +2,7 @@
"name": "twenty-front",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"tags": ["scope:frontend"],
"targets": {
"build": {
"outputs": ["{options.outputPath}"],
@ -24,115 +25,58 @@
"open": true
}
},
"typecheck": {
"reset:env": {
"executor": "nx:run-commands",
"inputs": ["{projectRoot}/.env.example"],
"outputs": ["{projectRoot}/.env"],
"cache": true,
"options": {
"cwd": "{projectRoot}",
"command": "tsc -b tsconfig.json",
"args": ["--incremental"]
},
"configurations": {
"ci": { "args": [] },
"watch": { "watch": true }
"command": "cp .env.example .env"
}
},
"typecheck": {},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"eslintConfig": "{projectRoot}/.eslintrc.cjs",
"ignorePath": "{workspaceRoot}/.gitignore",
"lintFilePatterns": [
"{projectRoot}/src/**/*.{ts,tsx,json}",
"{projectRoot}/package.json"
],
"maxWarnings": 0,
"reportUnusedDisableDirectives": "error",
"cache": true
"reportUnusedDisableDirectives": "error"
},
"configurations": {
"ci": {
"eslintConfig": "{projectRoot}/.eslintrc-ci.cjs",
"cache": false
},
"fix": {
"fix": true
}
"ci": { "eslintConfig": "{projectRoot}/.eslintrc-ci.cjs" },
"fix": {}
}
},
"fmt": {
"executor": "nx:run-commands",
"inputs": ["{projectRoot}/src/**/*"],
"cache": true,
"options": {
"cwd": "{projectRoot}",
"command": "prettier src --check"
"files": "src"
},
"configurations": {
"fix": { "args": ["--write"] }
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{projectRoot}/coverage"],
"options": {
"jestConfig": "{projectRoot}/jest.config.ts",
"coverage": true,
"coverageReporters": ["text-summary"]
},
"configurations": {
"ci": {
"ci": true,
"maxWorkers": 3
},
"coverage": {
"coverageReporters": ["lcov", "text"]
},
"watch": { "watch": true }
}
},
"storybook:build": {
"executor": "@nx/storybook:build",
"outputs": ["{options.outputDir}"],
"options": {
"outputDir": "{projectRoot}/storybook-static",
"configDir": "{projectRoot}/.storybook"
"fix": {}
}
},
"test": {},
"storybook:build": {},
"storybook:dev": {
"executor": "@nx/storybook:storybook",
"options": {
"port": 6006,
"configDir": "{projectRoot}/.storybook"
}
"options": { "port": 6006 }
},
"storybook:static": {
"executor": "@nx/web:file-server",
"options": {
"buildTarget": "twenty-front:storybook:build",
"port": 6006,
"staticFilePath": "{projectRoot}/storybook-static",
"watch": false
"port": 6006
}
},
"storybook:test": {
"executor": "nx:run-commands",
"options": {
"cwd": "{projectRoot}",
"commands": [
"test-storybook --url http://localhost:6006 --maxWorkers=3 --coverage",
"nyc report --reporter=lcov --reporter=text-summary -t coverage/storybook --report-dir coverage/storybook --check-coverage"
],
"parallel": false
"url": "http://localhost:6006"
},
"configurations": {
"docs": {
"commands": ["STORYBOOK_SCOPE=ui-docs nx storybook:test"]
},
"modules": {
"commands": ["STORYBOOK_SCOPE=modules nx storybook:test"]
},
"pages": { "commands": ["STORYBOOK_SCOPE=pages nx storybook:test"] }
"docs": { "env": { "STORYBOOK_SCOPE": "ui-docs" } },
"modules": { "env": { "STORYBOOK_SCOPE": "modules" } },
"pages": { "env": { "STORYBOOK_SCOPE": "pages" } }
}
},
"graphql:generate": {
@ -144,24 +88,13 @@
},
"configurations": {
"data": {
"args": ["--config=codegen.cjs"]
"config": "codegen.cjs"
},
"metadata": {
"args": ["--config=codegen-metadata.cjs"]
"config": "codegen-metadata.cjs"
}
}
},
"chromatic": {
"executor": "nx:run-commands",
"options": {
"cwd": "{projectRoot}",
"command": "cross-var chromatic --project-token=$CHROMATIC_PROJECT_TOKEN --build-script-name=storybook:build"
},
"configurations": {
"ci": {
"args": ["--exit-zero-on-changes"]
}
}
}
"chromatic": {}
}
}

View File

@ -9,12 +9,12 @@ import {
} from '@/object-record/record-field/types/FieldMetadata';
import { type } from 'os';
import { FieldMetadataType } from '~/generated-metadata/graphql';
import { mockedCompanyObjectMetadataItem, mockedPersonObjectMetadataItem } from '~/testing/mock-data/metadata';
;
import {
mockedCompanyObjectMetadataItem,
mockedPersonObjectMetadataItem,
} from '~/testing/mock-data/metadata';
export const fieldMetadataId = 'fieldMetadataId';
export const textfieldDefinition: FieldDefinition<FieldTextMetadata> = {
fieldMetadataId,
label: 'User Name',

View File

@ -6,7 +6,8 @@ import {
// This file is not designed to be manually edited.
// It's an extract from the dev seeded environment metadata call
// TODO: automate the generation of this file
export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery = {
export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
{
__typename: 'Query',
objects: {
__typename: 'ObjectConnection',
@ -644,7 +645,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '549e03f3-97b3-4bf9-a23f-243fcda40f6f',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '442b3224-f4c6-49b8-979e-693606a22875',
fromFieldMetadataId:
'442b3224-f4c6-49b8-979e-693606a22875',
fromObjectMetadata: {
__typename: 'object',
id: 'b3f8207f-0b88-44ef-981d-a7ead80dff46',
@ -820,7 +822,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '94cb665d-b973-4276-bf55-656e08d79736',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: 'ae82a0a0-d928-499a-a6b1-ad46006452b0',
fromFieldMetadataId:
'ae82a0a0-d928-499a-a6b1-ad46006452b0',
fromObjectMetadata: {
__typename: 'object',
id: '3a7ae3ad-fa9a-4ae4-8a01-dd656a1afc9d',
@ -881,7 +884,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: 'b103a006-841d-4c39-b3b6-9385eb1cedfa',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '1cbbd683-b426-4509-9557-54671e6f0447',
fromFieldMetadataId:
'1cbbd683-b426-4509-9557-54671e6f0447',
fromObjectMetadata: {
__typename: 'object',
id: '8bef276b-342c-4088-9448-752fc8efd426',
@ -1091,7 +1095,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '3e9e97f8-a2a4-4f90-a6a0-721fb1e66334',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: 'ca7a26f0-84f3-4215-a3a1-6967961de3c4',
fromFieldMetadataId:
'ca7a26f0-84f3-4215-a3a1-6967961de3c4',
fromObjectMetadata: {
__typename: 'object',
id: '8d68cb28-d11a-4fc9-819e-d154c6d05edd',
@ -1209,7 +1214,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '16a649f3-94b9-456e-ad2a-70dcd16c9516',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '12099cb8-ee26-4ce7-836c-73230c94c3e8',
fromFieldMetadataId:
'12099cb8-ee26-4ce7-836c-73230c94c3e8',
fromObjectMetadata: {
__typename: 'object',
id: '3a7ae3ad-fa9a-4ae4-8a01-dd656a1afc9d',
@ -1385,7 +1391,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '5a766df3-68b4-4772-ab77-bfcc61bfbaf5',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '776f05e8-fe39-47c7-861e-586361299462',
fromFieldMetadataId:
'776f05e8-fe39-47c7-861e-586361299462',
fromObjectMetadata: {
__typename: 'object',
id: 'c5be9551-fa87-4d5c-8017-ef72251c5194',
@ -1521,7 +1528,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: 'a67bb487-2239-4073-ac05-8e2df6446185',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '67044674-2477-44b4-a7a2-fba9add0e9ce',
fromFieldMetadataId:
'67044674-2477-44b4-a7a2-fba9add0e9ce',
fromObjectMetadata: {
__typename: 'object',
id: '8d68cb28-d11a-4fc9-819e-d154c6d05edd',
@ -1639,7 +1647,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: 'd9f82315-17dd-4991-9713-ca99455383e5',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '62332d09-84c5-4959-af41-f1e9cc22ec8d',
fromFieldMetadataId:
'62332d09-84c5-4959-af41-f1e9cc22ec8d',
fromObjectMetadata: {
__typename: 'object',
id: 'c5be9551-fa87-4d5c-8017-ef72251c5194',
@ -1746,7 +1755,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: 'ac4bf17f-3e8f-4f90-bf23-ddb8ff4e9063',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: 'a16e97e2-2d9f-45f7-85bf-c6cc78de9175',
fromFieldMetadataId:
'a16e97e2-2d9f-45f7-85bf-c6cc78de9175',
fromObjectMetadata: {
__typename: 'object',
id: '69aca779-9ce1-41fe-b0f9-b7e697af84e1',
@ -1899,7 +1909,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '6bec3a65-b7eb-4597-96fe-26b10088d2fc',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: 'a06ac5ca-493e-413e-a305-0812deeaab85',
fromFieldMetadataId:
'a06ac5ca-493e-413e-a305-0812deeaab85',
fromObjectMetadata: {
__typename: 'object',
id: '8d68cb28-d11a-4fc9-819e-d154c6d05edd',
@ -2052,7 +2063,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '2c17a017-0dd4-4623-b7dc-63187f0eef12',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: 'bfff2fe1-f45e-4cb4-bd9e-9d68dfe9af7e',
fromFieldMetadataId:
'bfff2fe1-f45e-4cb4-bd9e-9d68dfe9af7e',
fromObjectMetadata: {
__typename: 'object',
id: 'c58aa98d-ab8a-4d7d-84d8-8d44f403cb2b',
@ -2113,7 +2125,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: 'ad0eb66d-e558-465d-b148-cc0cf3db3b95',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '29f251c2-fd6f-4fa7-a55b-80e6481f4ba9',
fromFieldMetadataId:
'29f251c2-fd6f-4fa7-a55b-80e6481f4ba9',
fromObjectMetadata: {
__typename: 'object',
id: '28755ee8-fa7b-4413-b453-4a98e84b237a',
@ -2300,7 +2313,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '4c2b4383-93f8-4996-b870-bc2acf330537',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '5e054149-2d41-4591-b968-8fdf0afcbc79',
fromFieldMetadataId:
'5e054149-2d41-4591-b968-8fdf0afcbc79',
fromObjectMetadata: {
__typename: 'object',
id: 'efa1addc-a9cb-4789-b99e-a060fa84f987',
@ -2510,7 +2524,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: 'c5cdbacd-2489-4409-be9e-bb4cb38f6ddd',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: 'ea83af89-be10-49af-a605-10c3392ae007',
fromFieldMetadataId:
'ea83af89-be10-49af-a605-10c3392ae007',
fromObjectMetadata: {
__typename: 'object',
id: 'efa1addc-a9cb-4789-b99e-a060fa84f987',
@ -2789,7 +2804,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: 'cab6d0bd-c3fb-46dc-af6f-de28e4689dd0',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: 'fc92c00d-e5ff-4982-965e-514ee30bcf1c',
fromFieldMetadataId:
'fc92c00d-e5ff-4982-965e-514ee30bcf1c',
fromObjectMetadata: {
__typename: 'object',
id: '184958e2-9434-453c-98be-7ca4311cc77e',
@ -3793,7 +3809,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '9b2b32d2-9864-4dd6-9f3f-700525313393',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '6be4ff53-c65b-4955-9f86-935dd953154d',
fromFieldMetadataId:
'6be4ff53-c65b-4955-9f86-935dd953154d',
fromObjectMetadata: {
__typename: 'object',
id: '28755ee8-fa7b-4413-b453-4a98e84b237a',
@ -4143,7 +4160,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '35414edf-0c44-4500-95cc-ae6694ef9947',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: 'fc6a4a82-f80f-4aad-85e3-b2ae9b8fb26b',
fromFieldMetadataId:
'fc6a4a82-f80f-4aad-85e3-b2ae9b8fb26b',
fromObjectMetadata: {
__typename: 'object',
id: '28755ee8-fa7b-4413-b453-4a98e84b237a',
@ -4956,7 +4974,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '56260075-0a16-452a-ace1-65648fb299fe',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '60c518d0-c6ec-4b37-8bac-129e1442f390',
fromFieldMetadataId:
'60c518d0-c6ec-4b37-8bac-129e1442f390',
fromObjectMetadata: {
__typename: 'object',
id: 'd398ff30-85e0-45ab-a62a-ba2d775ce186',
@ -5086,7 +5105,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '3caf1987-2c71-49b2-8f92-5065339d66af',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: 'b2be8cfa-97dc-4482-bad2-b8576b4090e7',
fromFieldMetadataId:
'b2be8cfa-97dc-4482-bad2-b8576b4090e7',
fromObjectMetadata: {
__typename: 'object',
id: '56cb9f6b-1aae-4cba-85ed-fff37b1e3c25',
@ -5227,7 +5247,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: 'b0783352-803c-44d4-b195-c6697eaa35af',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '79c3c3b7-b71c-47c0-a6ca-93ebf9842932',
fromFieldMetadataId:
'79c3c3b7-b71c-47c0-a6ca-93ebf9842932',
fromObjectMetadata: {
__typename: 'object',
id: '8d68cb28-d11a-4fc9-819e-d154c6d05edd',
@ -5701,7 +5722,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '5eec3fa0-e260-47af-8ca8-bd2089573ef3',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '59abd17e-faa3-4527-94ee-6aa54c1ebae0',
fromFieldMetadataId:
'59abd17e-faa3-4527-94ee-6aa54c1ebae0',
fromObjectMetadata: {
__typename: 'object',
id: '8d68cb28-d11a-4fc9-819e-d154c6d05edd',
@ -6864,7 +6886,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '0ca8dd47-2a20-4950-bf82-8fd4eafd6d0d',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: 'c68fb8af-ad36-439c-8c9d-799ba4cf4169',
fromFieldMetadataId:
'c68fb8af-ad36-439c-8c9d-799ba4cf4169',
fromObjectMetadata: {
__typename: 'object',
id: '184958e2-9434-453c-98be-7ca4311cc77e',
@ -7209,7 +7232,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: 'b773b6fe-d987-43e2-a611-d6ca73ebd8bf',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '50b1c013-d292-4440-b95c-866156cb3e50',
fromFieldMetadataId:
'50b1c013-d292-4440-b95c-866156cb3e50',
fromObjectMetadata: {
__typename: 'object',
id: 'b09664c4-a413-4d1f-949e-2a67f1ec649f',
@ -7293,7 +7317,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '76108795-7b26-4b28-958d-e49b3121880f',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '8f7912c8-8dc7-40ca-8625-b6d0ec2dc1f4',
fromFieldMetadataId:
'8f7912c8-8dc7-40ca-8625-b6d0ec2dc1f4',
fromObjectMetadata: {
__typename: 'object',
id: '28755ee8-fa7b-4413-b453-4a98e84b237a',
@ -7446,7 +7471,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '8d09bfb5-aef9-4adf-9f6a-3ba89e7475cd',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '2c2077f0-2efc-4569-b2d9-44c8583a2a58',
fromFieldMetadataId:
'2c2077f0-2efc-4569-b2d9-44c8583a2a58',
fromObjectMetadata: {
__typename: 'object',
id: '69aca779-9ce1-41fe-b0f9-b7e697af84e1',
@ -7507,7 +7533,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: 'c10de251-b748-4c5d-8dfa-51cbd82f75dc',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: 'fae2489f-7f59-4385-bec8-9d3f4044d1da',
fromFieldMetadataId:
'fae2489f-7f59-4385-bec8-9d3f4044d1da',
fromObjectMetadata: {
__typename: 'object',
id: 'c5be9551-fa87-4d5c-8017-ef72251c5194',
@ -7706,7 +7733,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '5afb80d4-d66d-49fa-b036-35656dbd7eb9',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '605cc521-9640-49bd-b2c2-c5aa6c588b90',
fromFieldMetadataId:
'605cc521-9640-49bd-b2c2-c5aa6c588b90',
fromObjectMetadata: {
__typename: 'object',
id: '8d68cb28-d11a-4fc9-819e-d154c6d05edd',
@ -7767,7 +7795,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '2ba1eae0-a1cf-4976-997e-0f2250d20ba8',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: 'a19d48b1-889e-4e6c-ad5a-a5707e92f8bf',
fromFieldMetadataId:
'a19d48b1-889e-4e6c-ad5a-a5707e92f8bf',
fromObjectMetadata: {
__typename: 'object',
id: 'c58aa98d-ab8a-4d7d-84d8-8d44f403cb2b',
@ -7885,7 +7914,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '47ed427f-20b2-454b-acef-39bc5ff2535e',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: 'c2897c17-90a9-487b-a358-579c14cdd862',
fromFieldMetadataId:
'c2897c17-90a9-487b-a358-579c14cdd862',
fromObjectMetadata: {
__typename: 'object',
id: 'c5be9551-fa87-4d5c-8017-ef72251c5194',
@ -8091,7 +8121,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: 'd6f3f2a6-ac78-4451-aa00-9dffd75413e1',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: 'efba6645-b939-4751-bd55-a2fa787997aa',
fromFieldMetadataId:
'efba6645-b939-4751-bd55-a2fa787997aa',
fromObjectMetadata: {
__typename: 'object',
id: '28755ee8-fa7b-4413-b453-4a98e84b237a',
@ -9513,7 +9544,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '8fbd9c8a-6999-4ecb-bc4f-0f67d10866bb',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '77da807c-10c9-4084-b396-25bbfb371ef4',
fromFieldMetadataId:
'77da807c-10c9-4084-b396-25bbfb371ef4',
fromObjectMetadata: {
__typename: 'object',
id: 'b3f8207f-0b88-44ef-981d-a7ead80dff46',
@ -9761,7 +9793,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '58fb8589-6e7c-477c-b9ac-5e68bfa99ea2',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '9ea86ae6-c26b-4ea0-b207-820b3ebf7110',
fromFieldMetadataId:
'9ea86ae6-c26b-4ea0-b207-820b3ebf7110',
fromObjectMetadata: {
__typename: 'object',
id: '8d68cb28-d11a-4fc9-819e-d154c6d05edd',
@ -9891,7 +9924,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: 'b782c321-0f72-4f2a-b420-af020a2095d1',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '5f4ea983-40a2-4377-a9ec-4bdfc52b0941',
fromFieldMetadataId:
'5f4ea983-40a2-4377-a9ec-4bdfc52b0941',
fromObjectMetadata: {
__typename: 'object',
id: 'b09664c4-a413-4d1f-949e-2a67f1ec649f',
@ -10262,7 +10296,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '91ed8064-e2cc-4130-9cb9-c5dc7ddee302',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '20577261-01ca-43ae-a6c8-d558dce6c0ee',
fromFieldMetadataId:
'20577261-01ca-43ae-a6c8-d558dce6c0ee',
fromObjectMetadata: {
__typename: 'object',
id: '8d68cb28-d11a-4fc9-819e-d154c6d05edd',
@ -10627,7 +10662,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '06dd3af4-7dc0-4599-9d99-3ea637fd672b',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: 'ff20f9f0-f081-436b-8526-d7b2b3c80c92',
fromFieldMetadataId:
'ff20f9f0-f081-436b-8526-d7b2b3c80c92',
fromObjectMetadata: {
__typename: 'object',
id: 'c58aa98d-ab8a-4d7d-84d8-8d44f403cb2b',
@ -11113,7 +11149,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: 'c7060c9e-9cb7-420e-a82f-1eabaee52c06',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: 'fc3cfebb-722e-42dd-9646-e9f9f07dc152',
fromFieldMetadataId:
'fc3cfebb-722e-42dd-9646-e9f9f07dc152',
fromObjectMetadata: {
__typename: 'object',
id: '8d68cb28-d11a-4fc9-819e-d154c6d05edd',
@ -11543,7 +11580,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '9e9890bd-ead6-44f2-8f09-46d27f09f607',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: 'aee6daaa-a9e3-4f1a-a4dc-aa34c57cef7f',
fromFieldMetadataId:
'aee6daaa-a9e3-4f1a-a4dc-aa34c57cef7f',
fromObjectMetadata: {
__typename: 'object',
id: '8d68cb28-d11a-4fc9-819e-d154c6d05edd',
@ -11604,7 +11642,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: 'eda707cd-b61d-4fda-933c-9eb5e17333d9',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: 'b802682c-3f9d-4f86-856b-a8e91048ae02',
fromFieldMetadataId:
'b802682c-3f9d-4f86-856b-a8e91048ae02',
fromObjectMetadata: {
__typename: 'object',
id: 'c5be9551-fa87-4d5c-8017-ef72251c5194',
@ -11688,7 +11727,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '43adaf3e-ec13-477e-9b95-3775d11166b1',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '87b36790-10ac-40ce-b309-c8033c0aa083',
fromFieldMetadataId:
'87b36790-10ac-40ce-b309-c8033c0aa083',
fromObjectMetadata: {
__typename: 'object',
id: '56cb9f6b-1aae-4cba-85ed-fff37b1e3c25',
@ -11852,7 +11892,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '8660a1ec-c72e-442c-81e3-da290931fbab',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '946beaa4-8816-4019-bd33-28c8463bfeaa',
fromFieldMetadataId:
'946beaa4-8816-4019-bd33-28c8463bfeaa',
fromObjectMetadata: {
__typename: 'object',
id: 'b09664c4-a413-4d1f-949e-2a67f1ec649f',
@ -11936,7 +11977,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '2d449c2a-7988-4b17-adfa-f362d44564bb',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '483d8221-01cd-4d70-83f7-f3d1b60c5575',
fromFieldMetadataId:
'483d8221-01cd-4d70-83f7-f3d1b60c5575',
fromObjectMetadata: {
__typename: 'object',
id: 'c5be9551-fa87-4d5c-8017-ef72251c5194',
@ -12066,7 +12108,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: 'c10efd06-e408-4560-bf12-62f9d8267a22',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '3500a80f-b0a8-45b1-8ca7-3d6b1ed45d3c',
fromFieldMetadataId:
'3500a80f-b0a8-45b1-8ca7-3d6b1ed45d3c',
fromObjectMetadata: {
__typename: 'object',
id: '28755ee8-fa7b-4413-b453-4a98e84b237a',
@ -12150,7 +12193,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '1842e867-107a-4544-93e0-249298a8edbf',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: 'adc8f6dd-aee1-492f-a715-7dd02bdfb5f5',
fromFieldMetadataId:
'adc8f6dd-aee1-492f-a715-7dd02bdfb5f5',
fromObjectMetadata: {
__typename: 'object',
id: '69aca779-9ce1-41fe-b0f9-b7e697af84e1',
@ -12211,7 +12255,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: 'c73fedc6-1a38-48d6-830f-bdfc92991506',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '2629a000-8bee-443d-9379-1c89a597df21',
fromFieldMetadataId:
'2629a000-8bee-443d-9379-1c89a597df21',
fromObjectMetadata: {
__typename: 'object',
id: 'c58aa98d-ab8a-4d7d-84d8-8d44f403cb2b',
@ -12352,7 +12397,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '44bff5e3-29ae-4a3a-a9d8-bae4981bff33',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '405aa0c6-ce96-4597-8b61-2271020fde11',
fromFieldMetadataId:
'405aa0c6-ce96-4597-8b61-2271020fde11',
fromObjectMetadata: {
__typename: 'object',
id: 'efa1addc-a9cb-4789-b99e-a060fa84f987',
@ -12631,7 +12677,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: 'e0602824-706f-4d5c-b1ac-6a3a83c01100',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '78ab1b0d-e6b7-4c45-ac46-decdcf913b23',
fromFieldMetadataId:
'78ab1b0d-e6b7-4c45-ac46-decdcf913b23',
fromObjectMetadata: {
__typename: 'object',
id: 'c58aa98d-ab8a-4d7d-84d8-8d44f403cb2b',
@ -12712,7 +12759,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: 'e0c1854d-d8a7-4936-a27c-265a09a635d4',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '17a9cee7-7f68-42bb-abd0-50932466f901',
fromFieldMetadataId:
'17a9cee7-7f68-42bb-abd0-50932466f901',
fromObjectMetadata: {
__typename: 'object',
id: 'c5be9551-fa87-4d5c-8017-ef72251c5194',
@ -12822,7 +12870,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: 'f5da2c34-7a8c-47a3-b262-7c44e9f6fd28',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: 'd61da288-7a71-47d5-ba6a-7700356e9a3a',
fromFieldMetadataId:
'd61da288-7a71-47d5-ba6a-7700356e9a3a',
fromObjectMetadata: {
__typename: 'object',
id: '69aca779-9ce1-41fe-b0f9-b7e697af84e1',
@ -12906,7 +12955,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: '859f61ab-5d4d-404d-b5e4-b3a7cec4325e',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '28419ee0-5f10-4130-ad39-31fe4fc4ae62',
fromFieldMetadataId:
'28419ee0-5f10-4130-ad39-31fe4fc4ae62',
fromObjectMetadata: {
__typename: 'object',
id: '8d68cb28-d11a-4fc9-819e-d154c6d05edd',
@ -13010,7 +13060,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
__typename: 'relation',
id: 'faa88528-2847-4ffc-9e90-df997dbdb443',
relationType: 'ONE_TO_MANY',
fromFieldMetadataId: '1579d027-2443-42a3-97e5-c3e6e81abe5c',
fromFieldMetadataId:
'1579d027-2443-42a3-97e5-c3e6e81abe5c',
fromObjectMetadata: {
__typename: 'object',
id: '28755ee8-fa7b-4413-b453-4a98e84b237a',

View File

@ -19,7 +19,7 @@
"noUnusedParameters": false,
"noFallthroughCasesInSwitch": true,
"forceConsistentCasingInFileNames": true,
"outDir": "../../dist/out-tsc",
"outDir": "../../.cache/tsc",
"paths": {
"@/*": ["packages/twenty-front/src/modules/*"],
"~/*": ["packages/twenty-front/src/*"],

View File

@ -2,6 +2,7 @@
"name": "twenty-server",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"tags": ["scope:backend"],
"targets": {
"build": {
"executor": "nx:run-commands",
@ -35,6 +36,16 @@
"command": "nx start --debug"
}
},
"reset:env": {
"executor": "nx:run-commands",
"inputs": ["{projectRoot}/.env.example"],
"outputs": ["{projectRoot}/.env"],
"cache": true,
"options": {
"cwd": "{projectRoot}",
"command": "cp .env.example .env"
}
},
"command": {
"executor": "nx:run-commands",
"dependsOn": ["build"],
@ -81,42 +92,16 @@
}
},
"lint": {
"executor": "@nx/eslint:lint",
"options": {
"eslintConfig": "{projectRoot}/.eslintrc.cjs",
"ignorePath": "{workspaceRoot}/.gitignore",
"lintFilePatterns": ["{projectRoot}/src/**/*.{ts,json}"]
},
"configurations": {
"ci": { "lintFilePatterns": ["{projectRoot}/**/*.{ts,json}"] },
"fix": { "fix": true }
"fix": {}
}
},
"test:unit": {
"executor": "nx:run-commands",
"dependsOn": ["build"],
"options": {
"cwd": "packages/twenty-server",
"command": "jest"
}
},
"test:unit:watch": {
"executor": "nx:run-commands",
"dependsOn": ["build"],
"options": {
"cwd": "packages/twenty-server",
"command": "jest --watch"
}
},
"test:unit:coverage": {
"executor": "nx:run-commands",
"dependsOn": ["build"],
"options": {
"cwd": "packages/twenty-server",
"command": "jest --coverage"
}
},
"test:unit:debug": {
"test": {},
"test:debug": {
"executor": "nx:run-commands",
"options": {
"cwd": "packages/twenty-server",

View File

@ -81,11 +81,13 @@ describe('CompanyResolver (e2e)', () => {
.expect(200)
.expect((res) => {
const data = res.body.data.findManyCompany;
expect(data).toBeDefined();
expect(Array.isArray(data)).toBe(true);
expect(data.length).toBeGreaterThan(0);
const company = data.find((c) => c.id === companyId);
expect(company).toBeDefined();
expect(company).toHaveProperty('id');
expect(company).toHaveProperty('name', 'New Company');
@ -94,6 +96,7 @@ describe('CompanyResolver (e2e)', () => {
// Check if we have access to ressources outside of our workspace
const instagramCompany = data.find((c) => c.name === 'Instagram');
expect(instagramCompany).toBeUndefined();
});
});

View File

@ -31,7 +31,7 @@ export const createApp = async (
imports: [AppModule],
});
if (!!config.moduleBuilderHook) {
if (config.moduleBuilderHook) {
moduleBuilder = config.moduleBuilderHook(moduleBuilder);
}

View File

@ -3,6 +3,7 @@
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/twenty-ui/src",
"projectType": "library",
"tags": ["scope:frontend"],
"targets": {
"build": {
"dependsOn": ["^build", "generateBarrels"]
@ -21,68 +22,40 @@
}
},
"lint": {
"executor": "@nx/eslint:lint",
"options": {
"eslintConfig": "{projectRoot}/.eslintrc.cjs",
"ignorePath": "{workspaceRoot}/.gitignore",
"lintFilePatterns": [
"{projectRoot}/src/**/*.{ts,tsx,json}",
"{projectRoot}/package.json"
],
"cache": true
]
},
"configurations": {
"fix": { "fix": true }
"fix": {}
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{projectRoot}/coverage"],
"fmt": {
"options": {
"jestConfig": "{projectRoot}/jest.config.ts"
}
},
"typecheck": {
"executor": "nx:run-commands",
"options": {
"cwd": "{projectRoot}",
"command": "tsc -b tsconfig.json",
"incremental": true
"files": "src"
},
"configurations": {
"ci": { "incremental": false },
"watch": { "watch": true }
"fix": {}
}
},
"test": {},
"typecheck": {},
"storybook:build": {},
"storybook:dev": {
"executor": "@nx/storybook:storybook",
"options": { "port": 6007 }
},
"storybook:static": {
"options": {
"port": 6007,
"configDir": "{projectRoot}/.storybook"
},
"configurations": {
"ci": { "quiet": true }
}
},
"storybook:build": {
"executor": "@nx/storybook:build",
"outputs": ["{options.outputDir}"],
"options": {
"outputDir": "{projectRoot}/storybook-static",
"configDir": "{projectRoot}/.storybook"
},
"configurations": {
"ci": {
"quiet": true
}
"buildTarget": "twenty-ui:storybook:build",
"port": 6007
}
},
"storybook:test": {
"executor": "nx:run-commands",
"options": {
"command": "test-storybook -c {projectRoot}/.storybook --url=http://localhost:6007"
"url": "http://localhost:6007"
}
}
}
},
"tags": []
}

View File

@ -8,7 +8,7 @@
"esModuleInterop": true,
"noEmit": true,
"types": ["node"],
"outDir": "../../dist/out-tsc",
"outDir": "../../.cache/tsc",
"paths": {
"@ui/*": ["packages/twenty-ui/src/*"]
}

View File

@ -2,20 +2,18 @@
"name": "eslint-rules",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "tools/eslint-rules",
"tags": ["scope:shared"],
"targets": {
"lint": {
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": ["{projectRoot}/**/*.ts"],
"fix": true
"eslintConfig": "{workspaceRoot}/.eslintrc.cjs",
"lintFilePatterns": ["{projectRoot}/**/*.ts"]
},
"configurations": {
"fix": {}
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "tools/eslint-rules/jest.config.ts"
}
}
"typecheck": {},
"test": {}
}
}

View File

@ -1,6 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "../../.cache/tsc",
"esModuleInterop": true,
"moduleResolution": "node16",
"module": "node16"

View File

@ -1,7 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"types": ["node"]
},
"exclude": ["**/*.spec.ts"],

View File

@ -1,7 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"types": ["jest", "node"]
},
"include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]