Skip to content

Commit

Permalink
feat: new working structure with workspaces (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielmfern authored Dec 4, 2023
1 parent 6b02df4 commit d9e57db
Show file tree
Hide file tree
Showing 36 changed files with 13,630 additions and 6,113 deletions.
36 changes: 30 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
// This configuration only applies to the package manager root.
const { resolve } = require("node:path");

const project = resolve(process.cwd(), "tsconfig.json");

/** @type {import("eslint").Linter.Config} */
module.exports = {
ignorePatterns: ["apps/**", "packages/**"],
extends: ["@repo/eslint-config/library.js"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
extends: ["eslint:recommended", "prettier"],
plugins: ["only-warn"],
globals: {
React: true,
JSX: true,
},
env: {
node: true,
},
settings: {
"import/resolver": {
typescript: {
project,
},
},
},
ignorePatterns: [
// Ignore dotfiles
".*.js",
"node_modules/",
"dist/",
],
overrides: [
{
files: ["*.js?(x)", "*.ts?(x)"],
},
],
};
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ out/
build
dist


# Debug
npm-debug.log*
yarn-debug.log*
Expand Down
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# React Email with Turborepo + npm
# React Email + Turborepo + npm workspaces

This example shows how to use React Email with [Turborepo](https://turbo.build) + [npm](https://npmjs.com).
This example shows how to use React Email with [Turborepo](https://turbo.build) + [npm workspaces](https://docs.npmjs.com/cli/v10/using-npm/workspaces).

### Structure

This monorepo includes the following apps:

- `apps/next`: a [Next.js](https://nextjs.org) app
- `apps/react-email`: a [react.email](https://react.email) app
- `apps/web`: a [Next.js](https://nextjs.org) app
- `packages/transactional`: a package with [react.email](https://react.email) email templates

## Instructions

Expand All @@ -23,11 +23,11 @@ npm install
npm run dev
```

4. Open URLs in the browser:
3. Open URL in the browser:

* http://localhost:3000
* http://localhost:3001

## License

MIT License
MIT License
9 changes: 0 additions & 9 deletions apps/next/.eslintrc.js

This file was deleted.

28 changes: 0 additions & 28 deletions apps/next/README.md

This file was deleted.

5 changes: 0 additions & 5 deletions apps/next/app/page.tsx

This file was deleted.

27 changes: 0 additions & 27 deletions apps/react-email/readme.md

This file was deleted.

6 changes: 3 additions & 3 deletions packages/eslint-config/next.js → apps/web/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ module.exports = {
extends: [
"eslint:recommended",
"prettier",
require.resolve("@vercel/style-guide/eslint/next"),
"eslint-config-turbo",
require.resolve("@vercel/style-guide/eslint/next")
],
parser: '@typescript-eslint/parser',
globals: {
React: true,
JSX: true,
},
env: {
node: true,
},
plugins: ["only-warn"],
plugins: ["only-warn", "@typescript-eslint"],
settings: {
"import/resolver": {
typescript: {
Expand Down
17 changes: 17 additions & 0 deletions apps/web/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## NextJS Web app

A simple example NextJS app that imports the email template from the
[transactional](../../packages/transactional/readme.md) package and renders
it on the index page.

### Running app

If you want to run the app individually you can just run:

```sh
npm run dev
```

## License

MIT License
File renamed without changes.
11 changes: 11 additions & 0 deletions apps/web/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { render } from '@react-email/components';

import { VercelInviteUserEmail } from 'transactional/emails/vercel-invite-user';

export default function Page(): JSX.Element {
const emailHTML = render(VercelInviteUserEmail({ }));

return (
<div dangerouslySetInnerHTML={{ __html: emailHTML }} />
);
}
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions apps/next/package.json → apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
"lint": "eslint . --max-warnings 0"
},
"dependencies": {
"@react-email/components": "0.0.12",
"next": "^14.0.3",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"transactional": "^1.0.0"
},
"devDependencies": {
"@next/eslint-plugin-next": "^14.0.2",
"@repo/eslint-config": "*",
"@repo/typescript-config": "*",
"@types/eslint": "^8.44.7",
"@types/node": "^17.0.12",
"@types/react": "^18.0.22",
Expand Down
8 changes: 7 additions & 1 deletion apps/next/tsconfig.json → apps/web/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"extends": "@repo/typescript-config/nextjs.json",
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "Bundler",
"allowJs": true,
"jsx": "preserve",
"noEmit": true,
"plugins": [
{
"name": "next"
Expand Down
Loading

0 comments on commit d9e57db

Please sign in to comment.