react-email 1.9.2 → 1.9.3
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/.prettierrc.js
CHANGED
package/dist/package.json
CHANGED
|
@@ -14,7 +14,7 @@ const downloadClient = async () => {
|
|
|
14
14
|
const downloadRes = await octokit.repos.downloadTarballArchive({
|
|
15
15
|
owner: 'resendlabs',
|
|
16
16
|
repo: 'react-email',
|
|
17
|
-
ref: 'v0.0.
|
|
17
|
+
ref: 'v0.0.14',
|
|
18
18
|
});
|
|
19
19
|
fs_1.default.mkdirSync('.react-email-temp');
|
|
20
20
|
const TAR_PATH = path_1.default.join('.react-email-temp', 'react-email.tar.gz');
|
|
@@ -21,7 +21,7 @@ const generateEmailsPreview = async (emailDir, type = 'all') => {
|
|
|
21
21
|
await createEmailPreviews(emailDir);
|
|
22
22
|
}
|
|
23
23
|
if (type === 'all' || type === 'static') {
|
|
24
|
-
await createStaticFiles(
|
|
24
|
+
await createStaticFiles();
|
|
25
25
|
}
|
|
26
26
|
spinner.stopAndPersist({
|
|
27
27
|
symbol: log_symbols_1.default.success,
|
|
@@ -66,14 +66,17 @@ const createEmailPreviews = async (emailDir) => {
|
|
|
66
66
|
await fs_extra_1.default.writeFile(targetFile, sourceCode);
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
const createStaticFiles = async (
|
|
69
|
+
const createStaticFiles = async () => {
|
|
70
70
|
const hasPublicDirectory = fs_1.default.existsSync(constants_1.PACKAGE_PUBLIC_PATH);
|
|
71
71
|
if (hasPublicDirectory) {
|
|
72
72
|
await fs_1.default.promises.rm(constants_1.PACKAGE_PUBLIC_PATH, { recursive: true });
|
|
73
73
|
}
|
|
74
74
|
await fs_extra_1.default.ensureDir(path_1.default.join(constants_1.PACKAGE_PUBLIC_PATH, 'static'));
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
77
|
-
|
|
75
|
+
const userHasStaticDirectory = fs_1.default.existsSync(path_1.default.join(constants_1.CURRENT_PATH, 'static'));
|
|
76
|
+
if (userHasStaticDirectory) {
|
|
77
|
+
const result = shelljs_1.default.cp('-r', path_1.default.join(constants_1.CURRENT_PATH, 'static'), path_1.default.join(constants_1.PACKAGE_PUBLIC_PATH));
|
|
78
|
+
if (result.code > 0) {
|
|
79
|
+
throw new Error(`Something went wrong while copying the file to ${path_1.default.join(constants_1.CURRENT_PATH, 'static')}, ${result.cat()}`);
|
|
80
|
+
}
|
|
78
81
|
}
|
|
79
82
|
};
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ export const downloadClient = async () => {
|
|
|
9
9
|
const downloadRes = await octokit.repos.downloadTarballArchive({
|
|
10
10
|
owner: 'resendlabs',
|
|
11
11
|
repo: 'react-email',
|
|
12
|
-
ref: 'v0.0.
|
|
12
|
+
ref: 'v0.0.14',
|
|
13
13
|
});
|
|
14
14
|
fs.mkdirSync('.react-email-temp');
|
|
15
15
|
const TAR_PATH = path.join('.react-email-temp', 'react-email.tar.gz');
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import logSymbols from 'log-symbols';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
CURRENT_PATH,
|
|
4
|
+
PACKAGE_EMAILS_PATH,
|
|
5
|
+
PACKAGE_PUBLIC_PATH,
|
|
6
|
+
} from './constants';
|
|
3
7
|
import fs from 'fs';
|
|
4
8
|
import ora from 'ora';
|
|
5
9
|
import shell from 'shelljs';
|
|
@@ -14,13 +18,13 @@ export const generateEmailsPreview = async (
|
|
|
14
18
|
) => {
|
|
15
19
|
try {
|
|
16
20
|
const spinner = ora('Generating emails preview').start();
|
|
17
|
-
closeOraOnSIGNIT(spinner)
|
|
21
|
+
closeOraOnSIGNIT(spinner);
|
|
18
22
|
|
|
19
23
|
if (type === 'all' || type === 'templates') {
|
|
20
24
|
await createEmailPreviews(emailDir);
|
|
21
25
|
}
|
|
22
26
|
if (type === 'all' || type === 'static') {
|
|
23
|
-
await createStaticFiles(
|
|
27
|
+
await createStaticFiles();
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
spinner.stopAndPersist({
|
|
@@ -81,7 +85,7 @@ const createEmailPreviews = async (emailDir: string) => {
|
|
|
81
85
|
}
|
|
82
86
|
};
|
|
83
87
|
|
|
84
|
-
const createStaticFiles = async (
|
|
88
|
+
const createStaticFiles = async () => {
|
|
85
89
|
const hasPublicDirectory = fs.existsSync(PACKAGE_PUBLIC_PATH);
|
|
86
90
|
|
|
87
91
|
if (hasPublicDirectory) {
|
|
@@ -89,18 +93,24 @@ const createStaticFiles = async (emailDir: string) => {
|
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
await fse.ensureDir(path.join(PACKAGE_PUBLIC_PATH, 'static'));
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
'-r',
|
|
95
|
-
path.join(emailDir, 'static'),
|
|
96
|
-
path.join(PACKAGE_PUBLIC_PATH),
|
|
96
|
+
const userHasStaticDirectory = fs.existsSync(
|
|
97
|
+
path.join(CURRENT_PATH, 'static'),
|
|
97
98
|
);
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
|
|
100
|
+
if (userHasStaticDirectory) {
|
|
101
|
+
const result = shell.cp(
|
|
102
|
+
'-r',
|
|
103
|
+
path.join(CURRENT_PATH, 'static'),
|
|
104
|
+
path.join(PACKAGE_PUBLIC_PATH),
|
|
104
105
|
);
|
|
106
|
+
|
|
107
|
+
if (result.code > 0) {
|
|
108
|
+
throw new Error(
|
|
109
|
+
`Something went wrong while copying the file to ${path.join(
|
|
110
|
+
CURRENT_PATH,
|
|
111
|
+
'static',
|
|
112
|
+
)}, ${result.cat()}`,
|
|
113
|
+
);
|
|
114
|
+
}
|
|
105
115
|
}
|
|
106
116
|
};
|