Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat (packages): VS Code extension for previewing emails just like markdown #996

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
110f598
chore (packages): generate a sample version of the vs code extension
gabrielmfern Oct 25, 2023
0355f66
feat (vs-code-ext): basic implementation for the vs code preview exte…
gabrielmfern Oct 27, 2023
b873aa1
feat (vs-code-ext): files for the two current utility functions
gabrielmfern Oct 27, 2023
a0a057f
feat (vs-code-ext): default preview page to help new users
gabrielmfern Oct 27, 2023
c1c2529
feat (vs-code-ext): validation and a error screen for emails
gabrielmfern Oct 27, 2023
a5108cf
Merge branch 'main' into feat/vs-code-preview-ext
gabrielmfern Oct 27, 2023
b56914a
feat (vs-code-ext): show the stack of the exception and if its not de…
gabrielmfern Oct 27, 2023
03752e2
feat (vs-code-ext): ui for the 'no email open' and 'email with error'…
gabrielmfern Oct 27, 2023
e5cd988
feat (vs-code-ext): renderOpenEmailFile more maintainable
gabrielmfern Oct 27, 2023
3e4a7aa
feat (vs-code-ext): preview updates when any changes to the document …
gabrielmfern Oct 27, 2023
e49d7e0
feat (vs-code-ext): keybindings for the opening of the preview
gabrielmfern Oct 27, 2023
a58af10
feat (vs-code-ext): do not allow for more than one preview panels ope…
gabrielmfern Oct 27, 2023
f185cdf
feat (vs-code-ext): limit the renderOpenEmailFile function to only ru…
gabrielmfern Oct 27, 2023
efddc7f
feat (vs-code-ext): renderOpenEmailFile blocking
gabrielmfern Oct 27, 2023
4e41744
fix (vs-code-ext): update the preview on save
gabrielmfern Oct 27, 2023
a5dd8ff
chore (vs-code-ext): remove react from deps
gabrielmfern Oct 27, 2023
b2469c5
chore (vs-code-ext): format and update pnpm lock
gabrielmfern Oct 27, 2023
6c0a6e5
feat (vs-code): new description and new README
gabrielmfern Oct 27, 2023
50b1914
Merge branch 'main' into feat/vs-code-preview-ext
gabrielmfern Nov 1, 2023
a6b4669
chore (deps): update lock file
gabrielmfern Nov 3, 2023
ec5122b
fix (vs-code-ext): remove test script that was causing an error
gabrielmfern Nov 3, 2023
eee5dec
chore (vs-code-ext): move outside the monorepo due to problems with vsce
gabrielmfern Nov 4, 2023
fc88231
chore (vs-code-ext): align with vs code marketplace requirements
gabrielmfern Nov 4, 2023
813a367
fix (vs-code-ext): use require instead of import due to cjs esm problems
gabrielmfern Nov 4, 2023
436fdf8
feat (vs-code-ext): ignore most files with the .vscodeignore
gabrielmfern Nov 4, 2023
7e62057
fix (vs-code-ext): make it run after packaging
gabrielmfern Nov 4, 2023
508d207
fix (vs-code-ext): remove beta version since vscode doesn't support p…
gabrielmfern Nov 4, 2023
3e1c02d
Merge branch 'main' into feat/vs-code-preview-ext
gabrielmfern Nov 4, 2023
d826af7
chore: format
gabrielmfern Nov 4, 2023
f0557c2
fix (vs-code-ext): build preview files not being deleted for files th…
gabrielmfern Nov 4, 2023
abb36e8
feat(vs-code-ext): display name to "React Email" and fix interop issu…
gabrielmfern Nov 4, 2023
150212d
chore (vs-code-ext): format
gabrielmfern Nov 4, 2023
47dc53a
chore(deps): bump next from 14.2.3 to 15.0.4 (#1810)
dependabot[bot] Dec 9, 2024
646df24
chore(deps): bump next from 14.2.3 to 15.0.4 (#1810)
dependabot[bot] Dec 9, 2024
43896e0
Merge branch 'main' into feat/vs-code-preview-ext
gabrielmfern Nov 7, 2023
b0820b2
fix (vs-code-ext): buuild the emails with a ts config tailored to bui…
gabrielmfern Nov 13, 2023
b3b0a00
feat (vs-code-ext): build async and save the previews on the os's tem…
gabrielmfern Nov 13, 2023
b4802c1
chore: format
gabrielmfern Nov 13, 2023
830610b
chore(vs-code-ext): Upgrade esbuild
gabrielmfern Jan 27, 2024
709efad
feat(vs-code-ext): Use jsx: "automatic" instead of pre-defined tsconfig
gabrielmfern Jan 27, 2024
dcf84b3
chore(vs-code-ext): Rename file properly
gabrielmfern Jan 27, 2024
24365e6
chore(vs-code-ext): Upgrade @vscode/vsce to 2.23.0
gabrielmfern Jan 27, 2024
82759e3
feat(vs-code-ext): Use `vm` to render email previews instead of creat…
gabrielmfern Jan 27, 2024
f931949
chore(vs-code-ext): Add 0.0.3 to changelog
gabrielmfern Jan 27, 2024
8dad11d
chore(vs-code-ext): Bump to 0.0.4
gabrielmfern Jan 27, 2024
2821567
chore(vs-code-ext): Update lock
gabrielmfern Jan 27, 2024
c002eb6
chore(vs-code-ext): Format
gabrielmfern Jan 27, 2024
60663b3
fix(react-email): Linting problem
gabrielmfern Jan 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/react-email/src/utils/get-email-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const getEmailComponent = async (

if (m in staticNodeModulesForVM) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return staticNodeModulesForVM[m];
return staticNodeModulesForVM[m as keyof typeof staticNodeModulesForVM];
}

// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-useless-template-literals
Expand Down
24 changes: 24 additions & 0 deletions vs-code-extension/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/semi": "warn",
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off"
},
"ignorePatterns": [
"out",
"dist",
"**/*.d.ts"
]
}
2 changes: 2 additions & 0 deletions vs-code-extension/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# the packaged version of the vs code extension for publishing
react-email-preview-*.vsix
7 changes: 7 additions & 0 deletions vs-code-extension/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint"
]
}
34 changes: 34 additions & 0 deletions vs-code-extension/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/test/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
}
]
}
11 changes: 11 additions & 0 deletions vs-code-extension/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
}
20 changes: 20 additions & 0 deletions vs-code-extension/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
12 changes: 12 additions & 0 deletions vs-code-extension/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.vscode/**
.vscode-test/**
src/**
.gitignore
vsc-extension-quickstart.md
node_modules/
!node_modules/esbuild
!node_modules/@esbuild
**/tsconfig.json
**/.eslintrc.json
**/*.map
**/*.ts
37 changes: 37 additions & 0 deletions vs-code-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Change Log

