From 43c34f1fd355cf907050d8a37af7cc3b8a8b34b0 Mon Sep 17 00:00:00 2001 From: Paul Ehikhuemen <67395687+lordelogos@users.noreply.github.com> Date: Sat, 16 Nov 2024 00:15:54 +0100 Subject: [PATCH] fix(create-jsx-email): update generators path for new project setup (#240) Co-authored-by: shellscape --- packages/create-jsx-email/src/index.ts | 2 +- test/cli/.snapshots/create-jsx-email.test.ts.snap | 3 ++- test/cli/create-jsx-email.test.ts | 7 +++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/create-jsx-email/src/index.ts b/packages/create-jsx-email/src/index.ts index 1f4e6d7f..16a84a53 100644 --- a/packages/create-jsx-email/src/index.ts +++ b/packages/create-jsx-email/src/index.ts @@ -137,7 +137,7 @@ const run = async () => { const { overwrite, projectName, projectType } = result; const root = join(process.cwd(), targetPath); - const generatorsPath = resolve(__dirname, '../generators'); + const generatorsPath = resolve(__dirname, '../dist/generators'); const jsx = projectType === 'JavaScript'; const templates = await globby([normalizePath(join(generatorsPath, '/*.*'))]); const outputPath = join(root, 'templates'); diff --git a/test/cli/.snapshots/create-jsx-email.test.ts.snap b/test/cli/.snapshots/create-jsx-email.test.ts.snap index ac2bbbb4..2032e4cf 100644 --- a/test/cli/.snapshots/create-jsx-email.test.ts.snap +++ b/test/cli/.snapshots/create-jsx-email.test.ts.snap @@ -2,7 +2,7 @@ exports[`create-jsx-email > command 1`] = ` " -create-jsx-email v2.0.4 +create-jsx-email The fastest way to get started with JSX Email @@ -126,6 +126,7 @@ export const Template = ({ email, name }: TemplateProps) => ( exports[`create-jsx-email > command 3`] = ` [ + ".test/new/.gitignore", ".test/new/README.md", ".test/new/package.json", ".test/new/tsconfig.json", diff --git a/test/cli/create-jsx-email.test.ts b/test/cli/create-jsx-email.test.ts index d22594c9..a346495f 100644 --- a/test/cli/create-jsx-email.test.ts +++ b/test/cli/create-jsx-email.test.ts @@ -15,14 +15,17 @@ describe('create-jsx-email', async () => { // Note: For some reason `pnpm exec` is fucking with our CWD, and resets it to // packages/jsx-email, which causes the config not to be found. so we use npx instead })`IS_CLI_TEST=true create-jsx-email .test/new --yes`; - const plain = strip(stdout).replace(/^(.*)create-jsx-email/, 'create-jsx-email'); + const plain = strip(stdout) + .replace(/^(.*)create-jsx-email/, 'create-jsx-email') + .replace(/v(\d+\.\d+\.\d+)/, ''); expect(plain).toMatchSnapshot(); const contents = await readFile(join(__dirname, '.test/new/templates/email.tsx'), 'utf8'); expect(contents).toMatchSnapshot(); - const files = await globby('.test/new/**/*'); + const files = await globby('.test/new/**/*', { dot: true }); + expect(files).toMatchSnapshot(); }); });