mirror of
https://github.com/lingble/twenty.git
synced 2025-11-02 13:47:55 +00:00
fix: fix storybook build script not found by Chromatic (#5235)
This commit is contained in:
@@ -24,6 +24,6 @@ runs:
|
|||||||
path: |
|
path: |
|
||||||
.cache
|
.cache
|
||||||
.nx/cache
|
.nx/cache
|
||||||
key: tasks-cache-${{ inputs.tag }}-${{ steps.tasks-key.outputs.key }}${{ inputs.suffix }}-${{ github.sha }}
|
key: tasks-cache-${{ github.ref_name }}-${{ inputs.tag }}-${{ steps.tasks-key.outputs.key }}${{ inputs.suffix }}-${{ github.sha }}
|
||||||
restore-keys: |
|
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
.github/workflows/ci-chromatic.yaml
vendored
39
.github/workflows/ci-chromatic.yaml
vendored
@@ -1,39 +0,0 @@
|
|||||||
name: 'CI Chromatic'
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths:
|
|
||||||
- 'package.json'
|
|
||||||
- 'packages/twenty-front/**'
|
|
||||||
pull_request:
|
|
||||||
types: [labeled]
|
|
||||||
paths:
|
|
||||||
- 'package.json'
|
|
||||||
- 'packages/twenty-front/**'
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
chromatic-deployment:
|
|
||||||
if: contains(github.event.pull_request.labels.*.name, 'run-chromatic') || github.event_name == 'push'
|
|
||||||
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 / 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 nx run twenty-front:chromatic:ci
|
|
||||||
60
.github/workflows/ci-front.yaml
vendored
60
.github/workflows/ci-front.yaml
vendored
@@ -17,19 +17,37 @@ concurrency:
|
|||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
front-sb-test:
|
front-sb-build:
|
||||||
runs-on: ci-8-cores
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
storybook_scope: [pages, modules]
|
|
||||||
env:
|
env:
|
||||||
REACT_APP_SERVER_BASE_URL: http://localhost:3000
|
REACT_APP_SERVER_BASE_URL: http://localhost:3000
|
||||||
STORYBOOK_SCOPE: ${{ matrix.storybook_scope }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Cancel Previous Runs
|
- name: Cancel Previous Runs
|
||||||
uses: styfle/cancel-workflow-action@0.11.0
|
uses: styfle/cancel-workflow-action@0.11.0
|
||||||
with:
|
with:
|
||||||
access_token: ${{ github.token }}
|
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: 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
|
||||||
|
steps:
|
||||||
- name: Fetch local actions
|
- name: Fetch local actions
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
@@ -41,14 +59,36 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
tag: scope:frontend
|
tag: scope:frontend
|
||||||
tasks: storybook:build
|
tasks: storybook:build
|
||||||
suffix: _${{ matrix.storybook_scope }}
|
|
||||||
- name: Front / Write .env
|
- name: Front / Write .env
|
||||||
run: npx nx reset:env twenty-front
|
run: npx nx reset:env twenty-front
|
||||||
- name: Run storybook tests
|
- name: Run storybook tests
|
||||||
|
run: npx nx storybook:test twenty-front --configuration=ci --scope=${{ 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: |
|
run: |
|
||||||
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
|
cd packages/twenty-front
|
||||||
"npx nx storybook:static twenty-front" \
|
touch .env
|
||||||
"npx wait-on tcp:6006 && npx nx storybook:test twenty-front"
|
echo "REACT_APP_SERVER_BASE_URL: $REACT_APP_SERVER_BASE_URL" >> .env
|
||||||
|
- name: Publish to Chromatic
|
||||||
|
run: |
|
||||||
|
npx nx run twenty-front:chromatic:ci
|
||||||
front-task:
|
front-task:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -26,3 +26,4 @@ storybook-static
|
|||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
.eslintcache
|
.eslintcache
|
||||||
.cache
|
.cache
|
||||||
|
.nyc_output
|
||||||
|
|||||||
29
nx.json
29
nx.json
@@ -112,19 +112,38 @@
|
|||||||
"storybook:test": {
|
"storybook:test": {
|
||||||
"executor": "nx:run-commands",
|
"executor": "nx:run-commands",
|
||||||
"options": {
|
"options": {
|
||||||
"cwd": "{projectRoot}",
|
|
||||||
"commands": [
|
"commands": [
|
||||||
"test-storybook --url {options.url} --maxWorkers=3 --coverage",
|
"test-storybook -c {args.configDir} --url {args.url} --maxWorkers=3 --coverage",
|
||||||
"nyc report --reporter=lcov --reporter=text-summary -t coverage/storybook --report-dir coverage/storybook --check-coverage"
|
"nyc report --reporter=lcov --reporter=text-summary -t {args.coverageDir} --report-dir {args.coverageDir} --check-coverage"
|
||||||
],
|
],
|
||||||
"parallel": false
|
"parallel": false,
|
||||||
|
"configDir": "{projectRoot}/.storybook",
|
||||||
|
"coverageDir": "{projectRoot}/coverage/storybook",
|
||||||
|
"url": "http://localhost:6006",
|
||||||
|
"port": 6006
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"ci": {
|
||||||
|
"commands": [
|
||||||
|
{
|
||||||
|
"prefix": "[SB]",
|
||||||
|
"command": "nx storybook:static {projectName} --port={args.port}",
|
||||||
|
"forwardAllArgs": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "npx wait-on tcp:{args.port} && nx storybook:test {projectName}",
|
||||||
|
"forwardAllArgs": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"parallel": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"chromatic": {
|
"chromatic": {
|
||||||
"executor": "nx:run-commands",
|
"executor": "nx:run-commands",
|
||||||
"options": {
|
"options": {
|
||||||
"cwd": "{projectRoot}",
|
"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
|
"ci": false
|
||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npx vite build && sh ./scripts/inject-runtime-env.sh",
|
"build": "npx vite build && sh ./scripts/inject-runtime-env.sh",
|
||||||
"build:sourcemaps": "VITE_BUILD_SOURCEMAP=true NODE_OPTIONS=--max-old-space-size=4096 npx nx build",
|
"build:sourcemaps": "VITE_BUILD_SOURCEMAP=true NODE_OPTIONS=--max-old-space-size=4096 npx nx build",
|
||||||
|
"build-storybook": "cd ../.. && npx nx storybook:build twenty-front",
|
||||||
"start:prod": "NODE_ENV=production npx vite --host",
|
"start:prod": "NODE_ENV=production npx vite --host",
|
||||||
"tsup": "npx tsup"
|
"tsup": "npx tsup"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -60,23 +60,74 @@
|
|||||||
},
|
},
|
||||||
"test": {},
|
"test": {},
|
||||||
"storybook:build": {},
|
"storybook:build": {},
|
||||||
|
"storybook:build:scope": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"options": {
|
||||||
|
"command": "STORYBOOK_SCOPE={args.scope} nx storybook:build twenty-front",
|
||||||
|
"scope": "all"
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"docs": { "scope": "ui-docs" },
|
||||||
|
"modules": { "scope": "modules" },
|
||||||
|
"pages": { "scope": "pages" }
|
||||||
|
}
|
||||||
|
},
|
||||||
"storybook:dev": {
|
"storybook:dev": {
|
||||||
"options": { "port": 6006 }
|
"options": { "port": 6006 }
|
||||||
},
|
},
|
||||||
|
"storybook:dev:scope": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"options": {
|
||||||
|
"command": "STORYBOOK_SCOPE={args.scope} nx storybook:dev twenty-front",
|
||||||
|
"scope": "all"
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"docs": { "scope": "ui-docs" },
|
||||||
|
"modules": { "scope": "modules" },
|
||||||
|
"pages": { "scope": "pages" }
|
||||||
|
}
|
||||||
|
},
|
||||||
"storybook:static": {
|
"storybook:static": {
|
||||||
"options": {
|
"options": {
|
||||||
"buildTarget": "twenty-front:storybook:build",
|
"buildTarget": "twenty-front:storybook:build",
|
||||||
"port": 6006
|
"port": 6006
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"storybook:test": {
|
"storybook:static:scope": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
"options": {
|
"options": {
|
||||||
"url": "http://localhost:6006"
|
"command": "STORYBOOK_SCOPE={args.scope} nx storybook:static twenty-front",
|
||||||
|
"scope": "all"
|
||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"docs": { "env": { "STORYBOOK_SCOPE": "ui-docs" } },
|
"docs": { "scope": "ui-docs" },
|
||||||
"modules": { "env": { "STORYBOOK_SCOPE": "modules" } },
|
"modules": { "scope": "modules" },
|
||||||
"pages": { "env": { "STORYBOOK_SCOPE": "pages" } }
|
"pages": { "scope": "pages" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"storybook:test": {
|
||||||
|
"options": {
|
||||||
|
"url": "http://localhost:6006",
|
||||||
|
"port": 6006
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"ci": {
|
||||||
|
"commands": [
|
||||||
|
{
|
||||||
|
"prefix": "[SB]",
|
||||||
|
"command": "nx storybook:static {projectName} --port={args.port}",
|
||||||
|
"forwardAllArgs": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "STORYBOOK_SCOPE={args.scope} npx wait-on tcp:{args.port} && nx storybook:test {projectName}",
|
||||||
|
"forwardAllArgs": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"parallel": true
|
||||||
|
},
|
||||||
|
"docs": { "scope": "ui-docs" },
|
||||||
|
"modules": { "scope": "modules" },
|
||||||
|
"pages": { "scope": "pages" }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"graphql:generate": {
|
"graphql:generate": {
|
||||||
@@ -96,15 +147,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"chromatic": {
|
"chromatic": {
|
||||||
"executor": "nx:run-commands",
|
|
||||||
"options": {
|
|
||||||
"cwd": "{projectRoot}",
|
|
||||||
"command": "cross-var chromatic --project-token=$CHROMATIC_PROJECT_TOKEN --build-script-name=storybook:build"
|
|
||||||
},
|
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"ci": {
|
"ci": {}
|
||||||
"args": ["--exit-zero-on-changes"]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export const RightDrawerEmailThread = () => {
|
|||||||
|
|
||||||
useRegisterClickOutsideListenerCallback({
|
useRegisterClickOutsideListenerCallback({
|
||||||
callbackId:
|
callbackId:
|
||||||
'EmailThreadClickOutsideCallBack-' + thread.id ?? 'no-thread-id',
|
'EmailThreadClickOutsideCallBack-' + (thread.id ?? 'no-thread-id'),
|
||||||
callbackFunction: useRecoilCallback(
|
callbackFunction: useRecoilCallback(
|
||||||
({ set }) =>
|
({ set }) =>
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
@@ -97,9 +97,7 @@ export const usePrepareFindManyActivitiesQuery = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const filteredActivities = [
|
const filteredActivities = [
|
||||||
...activities.filter(
|
...activities.filter((activity) => !shouldActivityBeExcluded?.(activity)),
|
||||||
(activity) => !shouldActivityBeExcluded?.(activity) ?? true,
|
|
||||||
),
|
|
||||||
].sort((a, b) => {
|
].sort((a, b) => {
|
||||||
return a.createdAt > b.createdAt ? -1 : 1;
|
return a.createdAt > b.createdAt ? -1 : 1;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ const meta: Meta = {
|
|||||||
fieldDefinition: {
|
fieldDefinition: {
|
||||||
fieldMetadataId: 'phone',
|
fieldMetadataId: 'phone',
|
||||||
label: 'Phone',
|
label: 'Phone',
|
||||||
type: FieldMetadataType.Text,
|
type: FieldMetadataType.Phone,
|
||||||
iconName: 'IconPhone',
|
iconName: 'IconPhone',
|
||||||
metadata: {
|
metadata: {
|
||||||
fieldName: 'phone',
|
fieldName: 'phone',
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ const PhoneFieldInputWithContext = ({
|
|||||||
fieldDefinition={{
|
fieldDefinition={{
|
||||||
fieldMetadataId: 'phone',
|
fieldMetadataId: 'phone',
|
||||||
label: 'Phone',
|
label: 'Phone',
|
||||||
type: FieldMetadataType.Text,
|
type: FieldMetadataType.Phone,
|
||||||
iconName: 'IconPhone',
|
iconName: 'IconPhone',
|
||||||
metadata: {
|
metadata: {
|
||||||
fieldName: 'phone',
|
fieldName: 'phone',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useTheme } from '@emotion/react';
|
import { css, useTheme } from '@emotion/react';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { IconComponent } from 'twenty-ui';
|
import { IconComponent } from 'twenty-ui';
|
||||||
|
|
||||||
@@ -87,10 +87,13 @@ const StyledButton = styled.button<
|
|||||||
`;
|
`;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
${({ theme, isActive }) =>
|
||||||
|
isActive &&
|
||||||
|
css`
|
||||||
&:hover {
|
&:hover {
|
||||||
background: ${({ theme, isActive }) =>
|
background: ${theme.background.transparent.lighter};
|
||||||
!!isActive ?? theme.background.transparent.lighter};
|
|
||||||
}
|
}
|
||||||
|
`}
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
background: ${({ theme, disabled }) =>
|
background: ${({ theme, disabled }) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user