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>
This commit is contained in:
Pacifique LINJANJA
2024-04-17 18:06:02 +02:00
committed by GitHub
parent 977927af04
commit 627a6bda29
40 changed files with 800 additions and 381 deletions

View File

@ -8,6 +8,7 @@ describe('getDisplayNameFromParticipant', () => {
handle: '',
role: 'from',
person: {
__typename: 'Person',
id: '1',
createdAt: '',
updatedAt: '',
@ -32,6 +33,7 @@ describe('getDisplayNameFromParticipant', () => {
companyId: '',
},
workspaceMember: {
__typename: 'WorkspaceMember',
id: '1',
name: {
firstName: 'Jane',

View File

@ -4,7 +4,7 @@ import { groupEventsByMonth } from '../groupEventsByMonth';
describe('groupEventsByMonth', () => {
it('should group activities by month', () => {
const grouped = groupEventsByMonth(mockedEvents as unknown as Event[]);
const grouped = groupEventsByMonth(mockedEvents);
expect(grouped).toHaveLength(2);
expect(grouped[0].items).toHaveLength(1);

View File

@ -83,12 +83,10 @@ describe('useCreateActivityInCache', () => {
act(() => {
const res = result.current.createActivityInCache({
type: 'Note',
targetableObjects: [
{
targetObjectNameSingular: 'person',
id: '1234',
},
],
targetObject: {
targetObjectNameSingular: 'person',
id: '1234',
},
});
expect(res.createdActivityInCache).toHaveProperty('id');

View File

@ -4,7 +4,10 @@ import { RecoilRoot, useSetRecoilState } from 'recoil';
import { useOnboardingStatus } from '@/auth/hooks/useOnboardingStatus';
import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
import {
CurrentWorkspace,
currentWorkspaceState,
} from '@/auth/states/currentWorkspaceState';
import { isVerifyPendingState } from '@/auth/states/isVerifyPendingState';
import { tokenPairState } from '@/auth/states/tokenPairState';
import { billingState } from '@/client-config/states/billingState';
@ -84,7 +87,7 @@ describe('useOnboardingStatus', () => {
setCurrentWorkspace({
...currentWorkspace,
subscriptionStatus: 'incomplete',
});
} as CurrentWorkspace);
setCurrentWorkspaceMember(currentWorkspaceMember);
});
@ -106,7 +109,7 @@ describe('useOnboardingStatus', () => {
setCurrentWorkspace({
...currentWorkspace,
subscriptionStatus: 'canceled',
});
} as CurrentWorkspace);
setCurrentWorkspaceMember({
...currentWorkspaceMember,
name: {
@ -130,7 +133,7 @@ describe('useOnboardingStatus', () => {
...currentWorkspace,
activationStatus: 'inactive',
subscriptionStatus: 'active',
});
} as CurrentWorkspace);
});
expect(result.current.onboardingStatus).toBe(
@ -153,7 +156,7 @@ describe('useOnboardingStatus', () => {
setCurrentWorkspace({
...currentWorkspace,
subscriptionStatus: 'active',
});
} as CurrentWorkspace);
setCurrentWorkspaceMember(currentWorkspaceMember);
});
@ -175,7 +178,7 @@ describe('useOnboardingStatus', () => {
setCurrentWorkspace({
...currentWorkspace,
subscriptionStatus: 'active',
});
} as CurrentWorkspace);
setCurrentWorkspaceMember({
...currentWorkspaceMember,
name: {
@ -203,7 +206,7 @@ describe('useOnboardingStatus', () => {
setCurrentWorkspace({
...currentWorkspace,
subscriptionStatus: 'past_due',
});
} as CurrentWorkspace);
setCurrentWorkspaceMember({
...currentWorkspaceMember,
name: {
@ -231,7 +234,7 @@ describe('useOnboardingStatus', () => {
setCurrentWorkspace({
...currentWorkspace,
subscriptionStatus: 'unpaid',
});
} as CurrentWorkspace);
setCurrentWorkspaceMember({
...currentWorkspaceMember,
name: {

View File

@ -84,77 +84,77 @@ export const mocks = [
query: gql`
mutation CreateOneFavorite($input: FavoriteCreateInput!) {
createFavorite(data: $input) {
__typename
id
companyId
createdAt
personId
person {
__typename
xLink {
label
url
__typename
id
companyId
createdAt
personId
person {
__typename
xLink {
label
url
}
id
createdAt
city
email
jobTitle
name {
firstName
lastName
}
phone
linkedinLink {
label
url
}
updatedAt
avatarUrl
companyId
}
position
workspaceMemberId
workspaceMember {
__typename
colorScheme
name {
firstName
lastName
}
locale
userId
avatarUrl
createdAt
updatedAt
id
}
company {
__typename
xLink {
label
url
}
linkedinLink {
label
url
}
domainName
annualRecurringRevenue {
amountMicros
currencyCode
}
createdAt
address
updatedAt
name
accountOwnerId
employees
id
idealCustomerProfile
}
updatedAt
}
id
createdAt
city
email
jobTitle
name {
firstName
lastName
}
phone
linkedinLink {
label
url
}
updatedAt
avatarUrl
companyId
}
position
workspaceMemberId
workspaceMember {
__typename
colorScheme
name {
firstName
lastName
}
locale
userId
avatarUrl
createdAt
updatedAt
id
}
company {
__typename
xLink {
label
url
}
linkedinLink {
label
url
}
domainName
annualRecurringRevenue {
amountMicros
currencyCode
}
createdAt
address
updatedAt
name
accountOwnerId
employees
id
idealCustomerProfile
}
updatedAt
}
}
`,
variables: {
@ -201,77 +201,77 @@ export const mocks = [
$input: FavoriteUpdateInput!
) {
updateFavorite(id: $idToUpdate, data: $input) {
__typename
id
companyId
createdAt
personId
person {
__typename
xLink {
label
url
__typename
id
companyId
createdAt
personId
person {
__typename
xLink {
label
url
}
id
createdAt
city
email
jobTitle
name {
firstName
lastName
}
phone
linkedinLink {
label
url
}
updatedAt
avatarUrl
companyId
}
position
workspaceMemberId
workspaceMember {
__typename
colorScheme
name {
firstName
lastName
}
locale
userId
avatarUrl
createdAt
updatedAt
id
}
company {
__typename
xLink {
label
url
}
linkedinLink {
label
url
}
domainName
annualRecurringRevenue {
amountMicros
currencyCode
}
createdAt
address
updatedAt
name
accountOwnerId
employees
id
idealCustomerProfile
}
updatedAt
}
id
createdAt
city
email
jobTitle
name {
firstName
lastName
}
phone
linkedinLink {
label
url
}
updatedAt
avatarUrl
companyId
}
position
workspaceMemberId
workspaceMember {
__typename
colorScheme
name {
firstName
lastName
}
locale
userId
avatarUrl
createdAt
updatedAt
id
}
company {
__typename
xLink {
label
url
}
linkedinLink {
label
url
}
domainName
annualRecurringRevenue {
amountMicros
currencyCode
}
createdAt
address
updatedAt
name
accountOwnerId
employees
id
idealCustomerProfile
}
updatedAt
}
}
`,
variables: {

View File

@ -22,28 +22,38 @@ export const query = gql`
`;
export const findManyViewsQuery = gql`
query FindManyViews($filter: ViewFilterInput, $orderBy: ViewOrderByInput, $lastCursor: String, $limit: Float) {
views(filter: $filter, orderBy: $orderBy, first: $limit, after: $lastCursor) {
edges {
node {
__typename
id
objectMetadataId
type
createdAt
name
updatedAt
}
cursor
query FindManyViews(
$filter: ViewFilterInput
$orderBy: ViewOrderByInput
$lastCursor: String
$limit: Float
) {
views(
filter: $filter
orderBy: $orderBy
first: $limit
after: $lastCursor
) {
edges {
node {
__typename
id
objectMetadataId
type
createdAt
name
updatedAt
}
pageInfo {
hasNextPage
startCursor
endCursor
}
totalCount
cursor
}
pageInfo {
hasNextPage
startCursor
endCursor
}
totalCount
}
}
`;
export const variables = {

View File

@ -4,7 +4,7 @@ import { act, renderHook } from '@testing-library/react';
import { RecoilRoot } from 'recoil';
import { useCreateOneRelationMetadataItem } from '@/object-metadata/hooks/useCreateOneRelationMetadataItem';
import { RelationMetadataType } from '~/generated/graphql';
import { FieldMetadataType, RelationMetadataType } from '~/generated/graphql';
import {
query,
@ -45,6 +45,7 @@ describe('useCreateOneRelationMetadataItem', () => {
relationType: RelationMetadataType.OneToOne,
field: {
label: 'label',
type: FieldMetadataType.Relation,
},
objectMetadataId: 'objectMetadataId',
connect: {

View File

@ -159,6 +159,7 @@ describe('useFieldMetadataItem', () => {
const res = await result.current.editMetadataField({
id: fieldMetadataItem.id,
label: 'New label',
type: FieldMetadataType.Text,
});
expect(res.data).toEqual({

View File

@ -6,27 +6,27 @@ export const query = gql`
mutation CreatePeople($data: [PersonCreateInput!]!) {
createPeople(data: $data) {
__typename
xLink {
label
url
}
id
createdAt
city
email
jobTitle
name {
firstName
lastName
}
phone
linkedinLink {
label
url
}
updatedAt
avatarUrl
companyId
xLink {
label
url
}
id
createdAt
city
email
jobTitle
name {
firstName
lastName
}
phone
linkedinLink {
label
url
}
updatedAt
avatarUrl
companyId
}
}
`;

View File

@ -4,27 +4,27 @@ export const query = gql`
mutation CreateOnePerson($input: PersonCreateInput!) {
createPerson(data: $input) {
__typename
xLink {
label
url
}
id
createdAt
city
email
jobTitle
name {
firstName
lastName
}
phone
linkedinLink {
label
url
}
updatedAt
avatarUrl
companyId
xLink {
label
url
}
id
createdAt
city
email
jobTitle
name {
firstName
lastName
}
phone
linkedinLink {
label
url
}
updatedAt
avatarUrl
companyId
}
}
`;

View File

@ -6,27 +6,27 @@ export const query = gql`
mutation ExecuteQuickActionOnOnePerson($idToExecuteQuickActionOn: UUID!) {
executeQuickActionOnPerson(id: $idToExecuteQuickActionOn) {
__typename
xLink {
label
url
}
id
createdAt
city
email
jobTitle
name {
firstName
lastName
}
phone
linkedinLink {
label
url
}
updatedAt
avatarUrl
companyId
xLink {
label
url
}
id
createdAt
city
email
jobTitle
name {
firstName
lastName
}
phone
linkedinLink {
label
url
}
updatedAt
avatarUrl
companyId
}
}
`;

View File

@ -6,27 +6,27 @@ export const query = gql`
query FindOnePerson($objectRecordId: UUID!) {
person(filter: { id: { eq: $objectRecordId } }) {
__typename
xLink {
label
url
}
id
createdAt
city
email
jobTitle
name {
firstName
lastName
}
phone
linkedinLink {
label
url
}
updatedAt
avatarUrl
companyId
xLink {
label
url
}
id
createdAt
city
email
jobTitle
name {
firstName
lastName
}
phone
linkedinLink {
label
url
}
updatedAt
avatarUrl
companyId
}
}
`;

View File

@ -4,27 +4,27 @@ export const query = gql`
mutation UpdateOnePerson($idToUpdate: UUID!, $input: PersonUpdateInput!) {
updatePerson(id: $idToUpdate, data: $input) {
__typename
xLink {
label
url
}
id
createdAt
city
email
jobTitle
name {
firstName
lastName
}
phone
linkedinLink {
label
url
}
updatedAt
avatarUrl
companyId
xLink {
label
url
}
id
createdAt
city
email
jobTitle
name {
firstName
lastName
}
phone
linkedinLink {
label
url
}
updatedAt
avatarUrl
companyId
}
}
`;

View File

@ -23,5 +23,5 @@ export type FieldDefinition<T extends FieldMetadata> = {
type: FieldMetadataType;
metadata: T;
infoTooltipContent?: string;
defaultValue: any;
defaultValue?: any;
};

View File

@ -8,6 +8,7 @@ import {
} from '@/object-record/record-field/__mocks__/fieldDefinitions';
import { FieldDefinition } from '@/object-record/record-field/types/FieldDefinition';
import { FieldCurrencyMetadata } from '@/object-record/record-field/types/FieldMetadata';
import { FieldMetadataType } from '~/generated/graphql';
import { isFieldValueEmpty } from '../isFieldValueEmpty';
@ -64,7 +65,7 @@ describe('isFieldValueEmpty', () => {
fieldMetadataId,
label: 'Annual Income',
iconName: 'cashCow',
type: 'CURRENCY',
type: FieldMetadataType.Currency,
metadata: {
fieldName: 'annualIncome',
placeHolder: '100000',

View File

@ -1,6 +1,6 @@
import { createContext } from 'react';
type RecordTableRowContextProps = {
export type RecordTableRowContextProps = {
pathToShowPage: string;
recordId: string;
rowIndex: number;

View File

@ -1,12 +1,14 @@
import { FieldMetadata } from '@/object-record/record-field/types/FieldMetadata';
import { RecordTableRowContextProps } from '@/object-record/record-table/contexts/RecordTableRowContext';
import { ColumnDefinition } from '@/object-record/record-table/types/ColumnDefinition';
import { FieldMetadataType } from '~/generated-metadata/graphql';
export const recordTableRow = {
export const recordTableRow: RecordTableRowContextProps = {
rowIndex: 2,
isSelected: false,
recordId: 'recordId',
pathToShowPage: '/',
isReadOnly: false,
};
export const recordTableCell: {

View File

@ -20,6 +20,7 @@ describe('useLimitPerMetadataItem', () => {
isActive: true,
isCustom: true,
isSystem: true,
isRemote: false,
labelPlural: 'labelPlural',
labelSingular: 'labelSingular',
namePlural: 'namePlural',

View File

@ -118,6 +118,7 @@ describe('useMultiObjectSearch', () => {
isActive: true,
isCustom: true,
isSystem: false,
isRemote: false,
labelPlural: 'labelPlural',
labelSingular: 'labelSingular',
namePlural: 'namePlural',
@ -152,6 +153,7 @@ describe('useMultiObjectSearch', () => {
isActive: true,
isCustom: true,
isSystem: false,
isRemote: false,
labelPlural: 'labelPlural',
labelSingular: 'labelSingular',
namePlural: 'namePlural',

View File

@ -72,6 +72,7 @@ describe('useFilteredSearchEntityQuery', () => {
setCurrentWorkspaceMember({
id: '32219445-f587-4c40-b2b1-6d3205ed96da',
name: { firstName: 'John', lastName: 'Connor' },
locale: 'en',
});
const mockObjectMetadataItems = getObjectMetadataItemsMock();

View File

@ -21,8 +21,7 @@ Buttons are often used for form submissions and to toggle elements into view.
## Usage
```js
import { Button } from '@/ui/button/components/Button';
<Button title='Click me' />
```
<Button title="Click me" />;
```

View File

@ -17,6 +17,7 @@ const workspaceMember: Omit<
WorkspaceMember,
'createdAt' | 'updatedAt' | 'userId' | 'userEmail'
> = {
__typename: 'WorkspaceMember',
id: 'id',
name: {
firstName: 'firstName',

View File

@ -1,6 +1,7 @@
import { RecordBoardFieldDefinition } from '@/object-record/record-board/types/RecordBoardFieldDefinition';
import { FieldMetadata } from '@/object-record/record-field/types/FieldMetadata';
import { mapBoardFieldDefinitionsToViewFields } from '@/views/utils/mapBoardFieldDefinitionsToViewFields';
import { FieldMetadataType } from '~/generated/graphql';
describe('mapBoardFieldDefinitionsToViewFields', () => {
it('should map board field definitions to view fields', () => {
@ -9,7 +10,7 @@ describe('mapBoardFieldDefinitionsToViewFields', () => {
fieldMetadataId: 'fieldMetadataId',
label: 'label',
iconName: 'iconName',
type: 'BOOLEAN',
type: FieldMetadataType.Boolean,
metadata: {
objectMetadataNameSingular: 'objectMetadataNameSingular',
fieldName: 'fieldName',
@ -22,7 +23,7 @@ describe('mapBoardFieldDefinitionsToViewFields', () => {
fieldMetadataId: 'fieldMetadataId1',
label: 'label1',
iconName: 'iconName1',
type: 'NUMBER',
type: FieldMetadataType.Number,
metadata: {
objectMetadataNameSingular: 'objectMetadataNameSingular1',
fieldName: 'fieldName1',

View File

@ -10,6 +10,7 @@ import { mapColumnDefinitionsToViewFields } from '@/views/utils/mapColumnDefinit
import { mapViewFieldsToColumnDefinitions } from '@/views/utils/mapViewFieldsToColumnDefinitions';
import { mapViewFiltersToFilters } from '@/views/utils/mapViewFiltersToFilters';
import { mapViewSortsToSorts } from '@/views/utils/mapViewSortsToSorts';
import { FieldMetadataType } from '~/generated/graphql';
const baseDefinition = {
fieldMetadataId: '05731f68-6e7a-4903-8374-c0b6a9063482',
@ -91,7 +92,7 @@ describe('mapViewFieldsToColumnDefinitions', () => {
metadata: { fieldName: 'fieldName 1' },
infoTooltipContent: 'infoTooltipContent 1',
iconName: 'iconName 1',
type: 'TEXT',
type: FieldMetadataType.Text,
position: 1,
size: 1,
isVisible: false,
@ -111,7 +112,7 @@ describe('mapViewFieldsToColumnDefinitions', () => {
metadata: { fieldName: 'fieldName 2' },
infoTooltipContent: 'infoTooltipContent 2',
iconName: 'iconName 2',
type: 'TEXT',
type: FieldMetadataType.Text,
position: 2,
size: 1,
isVisible: false,
@ -131,7 +132,7 @@ describe('mapViewFieldsToColumnDefinitions', () => {
metadata: { fieldName: 'fieldName 3' },
infoTooltipContent: 'infoTooltipContent 3',
iconName: 'iconName 3',
type: 'TEXT',
type: FieldMetadataType.Text,
position: 3,
size: 1,
isVisible: false,
@ -148,7 +149,7 @@ describe('mapViewFieldsToColumnDefinitions', () => {
metadata: { fieldName: 'fieldName 1' },
infoTooltipContent: 'infoTooltipContent 1',
iconName: 'iconName 1',
type: 'TEXT',
type: FieldMetadataType.Text,
size: 1,
},
{
@ -158,7 +159,7 @@ describe('mapViewFieldsToColumnDefinitions', () => {
metadata: { fieldName: 'fieldName 3' },
infoTooltipContent: 'infoTooltipContent 3',
iconName: 'iconName 3',
type: 'TEXT',
type: FieldMetadataType.Text,
size: 3,
},
];
@ -170,7 +171,7 @@ describe('mapViewFieldsToColumnDefinitions', () => {
metadata: { fieldName: 'fieldName 1' },
infoTooltipContent: 'infoTooltipContent 1',
iconName: 'iconName 1',
type: 'TEXT',
type: FieldMetadataType.Text,
size: 1,
position: 1,
isVisible: false,
@ -182,7 +183,7 @@ describe('mapViewFieldsToColumnDefinitions', () => {
metadata: { fieldName: 'fieldName 3' },
infoTooltipContent: 'infoTooltipContent 3',
iconName: 'iconName 3',
type: 'TEXT',
type: FieldMetadataType.Text,
size: 3,
position: 3,
isVisible: true,