Skip to content

Commit

Permalink
fix(create-jsx-email): update generators path for new project setup (#…
Browse files Browse the repository at this point in the history
…240)

Co-authored-by: shellscape <[email protected]>
  • Loading branch information
lordelogos and shellscape authored Nov 15, 2024
1 parent f5eafd0 commit 43c34f1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/create-jsx-email/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
3 changes: 2 additions & 1 deletion test/cli/.snapshots/create-jsx-email.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down
7 changes: 5 additions & 2 deletions test/cli/create-jsx-email.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});

0 comments on commit 43c34f1

Please sign in to comment.