diff --git a/.changeset/remove-normalize-path.md b/.changeset/remove-normalize-path.md new file mode 100644 index 0000000000..cf46fb04de --- /dev/null +++ b/.changeset/remove-normalize-path.md @@ -0,0 +1,5 @@ +--- +"react-email": patch +--- + +Remove the `normalize-path` dependency. diff --git a/packages/react-email/package.json b/packages/react-email/package.json index f86074ada2..67e7bb4e0a 100644 --- a/packages/react-email/package.json +++ b/packages/react-email/package.json @@ -59,7 +59,6 @@ "log-symbols": "catalog:", "marked": "^15.0.12", "mime-types": "^3.0.0", - "normalize-path": "^3.0.0", "nypm": "catalog:", "picospinner": "catalog:", "prismjs": "^1.30.0", diff --git a/packages/react-email/src/cli/commands/export.ts b/packages/react-email/src/cli/commands/export.ts index 417789dd46..529c9ae3bf 100644 --- a/packages/react-email/src/cli/commands/export.ts +++ b/packages/react-email/src/cli/commands/export.ts @@ -6,7 +6,6 @@ import type { Options } from '@react-email/render'; import { type BuildFailure, build, stop } from 'esbuild'; import { glob } from 'glob'; import logSymbols from 'log-symbols'; -import normalize from 'normalize-path'; import { inlineCssLoader } from '../utils/esbuild/inline-css-loader.js'; import { loadEsbuildPlugins } from '../utils/esbuild/load-esbuild-plugins.js'; import { renderingUtilitiesExporter } from '../utils/esbuild/renderring-utilities-exporter.js'; @@ -247,12 +246,10 @@ export const exportTemplates = async ( spinner.succeed(); } - const allBuiltTemplates = glob.sync( - normalize(`${pathToWhereEmailMarkupShouldBeDumped}/**/*.cjs`), - { - absolute: true, - }, - ); + const allBuiltTemplates = glob.sync('**/*.cjs', { + cwd: pathToWhereEmailMarkupShouldBeDumped, + absolute: true, + }); const extension = options.extension && options.extension.length > 0 diff --git a/packages/react-email/src/cli/commands/testing/export.spec.ts b/packages/react-email/src/cli/commands/testing/export.spec.ts index a55445da96..da17efaa94 100644 --- a/packages/react-email/src/cli/commands/testing/export.spec.ts +++ b/packages/react-email/src/cli/commands/testing/export.spec.ts @@ -1,4 +1,5 @@ import fs from 'node:fs'; +import os from 'node:os'; import path from 'node:path'; import { exportTemplates } from '../export.js'; @@ -236,3 +237,21 @@ test('email export with custom extension', { retry: 3 }, async () => { ' { + const pathToEmailsDirectory = path.resolve(__dirname, './emails'); + const parentDirectory = fs.mkdtempSync(path.join(os.tmpdir(), 'export-')); + const pathToDumpMarkup = path.join(parentDirectory, 'out[1]'); + + try { + await exportTemplates(pathToDumpMarkup, pathToEmailsDirectory, { + silent: true, + }); + + expect( + fs.existsSync(path.join(pathToDumpMarkup, 'vercel-invite-user.html')), + ).toBe(true); + } finally { + fs.rmSync(parentDirectory, { recursive: true, force: true }); + } +}); diff --git a/packages/ui/package.json b/packages/ui/package.json index def2b06a47..473f0e2678 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -52,7 +52,6 @@ "@types/fs-extra": "11.0.4", "@types/mime-types": "catalog:", "@types/node": "catalog:", - "@types/normalize-path": "3.0.2", "@types/react": "catalog:", "@types/react-dom": "catalog:", "@types/webpack": "5.28.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 554c50bde5..64670c3300 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -705,9 +705,6 @@ importers: mime-types: specifier: ^3.0.0 version: 3.0.2 - normalize-path: - specifier: ^3.0.0 - version: 3.0.0 nypm: specifier: 'catalog:' version: 0.6.6 @@ -907,9 +904,6 @@ importers: '@types/node': specifier: 'catalog:' version: 22.19.18 - '@types/normalize-path': - specifier: 3.0.2 - version: 3.0.2 '@types/react': specifier: 'catalog:' version: 19.2.14 @@ -4374,9 +4368,6 @@ packages: '@types/node@25.5.0': resolution: {integrity: sha512-jp2P3tQMSxWugkCUKLRPVUpGaL5MVFwF8RDuSRztfwgN1wmqJeMSbKlnEtQqU8UrhTmzEmZdu2I6v2dpp7XIxw==} - '@types/normalize-path@3.0.2': - resolution: {integrity: sha512-DO++toKYPaFn0Z8hQ7Tx+3iT9t77IJo/nDiqTXilgEP+kPNIYdpS9kh3fXuc53ugqwp9pxC1PVjCpV1tQDyqMA==} - '@types/offscreencanvas@2019.7.3': resolution: {integrity: sha512-ieXiYmgSRXUDeOntE1InxjWyvEelZGP63M+cGuquuRLuIKKT1osnkXjxev9B7d1nXSug5vpunx+gNlbVxMlC9A==} @@ -12892,8 +12883,6 @@ snapshots: dependencies: undici-types: 7.18.2 - '@types/normalize-path@3.0.2': {} - '@types/offscreencanvas@2019.7.3': {} '@types/prismjs@1.26.6': {}