From c9db37bad3f75435f92b29dc577ef5470caa8ab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tha=C3=AFs?= Date: Fri, 3 May 2024 19:19:21 +0200 Subject: [PATCH] fix: fix storybook:build memory allocation error in CI (#5284) --- .eslintrc.react.cjs | 5 ++ .github/workflows/ci-front.yaml | 2 +- package.json | 6 +++ .../__tests__/useCreateActivityInDB.test.tsx | 2 +- .../utils/editDatabaseConnection.ts | 4 +- .../spreadsheet-import/utils/uniqueEntries.ts | 2 +- packages/twenty-server/.eslintrc.cjs | 5 ++ .../create-company-and-contact.service.ts | 2 +- .../message-find-many.pre-query.hook.ts | 2 +- packages/twenty-ui/.eslintrc.cjs | 5 ++ yarn.lock | 54 +++++++++++++++++++ 11 files changed, 83 insertions(+), 6 deletions(-) diff --git a/.eslintrc.react.cjs b/.eslintrc.react.cjs index d91b0d185c36..0aca87d0e44e 100644 --- a/.eslintrc.react.cjs +++ b/.eslintrc.react.cjs @@ -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'`)", + }, ], }, ], diff --git a/.github/workflows/ci-front.yaml b/.github/workflows/ci-front.yaml index 05a7e9fe1b05..86ae4ef979d5 100644 --- a/.github/workflows/ci-front.yaml +++ b/.github/workflows/ci-front.yaml @@ -38,7 +38,7 @@ jobs: - name: Front / Write .env run: npx nx reset:env twenty-front - name: Front / Build storybook - run: npx nx storybook:build twenty-front + 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 diff --git a/package.json b/package.json index 5d4a7f0a60d2..896feaa7420c 100644 --- a/package.json +++ b/package.json @@ -110,8 +110,10 @@ "jsonwebtoken": "^9.0.0", "libphonenumber-js": "^1.10.26", "lodash.camelcase": "^4.3.0", + "lodash.compact": "^3.0.1", "lodash.debounce": "^4.0.8", "lodash.groupby": "^4.6.0", + "lodash.identity": "^3.0.0", "lodash.isempty": "^4.4.0", "lodash.isequal": "^4.5.0", "lodash.isobject": "^3.0.2", @@ -120,6 +122,7 @@ "lodash.merge": "^4.6.2", "lodash.omit": "^4.5.0", "lodash.pick": "^4.4.0", + "lodash.pickby": "^4.6.0", "lodash.snakecase": "^4.1.1", "lodash.upperfirst": "^4.3.1", "luxon": "^3.3.0", @@ -240,14 +243,17 @@ "@types/jest": "^29.5.11", "@types/js-cookie": "^3.0.3", "@types/lodash.camelcase": "^4.3.7", + "@types/lodash.compact": "^3.0.9", "@types/lodash.debounce": "^4.0.7", "@types/lodash.groupby": "^4.6.9", + "@types/lodash.identity": "^3.0.9", "@types/lodash.isempty": "^4.4.7", "@types/lodash.isequal": "^4.5.7", "@types/lodash.isobject": "^3.0.7", "@types/lodash.kebabcase": "^4.1.7", "@types/lodash.mapvalues": "^4.6.9", "@types/lodash.omit": "^4.5.9", + "@types/lodash.pickby": "^4.6.9", "@types/lodash.snakecase": "^4.1.7", "@types/lodash.upperfirst": "^4.3.7", "@types/luxon": "^3.3.0", diff --git a/packages/twenty-front/src/modules/activities/hooks/__tests__/useCreateActivityInDB.test.tsx b/packages/twenty-front/src/modules/activities/hooks/__tests__/useCreateActivityInDB.test.tsx index c4726cb8c710..e047e47c420d 100644 --- a/packages/twenty-front/src/modules/activities/hooks/__tests__/useCreateActivityInDB.test.tsx +++ b/packages/twenty-front/src/modules/activities/hooks/__tests__/useCreateActivityInDB.test.tsx @@ -2,7 +2,7 @@ import { ReactNode } from 'react'; import { MockedProvider, MockedResponse } from '@apollo/client/testing'; import { act, renderHook } from '@testing-library/react'; import gql from 'graphql-tag'; -import pick from 'lodash/pick'; +import pick from 'lodash.pick'; import { RecoilRoot } from 'recoil'; import { useCreateActivityInDB } from '@/activities/hooks/useCreateActivityInDB'; diff --git a/packages/twenty-front/src/modules/settings/integrations/database-connection/utils/editDatabaseConnection.ts b/packages/twenty-front/src/modules/settings/integrations/database-connection/utils/editDatabaseConnection.ts index bcb9d6103d60..1c1988ad822c 100644 --- a/packages/twenty-front/src/modules/settings/integrations/database-connection/utils/editDatabaseConnection.ts +++ b/packages/twenty-front/src/modules/settings/integrations/database-connection/utils/editDatabaseConnection.ts @@ -1,4 +1,6 @@ -import { identity, isEmpty, pickBy } from 'lodash'; +import identity from 'lodash.identity'; +import isEmpty from 'lodash.isempty'; +import pickBy from 'lodash.pickby'; import { z } from 'zod'; import { settingsIntegrationPostgreSQLConnectionFormSchema } from '@/settings/integrations/database-connection/components/SettingsIntegrationDatabaseConnectionForm'; diff --git a/packages/twenty-front/src/modules/spreadsheet-import/utils/uniqueEntries.ts b/packages/twenty-front/src/modules/spreadsheet-import/utils/uniqueEntries.ts index 276921af98c2..0e82bc44fe41 100644 --- a/packages/twenty-front/src/modules/spreadsheet-import/utils/uniqueEntries.ts +++ b/packages/twenty-front/src/modules/spreadsheet-import/utils/uniqueEntries.ts @@ -1,4 +1,4 @@ -import uniqBy from 'lodash/uniqBy'; +import uniqBy from 'lodash.uniqby'; import { MatchColumnsStepProps, diff --git a/packages/twenty-server/.eslintrc.cjs b/packages/twenty-server/.eslintrc.cjs index daad469206b4..af85a600d9df 100644 --- a/packages/twenty-server/.eslintrc.cjs +++ b/packages/twenty-server/.eslintrc.cjs @@ -17,6 +17,11 @@ module.exports = { group: ['**../'], message: 'Relative imports are not allowed.', }, + { + group: ['lodash'], + message: + "Please use the standalone lodash package (for instance: `import groupBy from 'lodash.groupby'` instead of `import { groupBy } from 'lodash'`)", + }, ], }, ], diff --git a/packages/twenty-server/src/modules/connected-account/auto-companies-and-contacts-creation/services/create-company-and-contact.service.ts b/packages/twenty-server/src/modules/connected-account/auto-companies-and-contacts-creation/services/create-company-and-contact.service.ts index af61502f0804..fd1fd186a279 100644 --- a/packages/twenty-server/src/modules/connected-account/auto-companies-and-contacts-creation/services/create-company-and-contact.service.ts +++ b/packages/twenty-server/src/modules/connected-account/auto-companies-and-contacts-creation/services/create-company-and-contact.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { EntityManager, Repository } from 'typeorm'; -import compact from 'lodash/compact'; +import compact from 'lodash.compact'; import { getDomainNameFromHandle } from 'src/modules/calendar-messaging-participant/utils/get-domain-name-from-handle.util'; import { CreateCompanyService } from 'src/modules/connected-account/auto-companies-and-contacts-creation/create-company/create-company.service'; diff --git a/packages/twenty-server/src/modules/messaging/query-hooks/message/message-find-many.pre-query.hook.ts b/packages/twenty-server/src/modules/messaging/query-hooks/message/message-find-many.pre-query.hook.ts index 0e4cdd216610..fbd837f23fd1 100644 --- a/packages/twenty-server/src/modules/messaging/query-hooks/message/message-find-many.pre-query.hook.ts +++ b/packages/twenty-server/src/modules/messaging/query-hooks/message/message-find-many.pre-query.hook.ts @@ -5,7 +5,7 @@ import { NotFoundException, } from '@nestjs/common'; -import { groupBy } from 'lodash'; +import groupBy from 'lodash.groupby'; import { WorkspacePreQueryHook } from 'src/engine/api/graphql/workspace-query-runner/workspace-pre-query-hook/interfaces/workspace-pre-query-hook.interface'; import { FindManyResolverArgs } from 'src/engine/api/graphql/workspace-resolver-builder/interfaces/workspace-resolvers-builder.interface'; diff --git a/packages/twenty-ui/.eslintrc.cjs b/packages/twenty-ui/.eslintrc.cjs index 5768c81945e5..50ca951215a3 100644 --- a/packages/twenty-ui/.eslintrc.cjs +++ b/packages/twenty-ui/.eslintrc.cjs @@ -22,6 +22,11 @@ module.exports = { message: 'Please use the custom wrapper: `useScopedHotkeys` from `@ui/utilities`', }, + { + group: ['lodash'], + message: + "Please use the standalone lodash package (for instance: `import groupBy from 'lodash.groupby'` instead of `import { groupBy } from 'lodash'`)", + }, ], }, ], diff --git a/yarn.lock b/yarn.lock index b02ac166a166..9389333051c2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16564,6 +16564,15 @@ __metadata: languageName: node linkType: hard +"@types/lodash.compact@npm:^3.0.9": + version: 3.0.9 + resolution: "@types/lodash.compact@npm:3.0.9" + dependencies: + "@types/lodash": "npm:*" + checksum: 9eff2fecd6773352f5b762a2c58f261e3c83f61d7297efe94b08f9a4b524b24ccc2de5e8d728e2ffd42472fa06973df0856e474eb74b5e614813d26d7436efc6 + languageName: node + linkType: hard + "@types/lodash.debounce@npm:^4.0.7": version: 4.0.9 resolution: "@types/lodash.debounce@npm:4.0.9" @@ -16591,6 +16600,15 @@ __metadata: languageName: node linkType: hard +"@types/lodash.identity@npm:^3.0.9": + version: 3.0.9 + resolution: "@types/lodash.identity@npm:3.0.9" + dependencies: + "@types/lodash": "npm:*" + checksum: fac961d04fe704b04bef608e9bffd8c7ea44d1d6f014c01ff520cd63e22fa58aa843d2017c18e31bcf21b35124b9c5c7dbf12b33362020d15f5c0591ff4cbc19 + languageName: node + linkType: hard + "@types/lodash.isempty@npm:^4.4.7": version: 4.4.9 resolution: "@types/lodash.isempty@npm:4.4.9" @@ -16672,6 +16690,15 @@ __metadata: languageName: node linkType: hard +"@types/lodash.pickby@npm:^4.6.9": + version: 4.6.9 + resolution: "@types/lodash.pickby@npm:4.6.9" + dependencies: + "@types/lodash": "npm:*" + checksum: a572e22a24f73e9041e1beca8bb8125875734471c440f7fe9ff48ced10e6ffe45a2392098940f4c1327252e3455afd0e2ea0cc3908a2e3bd0bafe60335e27e6c + languageName: node + linkType: hard + "@types/lodash.snakecase@npm:^4.1.7": version: 4.1.9 resolution: "@types/lodash.snakecase@npm:4.1.9" @@ -33675,6 +33702,13 @@ __metadata: languageName: node linkType: hard +"lodash.compact@npm:^3.0.1": + version: 3.0.1 + resolution: "lodash.compact@npm:3.0.1" + checksum: 9cc32065f1a9aa90bf3caa987fb7e00f8b90a49209e7f9f37c601e595f396a83ebe8f3328b2ef7f365cf822c9f21697527620c9c9c9734f107453b4c6c4dd810 + languageName: node + linkType: hard + "lodash.debounce@npm:^4.0.8": version: 4.0.8 resolution: "lodash.debounce@npm:4.0.8" @@ -33745,6 +33779,13 @@ __metadata: languageName: node linkType: hard +"lodash.identity@npm:^3.0.0": + version: 3.0.0 + resolution: "lodash.identity@npm:3.0.0" + checksum: a09ca0f99ae495c353e4ac6888684397f3b5b0c5f7d13a866a3956b7b2aa779462c78c219a31d4aab255d027ac5e11e8c3d943e70956e2a3d42feea56a8e9c1c + languageName: node + linkType: hard + "lodash.includes@npm:^4.3.0": version: 4.3.0 resolution: "lodash.includes@npm:4.3.0" @@ -33892,6 +33933,13 @@ __metadata: languageName: node linkType: hard +"lodash.pickby@npm:^4.6.0": + version: 4.6.0 + resolution: "lodash.pickby@npm:4.6.0" + checksum: 46befadb64ab0f61159977174b291f87b005cec1c7bd73d1b6949ec4cdff483c1be0e34398df8955b76ce06a3e93a4a5c5a552a4299520390d6993c5420c7ab9 + languageName: node + linkType: hard + "lodash.snakecase@npm:^4.1.1": version: 4.1.1 resolution: "lodash.snakecase@npm:4.1.1" @@ -46449,8 +46497,10 @@ __metadata: "@types/jest": "npm:^29.5.11" "@types/js-cookie": "npm:^3.0.3" "@types/lodash.camelcase": "npm:^4.3.7" + "@types/lodash.compact": "npm:^3.0.9" "@types/lodash.debounce": "npm:^4.0.7" "@types/lodash.groupby": "npm:^4.6.9" + "@types/lodash.identity": "npm:^3.0.9" "@types/lodash.isempty": "npm:^4.4.7" "@types/lodash.isequal": "npm:^4.5.7" "@types/lodash.isobject": "npm:^3.0.7" @@ -46459,6 +46509,7 @@ __metadata: "@types/lodash.merge": "npm:^4.6.7" "@types/lodash.omit": "npm:^4.5.9" "@types/lodash.pick": "npm:^4.3.7" + "@types/lodash.pickby": "npm:^4.6.9" "@types/lodash.snakecase": "npm:^4.1.7" "@types/lodash.upperfirst": "npm:^4.3.7" "@types/luxon": "npm:^3.3.0" @@ -46556,8 +46607,10 @@ __metadata: jsonwebtoken: "npm:^9.0.0" libphonenumber-js: "npm:^1.10.26" lodash.camelcase: "npm:^4.3.0" + lodash.compact: "npm:^3.0.1" lodash.debounce: "npm:^4.0.8" lodash.groupby: "npm:^4.6.0" + lodash.identity: "npm:^3.0.0" lodash.isempty: "npm:^4.4.0" lodash.isequal: "npm:^4.5.0" lodash.isobject: "npm:^3.0.2" @@ -46566,6 +46619,7 @@ __metadata: lodash.merge: "npm:^4.6.2" lodash.omit: "npm:^4.5.0" lodash.pick: "npm:^4.4.0" + lodash.pickby: "npm:^4.6.0" lodash.snakecase: "npm:^4.1.1" lodash.upperfirst: "npm:^4.3.1" luxon: "npm:^3.3.0"