react-email 3.0.3-canary.1 → 3.0.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.
Files changed (84) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cli/index.js +52 -29
  3. package/dist/cli/index.mjs +41 -31
  4. package/dist/preview/.next/BUILD_ID +1 -1
  5. package/dist/preview/.next/app-build-manifest.json +28 -28
  6. package/dist/preview/.next/build-manifest.json +13 -13
  7. package/dist/preview/.next/cache/eslint/.cache_117y9un +1 -1
  8. package/dist/preview/.next/cache/webpack/client-production/0.pack +0 -0
  9. package/dist/preview/.next/cache/webpack/client-production/index.pack +0 -0
  10. package/dist/preview/.next/cache/webpack/edge-server-production/index.pack +0 -0
  11. package/dist/preview/.next/cache/webpack/server-production/0.pack +0 -0
  12. package/dist/preview/.next/cache/webpack/server-production/index.pack +0 -0
  13. package/dist/preview/.next/next-minimal-server.js.nft.json +1 -1
  14. package/dist/preview/.next/next-server.js.nft.json +1 -1
  15. package/dist/preview/.next/prerender-manifest.json +1 -1
  16. package/dist/preview/.next/required-server-files.json +1 -1
  17. package/dist/preview/.next/server/app/_not-found/page.js +1 -1
  18. package/dist/preview/.next/server/app/_not-found/page.js.nft.json +1 -1
  19. package/dist/preview/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  20. package/dist/preview/.next/server/app/favicon.ico/route.js +2 -2
  21. package/dist/preview/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  22. package/dist/preview/.next/server/app/page.js +1 -1
  23. package/dist/preview/.next/server/app/page.js.nft.json +1 -1
  24. package/dist/preview/.next/server/app/page_client-reference-manifest.js +1 -1
  25. package/dist/preview/.next/server/app/preview/[...slug]/page.js +6 -6
  26. package/dist/preview/.next/server/app/preview/[...slug]/page.js.nft.json +1 -1
  27. package/dist/preview/.next/server/app/preview/[...slug]/page_client-reference-manifest.js +1 -1
  28. package/dist/preview/.next/server/chunks/128.js +7 -0
  29. package/dist/preview/.next/server/chunks/{845.js → 176.js} +2 -2
  30. package/dist/preview/.next/server/chunks/287.js +4 -0
  31. package/dist/preview/.next/server/chunks/303.js +6 -0
  32. package/dist/preview/.next/server/chunks/359.js +10 -0
  33. package/dist/preview/.next/server/chunks/6.js +1 -1
  34. package/dist/preview/.next/server/chunks/894.js +4 -0
  35. package/dist/preview/.next/server/middleware-build-manifest.js +1 -1
  36. package/dist/preview/.next/server/pages/500.html +1 -1
  37. package/dist/preview/.next/server/pages/_app.js +1 -1
  38. package/dist/preview/.next/server/pages/_app.js.nft.json +1 -1
  39. package/dist/preview/.next/server/pages/_document.js +1 -1
  40. package/dist/preview/.next/server/pages/_document.js.nft.json +1 -1
  41. package/dist/preview/.next/server/pages/_error.js +1 -1
  42. package/dist/preview/.next/server/pages/_error.js.nft.json +1 -1
  43. package/dist/preview/.next/server/server-reference-manifest.js +1 -1
  44. package/dist/preview/.next/server/server-reference-manifest.json +1 -1
  45. package/dist/preview/.next/static/9wK7iUJPUvFYJNYOqHNpo/_buildManifest.js +1 -0
  46. package/dist/preview/.next/static/chunks/121-c9990f9db62882f2.js +2 -0
  47. package/dist/preview/.next/static/chunks/262-1ec6780d76508af8.js +1 -0
  48. package/dist/preview/.next/static/chunks/{124-ae7f66e23ad37cb6.js → 599-b4e686757f7b900d.js} +1 -1
  49. package/dist/preview/.next/static/chunks/732-2b6186d8c8624033.js +1 -0
  50. package/dist/preview/.next/static/chunks/783-41562adc25d0c844.js +9 -0
  51. package/dist/preview/.next/static/chunks/app/_not-found/{page-f013323e54e30eb4.js → page-02dfc5a8a0bd636e.js} +1 -1
  52. package/dist/preview/.next/static/chunks/app/{layout-6a058829ca2e1648.js → layout-62d01ca567f6fd12.js} +1 -1
  53. package/dist/preview/.next/static/chunks/app/page-630c6c846e3efc69.js +1 -0
  54. package/dist/preview/.next/static/chunks/app/preview/[...slug]/page-6547e9f3ba86c271.js +1 -0
  55. package/dist/preview/.next/static/chunks/{9e70e2c9-cf735c555aae829e.js → f38cb6f6-40e76da092bb0490.js} +1 -1
  56. package/dist/preview/.next/static/chunks/main-app-6ed588927d8fd56c.js +1 -0
  57. package/dist/preview/.next/static/chunks/main-ee2ceeb6c8bf53ac.js +1 -0
  58. package/dist/preview/.next/static/chunks/pages/_app-02aac361ebb5625a.js +1 -0
  59. package/dist/preview/.next/static/chunks/pages/_error-52f603c388364756.js +1 -0
  60. package/dist/preview/.next/static/chunks/polyfills-78c92fac7aa8fdd8.js +1 -0
  61. package/dist/preview/.next/static/chunks/{webpack-787bdf42b5977b69.js → webpack-cf1ab84f284a4073.js} +1 -1
  62. package/dist/preview/.next/trace +52 -52
  63. package/package.json +2 -2
  64. package/src/actions/render-email-by-path.tsx +2 -2
  65. package/src/utils/register-spinner-autostopping.ts +28 -0
  66. package/dist/preview/.next/server/chunks/29.js +0 -10
  67. package/dist/preview/.next/server/chunks/702.js +0 -7
  68. package/dist/preview/.next/server/chunks/765.js +0 -6
  69. package/dist/preview/.next/server/chunks/95.js +0 -4
  70. package/dist/preview/.next/server/chunks/979.js +0 -4
  71. package/dist/preview/.next/static/UkSc9BvDf-yFhQmi9UeyH/_buildManifest.js +0 -1
  72. package/dist/preview/.next/static/chunks/246-aeae0d42438095fa.js +0 -1
  73. package/dist/preview/.next/static/chunks/271-465a8f7fa0f088b0.js +0 -1
  74. package/dist/preview/.next/static/chunks/814-1930a70da275907a.js +0 -9
  75. package/dist/preview/.next/static/chunks/816-025a1ae3d98f8bbc.js +0 -2
  76. package/dist/preview/.next/static/chunks/app/page-bfde41be5bed6456.js +0 -1
  77. package/dist/preview/.next/static/chunks/app/preview/[...slug]/page-970a94d529b78bd7.js +0 -1
  78. package/dist/preview/.next/static/chunks/main-3b591628bc46f6ef.js +0 -1
  79. package/dist/preview/.next/static/chunks/main-app-f5afc98786b35330.js +0 -1
  80. package/dist/preview/.next/static/chunks/pages/_app-88c2f98e605e9ac8.js +0 -1
  81. package/dist/preview/.next/static/chunks/pages/_error-2c30ce48edcc8dfe.js +0 -1
  82. package/dist/preview/.next/static/chunks/polyfills-42372ed130431b0a.js +0 -1
  83. package/src/utils/close-ora-on-sigint.ts +0 -15
  84. /package/dist/preview/.next/static/{UkSc9BvDf-yFhQmi9UeyH → 9wK7iUJPUvFYJNYOqHNpo}/_ssgManifest.js +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # react-email
