react-email 5.0.0-canary.7 → 5.0.0-canary.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.js +23 -13
- package/package.json +1 -1
- package/src/commands/resend/reset.ts +8 -0
- package/src/commands/resend/setup.ts +29 -0
- package/src/index.ts +10 -4
- package/src/commands/resend-setup.ts +0 -22
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -87,7 +87,7 @@ const getEmailsDirectoryMetadata = async (absolutePathToEmailsDirectory, keepFil
|
|
|
87
87
|
//#region package.json
|
|
88
88
|
var package_default = {
|
|
89
89
|
name: "react-email",
|
|
90
|
-
version: "5.0.0-canary.
|
|
90
|
+
version: "5.0.0-canary.8",
|
|
91
91
|
description: "A live preview of your emails right in your browser.",
|
|
92
92
|
bin: { "email": "./dist/index.js" },
|
|
93
93
|
type: "module",
|
|
@@ -967,19 +967,27 @@ const exportTemplates = async (pathToWhereEmailMarkupShouldBeDumped, emailsDirec
|
|
|
967
967
|
};
|
|
968
968
|
|
|
969
969
|
//#endregion
|
|
970
|
-
//#region src/commands/resend
|
|
971
|
-
async function
|
|
970
|
+
//#region src/commands/resend/reset.ts
|
|
971
|
+
async function resendReset() {
|
|
972
|
+
conf.delete("resendApiKey");
|
|
973
|
+
console.info(`${logSymbols.success} Resend API Key successfully deleted`);
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
//#endregion
|
|
977
|
+
//#region src/commands/resend/setup.ts
|
|
978
|
+
async function resendSetup() {
|
|
972
979
|
const previousValue = conf.get("resendApiKey");
|
|
973
|
-
if (typeof previousValue === "string" && previousValue.length > 0) {
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
+
if (typeof previousValue === "string" && previousValue.length > 0) console.info(`You already have a Resend API Key configured (${styleText("grey", previousValue.slice(0, 11))}...), continuing will replace it.`);
|
|
981
|
+
const { apiKey } = await prompts({
|
|
982
|
+
type: "password",
|
|
983
|
+
name: "apiKey",
|
|
984
|
+
message: "Enter your API Key (make sure it has \"Full Access\")"
|
|
985
|
+
});
|
|
986
|
+
if (apiKey?.trim().length > 0) {
|
|
987
|
+
conf.set("resendApiKey", apiKey);
|
|
988
|
+
console.info(`${logSymbols.success} Resend integration successfully set up`);
|
|
989
|
+
console.info(`You can always remove it with ${styleText("green", "npx react-email@latest resend reset")}`);
|
|
980
990
|
}
|
|
981
|
-
conf.set("resendApiKey", apiKey);
|
|
982
|
-
console.info(`${logSymbols.success} Resend integration successfully set up`);
|
|
983
991
|
}
|
|
984
992
|
|
|
985
993
|
//#endregion
|
|
@@ -1024,7 +1032,9 @@ program.command("export").description("Build the templates to the `out` director
|
|
|
1024
1032
|
plainText,
|
|
1025
1033
|
pretty
|
|
1026
1034
|
}));
|
|
1027
|
-
program.command("resend")
|
|
1035
|
+
const resend = program.command("resend");
|
|
1036
|
+
resend.command("setup").description("Sets up the integration between the React Email CLI, and your Resend account through an API Key").action(resendSetup);
|
|
1037
|
+
resend.command("reset").description("Deletes your API Key from the React Email configuration").action(resendReset);
|
|
1028
1038
|
program.parse();
|
|
1029
1039
|
|
|
1030
1040
|
//#endregion
|
package/package.json
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import logSymbols from 'log-symbols';
|
|
2
|
+
import prompts from 'prompts';
|
|
3
|
+
import { conf } from '../../utils/conf.js';
|
|
4
|
+
import { styleText } from '../../utils/style-text.js';
|
|
5
|
+
|
|
6
|
+
export async function resendSetup() {
|
|
7
|
+
const previousValue = conf.get('resendApiKey');
|
|
8
|
+
if (typeof previousValue === 'string' && previousValue.length > 0) {
|
|
9
|
+
console.info(
|
|
10
|
+
`You already have a Resend API Key configured (${styleText('grey', previousValue.slice(0, 11))}...), continuing will replace it.`,
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const { apiKey } = await prompts({
|
|
15
|
+
type: 'password',
|
|
16
|
+
name: 'apiKey',
|
|
17
|
+
message: 'Enter your API Key (make sure it has "Full Access")',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
if (apiKey?.trim().length > 0) {
|
|
21
|
+
conf.set('resendApiKey', apiKey);
|
|
22
|
+
console.info(
|
|
23
|
+
`${logSymbols.success} Resend integration successfully set up`,
|
|
24
|
+
);
|
|
25
|
+
console.info(
|
|
26
|
+
`You can always remove it with ${styleText('green', 'npx react-email@latest resend reset')}`,
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -3,7 +3,8 @@ import { program } from 'commander';
|
|
|
3
3
|
import { build } from './commands/build.js';
|
|
4
4
|
import { dev } from './commands/dev.js';
|
|
5
5
|
import { exportTemplates } from './commands/export.js';
|
|
6
|
-
import {
|
|
6
|
+
import { resendReset } from './commands/resend/reset.js';
|
|
7
|
+
import { resendSetup } from './commands/resend/setup.js';
|
|
7
8
|
import { start } from './commands/start.js';
|
|
8
9
|
import { packageJson } from './utils/packageJson.js';
|
|
9
10
|
|
|
@@ -53,13 +54,18 @@ program
|
|
|
53
54
|
exportTemplates(outDir, srcDir, { silent, plainText, pretty }),
|
|
54
55
|
);
|
|
55
56
|
|
|
56
|
-
program
|
|
57
|
-
|
|
57
|
+
const resend = program.command('resend');
|
|
58
|
+
|
|
59
|
+
resend
|
|
58
60
|
.command('setup')
|
|
59
61
|
.description(
|
|
60
62
|
'Sets up the integration between the React Email CLI, and your Resend account through an API Key',
|
|
61
63
|
)
|
|
62
|
-
.argument('apiKey', 'API Key for use setting up the integration')
|
|
63
64
|
.action(resendSetup);
|
|
64
65
|
|
|
66
|
+
resend
|
|
67
|
+
.command('reset')
|
|
68
|
+
.description('Deletes your API Key from the React Email configuration')
|
|
69
|
+
.action(resendReset);
|
|
70
|
+
|
|
65
71
|
program.parse();
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import logSymbols from 'log-symbols';
|
|
2
|
-
import prompts from 'prompts';
|
|
3
|
-
import { conf } from '../utils/conf.js';
|
|
4
|
-
import { styleText } from '../utils/style-text.js';
|
|
5
|
-
|
|
6
|
-
export async function resendSetup(apiKey: string) {
|
|
7
|
-
const previousValue = conf.get('resendApiKey');
|
|
8
|
-
if (typeof previousValue === 'string' && previousValue.length > 0) {
|
|
9
|
-
const response = await prompts({
|
|
10
|
-
type: 'confirm',
|
|
11
|
-
name: 'replaceApiKey',
|
|
12
|
-
message: `You already have a Resend API Key configured (${styleText('grey', previousValue.slice(0, 11))}...). Do you want to replace it?`,
|
|
13
|
-
initial: false,
|
|
14
|
-
});
|
|
15
|
-
if (!response.replaceApiKey) {
|
|
16
|
-
process.exit(0);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
conf.set('resendApiKey', apiKey);
|
|
21
|
-
console.info(`${logSymbols.success} Resend integration successfully set up`);
|
|
22
|
-
}
|