Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
fix(documents): email preview server — print URL/port banner, fail loudly, declare postcss
naveenkasheec3308d22ad
diff --git a/packages/documents/package.json b/packages/documents/package.jsonindex c9557f1780..539061b47c 100644--- a/packages/documents/package.json+++ b/packages/documents/package.json@@ -32,6 +32,7 @@"@testing-library/dom": "8.20.1","@types/dompurify": "2.4.0","@types/react": "catalog:",+ "postcss": "8.5.15","react": "catalog:","react-email": "4.2.8","tsup": "catalog:",diff --git a/packages/documents/scripts/email-dev.mjs b/packages/documents/scripts/email-dev.mjsindex ef139a9e1d..bbd0dcabc2 100644--- a/packages/documents/scripts/email-dev.mjs+++ b/packages/documents/scripts/email-dev.mjs@@ -8,13 +8,38 @@ import { fileURLToPath } from "node:url";const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../../..");// loadEnvFile never overwrites existing keys — .env.local first so it wins.+const loadedEnvFiles = [];for (const file of [".env.local", ".env"]) {const path = resolve(repoRoot, file);- if (existsSync(path)) process.loadEnvFile(path);+ if (existsSync(path)) {+ process.loadEnvFile(path);+ loadedEnvFiles.push(file);+ }}const [dir = "./src/email"] = process.argv.slice(2);-const result = spawnSync("email", ["dev", "--dir", dir, "--port", "3030"], {+const port = process.env.EMAIL_DEV_PORT || "3030";++console.log(`+ Email preview server+ ➜ URL: http://localhost:${port}+ ➜ Templates: ${dir}+ ➜ Env files: ${loadedEnvFiles.join(", ") || "none found"}+ ➜ ERP_URL: ${process.env.ERP_URL || "(not set — asset URLs will be broken)"}+`);++const result = spawnSync("email", ["dev", "--dir", dir, "--port", port], {stdio: "inherit"});+// spawnSync reports launch failures (e.g. binary missing) via result.error+// with status null — without this check the script exits 0 printing nothing.+if (result.error) {+ console.error(`Failed to start react-email preview server: ${result.error.message}`);+ if (result.error.code === "ENOENT") {+ console.error(+ "The `email` binary was not found. Run `pnpm install`, then start via `pnpm --filter @carbon/documents email` so node_modules/.bin is on PATH."+ );+ }+ process.exit(1);+}process.exit(result.status ?? 0);diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 2d626272a1..5ef49bf145 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -2129,6 +2129,9 @@ importers:'@types/react':specifier: 18.3.28version: 18.3.28+ postcss:+ specifier: 8.5.15+ version: 8.5.15react:specifier: 18.3.1version: 18.3.1