2
2
 
3
+ ## 3.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 1e82151: fix null byte characters being rendered in the preview server
8
+ - b34aa90: Move react and react-dom to just dependencies for better DX
9
+ - 6781316: Improve error messages for all CLI commands
10
+
11
+ ## 3.0.3-canary.2
12
+
13
+ ### Patch Changes
14
+
15
+ - 6781316: Improve error messages for all CLI commands
16
+
3
17
  ## 3.0.3-canary.1
4
18
 
5
19
  ### Patch Changes
package/dist/cli/index.js CHANGED
@@ -340,7 +340,7 @@ var import_commander = require("commander");
340
340
  // package.json
341
341
  var package_default = {
342
342
  name: "react-email",
343
- version: "3.0.3-canary.1",
343
+ version: "3.0.3",
344
344
  description: "A live preview of your emails right in your browser.",
345
345
  bin: {
346
346
  email: "./dist/cli/index.js"
@@ -626,9 +626,10 @@ var import_node_http = __toESM(require("http"));
626
626
  var import_node_url = __toESM(require("url"));
627
627
  var import_next = __toESM(require("next"));
628
628
  var import_ora = __toESM(require("ora"));
629
- var import_log_symbols = __toESM(require("log-symbols"));
629
+ var import_log_symbols2 = __toESM(require("log-symbols"));
630
630
  var import_chalk = __toESM(require("chalk"));
631
- // src/utils/close-ora-on-sigint.ts
631
+ // src/utils/register-spinner-autostopping.ts
632
+ var import_log_symbols = __toESM(require("log-symbols"));
632
633
  var spinners = /* @__PURE__ */ new Set();
633
634
  process.on("SIGINT", function() {
634
635
  spinners.forEach(function(spinner) {
@@ -637,7 +638,18 @@ process.on("SIGINT", function() {
637
638
  }
638
639
  });
639
640
  });
640
- var closeOraOnSIGNIT = function(spinner) {
641
+ process.on("exit", function(code) {
642
+ if (code !== 0) {
643
+ spinners.forEach(function(spinner) {
644
+ if (spinner.isSpinning) {
645
+ spinner.stopAndPersist({
646
+ symbol: import_log_symbols.default.error
647
+ });
648
+ }
649
+ });
650
+ }
651
+ });
652
+ var registerSpinnerAutostopping = function(spinner) {
641
653
  spinners.add(spinner);
642
654
  };
643
655
  // src/cli/utils/preview/serve-static-file.ts
@@ -777,7 +789,7 @@ var startDevServer = function() {
777
789
  console.log(" Running preview at: http://localhost:".concat(port, "\n"));
778
790
  } else {
779
791
  nextPortToTry = port + 1;
780
- console.warn(" ".concat(import_log_symbols.default.warning, " Port ").concat(port, " is already in use, trying ").concat(nextPortToTry));
792
+ console.warn(" ".concat(import_log_symbols2.default.warning, " Port ").concat(port, " is already in use, trying ").concat(nextPortToTry));
781
793
  return [
782
794
  2,
783
795
  startDevServer(emailsDirRelativePath, staticBaseDirRelativePath, nextPortToTry)
@@ -800,14 +812,14 @@ var startDevServer = function() {
800
812
  });
801
813
  }));
802
814
  devServer.on("error", function(e) {
803
- console.error(" ".concat(import_log_symbols.default.error, " preview server error: "), JSON.stringify(e));
815
+ console.error(" ".concat(import_log_symbols2.default.error, " preview server error: "), JSON.stringify(e));
804
816
  process.exit(1);
805
817
  });
806
818
  spinner = (0, import_ora.default)({
807
819
  text: "Getting react-email preview server ready...\n",
808
820
  prefixText: " "
809
821
  }).start();
810
- closeOraOnSIGNIT(spinner);
822
+ registerSpinnerAutostopping(spinner);
811
823
  timeBeforeNextReady = performance.now();
812
824
  process.env = _object_spread(_object_spread_props(_object_spread({}, process.env), {
813
825
  NODE_ENV: "development"
@@ -839,7 +851,7 @@ var startDevServer = function() {
839
851
  secondsToNextReady = ((performance.now() - timeBeforeNextReady) / 1e3).toFixed(1);
840
852
  spinner.stopAndPersist({
841
853
  text: "Ready in ".concat(secondsToNextReady, "s\n"),
842
- symbol: import_log_symbols.default.success
854
+ symbol: import_log_symbols2.default.success
843
855
  });
844
856
  return [
845
857
  2,
@@ -1841,7 +1853,8 @@ var dev = function() {
1841
1853
  5
1842
1854
  ]);
1843
1855
  if (!import_node_fs4.default.existsSync(emailsDirRelativePath)) {
1844
- throw new Error("Missing ".concat(emailsDirRelativePath, " folder"));
1856
+ console.error("Missing ".concat(emailsDirRelativePath, " folder"));
1857
+ process.exit(1);
1845
1858
  }
1846
1859
  return [
1847
1860
  4,
@@ -1885,7 +1898,7 @@ var import_node_path8 = __toESM(require("path"));
1885
1898
  var import_glob = require("glob");
1886
1899
  var import_esbuild = require("esbuild");
1887
1900
  var import_ora2 = __toESM(require("ora"));
1888
- var import_log_symbols2 = __toESM(require("log-symbols"));
1901
+ var import_log_symbols3 = __toESM(require("log-symbols"));
1889
1902
  var import_normalize_path = __toESM(require("normalize-path"));
1890
1903
  // src/actions/get-emails-directory-metadata.ts
1891
1904
  var import_node_fs5 = __toESM(require("fs"));
@@ -2086,7 +2099,7 @@ var exportTemplates = function() {
2086
2099
  }
2087
2100
  if (!options.silent) {
2088
2101
  spinner = (0, import_ora2.default)("Preparing files...\n").start();
2089
- closeOraOnSIGNIT(spinner);
2102
+ registerSpinnerAutostopping(spinner);
2090
2103
  }
2091
2104
  return [
2092
2105
  4,
@@ -2097,7 +2110,7 @@ var exportTemplates = function() {
2097
2110
  if (typeof emailsDirectoryMetadata === "undefined") {
2098
2111
  if (spinner) {
2099
2112
  spinner.stopAndPersist({
2100
- symbol: import_log_symbols2.default.error,
2113
+ symbol: import_log_symbols3.default.error,
2101
2114
  text: "Could not find the directory at ".concat(emailsDirectoryPath)
2102
2115
  });
2103
2116
  }
@@ -2146,15 +2159,15 @@ var exportTemplates = function() {
2146
2159
  buildFailure = exception;
2147
2160
  if (spinner) {
2148
2161
  spinner.stopAndPersist({
2149
- symbol: import_log_symbols2.default.error,
2162
+ symbol: import_log_symbols3.default.error,
2150
2163
  text: "Failed to build emails"
2151
2164
  });
2152
2165
  }
2153
- console.warn(buildFailure.warnings);
2154
- console.error(buildFailure.errors);
2155
- throw new Error("esbuild bundling process for email templates failed:\n".concat(allTemplates.map(function(p) {
2156
- return "- ".concat(p);
2157
- }).join("\n")));
2166
+ process.exit(1);
2167
+ return [
2168
+ 3,
2169
+ 5
2170
+ ];
2158
2171
  case 5:
2159
2172
  if (spinner) {
2160
2173
  spinner.succeed();
@@ -2216,12 +2229,16 @@ var exportTemplates = function() {
2216
2229
  exception1 = _state.sent();
2217
2230
  if (spinner) {
2218
2231
  spinner.stopAndPersist({
2219
- symbol: import_log_symbols2.default.error,
2232
+ symbol: import_log_symbols3.default.error,
2220
2233
  text: "failed when rendering ".concat(template.split("/").pop())
2221
2234
  });
2222
2235
  }
2223
2236
  console.error(exception1);
2224
- throw exception1;
2237
+ process.exit(1);
2238
+ return [
2239
+ 3,
2240
+ 12
2241
+ ];
2225
2242
  case 12:
2226
2243
  _iteratorAbruptCompletion = false;
2227
2244
  return [
@@ -2324,11 +2341,16 @@ var exportTemplates = function() {
2324
2341
  console.error(exception2);
2325
2342
  if (spinner) {
2326
2343
  spinner.stopAndPersist({
2327
- symbol: import_log_symbols2.default.error,
2344
+ symbol: import_log_symbols3.default.error,
2328
2345
  text: "Failed to copy static files"
2329
2346
  });
2330
2347
  }
2331
- throw new Error("Something went wrong while copying the file to ".concat(pathToWhereEmailMarkupShouldBeDumped, "/static, ").concat(exception2));
2348
+ console.error("Something went wrong while copying the file to ".concat(pathToWhereEmailMarkupShouldBeDumped, "/static, ").concat(exception2));
2349
+ process.exit(1);
2350
+ return [
2351
+ 3,
2352
+ 25
2353
+ ];
2332
2354
  case 25:
2333
2355
  if (!(spinner && !options.silent)) return [
2334
2356
  3,
@@ -2343,7 +2365,7 @@ var exportTemplates = function() {
2343
2365
  fileTree = _state.sent();
2344
2366
  console.log(fileTree);
2345
2367
  spinner.stopAndPersist({
2346
- symbol: import_log_symbols2.default.success,
2368
+ symbol: import_log_symbols3.default.success,
2347
2369
  text: "Successfully exported emails"
2348
2370
  });
2349
2371
  _state.label = 27;
@@ -2363,7 +2385,7 @@ var import_node_fs8 = __toESM(require("fs"));
2363
2385
  var import_node_path9 = __toESM(require("path"));
2364
2386
  var import_ora3 = __toESM(require("ora"));
2365
2387
  var import_node_child_process = require("child_process");
2366
- var import_log_symbols3 = __toESM(require("log-symbols"));
2388
+ var import_log_symbols4 = __toESM(require("log-symbols"));
2367
2389
  var buildPreviewApp = function(absoluteDirectory) {
2368
2390
  return new Promise(function(resolve, reject) {
2369
2391
  var nextBuild = (0, import_node_child_process.spawn)("npm", [
@@ -2593,10 +2615,10 @@ var build2 = function() {
2593
2615
  text: "Starting build process...",
2594
2616
  prefixText: " "
2595
2617
  }).start();
2596
- closeOraOnSIGNIT(spinner);
2597
- spinner.text = "Checking if emails folder exists";
2618
+ registerSpinnerAutostopping(spinner);
2619
+ spinner.text = "Checking if ".concat(emailsDirRelativePath, " folder exists");
2598
2620
  if (!import_node_fs8.default.existsSync(emailsDirRelativePath)) {
2599
- throw new Error("Missing ".concat(emailsDirRelativePath, " folder"));
2621
+ process.exit(1);
2600
2622
  }
2601
2623
  emailsDirPath = import_node_path9.default.join(process.cwd(), emailsDirRelativePath);
2602
2624
  staticPath = import_node_path9.default.join(emailsDirPath, "static");
@@ -2674,7 +2696,7 @@ var build2 = function() {
2674
2696
  _state.sent();
2675
2697
  spinner.stopAndPersist({
2676
2698
  text: "Successfully prepared `.react-email` for `next build`",
2677
- symbol: import_log_symbols3.default.success
2699
+ symbol: import_log_symbols4.default.success
2678
2700
  });
2679
2701
  return [
2680
2702
  4,
@@ -2717,7 +2739,8 @@ var start = function() {
2717
2739
  usersProjectLocation = process.cwd();
2718
2740
  builtPreviewPath = import_node_path10.default.resolve(usersProjectLocation, "./.react-email");
2719
2741
  if (!import_node_fs9.default.existsSync(builtPreviewPath)) {
2720
- throw new Error("Could not find `.react-email`, maybe you haven't ran `email build`?");
2742
+ console.error("Could not find .react-email, maybe you haven't ran email build?");
2743
+ process.exit(1);
2721
2744
  }
2722
2745
  nextStart = (0, import_node_child_process2.spawn)("npm", [
2723
2746
  "start"
@@ -13,7 +13,7 @@ import { program } from "commander";
13
13
  // package.json
14
14
  var package_default = {
15
15
  name: "react-email",
16
- version: "3.0.3-canary.1",
16
+ version: "3.0.3",
17
17
  description: "A live preview of your emails right in your browser.",
18
18
  bin: {
19
19
  email: "./dist/cli/index.js"
@@ -209,10 +209,11 @@ import http from "node:http";
209
209
  import url from "node:url";
210
210
  import next from "next";
211
211
  import ora from "ora";
212
- import logSymbols from "log-symbols";
212
+ import logSymbols2 from "log-symbols";
213
213
  import chalk from "chalk";
214
214
 
215
- // src/utils/close-ora-on-sigint.ts
215
+ // src/utils/register-spinner-autostopping.ts
216
+ import logSymbols from "log-symbols";
216
217
  var spinners = /* @__PURE__ */ new Set();
217
218
  process.on("SIGINT", () => {
218
219
  spinners.forEach((spinner) => {
@@ -221,7 +222,18 @@ process.on("SIGINT", () => {
221
222
  }
222
223
  });
223
224
  });
224
- var closeOraOnSIGNIT = (spinner) => {
225
+ process.on("exit", (code) => {
226
+ if (code !== 0) {
227
+ spinners.forEach((spinner) => {
228
+ if (spinner.isSpinning) {
229
+ spinner.stopAndPersist({
230
+ symbol: logSymbols.error
231
+ });
232
+ }
233
+ });
234
+ }
235
+ });
236
+ var registerSpinnerAutostopping = (spinner) => {
225
237
  spinners.add(spinner);
226
238
  };
227
239
 
@@ -317,7 +329,7 @@ var startDevServer = async (emailsDirRelativePath, staticBaseDirRelativePath, po
317
329
  } else {
318
330
  const nextPortToTry = port + 1;
319
331
  console.warn(
320
- ` ${logSymbols.warning} Port ${port} is already in use, trying ${nextPortToTry}`
332
+ ` ${logSymbols2.warning} Port ${port} is already in use, trying ${nextPortToTry}`
321
333
  );
322
334
  return startDevServer(
323
335
  emailsDirRelativePath,
@@ -330,7 +342,7 @@ var startDevServer = async (emailsDirRelativePath, staticBaseDirRelativePath, po
330
342
  });
331
343
  devServer.on("error", (e) => {
332
344
  console.error(
333
- ` ${logSymbols.error} preview server error: `,
345
+ ` ${logSymbols2.error} preview server error: `,
334
346
  JSON.stringify(e)
335
347
  );
336
348
  process.exit(1);
@@ -339,7 +351,7 @@ var startDevServer = async (emailsDirRelativePath, staticBaseDirRelativePath, po
339
351
  text: "Getting react-email preview server ready...\n",
340
352
  prefixText: " "
341
353
  }).start();
342
- closeOraOnSIGNIT(spinner);
354
+ registerSpinnerAutostopping(spinner);
343
355
  const timeBeforeNextReady = performance.now();
344
356
  process.env = {
345
357
  ...process.env,
@@ -372,7 +384,7 @@ var startDevServer = async (emailsDirRelativePath, staticBaseDirRelativePath, po
372
384
  spinner.stopAndPersist({
373
385
  text: `Ready in ${secondsToNextReady}s
374
386
  `,
375
- symbol: logSymbols.success
387
+ symbol: logSymbols2.success
376
388
  });
377
389
  return devServer;
378
390
  };
@@ -700,7 +712,8 @@ var setupHotreloading = async (devServer2, emailDirRelativePath) => {
700
712
  var dev = async ({ dir: emailsDirRelativePath, port }) => {
701
713
  try {
702
714
  if (!fs4.existsSync(emailsDirRelativePath)) {
703
- throw new Error(`Missing ${emailsDirRelativePath} folder`);
715
+ console.error(`Missing ${emailsDirRelativePath} folder`);
716
+ process.exit(1);
704
717
  }
705
718
  const devServer2 = await startDevServer(
706
719
  emailsDirRelativePath,
@@ -721,7 +734,7 @@ import path9 from "node:path";
721
734
  import { glob } from "glob";
722
735
  import { build } from "esbuild";
723
736
  import ora2 from "ora";
724
- import logSymbols2 from "log-symbols";
737
+ import logSymbols3 from "log-symbols";
725
738
  import normalize from "normalize-path";
726
739
 
727
740
  // src/actions/get-emails-directory-metadata.ts
@@ -864,7 +877,7 @@ var exportTemplates = async (pathToWhereEmailMarkupShouldBeDumped, emailsDirecto
864
877
  let spinner;
865
878
  if (!options.silent) {
866
879
  spinner = ora2("Preparing files...\n").start();
867
- closeOraOnSIGNIT(spinner);
880
+ registerSpinnerAutostopping(spinner);
868
881
  }
869
882
  const emailsDirectoryMetadata = await getEmailsDirectoryMetadata(
870
883
  path9.resolve(process.cwd(), emailsDirectoryPath),
@@ -873,7 +886,7 @@ var exportTemplates = async (pathToWhereEmailMarkupShouldBeDumped, emailsDirecto
873
886
  if (typeof emailsDirectoryMetadata === "undefined") {
874
887
  if (spinner) {
875
888
  spinner.stopAndPersist({
876
- symbol: logSymbols2.error,
889
+ symbol: logSymbols3.error,
877
890
  text: `Could not find the directory at ${emailsDirectoryPath}`
878
891
  });
879
892
  }
@@ -897,16 +910,11 @@ var exportTemplates = async (pathToWhereEmailMarkupShouldBeDumped, emailsDirecto
897
910
  const buildFailure = exception;
898
911
  if (spinner) {
899
912
  spinner.stopAndPersist({
900
- symbol: logSymbols2.error,
913
+ symbol: logSymbols3.error,
901
914
  text: "Failed to build emails"
902
915
  });
903
916
  }
904
- console.warn(buildFailure.warnings);
905
- console.error(buildFailure.errors);
906
- throw new Error(
907
- `esbuild bundling process for email templates failed:
908
- ${allTemplates.map((p) => `- ${p}`).join("\n")}`
909
- );
917
+ process.exit(1);
910
918
  }
911
919
  if (spinner) {
912
920
  spinner.succeed();
@@ -938,12 +946,12 @@ ${allTemplates.map((p) => `- ${p}`).join("\n")}`
938
946
  } catch (exception) {
939
947
  if (spinner) {
940
948
  spinner.stopAndPersist({
941
- symbol: logSymbols2.error,
949
+ symbol: logSymbols3.error,
942
950
  text: `failed when rendering ${template.split("/").pop()}`
943
951
  });
944
952
  }
945
953
  console.error(exception);
946
- throw exception;
954
+ process.exit(1);
947
955
  }
948
956
  }
949
957
  if (spinner) {
@@ -967,13 +975,14 @@ ${allTemplates.map((p) => `- ${p}`).join("\n")}`
967
975
  console.error(exception);
968
976
  if (spinner) {
969
977
  spinner.stopAndPersist({
970
- symbol: logSymbols2.error,
978
+ symbol: logSymbols3.error,
971
979
  text: "Failed to copy static files"
972
980
  });
973
981
  }
974
- throw new Error(
982
+ console.error(
975
983
  `Something went wrong while copying the file to ${pathToWhereEmailMarkupShouldBeDumped}/static, ${exception}`
976
984
  );
985
+ process.exit(1);
977
986
  }
978
987
  }
979
988
  if (spinner && !options.silent) {
@@ -981,7 +990,7 @@ ${allTemplates.map((p) => `- ${p}`).join("\n")}`
981
990
  const fileTree = await tree(pathToWhereEmailMarkupShouldBeDumped, 4);
982
991
  console.log(fileTree);
983
992
  spinner.stopAndPersist({
984
- symbol: logSymbols2.success,
993
+ symbol: logSymbols3.success,
985
994
  text: "Successfully exported emails"
986
995
  });
987
996
  }
@@ -992,7 +1001,7 @@ import fs8 from "node:fs";
992
1001
  import path10 from "node:path";
993
1002
  import ora3 from "ora";
994
1003
  import { spawn } from "node:child_process";
995
- import logSymbols3 from "log-symbols";
1004
+ import logSymbols4 from "log-symbols";
996
1005
  var buildPreviewApp = (absoluteDirectory) => {
997
1006
  return new Promise((resolve, reject) => {
998
1007
  const nextBuild = spawn("npm", ["run", "build"], {
@@ -1158,10 +1167,10 @@ var build2 = async ({
1158
1167
  text: "Starting build process...",
1159
1168
  prefixText: " "
1160
1169
  }).start();
1161
- closeOraOnSIGNIT(spinner);
1162
- spinner.text = "Checking if emails folder exists";
1170
+ registerSpinnerAutostopping(spinner);
1171
+ spinner.text = `Checking if ${emailsDirRelativePath} folder exists`;
1163
1172
  if (!fs8.existsSync(emailsDirRelativePath)) {
1164
- throw new Error(`Missing ${emailsDirRelativePath} folder`);
1173
+ process.exit(1);
1165
1174
  }
1166
1175
  const emailsDirPath = path10.join(process.cwd(), emailsDirRelativePath);
1167
1176
  const staticPath = path10.join(emailsDirPath, "static");
@@ -1200,7 +1209,7 @@ var build2 = async ({
1200
1209
  await npmInstall(builtPreviewAppPath, packageManager);
1201
1210
  spinner.stopAndPersist({
1202
1211
  text: "Successfully prepared `.react-email` for `next build`",
1203
- symbol: logSymbols3.success
1212
+ symbol: logSymbols4.success
1204
1213
  });
1205
1214
  await buildPreviewApp(builtPreviewAppPath);
1206
1215
  } catch (error) {
@@ -1221,9 +1230,10 @@ var start = async () => {
1221
1230
  "./.react-email"
1222
1231
  );
1223
1232
  if (!fs9.existsSync(builtPreviewPath)) {
1224
- throw new Error(
1225
- "Could not find `.react-email`, maybe you haven't ran `email build`?"
1233
+ console.error(
1234
+ "Could not find .react-email, maybe you haven't ran email build?"
1226
1235
  );
1236
+ process.exit(1);
1227
1237
  }
1228
1238
  const nextStart = spawn2("npm", ["start"], {
1229
1239
  cwd: builtPreviewPath,
@@ -1 +1 @@
1
- UkSc9BvDf-yFhQmi9UeyH
1
+ 9wK7iUJPUvFYJNYOqHNpo
@@ -1,44 +1,44 @@
1
1
  {
2
2
  "pages": {
3
3
  "/_not-found/page": [
4
- "static/chunks/webpack-787bdf42b5977b69.js",
5
- "static/chunks/9e70e2c9-cf735c555aae829e.js",
6
- "static/chunks/816-025a1ae3d98f8bbc.js",
7
- "static/chunks/main-app-f5afc98786b35330.js",
8
- "static/chunks/app/_not-found/page-f013323e54e30eb4.js"
4
+ "static/chunks/webpack-cf1ab84f284a4073.js",
5
+ "static/chunks/f38cb6f6-40e76da092bb0490.js",
6
+ "static/chunks/121-c9990f9db62882f2.js",
7
+ "static/chunks/main-app-6ed588927d8fd56c.js",
8
+ "static/chunks/app/_not-found/page-02dfc5a8a0bd636e.js"
9
9
  ],
10
10
  "/layout": [
11
- "static/chunks/webpack-787bdf42b5977b69.js",
12
- "static/chunks/9e70e2c9-cf735c555aae829e.js",
13
- "static/chunks/816-025a1ae3d98f8bbc.js",
14
- "static/chunks/main-app-f5afc98786b35330.js",
11
+ "static/chunks/webpack-cf1ab84f284a4073.js",
12
+ "static/chunks/f38cb6f6-40e76da092bb0490.js",
13
+ "static/chunks/121-c9990f9db62882f2.js",
14
+ "static/chunks/main-app-6ed588927d8fd56c.js",
15
15
  "static/css/eb0a93282704d7ab.css",
16
16
  "static/css/0a13d10225a26b9d.css",
17
- "static/chunks/246-aeae0d42438095fa.js",
18
- "static/chunks/app/layout-6a058829ca2e1648.js"
17
+ "static/chunks/262-1ec6780d76508af8.js",
18
+ "static/chunks/app/layout-62d01ca567f6fd12.js"
19
19
  ],
20
20
  "/page": [
21
- "static/chunks/webpack-787bdf42b5977b69.js",
22
- "static/chunks/9e70e2c9-cf735c555aae829e.js",
23
- "static/chunks/816-025a1ae3d98f8bbc.js",
24
- "static/chunks/main-app-f5afc98786b35330.js",
21
+ "static/chunks/webpack-cf1ab84f284a4073.js",
22
+ "static/chunks/f38cb6f6-40e76da092bb0490.js",
23
+ "static/chunks/121-c9990f9db62882f2.js",
24
+ "static/chunks/main-app-6ed588927d8fd56c.js",
25
25
  "static/css/0a13d10225a26b9d.css",
26
- "static/chunks/246-aeae0d42438095fa.js",
27
- "static/chunks/814-1930a70da275907a.js",
28
- "static/chunks/271-465a8f7fa0f088b0.js",
29
- "static/chunks/app/page-bfde41be5bed6456.js"
26
+ "static/chunks/262-1ec6780d76508af8.js",
27
+ "static/chunks/783-41562adc25d0c844.js",
28
+ "static/chunks/732-2b6186d8c8624033.js",
29
+ "static/chunks/app/page-630c6c846e3efc69.js"
30
30
  ],
31
31
  "/preview/[...slug]/page": [
32
- "static/chunks/webpack-787bdf42b5977b69.js",
33
- "static/chunks/9e70e2c9-cf735c555aae829e.js",
34
- "static/chunks/816-025a1ae3d98f8bbc.js",
35
- "static/chunks/main-app-f5afc98786b35330.js",
32
+ "static/chunks/webpack-cf1ab84f284a4073.js",
33
+ "static/chunks/f38cb6f6-40e76da092bb0490.js",
34
+ "static/chunks/121-c9990f9db62882f2.js",
35
+ "static/chunks/main-app-6ed588927d8fd56c.js",
36
36
  "static/css/0a13d10225a26b9d.css",
37
- "static/chunks/246-aeae0d42438095fa.js",
38
- "static/chunks/814-1930a70da275907a.js",
39
- "static/chunks/124-ae7f66e23ad37cb6.js",
40
- "static/chunks/271-465a8f7fa0f088b0.js",
41
- "static/chunks/app/preview/[...slug]/page-970a94d529b78bd7.js"
37
+ "static/chunks/262-1ec6780d76508af8.js",
38
+ "static/chunks/783-41562adc25d0c844.js",
39
+ "static/chunks/599-b4e686757f7b900d.js",
40
+ "static/chunks/732-2b6186d8c8624033.js",
41
+ "static/chunks/app/preview/[...slug]/page-6547e9f3ba86c271.js"
42
42
  ]
43
43
  }
44
44
  }
@@ -1,31 +1,31 @@
1
1
  {
2
2
  "polyfillFiles": [
3
- "static/chunks/polyfills-42372ed130431b0a.js"
3
+ "static/chunks/polyfills-78c92fac7aa8fdd8.js"
4
4
  ],
5
5
  "devFiles": [],
6
6
  "ampDevFiles": [],
7
7
  "lowPriorityFiles": [
8
- "static/UkSc9BvDf-yFhQmi9UeyH/_buildManifest.js",
9
- "static/UkSc9BvDf-yFhQmi9UeyH/_ssgManifest.js"
8
+ "static/9wK7iUJPUvFYJNYOqHNpo/_buildManifest.js",
9
+ "static/9wK7iUJPUvFYJNYOqHNpo/_ssgManifest.js"
10
10
  ],
11
11
  "rootMainFiles": [
12
- "static/chunks/webpack-787bdf42b5977b69.js",
13
- "static/chunks/9e70e2c9-cf735c555aae829e.js",
14
- "static/chunks/816-025a1ae3d98f8bbc.js",
15
- "static/chunks/main-app-f5afc98786b35330.js"
12
+ "static/chunks/webpack-cf1ab84f284a4073.js",
13
+ "static/chunks/f38cb6f6-40e76da092bb0490.js",
14
+ "static/chunks/121-c9990f9db62882f2.js",
15
+ "static/chunks/main-app-6ed588927d8fd56c.js"
16
16
  ],
17
17
  "pages": {
18
18
  "/_app": [
19
- "static/chunks/webpack-787bdf42b5977b69.js",
19
+ "static/chunks/webpack-cf1ab84f284a4073.js",
20
20
  "static/chunks/framework-bef83a85c94ff7de.js",
21
- "static/chunks/main-3b591628bc46f6ef.js",
22
- "static/chunks/pages/_app-88c2f98e605e9ac8.js"
21
+ "static/chunks/main-ee2ceeb6c8bf53ac.js",
22
+ "static/chunks/pages/_app-02aac361ebb5625a.js"
23
23
  ],
24
24
  "/_error": [
25
- "static/chunks/webpack-787bdf42b5977b69.js",
25
+ "static/chunks/webpack-cf1ab84f284a4073.js",
26
26
  "static/chunks/framework-bef83a85c94ff7de.js",
27
- "static/chunks/main-3b591628bc46f6ef.js",
28
- "static/chunks/pages/_error-2c30ce48edcc8dfe.js"
27
+ "static/chunks/main-ee2ceeb6c8bf53ac.js",
28
+ "static/chunks/pages/_error-52f603c388364756.js"
29
29
  ]
30
30
  },
31
31
  "ampFirstPages": []