Skip to content

Commit

Permalink
Merge branch 'main' into feat/twenty-orm-sync
Browse files Browse the repository at this point in the history
  • Loading branch information
magrinj committed May 6, 2024
2 parents 0b67846 + ff77a4e commit 54e17bd
Show file tree
Hide file tree
Showing 194 changed files with 2,943 additions and 1,362 deletions.
5 changes: 5 additions & 0 deletions .eslintrc.react.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ module.exports = {
message:
'Please use the custom wrapper: `useScopedHotkeys` from `twenty-ui`',
},
{
group: ['lodash'],
message:
"Please use the standalone lodash package (for instance: `import groupBy from 'lodash.groupby'` instead of `import { groupBy } from 'lodash'`)",
},
],
},
],
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/actions/task-cache/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ runs:
path: |
.cache
.nx/cache
key: tasks-cache-${{ inputs.tag }}-${{ steps.tasks-key.outputs.key }}${{ inputs.suffix }}-${{ github.sha }}
node_modules/.cache
packages/*/node_modules/.cache
key: tasks-cache-${{ github.ref_name }}-${{ inputs.tag }}-${{ steps.tasks-key.outputs.key }}${{ inputs.suffix }}-${{ github.sha }}
restore-keys: |
tasks-cache-${{ inputs.tag }}-${{ steps.tasks-key.outputs.key }}${{ inputs.suffix }}-
tasks-cache-${{ github.ref_name }}-${{ inputs.tag }}-${{ steps.tasks-key.outputs.key }}${{ inputs.suffix }}-
39 changes: 0 additions & 39 deletions .github/workflows/ci-chromatic.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/ci-chrome-extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
access_token: ${{ github.token }}
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/workflows/actions/yarn-install
Expand Down
71 changes: 57 additions & 14 deletions .github/workflows/ci-front.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,37 @@ concurrency:
cancel-in-progress: true

jobs:
front-sb-build:
runs-on: ubuntu-latest
env:
REACT_APP_SERVER_BASE_URL: http://localhost:3000
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Fetch local actions
uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/workflows/actions/yarn-install
- name: Front / Restore Storybook Task Cache
uses: ./.github/workflows/actions/task-cache
with:
tag: scope:frontend
tasks: storybook:build
- name: Front / Write .env
run: npx nx reset:env twenty-front
- name: Front / Build storybook
run: NODE_OPTIONS=--max-old-space-size=5000 npx nx storybook:build twenty-front
front-sb-test:
runs-on: ci-8-cores
needs: front-sb-build
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/[email protected]
with:
access_token: ${{ github.token }}
- name: Fetch local actions
uses: actions/checkout@v4
- name: Install dependencies
Expand All @@ -41,38 +59,63 @@ jobs:
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 nx storybook:static:test twenty-front --configuration=${{ matrix.storybook_scope }}
front-chromatic-deployment:
if: contains(github.event.pull_request.labels.*.name, 'run-chromatic') || github.event_name == 'push'
needs: front-sb-build
runs-on: ubuntu-latest
env:
REACT_APP_SERVER_BASE_URL: http://127.0.0.1:3000
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
uses: ./.github/workflows/actions/yarn-install
- name: Front / Restore Storybook Task Cache
uses: ./.github/workflows/actions/task-cache
with:
tag: scope:frontend
tasks: storybook:build
- name: Front / Write .env
run: |
cd packages/twenty-front
touch .env
echo "REACT_APP_SERVER_BASE_URL: $REACT_APP_SERVER_BASE_URL" >> .env
- name: Publish to Chromatic
run: |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"npx nx storybook:static twenty-front" \
"npx wait-on tcp:6006 && npx nx storybook:test twenty-front"
npx nx run twenty-front:chromatic:ci
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/[email protected]
with:
access_token: ${{ github.token }}
- name: Fetch local actions and base branch history
- 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: Front / Restore Task Cache
- name: Front / Restore ${{ matrix.task }} task cache
uses: ./.github/workflows/actions/task-cache
with:
tag: scope:frontend
tasks: ${{ matrix.task }}
- name: Front / Run task
- name: Reset .env
uses: ./.github/workflows/actions/nx-affected
with:
tag: scope:frontend
tasks: reset:env
- name: Run ${{ matrix.task }} task
uses: ./.github/workflows/actions/nx-affected
with:
tag: scope:frontend
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
ports:
- 5432:5432
steps:
- name: Fetch local actions and base branch history
- name: Fetch custom Github Actions and base branch history
uses: actions/checkout@v4
with:
fetch-depth: 0
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ storybook-static
*.tsbuildinfo
.eslintcache
.cache
.nyc_output
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@
"internalConsoleOptions": "openOnSessionStart",
"console": "internalConsole",
"cwd": "${workspaceFolder}/packages/twenty-server/"
},
{
"name": "twenty-server - command debug example",
"type": "node",
"request": "launch",
"runtimeExecutable": "npx",
"runtimeVersion": "18",
"runtimeArgs": [
"nx",
"run",
"twenty-server:command",
"my-command",
"--my-parameter value",
],
"outputCapture": "std",
"internalConsoleOptions": "openOnSessionStart",
"console": "internalConsole",
"cwd": "${workspaceFolder}/packages/twenty-server/"
}
]
}
85 changes: 72 additions & 13 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
{
"namedInputs": {
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"sharedGlobals": ["{workspaceRoot}/.github/workflows/**/*"]
"default": ["{projectRoot}/**/*"],
"excludeStories": [
"default",
"!{projectRoot}/.storybook/*",
"!{projectRoot}/**/tsconfig.storybook.json",
"!{projectRoot}/**/*.stories.(ts|tsx)",
"!{projectRoot}/**/__stories__/*"
],
"excludeTests": [
"default",
"!{projectRoot}/**/jest.config.(js|ts)",
"!{projectRoot}/**/tsconfig.spec.json",
"!{projectRoot}/**/*.test.(ts|tsx)",
"!{projectRoot}/**/*.spec.(ts|tsx)",
"!{projectRoot}/**/__tests__/*"
],
"production": [
"default",
"excludeStories",
"excludeTests",
"!{projectRoot}/**/__mocks__/*",
"!{projectRoot}/**/testing/*"
]
},
"targetDefaults": {
"build": {
"cache": true,
"inputs": ["^production", "production"],
"dependsOn": ["^build"]
},
"start": {
Expand Down Expand Up @@ -58,6 +80,11 @@
"executor": "@nx/jest:jest",
"cache": true,
"dependsOn": ["^build"],
"inputs": [
"^default",
"excludeStories",
"{workspaceRoot}/jest.preset.js"
],
"outputs": ["{projectRoot}/coverage"],
"options": {
"jestConfig": "{projectRoot}/jest.config.ts",
Expand All @@ -82,12 +109,7 @@
"executor": "@nx/storybook:build",
"cache": true,
"dependsOn": ["^build"],
"inputs": [
"default",
"^default",
"{projectRoot}/.storybook/**/*",
"{projectRoot}/tsconfig.storybook.json"
],
"inputs": ["^default", "excludeTests"],
"outputs": ["{options.outputDir}"],
"options": {
"outputDir": "{projectRoot}/storybook-static",
Expand All @@ -106,25 +128,58 @@
"executor": "@nx/web:file-server",
"options": {
"staticFilePath": "{projectRoot}/storybook-static",
"parallel": false,
"watch": false
}
},
"storybook:coverage": {
"executor": "nx:run-commands",
"cache": true,
"inputs": [
"^default",
"excludeTests",
"{projectRoot}/coverage/storybook/coverage-storybook.json"
],
"outputs": [
"{projectRoot}/coverage/storybook",
"!{projectRoot}/coverage/storybook/coverage-storybook.json"
],
"options": {
"command": "npx nyc report --reporter={args.reporter} --reporter=text-summary -t {args.coverageDir} --report-dir {args.coverageDir} --check-coverage --cwd={projectRoot}",
"coverageDir": "coverage/storybook",
"reporter": "lcov"
}
},
"storybook:test": {
"executor": "nx:run-commands",
"cache": true,
"inputs": ["^default", "excludeTests"],
"outputs": ["{projectRoot}/coverage/storybook"],
"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"
"test-storybook --url http://localhost:{args.port} --maxWorkers=3 --coverage --coverageDirectory={args.coverageDir}",
"nx storybook:coverage {projectName} --coverageDir={args.coverageDir}"
],
"parallel": false
"parallel": false,
"coverageDir": "coverage/storybook",
"port": 6006
}
},
"storybook:static:test": {
"executor": "nx:run-commands",
"options": {
"commands": [
"npx concurrently --kill-others --success=first -n SB,TEST 'nx storybook:static {projectName} --port={args.port}' 'npx wait-on tcp:{args.port} && nx storybook:test {projectName} --port={args.port}'"
],
"port": 6006
}
},
"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}",
"command": "cross-var chromatic --project-token=$CHROMATIC_PROJECT_TOKEN --build-script-name=build-storybook --exit-zero-on-changes={args.ci}",
"ci": false
},
"configurations": {
Expand All @@ -135,7 +190,11 @@
},
"@nx/jest:jest": {
"cache": true,
"inputs": ["default", "^default", "{workspaceRoot}/jest.preset.js"],
"inputs": [
"^default",
"excludeStories",
"{workspaceRoot}/jest.preset.js"
],
"options": {
"passWithNoTests": true
},
Expand Down
Loading

0 comments on commit 54e17bd

Please sign in to comment.