Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(create-jsx-email): update generators path for new project setup #240

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
});
});
Loading