mirror of
https://github.com/twentyhq/twenty.git
synced 2024-09-11 23:37:21 +03:00
Move emails to dedicated package (#3542)
* Add new package * Add twenty-emails package * Use generated files from twenty-emails in twenty-server * Fix deleted file * Import emails templates properly
This commit is contained in:
parent
e45a825a3a
commit
e358d677f9
@ -261,6 +261,9 @@
|
|||||||
"vite-plugin-checker": "^0.6.2",
|
"vite-plugin-checker": "^0.6.2",
|
||||||
"vite-plugin-svgr": "^4.2.0"
|
"vite-plugin-svgr": "^4.2.0"
|
||||||
},
|
},
|
||||||
|
"scripts": {
|
||||||
|
"postinstall": "yarn nx run twenty-emails:build"
|
||||||
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^18.17.1",
|
"node": "^18.17.1",
|
||||||
"npm": "please-use-yarn",
|
"npm": "please-use-yarn",
|
||||||
@ -278,6 +281,7 @@
|
|||||||
"packages/twenty-front",
|
"packages/twenty-front",
|
||||||
"packages/twenty-docs",
|
"packages/twenty-docs",
|
||||||
"packages/twenty-server",
|
"packages/twenty-server",
|
||||||
|
"packages/twenty-emails",
|
||||||
"packages/twenty-utils",
|
"packages/twenty-utils",
|
||||||
"packages/twenty-zapier",
|
"packages/twenty-zapier",
|
||||||
"packages/twenty-website",
|
"packages/twenty-website",
|
||||||
|
1
packages/twenty-emails/.gitignore
vendored
Normal file
1
packages/twenty-emails/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
dist
|
18
packages/twenty-emails/package.json
Normal file
18
packages/twenty-emails/package.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"name": "twenty-emails",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"description": "",
|
||||||
|
"author": "",
|
||||||
|
"private": true,
|
||||||
|
"license": "AGPL-3.0",
|
||||||
|
"main": "./dist/index.js",
|
||||||
|
"scripts": {
|
||||||
|
"nx": "NX_DEFAULT_PROJECT=twenty-emails node ../../node_modules/nx/bin/nx.js",
|
||||||
|
"build": "tsup"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.17.1",
|
||||||
|
"npm": "please-use-yarn",
|
||||||
|
"yarn": "^4.0.2"
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,7 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Container, Html } from '@react-email/components';
|
import { Container, Html } from '@react-email/components';
|
||||||
|
import { BaseHead } from 'src/components/BaseHead';
|
||||||
import { BaseHead } from 'src/emails/components/BaseHead';
|
import { Logo } from 'src/components/Logo';
|
||||||
import { Logo } from 'src/emails/components/Logo';
|
|
||||||
|
|
||||||
export const BaseEmail = ({ children }) => {
|
export const BaseEmail = ({ children }) => {
|
||||||
return (
|
return (
|
@ -1,7 +1,6 @@
|
|||||||
import { Font, Head } from '@react-email/components';
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import { Font, Head } from '@react-email/components';
|
||||||
import { emailTheme } from 'src/emails/common-style';
|
import { emailTheme } from 'src/common-style';
|
||||||
|
|
||||||
export const BaseHead = () => {
|
export const BaseHead = () => {
|
||||||
return (
|
return (
|
@ -1,7 +1,6 @@
|
|||||||
import { Button } from '@react-email/button';
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import { Button } from '@react-email/button';
|
||||||
import { emailTheme } from 'src/emails/common-style';
|
import { emailTheme } from 'src/common-style';
|
||||||
const callToActionStyle = {
|
const callToActionStyle = {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
padding: '8px 32px',
|
padding: '8px 32px',
|
@ -1,9 +1,8 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import { Column } from '@react-email/components';
|
||||||
import { Row } from '@react-email/row';
|
import { Row } from '@react-email/row';
|
||||||
import { Text } from '@react-email/text';
|
import { Text } from '@react-email/text';
|
||||||
import { Column } from '@react-email/components';
|
import { emailTheme } from 'src/common-style';
|
||||||
|
|
||||||
import { emailTheme } from 'src/emails/common-style';
|
|
||||||
|
|
||||||
const rowStyle = {
|
const rowStyle = {
|
||||||
display: 'flex',
|
display: 'flex',
|
@ -1,7 +1,6 @@
|
|||||||
import { Text } from '@react-email/text';
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import { Text } from '@react-email/text';
|
||||||
import { emailTheme } from 'src/emails/common-style';
|
import { emailTheme } from 'src/common-style';
|
||||||
|
|
||||||
const mainTextStyle = {
|
const mainTextStyle = {
|
||||||
fontSize: emailTheme.font.size.md,
|
fontSize: emailTheme.font.size.md,
|
@ -1,10 +1,9 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import { BaseEmail } from 'src/components/BaseEmail';
|
||||||
import { HighlightedText } from 'src/emails/components/HighlightedText';
|
import { CallToAction } from 'src/components/CallToAction';
|
||||||
import { MainText } from 'src/emails/components/MainText';
|
import { HighlightedText } from 'src/components/HighlightedText';
|
||||||
import { Title } from 'src/emails/components/Title';
|
import { MainText } from 'src/components/MainText';
|
||||||
import { BaseEmail } from 'src/emails/components/BaseEmail';
|
import { Title } from 'src/components/Title';
|
||||||
import { CallToAction } from 'src/emails/components/CallToAction';
|
|
||||||
|
|
||||||
type CleanInactiveWorkspaceEmailData = {
|
type CleanInactiveWorkspaceEmailData = {
|
||||||
daysLeft: number;
|
daysLeft: number;
|
@ -1,10 +1,9 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import { BaseEmail } from 'src/components/BaseEmail';
|
||||||
import { HighlightedText } from 'src/emails/components/HighlightedText';
|
import { CallToAction } from 'src/components/CallToAction';
|
||||||
import { MainText } from 'src/emails/components/MainText';
|
import { HighlightedText } from 'src/components/HighlightedText';
|
||||||
import { Title } from 'src/emails/components/Title';
|
import { MainText } from 'src/components/MainText';
|
||||||
import { BaseEmail } from 'src/emails/components/BaseEmail';
|
import { Title } from 'src/components/Title';
|
||||||
import { CallToAction } from 'src/emails/components/CallToAction';
|
|
||||||
|
|
||||||
type DeleteInactiveWorkspaceEmailData = {
|
type DeleteInactiveWorkspaceEmailData = {
|
||||||
daysSinceDead: number;
|
daysSinceDead: number;
|
7
packages/twenty-emails/tsconfig.json
Normal file
7
packages/twenty-emails/tsconfig.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "commonjs",
|
||||||
|
"baseUrl": "./",
|
||||||
|
"jsx": "react-jsx"
|
||||||
|
}
|
||||||
|
}
|
9
packages/twenty-emails/tsup.config.ts
Normal file
9
packages/twenty-emails/tsup.config.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { defineConfig } from 'tsup';
|
||||||
|
|
||||||
|
export default defineConfig([
|
||||||
|
{
|
||||||
|
entry: { index: './tsup.index.tsx' },
|
||||||
|
format: ['cjs', 'esm'],
|
||||||
|
dts: true,
|
||||||
|
},
|
||||||
|
]);
|
2
packages/twenty-emails/tsup.index.tsx
Normal file
2
packages/twenty-emails/tsup.index.tsx
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export * from './src/emails/clean-inactive-workspaces.email';
|
||||||
|
export * from './src/emails/delete-inactive-workspaces.email';
|
@ -37,7 +37,8 @@
|
|||||||
"@graphql-yoga/nestjs": "patch:@graphql-yoga/nestjs@2.1.0#./patches/@graphql-yoga+nestjs+2.1.0.patch",
|
"@graphql-yoga/nestjs": "patch:@graphql-yoga/nestjs@2.1.0#./patches/@graphql-yoga+nestjs+2.1.0.patch",
|
||||||
"@nestjs/graphql": "patch:@nestjs/graphql@12.0.8#./patches/@nestjs+graphql+12.0.8.patch",
|
"@nestjs/graphql": "patch:@nestjs/graphql@12.0.8#./patches/@nestjs+graphql+12.0.8.patch",
|
||||||
"@ptc-org/nestjs-query-graphql": "patch:@ptc-org/nestjs-query-graphql@4.2.0#./patches/@ptc-org+nestjs-query-graphql+4.2.0.patch",
|
"@ptc-org/nestjs-query-graphql": "patch:@ptc-org/nestjs-query-graphql@4.2.0#./patches/@ptc-org+nestjs-query-graphql+4.2.0.patch",
|
||||||
"class-validator": "patch:class-validator@^0.14.0#./patches/class-validator+0.14.0.patch"
|
"class-validator": "patch:class-validator@^0.14.0#./patches/class-validator+0.14.0.patch",
|
||||||
|
"twenty-emails": "workspace:*"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^18.17.1",
|
"node": "^18.17.1",
|
||||||
|
@ -3,6 +3,10 @@ import { InjectRepository } from '@nestjs/typeorm';
|
|||||||
|
|
||||||
import { render } from '@react-email/render';
|
import { render } from '@react-email/render';
|
||||||
import { Repository } from 'typeorm';
|
import { Repository } from 'typeorm';
|
||||||
|
import {
|
||||||
|
CleanInactiveWorkspaceEmail,
|
||||||
|
DeleteInactiveWorkspaceEmail,
|
||||||
|
} from 'twenty-emails';
|
||||||
|
|
||||||
import { MessageQueueJob } from 'src/integrations/message-queue/interfaces/message-queue-job.interface';
|
import { MessageQueueJob } from 'src/integrations/message-queue/interfaces/message-queue-job.interface';
|
||||||
|
|
||||||
@ -12,14 +16,12 @@ import { TypeORMService } from 'src/database/typeorm/typeorm.service';
|
|||||||
import { DataSourceEntity } from 'src/metadata/data-source/data-source.entity';
|
import { DataSourceEntity } from 'src/metadata/data-source/data-source.entity';
|
||||||
import { UserService } from 'src/core/user/services/user.service';
|
import { UserService } from 'src/core/user/services/user.service';
|
||||||
import { EmailService } from 'src/integrations/email/email.service';
|
import { EmailService } from 'src/integrations/email/email.service';
|
||||||
import CleanInactiveWorkspaceEmail from 'src/workspace/cron/clean-inactive-workspaces/clean-inactive-workspaces.email';
|
|
||||||
import { EnvironmentService } from 'src/integrations/environment/environment.service';
|
import { EnvironmentService } from 'src/integrations/environment/environment.service';
|
||||||
import {
|
import {
|
||||||
FeatureFlagEntity,
|
FeatureFlagEntity,
|
||||||
FeatureFlagKeys,
|
FeatureFlagKeys,
|
||||||
} from 'src/core/feature-flag/feature-flag.entity';
|
} from 'src/core/feature-flag/feature-flag.entity';
|
||||||
import { ObjectMetadataEntity } from 'src/metadata/object-metadata/object-metadata.entity';
|
import { ObjectMetadataEntity } from 'src/metadata/object-metadata/object-metadata.entity';
|
||||||
import DeleteInactiveWorkspaceEmail from 'src/workspace/cron/clean-inactive-workspaces/delete-inactive-workspaces.email';
|
|
||||||
import { computeObjectTargetTable } from 'src/workspace/utils/compute-object-target-table.util';
|
import { computeObjectTargetTable } from 'src/workspace/utils/compute-object-target-table.util';
|
||||||
|
|
||||||
const MILLISECONDS_IN_ONE_DAY = 1000 * 3600 * 24;
|
const MILLISECONDS_IN_ONE_DAY = 1000 * 3600 * 24;
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
"forceConsistentCasingInFileNames": false,
|
"forceConsistentCasingInFileNames": false,
|
||||||
"noFallthroughCasesInSwitch": false,
|
"noFallthroughCasesInSwitch": false,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"types": ["jest", "node"],
|
"types": ["jest", "node"]
|
||||||
"jsx": "react-jsx"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42367,6 +42367,12 @@ __metadata:
|
|||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
|
"twenty-emails@workspace:*, twenty-emails@workspace:packages/twenty-emails":
|
||||||
|
version: 0.0.0-use.local
|
||||||
|
resolution: "twenty-emails@workspace:packages/twenty-emails"
|
||||||
|
languageName: unknown
|
||||||
|
linkType: soft
|
||||||
|
|
||||||
"twenty-front@workspace:packages/twenty-front":
|
"twenty-front@workspace:packages/twenty-front":
|
||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "twenty-front@workspace:packages/twenty-front"
|
resolution: "twenty-front@workspace:packages/twenty-front"
|
||||||
@ -42381,6 +42387,7 @@ __metadata:
|
|||||||
"@nestjs/graphql": "patch:@nestjs/graphql@12.0.8#./patches/@nestjs+graphql+12.0.8.patch"
|
"@nestjs/graphql": "patch:@nestjs/graphql@12.0.8#./patches/@nestjs+graphql+12.0.8.patch"
|
||||||
"@ptc-org/nestjs-query-graphql": "patch:@ptc-org/nestjs-query-graphql@4.2.0#./patches/@ptc-org+nestjs-query-graphql+4.2.0.patch"
|
"@ptc-org/nestjs-query-graphql": "patch:@ptc-org/nestjs-query-graphql@4.2.0#./patches/@ptc-org+nestjs-query-graphql+4.2.0.patch"
|
||||||
class-validator: "patch:class-validator@^0.14.0#./patches/class-validator+0.14.0.patch"
|
class-validator: "patch:class-validator@^0.14.0#./patches/class-validator+0.14.0.patch"
|
||||||
|
twenty-emails: "workspace:*"
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user