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,167 +17,63 @@ 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-
access_token: ${{ github.token }}
- 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:
- 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
access_token: ${{ github.token }}
- 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',
@ -64,7 +64,7 @@ export const linkFieldDefinition: FieldDefinition<FieldLinkMetadata> = {
label: 'LinkedIn URL',
iconName: 'url',
type: FieldMetadataType.Link,
defaultValue: { label: '', url: ''},
defaultValue: { label: '', url: '' },
metadata: {
fieldName: 'linkedInURL',
placeHolder: 'https://linkedin.com/user',

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

@ -3,7 +3,7 @@
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"builder": "swc",
"typeCheck": true
"builder": "swc",
"typeCheck": true
}
}

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,
"configDir": "{projectRoot}/.storybook"
},
"configurations": {
"ci": { "quiet": true }
}
"options": { "port": 6007 }
},
"storybook:build": {
"executor": "@nx/storybook:build",
"outputs": ["{options.outputDir}"],
"storybook:static": {
"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"]