Commit Graph

20 Commits

Author SHA1 Message Date
Charles Bochet
040ec9165d
Try fix tests (#5431)
As per title!
2024-05-15 22:54:51 +02:00
Lucas Bordeau
cfacdfce60
Generic Profiling story to wrap any component (#5341)
This PR introduces a Profiling feature for our story book tests.

It also implements a new CI job : front-sb-test-performance, that only
runs stories suffixed with `.perf.stories.tsx`

## How it works 

It allows to wrap any component into an array of React Profiler
components that will run tests many times to have the most replicable
average render time possible.

It is simply used by calling the new `getProfilingStory` util.

Internally it creates a defined number of tests, separated by an
arbitrary waiting time to allow the CPU to give more stable results.

It will do 3 warm-up and 3 finishing runs of tests because the first and
last renders are always a bit erratic, so we want to measure only the
runs in-between.

On the UI side it gives a table of results : 

<img width="515" alt="image"
src="https://github.com/twentyhq/twenty/assets/26528466/273d2d91-26da-437a-890e-778cb6c1f993">

On the programmatic side, it stores the result in a div that can then be
parsed by the play fonction of storybook, to expect a defined threshold.

```tsx
play: async ({ canvasElement }) => {
    await findByTestId(
      canvasElement,
      'profiling-session-finished',
      {},
      { timeout: 60000 },
    );

    const profilingReport = getProfilingReportFromDocument(canvasElement);

    if (!isDefined(profilingReport)) {
      return;
    }

    const p95result = profilingReport?.total.p95;

    expect(
      p95result,
      `Component render time is more than p95 threshold (${p95ThresholdInMs}ms)`,
    ).toBeLessThan(p95ThresholdInMs);
  },
```
2024-05-15 13:50:02 +02:00
Thaïs
8c85e7bf61
fix: fix storybook:build cache output path (#5336) 2024-05-08 11:51:09 +02:00
Thaïs
b7a2e72c32
fix: fix storybook pages tests coverage (#5319) 2024-05-07 21:05:45 +02:00
Thaïs
1351a95754
fix: fix storybook coverage task (#5256)
- Fixes storybook coverage command: the coverage directory path was
incorrect, but instead of failing `storybook:test --configuration=ci`,
it was hanging indefinitely.
- Switches back to `concurrently` to launch `storybook:static` and
`storybook:test` in parallel, which allows to use options to explicitly
kill `storybook:static` when `storybook:test` fails.
- Moves `storybook:test --configuration=ci` to its own command
`storybook:static:test`: used in the CI, and can be used locally to run
storybook tests without having to launch `storybook:dev` first.
- Creates command `storybook:coverage` and enables cache for this
command.
- Fixes Jest tests that were failing.
- Improves caching conditions for some tasks (for instance, no need to
invalidate Jest test cache if only Storybook story files were modified).
2024-05-03 14:59:09 +02:00
Thaïs
5128ea3ffb
fix: fix storybook build script not found by Chromatic (#5235) 2024-05-02 16:15:36 +02:00
Thaïs
c193663a71
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.
2024-04-30 16:28:25 +02:00
Hinson Chan
3b0f81e7e1
5125 - fix npx nx start does not exit gracefully (#5133)
Fixes: https://github.com/twentyhq/twenty/issues/5125

Updated nx version that includes fix (see fix PR:
https://github.com/nrwl/nx/pull/22895, release confirming fix:
https://github.com/nrwl/nx/releases/tag/18.3.3)

<img width="291" alt="image"
src="https://github.com/twentyhq/twenty/assets/68029599/b72b4a5c-9957-445d-b8b2-8352122cade8">
2024-04-24 11:53:53 +02:00
Pacifique LINJANJA
627a6bda29
Update twenty-front commands (#4667)
# This PR

- Moves dev and ci scripts to the `project.json` file in the
twenty-front package
- Adds a project.json file in the root of the project with the main
start command that start both twenty-server and twenty-front
applications concurrently
- Updates the script command of the root project with the start:prod
command (replacing the start command which will be used in dev with the
help of nx)
- Add a start:prod command in the twenty-front app, replacing the start
command (now used for dev purpose)

Issue ref #4645 

@charlesBochet @FelixMalfait please let me know how can I improve it

---------

Co-authored-by: Thaïs Guigon <guigon.thais@gmail.com>
2024-04-17 18:06:02 +02:00
Thaïs
9f83cc1426
refactor: move @/ui/display/icon to twenty-ui (#4820)
Split from https://github.com/twentyhq/twenty/pull/4518

Part of https://github.com/twentyhq/twenty/issues/4766
2024-04-12 15:30:48 +02:00
Thaïs
c5349291c8
chore: setup twenty-ui absolute path alias (#4732)
Split from https://github.com/twentyhq/twenty/pull/4518

- Setup `@ui/*` as an internal alias to reference `twenty-ui/src`.
- Configures twenty-front to understand the `@ui/*` alias on development
mode, so twenty-ui can be hot reloaded.
- When building on production mode, twenty-front needs twenty-ui to be
built beforehand (which is automatic with the `dependsOn` option).
- Configures twenty-front to understand the `@ui/*` alias when launching
tests, so there is no need to re-build twenty-ui for tests.

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-04-04 15:38:01 +02:00
Thaïs
eef1211463
chore: include react components in twenty-ui test config (#4709)
Split from https://github.com/twentyhq/twenty/pull/4518

Part of https://github.com/twentyhq/twenty/issues/4766

- Re-generates some of the twenty-ui test and storybook config with Nx
- Includes tsx files in twenty-ui tests and compiles them with swc

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-04-04 12:30:49 +02:00
Thaïs
a3e5cf37b0
chore: upgrade Nx to v18.1.3 (#4706)
Split from https://github.com/twentyhq/twenty/pull/4518

- Upgrades dependencies and applies automatic config migrations with the
command: `npx nx migrate nx` (see
https://nx.dev/nx-api/nx/documents/migrate)
- Fixes lint errors after upgrading `@typescript-eslint`

Note: it was not possible (for now) to migrate Nx to the latest stable
version (v18.2.1) because it upgrades Typescript to v5.4.3, which seems
to cause a bug on install when Yarn tries to apply its native patches.
Might be a bug on the Yarn side.
2024-04-01 13:16:50 +02:00
Abdullah
8c0680b918
Setup the foundation for Twenty UI library. (#4423)
* feat: create a separate package for twenty-ui, extract the pill component with hard-coded theme values into it, and use the component inside twenty-front to complete the setup

* feat: extract the light and the dark theme into twenty-ui and update the AppThemeProvider component inside twenty-front to consume themes from twenty-ui

* fix: create a decorator inside preview.tsx to provide a default theme to storybook development server

* fix: remove redundant type declarations and revert back the naming convention for theme declarations

* fix: introduce a default value for pill label within the story for development server

* fix: introduce the nx script into package.json for twenty-ui and resolve imports for theme type within the package

* fix: remove the pill component from the twenty-front package along with the story for it

* fix: revert the package versions to those before running the nx cli command for storybook init

* feat: update readme to include details for building the ui library and starting the storybook development server

* fix: include details about twenty-ui inside jest.config for twenty-front to complete front-jest job

* - Added preview head for font
- Added theme addon for light/dark switch
- Added ComponentDecorator

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-03-13 14:21:18 +01:00
Thaïs
e011ecbd6f
POC: generate twenty-server package.json with Nx (#3654)
* POC: generate twenty-server package.json with Nx

* Re-add passport

* Fix instal

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2024-02-13 22:16:21 +01:00
Thaïs
a654205dbc
chore: set up twenty-emails config so build isn't needed in development (#3619)
* chore: set up twenty-emails config so build isn't needed in development

* fix: fix script dependency

* chore: use @vitejs/plugin-react-swc

* Remove useless dependancy

* Fix typing

* chore: use baseUrl in twenty-emails

* chore: fix docker server prod build

* refactor: optimize Docker file and tsconfig

* fix: fix WORKDIR in docker

---------

Co-authored-by: martmull <martmull@hotmail.fr>
2024-01-29 06:17:12 -03:00
Charles Bochet
a7265fa3b4
Remove flag relation select (#3588)
* Remove feature flag on relation and select

* Move packages back to twenty-server to enable smaller build without using nx

* Fix package.json
2024-01-23 09:59:00 +01:00
Thaïs
8483cf0b4b
POC: chore: use Nx workspace lint rules (#3163)
* chore: use Nx workspace lint rules

Closes #3162

* Fix lint

* Fix lint on BE

* Fix tests

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2024-01-03 23:07:25 +01:00
bosiraphael
5afcab4e78
3011 fill the messagerecipient table when fetching messages (#3073)
* wip

* trying to parse display names and emails

* add nodemailer mailparser

* mail parsing is working

* add personId and workspaceMemberId

* add date to messages

* Fix PR

* Run tsc on bigger machine

* Fix lint

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2023-12-19 17:08:54 +01:00
Charles Bochet
5bdca9de6c
Migrate to a monorepo structure (#2909) 2023-12-10 18:10:54 +01:00