7 Commits

Author SHA1 Message Date
4a4e65fe4a [REFACTOR] Twenty UI multi barrel (#11301)
# Introduction
closes https://github.com/twentyhq/core-team-issues/issues/591
Same than for `twenty-shared` made in
https://github.com/twentyhq/twenty/pull/11083.

## TODO
- [x] Manual migrate twenty-website twenty-ui imports

## What's next:
- Generate barrel and migration script factorization within own package
+ tests
- Refactoring using preconstruct ? TimeBox
- Lint circular dependencies
- Lint import from barrel and forbid them

### Preconstruct
We need custom rollup plugins addition, but preconstruct does not expose
its rollup configuration. It might be possible to handle this using the
babel overrides. But was a big tunnel.
We could give it a try afterwards ! ( allowing cjs interop and stuff
like that )
Stuck to vite lib app

Closed related PRs:
- https://github.com/twentyhq/twenty/pull/11294
- https://github.com/twentyhq/twenty/pull/11203
2025-04-03 09:47:55 +00:00
9ad8287dbc [REFACTOR] twenty-shared multi barrel and CJS/ESM build with preconstruct (#11083)
# Introduction

In this PR we've migrated `twenty-shared` from a `vite` app
[libary-mode](https://vite.dev/guide/build#library-mode) to a
[preconstruct](https://preconstruct.tools/) "atomic" application ( in
the future would like to introduce preconstruct to handle of all our
atomic dependencies such as `twenty-emails` `twenty-ui` etc it will be
integrated at the monorepo's root directly, would be to invasive in the
first, starting incremental via `twenty-shared`)

For more information regarding the motivations please refer to nor:
- https://github.com/twentyhq/core-team-issues/issues/587
-
https://github.com/twentyhq/core-team-issues/issues/281#issuecomment-2630949682

close https://github.com/twentyhq/core-team-issues/issues/589
close https://github.com/twentyhq/core-team-issues/issues/590

## How to test
In order to ease the review this PR will ship all the codegen at the
very end, the actual meaning full diff is `+2,411 −114`
In order to migrate existing dependent packages to `twenty-shared` multi
barrel new arch you need to run in local:
```sh
yarn tsx packages/twenty-shared/scripts/migrateFromSingleToMultiBarrelImport.ts && \
npx nx run-many -t lint --fix -p twenty-front twenty-ui twenty-server twenty-emails twenty-shared twenty-zapier
```
Note that `migrateFromSingleToMultiBarrelImport` is idempotent, it's atm
included in the PR but should not be merged. ( such as codegen will be
added before merging this script will be removed )

## Misc
- related opened issue preconstruct
https://github.com/preconstruct/preconstruct/issues/617

## Closed related PR
- https://github.com/twentyhq/twenty/pull/11028
- https://github.com/twentyhq/twenty/pull/10993
- https://github.com/twentyhq/twenty/pull/10960

## Upcoming enhancement: ( in others dedicated PRs )
- 1/ refactor generate barrel to export atomic module instead of `*`
- 2/ generate barrel own package with several files and tests
- 3/ Migration twenty-ui the same way
- 4/ Use `preconstruct` at monorepo global level

## Conclusion
As always any suggestions are welcomed !
2025-03-22 19:16:06 +01:00
6a738181b4 [CI][NITPICK] .yml to yaml github workflows (#9664)
# Introduction
Applying the most present `yaml` file extension to all
`.github/workflows/` files

## Notes
Regarding the `restore-cache` and `save-cache` composite actions github
agnostically searches for any `DockerFile` `action.yml` and
`action.yaml` within the target folder when invoking composite actions
as follows:
```yml
      - name: Restore storybook build cache
        if: steps.changed-files.outputs.any_changed == 'true'
        uses: ./.github/workflows/actions/restore-cache
        with: 
          key: ${{ env.STORYBOOK_BUILD_CACHE_KEY }}
```
2025-01-16 11:21:00 +01:00
d133d7f10e [CI] Migrate to ubuntu 24.04 runners (#9607)
## Introduction
Our GitHub Runners provider just
[released](https://depot.dev/changelog/2024-07-12-ubuntu-24-04-github-actions-runner-beta)
ubuntu-24.04 runners lately

## Cache primary key factorization
Refactored the calculation of the cache-primary-key prefix to avoid
duplication

## Runs
- twenty-front lint
https://github.com/twentyhq/twenty/actions/runs/12770312293/job/35595272862
- twenty-server
https://github.com/twentyhq/twenty/actions/runs/12770218595
2025-01-14 16:18:45 +01:00
b815de3e26 [FIX][CI] cache-hit incorrectly computed (#9603)
## Introduction
The `cache-hit` value should be a string boolean, but it seems like not
to always be the case ?

## Related runs
- twenty-server first attempt saves cache second retrieves it
https://github.com/twentyhq/twenty/actions/runs/12768260350
- twenty-front
https://github.com/twentyhq/twenty/actions/runs/12767064201
2025-01-14 14:18:33 +01:00
5d09bd4b93 [CI][NITPICK] Remove input types invalid syntax (#9596)
## Introduction
Unless I'm mistaken neither the `inputs.type` or `inputs.type` syntax
exists for `composite actions`.
By default it seems like any `Composite action` inputs are considered as
`string`.
```yml
name: Nx Affected CI
inputs:
  parallel:
    required: false
    types: [number]
    default: 3
  tag:
    required: false
    types: [string]
  tasks:
    required: true
    types: [string]
```

## Suggestion
To avoid misunderstanding of our composite actions inputs signature I
would recommend removing any `type` props but also default any inputs as
`strings`

## Misc
- Please find related GitHub community discussion
https://github.com/orgs/community/discussions/65588
2025-01-14 12:23:37 +01:00
6fc691beb0 [CI] Refactor composite action task-cache (#9583)
## Introduction
In this previous PR https://github.com/twentyhq/twenty/pull/9448 we've
refactored the storybook build caching flow to be using the new
[actions/cache](https://github.com/actions/cache) `restore` and `save`
functions, which significantly improve caching operations duration.

In this way, in this PR, we've standardize both of the `restore` and
`save` by refactoring the `task-cache` composite action. By creating two
new composite actions `save-cache` and `restore-cache` that centralize
the paths to cache and the way to compute the primary key.

## Misc
- **If no cache** is hit, then a job duration will long for its task
duration and nothing else, previously the cache upload would sometimes
take up to 3 mins.
- **if cache** is hit, then mainly the only time consuming step is the
dependencies installation ( which is theory is also cached, in fact
twice. We will be having a look on this issue in an upcoming PR )
2025-01-14 12:06:23 +01:00