All notable changes to the "react-email-preview" extension will be documented in this file.

## 0.0.4 - 2024-27-01

### Features

- Update building mechanism to not create temporary javascript files
- Upgrade esbuild to not need a `tsconfig`, meaning aliases and other things should now work properly

## 0.0.2 - 2023-11-04

### Features

- Update the display name to "React Email"

### Fixes

- OS issues with esbuild

## 0.0.1 - 2023-11-04

### Fixes

- Fixed build files not being deleted for files that are not email templates

## 0.0.0 - 2023-11-04

Released first version for testing.

### Features

- Command (`CTRL + SHIFT + E` or `CMD + SHIFT + E`) for opening split for preview
- Preview updates on file save
- When changing files the preview updates
- Multiple previews can't be open
7 changes: 7 additions & 0 deletions vs-code-extension/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2022 Bu Kinoshita and Zeno Rocha

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 changes: 37 additions & 0 deletions vs-code-extension/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
![React email cover](https://react.email/static/covers/react-email.png)

<div align="center"><strong>React Email Preview for VS Code</strong></div>
<div align="center">The next generation of writing emails.<br />High-quality, unstyled components for creating emails.</div>
<br />
<div align="center">
<a href="https://react.email">Website</a>
<span> · </span>
<a href="https://github.com/resendlabs/react-email">GitHub</a>
<span> · </span>
<a href="https://react.email/discord">Discord</a>
</div>

A easy way to have a preview of an email written with [react-email](https://github.com/resendlabs/react-email) from your editor.

## How to use?

To use it, you will need to run the command from the command pallete, or you will need
to use the keybinding that is by default `CTRL + SHIFT + E` (or `CMD + SHIFT + E` for Mac).

Once you run the command, a split will appear with a welcome message, once you focus a email
written with react-email, it will auto-detect and render it automatically for you showing a preview of
how it looks.

Something important is that the `vsce` doesn't play well with workspaces so the `package` script might break
when trying to run with the extension included in the monorepo.

## Found a bug?

If you have found a bug, even if small, please open a issue [here](https://github.com/resendlabs/react-email/issues).
We want for `react-email` to bring the best developer experience possible and your feedback is very welcome.

## What is react-email?

React Email is a collection of high-quality, unstyled components for creating beautiful emails using React and TypeScript. It reduces the pain of coding responsive emails with dark mode support. It also takes care of inconsistencies between Gmail, Outlook, and other email clients for you.

Find out more [here](https://react.email/).
Loading
Loading