react-email 6.1.3 → 6.1.4

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # react-email
2
2
 
3
+ ## 6.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 1c386ce: Avoid spamming each spinner frame as a new line on non-TTY streams (CI logs, pipes, dumb terminals). The spinner now logs each status text once instead of redrawing animated frames when the output is not a TTY.
8
+ - ad6a9de: - deprecate packageManager CLI option for `email build`, only supporting npm
9
+ - ensure `email build` dependency installation includes dev dependencies
10
+
3
11
  ## 6.1.3
4
12
 
5
13
  ## 6.1.2
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from "node:module";
3
3
  import { spawn } from "node:child_process";
4
- import { program } from "commander";
4
+ import { Option, program } from "commander";
5
5
  import * as fs$1 from "node:fs";
6
6
  import fs, { existsSync, promises, statSync, unlinkSync, writeFileSync } from "node:fs";
7
7
  import * as path$2 from "node:path";
@@ -6522,7 +6522,7 @@ const getEmailsDirectoryMetadata = async (absolutePathToEmailsDirectory, keepFil
6522
6522
  //#region package.json
6523
6523
  var package_default = {
6524
6524
  name: "react-email",
6525
- version: "6.1.3",
6525
+ version: "6.1.4",
6526
6526
  description: "A live preview of your emails right in your browser.",
6527
6527
  bin: { "email": "./dist/cli/index.mjs" },
6528
6528
  type: "module",
@@ -6657,7 +6657,70 @@ const normalizeDisplay = (display) => {
6657
6657
  symbolFormatter: withPrefixText(prefixText, symbolFormatter)
6658
6658
  };
6659
6659
  };
6660
- const createSpinner = (display, options) => new Spinner(normalizeDisplay(display), options);
6660
+ const isInteractiveStream = (stream) => {
6661
+ if (!stream.isTTY) return false;
6662
+ if (process.env.TERM === "dumb") return false;
6663
+ if (process.env.CI) return false;
6664
+ return true;
6665
+ };
6666
+ var NonInteractiveSpinner = class {
6667
+ running = false;
6668
+ text = "";
6669
+ prefixText = "";
6670
+ stream;
6671
+ lastLoggedLine;
6672
+ constructor(display) {
6673
+ if (typeof display === "string") {
6674
+ this.text = display;
6675
+ this.stream = process.stdout;
6676
+ } else {
6677
+ this.text = display.text ?? "";
6678
+ this.prefixText = display.prefixText ?? "";
6679
+ this.stream = display.stream ?? process.stdout;
6680
+ }
6681
+ }
6682
+ start() {
6683
+ this.running = true;
6684
+ this.log();
6685
+ }
6686
+ stop() {
6687
+ this.running = false;
6688
+ }
6689
+ setText(text) {
6690
+ this.text = text;
6691
+ if (this.running) this.log();
6692
+ }
6693
+ setDisplay(display) {
6694
+ if (typeof display.text === "string") this.text = display.text;
6695
+ const { symbol } = display;
6696
+ this.log(symbol);
6697
+ if (typeof symbol === "string") this.running = false;
6698
+ }
6699
+ succeed(display) {
6700
+ this.finish("✔", display);
6701
+ }
6702
+ fail(display) {
6703
+ this.finish("✖", display);
6704
+ }
6705
+ finish(symbol, display) {
6706
+ if (typeof display === "string") this.text = display;
6707
+ else if (typeof display?.text === "string") this.text = display.text;
6708
+ this.log(symbol);
6709
+ this.running = false;
6710
+ }
6711
+ log(symbol) {
6712
+ const symbolPrefix = typeof symbol === "string" && symbol.length > 0 ? `${symbol} ` : "";
6713
+ const trimmedText = this.text.replace(/\n+$/, "");
6714
+ const line = `${this.prefixText}${symbolPrefix}${trimmedText}`;
6715
+ if (line === this.lastLoggedLine) return;
6716
+ this.lastLoggedLine = line;
6717
+ this.stream.write(`${line}\n`);
6718
+ }
6719
+ };
6720
+ const createSpinner = (display, options) => {
6721
+ if (!isInteractiveStream(typeof display !== "string" && display.stream || process.stdout)) return new NonInteractiveSpinner(display);
6722
+ return new Spinner(normalizeDisplay(display), options);
6723
+ };
6661
6724
  const stopSpinnerAndPersist = (spinner, display) => {
6662
6725
  spinner?.setDisplay(display);
6663
6726
  };
@@ -6730,6 +6793,7 @@ const updatePackageJson = async (builtUiPath) => {
6730
6793
  await fs.promises.writeFile(packageJsonPath, JSON.stringify(packageJson), "utf8");
6731
6794
  };
6732
6795
  const build$1 = async ({ dir: emailsDirRelativePath, packageManager }) => {
6796
+ if (packageManager) console.warn("The --packageManager option is deprecated and ignored. The build command now just uses npm.");
6733
6797
  try {
6734
6798
  const usersProjectLocation = process.cwd();
6735
6799
  const previewServerLocation = await getUiLocation();
@@ -6769,18 +6833,25 @@ const build$1 = async ({ dir: emailsDirRelativePath, packageManager }) => {
6769
6833
  await updatePackageJson(builtPreviewAppPath);
6770
6834
  if (!isInReactEmailMonorepo) {
6771
6835
  spinner.setText("Installing dependencies on `.react-email`");
6772
- await installDependencies({
6773
- cwd: builtPreviewAppPath,
6774
- silent: true,
6775
- packageManager
6776
- });
6836
+ const previousInclude = process.env.NPM_CONFIG_INCLUDE;
6837
+ process.env.NPM_CONFIG_INCLUDE = "dev";
6838
+ try {
6839
+ await installDependencies({
6840
+ cwd: builtPreviewAppPath,
6841
+ silent: true,
6842
+ packageManager: "npm"
6843
+ });
6844
+ } finally {
6845
+ if (previousInclude === void 0) delete process.env.NPM_CONFIG_INCLUDE;
6846
+ else process.env.NPM_CONFIG_INCLUDE = previousInclude;
6847
+ }
6777
6848
  }
6778
6849
  stopSpinnerAndPersist(spinner, {
6779
6850
  text: "Successfully prepared `.react-email` for `next build`",
6780
6851
  symbol: logSymbols.success
6781
6852
  });
6782
6853
  await runScript("build", {
6783
- packageManager,
6854
+ packageManager: "npm",
6784
6855
  cwd: builtPreviewAppPath
6785
6856
  });
6786
6857
  } catch (error) {
@@ -7489,7 +7560,7 @@ if (!requiredFlags.every((flag) => process.execArgv.includes(flag))) spawn(proce
7489
7560
  else {
7490
7561
  program.name("react-email").description("A live preview of your emails right in your browser").version(package_default.version);
7491
7562
  program.command("dev").description("Starts the preview email development app").option("-d, --dir <path>", "Directory with your email templates", "./emails").option("-p --port <port>", "Port to run dev server on", "3000").action(dev);
7492
- program.command("build").description("Copies the preview app for onto .react-email and builds it").option("-d, --dir <path>", "Directory with your email templates", "./emails").option("-p --packageManager <name>", "Package name to use on installation on `.react-email`", "npm").action(build$1);
7563
+ program.command("build").description("Copies the preview app for onto .react-email and builds it").option("-d, --dir <path>", "Directory with your email templates", "./emails").addOption(new Option("-p, --packageManager <name>").hideHelp()).action(build$1);
7493
7564
  program.command("start").description("Runs the built preview app that is inside of \".react-email\"").action(start);
7494
7565
  program.command("export").description("Build the templates to the `out` directory").option("--outDir <path>", "Output directory", "out").option("-p, --pretty", "Pretty print the output", false).option("-t, --plainText", "Set output format as plain text", false).option("-d, --dir <path>", "Directory with your email templates", "./emails").option("-s, --silent", "To, or not to show a spinner with process information", false).action(({ outDir, pretty, plainText, silent, dir: srcDir }) => exportTemplates(outDir, srcDir, {
7495
7566
  silent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-email",
3
- "version": "6.1.3",
3
+ "version": "6.1.4",
4
4
  "description": "A live preview of your emails right in your browser.",
5
5
  "bin": {
6
6
  "email": "./dist/cli/index.mjs"