chore: set up twenty-emails config so build isn't needed in development (#3619)
* chore: set up twenty-emails config so build isn't needed in development * fix: fix script dependency * chore: use @vitejs/plugin-react-swc * Remove useless dependancy * Fix typing * chore: use baseUrl in twenty-emails * chore: fix docker server prod build * refactor: optimize Docker file and tsconfig * fix: fix WORKDIR in docker --------- Co-authored-by: martmull <martmull@hotmail.fr>
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -18,4 +18,3 @@
|
|||||||
!.yarn/versions
|
!.yarn/versions
|
||||||
coverage
|
coverage
|
||||||
.vercel
|
.vercel
|
||||||
**/yarn.lock
|
|
||||||
45
nx.json
45
nx.json
@ -2,20 +2,38 @@
|
|||||||
"targetDefaults": {
|
"targetDefaults": {
|
||||||
"build": {
|
"build": {
|
||||||
"cache": true,
|
"cache": true,
|
||||||
"dependsOn": ["^build"]
|
"dependsOn": [
|
||||||
|
"^build"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"cache": true,
|
||||||
|
"dependsOn": [
|
||||||
|
"^build"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"lint": {
|
"lint": {
|
||||||
"cache": true
|
"cache": true
|
||||||
},
|
},
|
||||||
"test": {
|
"test": {
|
||||||
"cache": true
|
"cache": true,
|
||||||
|
"dependsOn": [
|
||||||
|
"^build"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"e2e": {
|
"test:e2e": {
|
||||||
"cache": true
|
"cache": true,
|
||||||
|
"dependsOn": [
|
||||||
|
"^build"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"@nx/jest:jest": {
|
"@nx/jest:jest": {
|
||||||
"cache": true,
|
"cache": true,
|
||||||
"inputs": ["default", "^default", "{workspaceRoot}/jest.preset.js"],
|
"inputs": [
|
||||||
|
"default",
|
||||||
|
"^default",
|
||||||
|
"{workspaceRoot}/jest.preset.js"
|
||||||
|
],
|
||||||
"options": {
|
"options": {
|
||||||
"passWithNoTests": true
|
"passWithNoTests": true
|
||||||
},
|
},
|
||||||
@ -25,6 +43,13 @@
|
|||||||
"codeCoverage": true
|
"codeCoverage": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"@nx/vite:test": {
|
||||||
|
"cache": true,
|
||||||
|
"inputs": [
|
||||||
|
"default",
|
||||||
|
"^default"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"installation": {
|
"installation": {
|
||||||
@ -32,5 +57,15 @@
|
|||||||
},
|
},
|
||||||
"affected": {
|
"affected": {
|
||||||
"defaultBase": "main"
|
"defaultBase": "main"
|
||||||
|
},
|
||||||
|
"generators": {
|
||||||
|
"@nx/react": {
|
||||||
|
"application": {
|
||||||
|
"babel": true
|
||||||
|
},
|
||||||
|
"library": {
|
||||||
|
"unitTestRunner": "none"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
10
package.json
10
package.json
@ -155,6 +155,8 @@
|
|||||||
"zod": "^3.22.2"
|
"zod": "^3.22.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@babel/core": "^7.14.5",
|
||||||
|
"@babel/preset-react": "^7.14.5",
|
||||||
"@docusaurus/module-type-aliases": "^3.0.0",
|
"@docusaurus/module-type-aliases": "^3.0.0",
|
||||||
"@docusaurus/tsconfig": "3.0.0",
|
"@docusaurus/tsconfig": "3.0.0",
|
||||||
"@graphql-codegen/cli": "^3.3.1",
|
"@graphql-codegen/cli": "^3.3.1",
|
||||||
@ -168,7 +170,9 @@
|
|||||||
"@nx/eslint": "17.2.7",
|
"@nx/eslint": "17.2.7",
|
||||||
"@nx/eslint-plugin": "17.2.7",
|
"@nx/eslint-plugin": "17.2.7",
|
||||||
"@nx/jest": "17.2.7",
|
"@nx/jest": "17.2.7",
|
||||||
"@nx/js": "17.2.7",
|
"@nx/js": "17.2.8",
|
||||||
|
"@nx/react": "^17.2.8",
|
||||||
|
"@nx/vite": "17.2.8",
|
||||||
"@storybook/addon-actions": "^7.6.3",
|
"@storybook/addon-actions": "^7.6.3",
|
||||||
"@storybook/addon-coverage": "^1.0.0",
|
"@storybook/addon-coverage": "^1.0.0",
|
||||||
"@storybook/addon-essentials": "^7.6.7",
|
"@storybook/addon-essentials": "^7.6.7",
|
||||||
@ -185,7 +189,7 @@
|
|||||||
"@swc-node/register": "~1.6.7",
|
"@swc-node/register": "~1.6.7",
|
||||||
"@swc/core": "~1.3.100",
|
"@swc/core": "~1.3.100",
|
||||||
"@testing-library/jest-dom": "^6.1.5",
|
"@testing-library/jest-dom": "^6.1.5",
|
||||||
"@testing-library/react": "^13.4.0",
|
"@testing-library/react": "14.0.0",
|
||||||
"@types/apollo-upload-client": "^17.0.2",
|
"@types/apollo-upload-client": "^17.0.2",
|
||||||
"@types/bcrypt": "^5.0.0",
|
"@types/bcrypt": "^5.0.0",
|
||||||
"@types/better-sqlite3": "^7.6.8",
|
"@types/better-sqlite3": "^7.6.8",
|
||||||
@ -241,6 +245,7 @@
|
|||||||
"jest": "29.7.0",
|
"jest": "29.7.0",
|
||||||
"jest-environment-jsdom": "29.7.0",
|
"jest-environment-jsdom": "29.7.0",
|
||||||
"jest-fetch-mock": "^3.0.3",
|
"jest-fetch-mock": "^3.0.3",
|
||||||
|
"jsdom": "~22.1.0",
|
||||||
"msw": "^2.0.11",
|
"msw": "^2.0.11",
|
||||||
"msw-storybook-addon": "2.0.0--canary.122.b3ed3b1.0",
|
"msw-storybook-addon": "2.0.0--canary.122.b3ed3b1.0",
|
||||||
"nx": "^17.2.8",
|
"nx": "^17.2.8",
|
||||||
@ -259,6 +264,7 @@
|
|||||||
"typescript": "^5.3.3",
|
"typescript": "^5.3.3",
|
||||||
"vite": "^5.0.0",
|
"vite": "^5.0.0",
|
||||||
"vite-plugin-checker": "^0.6.2",
|
"vite-plugin-checker": "^0.6.2",
|
||||||
|
"vite-plugin-dts": "~2.3.0",
|
||||||
"vite-plugin-svgr": "^4.2.0"
|
"vite-plugin-svgr": "^4.2.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
@ -5,20 +5,15 @@ WORKDIR /app
|
|||||||
COPY ./package.json .
|
COPY ./package.json .
|
||||||
COPY ./yarn.lock .
|
COPY ./yarn.lock .
|
||||||
COPY ./.yarnrc.yml .
|
COPY ./.yarnrc.yml .
|
||||||
|
COPY ./tsconfig.base.json .
|
||||||
|
COPY ./nx.json .
|
||||||
COPY ./.yarn/releases /app/.yarn/releases
|
COPY ./.yarn/releases /app/.yarn/releases
|
||||||
COPY ./tools/eslint-rules /app/tools/eslint-rules
|
|
||||||
COPY ./packages/twenty-server/package.json /app/packages/twenty-server/package.json
|
|
||||||
COPY ./packages/twenty-server/patches /app/packages/twenty-server/patches
|
|
||||||
COPY ./packages/twenty-emails /app/packages/twenty-emails
|
COPY ./packages/twenty-emails /app/packages/twenty-emails
|
||||||
|
COPY ./packages/twenty-server /app/packages/twenty-server
|
||||||
WORKDIR /app/packages/twenty-emails
|
RUN yarn workspaces focus twenty-emails twenty-server
|
||||||
RUN yarn workspaces focus
|
RUN npx nx run twenty-server:build
|
||||||
RUN yarn build
|
|
||||||
|
|
||||||
WORKDIR /app/packages/twenty-server
|
WORKDIR /app/packages/twenty-server
|
||||||
COPY ./packages/twenty-server /app/packages/twenty-server
|
|
||||||
RUN yarn workspaces focus
|
|
||||||
RUN yarn build
|
|
||||||
|
|
||||||
LABEL org.opencontainers.image.source=https://github.com/twentyhq/twenty
|
LABEL org.opencontainers.image.source=https://github.com/twentyhq/twenty
|
||||||
LABEL org.opencontainers.image.description="This image provides a consistent and reproducible environment for the backend, ensuring it deploys faster and runs the same way regardless of the deployment environment."
|
LABEL org.opencontainers.image.description="This image provides a consistent and reproducible environment for the backend, ensuring it deploys faster and runs the same way regardless of the deployment environment."
|
||||||
|
|||||||
12
packages/twenty-emails/.babelrc
Normal file
12
packages/twenty-emails/.babelrc
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"presets": [
|
||||||
|
[
|
||||||
|
"@nx/react/babel",
|
||||||
|
{
|
||||||
|
"runtime": "automatic",
|
||||||
|
"useBuiltIns": "usage"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"plugins": []
|
||||||
|
}
|
||||||
18
packages/twenty-emails/.eslintrc.json
Normal file
18
packages/twenty-emails/.eslintrc.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"extends": ["../../.eslintrc.js"],
|
||||||
|
"ignorePatterns": ["!**/*"],
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
||||||
|
"rules": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": ["*.ts", "*.tsx"],
|
||||||
|
"rules": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": ["*.js", "*.jsx"],
|
||||||
|
"rules": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -8,18 +8,32 @@
|
|||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"nx": "NX_DEFAULT_PROJECT=twenty-emails node ../../node_modules/nx/bin/nx.js",
|
"nx": "NX_DEFAULT_PROJECT=twenty-emails node ../../node_modules/nx/bin/nx.js",
|
||||||
"build": "tsup"
|
"build": "vite build",
|
||||||
|
"lint": "eslint"
|
||||||
|
},
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"import": "./dist/index.mjs",
|
||||||
|
"require": "./dist/index.js"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@nx/vite": "17.2.8",
|
||||||
|
"@vitejs/plugin-react-swc": "^3.5.0",
|
||||||
|
"vite": "^5.0.0",
|
||||||
|
"vite-plugin-dts": "~2.3.0",
|
||||||
|
"vite-tsconfig-paths": "^4.2.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
"@react-email/components": "0.0.12",
|
"@react-email/components": "0.0.12",
|
||||||
"@types/react": "^18.2.39",
|
"date-fns": "^2.30.0"
|
||||||
"date-fns": "^2.30.0",
|
|
||||||
"tsup": "^8.0.1",
|
|
||||||
"typescript": "^5.3.3"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^18.17.1",
|
"node": "^18.17.1",
|
||||||
"npm": "please-use-yarn",
|
"npm": "please-use-yarn",
|
||||||
"yarn": "^4.0.2"
|
"yarn": "^4.0.2"
|
||||||
|
},
|
||||||
|
"nx": {
|
||||||
|
"projectType": "library"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,13 +1,17 @@
|
|||||||
import * as React from 'react';
|
import { PropsWithChildren } 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/components/BaseHead';
|
||||||
import { Logo } from 'src/components/Logo';
|
import { Logo } from 'src/components/Logo';
|
||||||
|
|
||||||
export const BaseEmail = ({ children, width = 290 }) => {
|
type BaseEmailProps = PropsWithChildren<{
|
||||||
|
width?: number;
|
||||||
|
}>;
|
||||||
|
|
||||||
|
export const BaseEmail = ({ children, width }: BaseEmailProps) => {
|
||||||
return (
|
return (
|
||||||
<Html lang="en">
|
<Html lang="en">
|
||||||
<BaseHead />
|
<BaseHead />
|
||||||
<Container width={width}>
|
<Container width={width || 290}>
|
||||||
<Logo />
|
<Logo />
|
||||||
{children}
|
{children}
|
||||||
</Container>
|
</Container>
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import * as React from 'react';
|
|
||||||
import { Font, Head } from '@react-email/components';
|
import { Font, Head } from '@react-email/components';
|
||||||
import { emailTheme } from 'src/common-style';
|
import { emailTheme } from 'src/common-style';
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import * as React from 'react';
|
import { ReactNode } from 'react';
|
||||||
import { Button } from '@react-email/button';
|
import { Button } from '@react-email/button';
|
||||||
import { emailTheme } from 'src/common-style';
|
import { emailTheme } from 'src/common-style';
|
||||||
|
|
||||||
const callToActionStyle = {
|
const callToActionStyle = {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
padding: '8px 32px',
|
padding: '8px 32px',
|
||||||
@ -13,7 +14,12 @@ const callToActionStyle = {
|
|||||||
fontWeight: emailTheme.font.weight.bold,
|
fontWeight: emailTheme.font.weight.bold,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CallToAction = ({ value, href }) => {
|
type CallToActionProps = {
|
||||||
|
href: string;
|
||||||
|
value: ReactNode;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const CallToAction = ({ value, href }: CallToActionProps) => {
|
||||||
return (
|
return (
|
||||||
<Button href={href} style={callToActionStyle}>
|
<Button href={href} style={callToActionStyle}>
|
||||||
{value}
|
{value}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import * as React from 'react';
|
import { ReactNode } from 'react';
|
||||||
import { Column } from '@react-email/components';
|
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';
|
||||||
@ -18,7 +18,11 @@ const highlightedStyle = {
|
|||||||
color: emailTheme.font.colors.highlighted,
|
color: emailTheme.font.colors.highlighted,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const HighlightedText = ({ value }) => {
|
type HighlightedTextProps = {
|
||||||
|
value: ReactNode;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const HighlightedText = ({ value }: HighlightedTextProps) => {
|
||||||
return (
|
return (
|
||||||
<Row style={rowStyle}>
|
<Row style={rowStyle}>
|
||||||
<Column>
|
<Column>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import * as React from 'react';
|
import { ReactNode } from 'react';
|
||||||
import { Link as EmailLink } from '@react-email/components';
|
import { Link as EmailLink } from '@react-email/components';
|
||||||
import { emailTheme } from 'src/common-style';
|
import { emailTheme } from 'src/common-style';
|
||||||
|
|
||||||
@ -7,7 +7,12 @@ const linkStyle = {
|
|||||||
textDecoration: 'underline',
|
textDecoration: 'underline',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Link = ({ value, href }) => {
|
type LinkProps = {
|
||||||
|
value: ReactNode;
|
||||||
|
href: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const Link = ({ value, href }: LinkProps) => {
|
||||||
return (
|
return (
|
||||||
<EmailLink href={href} style={linkStyle}>
|
<EmailLink href={href} style={linkStyle}>
|
||||||
{value}
|
{value}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import * as React from 'react';
|
import { PropsWithChildren } from 'react';
|
||||||
import { Text } from '@react-email/text';
|
import { Text } from '@react-email/text';
|
||||||
import { emailTheme } from 'src/common-style';
|
import { emailTheme } from 'src/common-style';
|
||||||
|
|
||||||
@ -8,6 +8,6 @@ const mainTextStyle = {
|
|||||||
color: emailTheme.font.colors.primary,
|
color: emailTheme.font.colors.primary,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MainText = ({ children }) => {
|
export const MainText = ({ children }: PropsWithChildren) => {
|
||||||
return <Text style={mainTextStyle}>{children}</Text>;
|
return <Text style={mainTextStyle}>{children}</Text>;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,6 +1,10 @@
|
|||||||
|
import { ReactNode } from 'react';
|
||||||
import { Heading } from '@react-email/components';
|
import { Heading } from '@react-email/components';
|
||||||
import * as React from 'react';
|
|
||||||
|
|
||||||
export const Title = ({ value }) => {
|
type TitleProps = {
|
||||||
|
value: ReactNode;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const Title = ({ value }: TitleProps) => {
|
||||||
return <Heading as="h1">{value}</Heading>;
|
return <Heading as="h1">{value}</Heading>;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import * as React from 'react';
|
|
||||||
import { BaseEmail } from 'src/components/BaseEmail';
|
import { BaseEmail } from 'src/components/BaseEmail';
|
||||||
import { CallToAction } from 'src/components/CallToAction';
|
import { CallToAction } from 'src/components/CallToAction';
|
||||||
import { HighlightedText } from 'src/components/HighlightedText';
|
import { HighlightedText } from 'src/components/HighlightedText';
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import * as React from 'react';
|
|
||||||
import { Column, Row, Section } from '@react-email/components';
|
import { Column, Row, Section } from '@react-email/components';
|
||||||
import { BaseEmail } from 'src/components/BaseEmail';
|
import { BaseEmail } from 'src/components/BaseEmail';
|
||||||
import { MainText } from 'src/components/MainText';
|
import { MainText } from 'src/components/MainText';
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import * as React from 'react';
|
|
||||||
import { BaseEmail } from 'src/components/BaseEmail';
|
import { BaseEmail } from 'src/components/BaseEmail';
|
||||||
import { CallToAction } from 'src/components/CallToAction';
|
import { CallToAction } from 'src/components/CallToAction';
|
||||||
import { Link } from 'src/components/Link';
|
import { Link } from 'src/components/Link';
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import * as React from 'react';
|
|
||||||
import { format } from 'date-fns';
|
import { format } from 'date-fns';
|
||||||
import { BaseEmail } from 'src/components/BaseEmail';
|
import { BaseEmail } from 'src/components/BaseEmail';
|
||||||
import { CallToAction } from 'src/components/CallToAction';
|
import { CallToAction } from 'src/components/CallToAction';
|
||||||
|
|||||||
4
packages/twenty-emails/src/index.ts
Normal file
4
packages/twenty-emails/src/index.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export * from './emails/clean-inactive-workspaces.email';
|
||||||
|
export * from './emails/delete-inactive-workspaces.email';
|
||||||
|
export * from './emails/password-reset-link.email';
|
||||||
|
export * from './emails/password-update-notify.email';
|
||||||
@ -1,7 +1,19 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "commonjs",
|
"jsx": "react-jsx",
|
||||||
"baseUrl": "./",
|
"allowJs": false,
|
||||||
"jsx": "react-jsx"
|
"esModuleInterop": false,
|
||||||
}
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"strict": true,
|
||||||
|
"types": ["vite/client"],
|
||||||
|
"baseUrl": "."
|
||||||
|
},
|
||||||
|
"files": [],
|
||||||
|
"include": [],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.lib.json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extends": "../../tsconfig.base.json"
|
||||||
}
|
}
|
||||||
|
|||||||
22
packages/twenty-emails/tsconfig.lib.json
Normal file
22
packages/twenty-emails/tsconfig.lib.json
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../../dist/out-tsc",
|
||||||
|
"types": [
|
||||||
|
"node",
|
||||||
|
"@nx/react/typings/image.d.ts",
|
||||||
|
"vite/client"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"**/*.spec.ts",
|
||||||
|
"**/*.test.ts",
|
||||||
|
"**/*.spec.tsx",
|
||||||
|
"**/*.test.tsx",
|
||||||
|
"**/*.spec.js",
|
||||||
|
"**/*.test.js",
|
||||||
|
"**/*.spec.jsx",
|
||||||
|
"**/*.test.jsx"
|
||||||
|
],
|
||||||
|
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
||||||
|
}
|
||||||
@ -1,9 +0,0 @@
|
|||||||
import { defineConfig } from 'tsup';
|
|
||||||
|
|
||||||
export default defineConfig([
|
|
||||||
{
|
|
||||||
entry: { index: './tsup.index.tsx' },
|
|
||||||
format: ['cjs', 'esm'],
|
|
||||||
dts: true,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
export * from './src/emails/clean-inactive-workspaces.email';
|
|
||||||
export * from './src/emails/delete-inactive-workspaces.email';
|
|
||||||
export * from './src/emails/password-reset-link.email';
|
|
||||||
export * from './src/emails/password-update-notify.email';
|
|
||||||
43
packages/twenty-emails/vite.config.ts
Normal file
43
packages/twenty-emails/vite.config.ts
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
import react from '@vitejs/plugin-react-swc';
|
||||||
|
import * as path from 'path';
|
||||||
|
import { defineConfig } from 'vite';
|
||||||
|
import dts from 'vite-plugin-dts';
|
||||||
|
import tsconfigPaths from 'vite-tsconfig-paths';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
root: __dirname,
|
||||||
|
cacheDir: '../../node_modules/.vite/packages/twenty-emails',
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
react(),
|
||||||
|
tsconfigPaths(),
|
||||||
|
dts({
|
||||||
|
entryRoot: 'src',
|
||||||
|
tsConfigFilePath: path.join(__dirname, 'tsconfig.lib.json'),
|
||||||
|
skipDiagnostics: true,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
|
||||||
|
// Configuration for building your library.
|
||||||
|
// See: https://vitejs.dev/guide/build.html#library-mode
|
||||||
|
build: {
|
||||||
|
outDir: './dist',
|
||||||
|
reportCompressedSize: true,
|
||||||
|
commonjsOptions: {
|
||||||
|
transformMixedEsModules: true,
|
||||||
|
},
|
||||||
|
lib: {
|
||||||
|
// Could also be a dictionary or array of multiple entry points.
|
||||||
|
entry: 'src/index.ts',
|
||||||
|
name: 'twenty-emails',
|
||||||
|
fileName: 'index',
|
||||||
|
// Change this to the formats you want to support.
|
||||||
|
// Don't forget to update your package.json as well.
|
||||||
|
formats: ['es', 'cjs'],
|
||||||
|
},
|
||||||
|
rollupOptions: {
|
||||||
|
// External packages that should not be bundled into your library.
|
||||||
|
external: ['react', 'react-dom', 'react/jsx-runtime'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
@ -8,19 +8,18 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"nx": "NX_DEFAULT_PROJECT=twenty-server node ../../node_modules/nx/bin/nx.js",
|
"nx": "NX_DEFAULT_PROJECT=twenty-server node ../../node_modules/nx/bin/nx.js",
|
||||||
"prebuild": "rimraf dist",
|
"prebuild": "rimraf dist",
|
||||||
"build": "yarn prebuild && nest build",
|
"build": "yarn prebuild && nest build --path ./tsconfig.build.json",
|
||||||
"build-twenty-emails": "yarn nx run twenty-emails:build",
|
|
||||||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||||
"start": "set NODE_ENV=development && yarn build-twenty-emails && nest start",
|
"start": "NODE_ENV=development && nest start",
|
||||||
"start:dev": "yarn build-twenty-emails && nest start --watch",
|
"start:dev": "npx nx start --watch",
|
||||||
"start:debug": "yarn build-twenty-emails && nest start --debug --watch",
|
"start:debug": "npx nx start:dev --debug",
|
||||||
"start:prod": "node dist/src/main",
|
"start:prod": "node dist/src/main",
|
||||||
"lint": "eslint \"src/**/*.ts\" --fix",
|
"lint": "eslint \"src/**/*.ts\" --fix",
|
||||||
"test": "yarn build-twenty-emails && jest",
|
"test": "jest",
|
||||||
"test:watch": "yarn build-twenty-emails && jest --watch",
|
"test:watch": "npx nx test --watch",
|
||||||
"test:cov": "yarn build-twenty-emails && jest --coverage",
|
"test:cov": "npx nx test --coverage",
|
||||||
"test:debug": "yarn build-twenty-emails && node --inspect-brk -r tsconfig-paths/register -r ts-node/register ../../node_modules/.bin/jest --runInBand",
|
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register ../../node_modules/.bin/jest --runInBand",
|
||||||
"test:e2e": "yarn build-twenty-emails && ./scripts/run-integration.sh",
|
"test:e2e": "./scripts/run-integration.sh",
|
||||||
"typeorm": "npx ts-node -r tsconfig-paths/register ../../node_modules/typeorm/cli.js",
|
"typeorm": "npx ts-node -r tsconfig-paths/register ../../node_modules/typeorm/cli.js",
|
||||||
"typeorm:migrate": "yarn typeorm migration:run -d ./src/database/typeorm/metadata/metadata.datasource.ts && yarn typeorm migration:run -d ./src/database/typeorm/core/core.datasource.ts",
|
"typeorm:migrate": "yarn typeorm migration:run -d ./src/database/typeorm/metadata/metadata.datasource.ts && yarn typeorm migration:run -d ./src/database/typeorm/core/core.datasource.ts",
|
||||||
"database:init": "yarn database:setup && yarn database:seed:dev",
|
"database:init": "yarn database:setup && yarn database:seed:dev",
|
||||||
@ -96,7 +95,6 @@
|
|||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"sharp": "^0.32.1",
|
"sharp": "^0.32.1",
|
||||||
"twenty-emails": "workspace:*",
|
|
||||||
"type-fest": "^4.1.0",
|
"type-fest": "^4.1.0",
|
||||||
"typeorm": "^0.3.17"
|
"typeorm": "^0.3.17"
|
||||||
},
|
},
|
||||||
@ -112,5 +110,14 @@
|
|||||||
"node": "^18.17.1",
|
"node": "^18.17.1",
|
||||||
"npm": "please-use-yarn",
|
"npm": "please-use-yarn",
|
||||||
"yarn": "^4.0.2"
|
"yarn": "^4.0.2"
|
||||||
|
},
|
||||||
|
"nx": {
|
||||||
|
"targets": {
|
||||||
|
"test:debug": {
|
||||||
|
"dependsOn": [
|
||||||
|
"^build"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,11 @@
|
|||||||
{
|
{
|
||||||
"extends": "./tsconfig.json",
|
"extends": "./tsconfig.json",
|
||||||
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
|
"compilerOptions": {
|
||||||
|
"rootDir": ".",
|
||||||
|
"paths": {
|
||||||
|
"src/*": ["packages/twenty-server/src/*"]
|
||||||
|
},
|
||||||
|
"types": ["node"]
|
||||||
|
},
|
||||||
|
"exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
{
|
{
|
||||||
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"jsx": "react-jsx",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"removeComments": true,
|
"removeComments": true,
|
||||||
@ -11,8 +13,6 @@
|
|||||||
"target": "es2017",
|
"target": "es2017",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"rootDir": "./",
|
|
||||||
"baseUrl": "./",
|
|
||||||
"incremental": true,
|
"incremental": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"strictNullChecks": true,
|
"strictNullChecks": true,
|
||||||
@ -22,6 +22,10 @@
|
|||||||
"forceConsistentCasingInFileNames": false,
|
"forceConsistentCasingInFileNames": false,
|
||||||
"noFallthroughCasesInSwitch": false,
|
"noFallthroughCasesInSwitch": false,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"types": ["jest", "node"]
|
"types": ["jest", "node"],
|
||||||
|
"paths": {
|
||||||
|
"src/*": ["packages/twenty-server/src/*"],
|
||||||
|
"twenty-emails": ["packages/twenty-emails/src/index.ts"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,9 @@
|
|||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"skipDefaultLibCheck": true,
|
"skipDefaultLibCheck": true,
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {}
|
"paths": {
|
||||||
|
"twenty-emails": ["packages/twenty-emails/src/index.ts"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "tmp"]
|
"exclude": ["node_modules", "tmp"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user