mirror of
https://github.com/twentyhq/twenty.git
synced 2024-08-18 02:10:25 +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-svgr": "^4.2.0"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "yarn nx run twenty-emails:build"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.17.1",
|
||||
"npm": "please-use-yarn",
|
||||
@ -278,6 +281,7 @@
|
||||
"packages/twenty-front",
|
||||
"packages/twenty-docs",
|
||||
"packages/twenty-server",
|
||||
"packages/twenty-emails",
|
||||
"packages/twenty-utils",
|
||||
"packages/twenty-zapier",
|
||||
"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 { Container, Html } from '@react-email/components';
|
||||
|
||||
import { BaseHead } from 'src/emails/components/BaseHead';
|
||||
import { Logo } from 'src/emails/components/Logo';
|
||||
import { BaseHead } from 'src/components/BaseHead';
|
||||
import { Logo } from 'src/components/Logo';
|
||||
|
||||
export const BaseEmail = ({ children }) => {
|
||||
return (
|
@ -1,7 +1,6 @@
|
||||
import { Font, Head } from '@react-email/components';
|
||||
import * as React from 'react';
|
||||
|
||||
import { emailTheme } from 'src/emails/common-style';
|
||||
import { Font, Head } from '@react-email/components';
|
||||
import { emailTheme } from 'src/common-style';
|
||||
|
||||
export const BaseHead = () => {
|
||||
return (
|
@ -1,7 +1,6 @@
|
||||
import { Button } from '@react-email/button';
|
||||
import * as React from 'react';
|
||||
|
||||
import { emailTheme } from 'src/emails/common-style';
|
||||
import { Button } from '@react-email/button';
|
||||
import { emailTheme } from 'src/common-style';
|
||||
const callToActionStyle = {
|
||||
display: 'flex',
|
||||
padding: '8px 32px',
|
@ -1,9 +1,8 @@
|
||||
import * as React from 'react';
|
||||
import { Column } from '@react-email/components';
|
||||
import { Row } from '@react-email/row';
|
||||
import { Text } from '@react-email/text';
|
||||
import { Column } from '@react-email/components';
|
||||
|
||||
import { emailTheme } from 'src/emails/common-style';
|
||||
import { emailTheme } from 'src/common-style';
|
||||
|
||||
const rowStyle = {
|
||||
display: 'flex',
|
@ -1,7 +1,6 @@
|
||||
import { Text } from '@react-email/text';
|
||||
import * as React from 'react';
|
||||
|
||||
import { emailTheme } from 'src/emails/common-style';
|
||||
import { Text } from '@react-email/text';
|
||||
import { emailTheme } from 'src/common-style';
|
||||
|
||||
const mainTextStyle = {
|
||||
fontSize: emailTheme.font.size.md,
|
@ -1,10 +1,9 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import { HighlightedText } from 'src/emails/components/HighlightedText';
|
||||
import { MainText } from 'src/emails/components/MainText';
|
||||
import { Title } from 'src/emails/components/Title';
|
||||
import { BaseEmail } from 'src/emails/components/BaseEmail';
|
||||
import { CallToAction } from 'src/emails/components/CallToAction';
|
||||
import { BaseEmail } from 'src/components/BaseEmail';
|
||||
import { CallToAction } from 'src/components/CallToAction';
|
||||
import { HighlightedText } from 'src/components/HighlightedText';
|
||||
import { MainText } from 'src/components/MainText';
|
||||
import { Title } from 'src/components/Title';
|
||||
|
||||
type CleanInactiveWorkspaceEmailData = {
|
||||
daysLeft: number;
|
@ -1,10 +1,9 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import { HighlightedText } from 'src/emails/components/HighlightedText';
|
||||
import { MainText } from 'src/emails/components/MainText';
|
||||
import { Title } from 'src/emails/components/Title';
|
||||
import { BaseEmail } from 'src/emails/components/BaseEmail';
|
||||
import { CallToAction } from 'src/emails/components/CallToAction';
|
||||
import { BaseEmail } from 'src/components/BaseEmail';
|
||||
import { CallToAction } from 'src/components/CallToAction';
|
||||
import { HighlightedText } from 'src/components/HighlightedText';
|
||||
import { MainText } from 'src/components/MainText';
|
||||
import { Title } from 'src/components/Title';
|
||||
|
||||
type DeleteInactiveWorkspaceEmailData = {
|
||||
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",
|
||||
"@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",
|
||||
"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": {
|
||||
"node": "^18.17.1",
|
||||
|
@ -3,6 +3,10 @@ import { InjectRepository } from '@nestjs/typeorm';
|
||||
|
||||
import { render } from '@react-email/render';
|
||||
import { Repository } from 'typeorm';
|
||||
import {
|
||||
CleanInactiveWorkspaceEmail,
|
||||
DeleteInactiveWorkspaceEmail,
|
||||
} from 'twenty-emails';
|
||||
|
||||
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 { UserService } from 'src/core/user/services/user.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 {
|
||||
FeatureFlagEntity,
|
||||
FeatureFlagKeys,
|
||||
} from 'src/core/feature-flag/feature-flag.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';
|
||||
|
||||
const MILLISECONDS_IN_ONE_DAY = 1000 * 3600 * 24;
|
||||
|
@ -22,7 +22,6 @@
|
||||
"forceConsistentCasingInFileNames": false,
|
||||
"noFallthroughCasesInSwitch": false,
|
||||
"resolveJsonModule": true,
|
||||
"types": ["jest", "node"],
|
||||
"jsx": "react-jsx"
|
||||
"types": ["jest", "node"]
|
||||
}
|
||||
}
|
||||
|
@ -42367,6 +42367,12 @@ __metadata:
|
||||
languageName: unknown
|
||||
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":
|
||||
version: 0.0.0-use.local
|
||||
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"
|
||||
"@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"
|
||||
twenty-emails: "workspace:*"
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user