♻️ Switch to app router (#922)

This commit is contained in:
Luke Vella 2023-11-06 09:15:49 +00:00 committed by GitHub
parent 41f85279bb
commit 95feb9f01a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
181 changed files with 2507 additions and 2494 deletions

View file

@ -0,0 +1,4 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
...require("@rallly/eslint-config")(__dirname),
};

View file

@ -1 +1,2 @@
export * from "./send-email";
export type { SupportedEmailProviders } from "./send-email";
export { EmailClient } from "./send-email";

View file

@ -77,11 +77,6 @@ export class EmailClient {
templateName: T,
options: SendEmailOptions<T>,
) {
if (!process.env.SUPPORT_EMAIL) {
console.info("SUPPORT_EMAIL not configured - skipping email send");
return;
}
const Template = templates[templateName] as TemplateComponent<T>;
const html = render(
<EmailContext.Provider value={this.config.context}>
@ -113,6 +108,11 @@ export class EmailClient {
});
}
if (!process.env["SUPPORT_EMAIL"]) {
console.info(" SUPPORT_EMAIL not configured - skipping email send");
return;
}
try {
await this.transport.sendMail(options);
return;
@ -137,7 +137,7 @@ export class EmailClient {
switch (this.config.provider.name) {
case "ses": {
const ses = new aws.SES({
region: process.env["AWS" + "_REGION"],
region: process.env["AWS" + "_REGION"] as string,
credentialDefaultProvider: defaultProvider,
});
@ -151,21 +151,21 @@ export class EmailClient {
break;
}
case "smtp": {
const hasAuth = process.env.SMTP_USER || process.env.SMTP_PWD;
const hasAuth = process.env["SMTP_USER"] || process.env["SMTP_PWD"];
this.cachedTransport = createTransport({
host: process.env.SMTP_HOST,
port: process.env.SMTP_PORT
? parseInt(process.env.SMTP_PORT)
host: process.env["SMTP_HOST"],
port: process.env["SMTP_PORT"]
? parseInt(process.env["SMTP_PORT"])
: undefined,
secure: process.env.SMTP_SECURE === "true",
secure: process.env["SMTP_SECURE"] === "true",
auth: hasAuth
? {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PWD,
user: process.env["SMTP_USER"],
pass: process.env["SMTP_PWD"],
}
: undefined,
tls:
process.env.SMTP_TLS_ENABLED === "true"
process.env["SMTP_TLS_ENABLED"] === "true"
? {
ciphers: "SSLv3",
rejectUnauthorized: false,

View file

@ -90,7 +90,7 @@ export const EmailLayout = ({
<span>&nbsp;&bull;&nbsp;</span>
<Link
style={linkStyles}
href={`mailto:${process.env.SUPPORT_EMAIL}`}
href={`mailto:${process.env["SUPPORT_EMAIL"]}`}
>
Contact
</Link>

View file

@ -1,5 +1,5 @@
{
"extends": "@rallly/tsconfig/react-library.json",
"include": ["**/*.ts", "**/*.tsx"],
"extends": "@rallly/tsconfig/react.json",
"include": ["**/*.ts", "**/*.tsx", "**/*.js"],
"exclude": ["node_modules", ".react-email"]
}