sofn-xyz / mailing

Build, test, send emails with React
https://www.mailing.run
MIT License
3.6k stars 74 forks source link

Template files with dashes `-` produce invalid code for `moduleManifest.ts` #447

Closed m5r closed 1 year ago

m5r commented 1 year ago

Describe the bug Filenames with dashes make the templater produce invalid code for moduleManifest.ts

✘ [ERROR] Expected "from" but found "-"

    .mailing/src/moduleManifest.ts:9:12:
      9 │ import reset-password from "../../emails/reset-password";
        │             ^
        ╵             from

wait  - compiling...
error - unhandledRejection: Error: Build failed with 1 error:
.mailing/src/moduleManifest.ts:9:12: ERROR: Expected "from" but found "-"
    at failureErrorWithLog (/home/mokhtar/app/remixtape/node_modules/mailing/node_modules/esbuild/lib/main.js:1575:15)
    at /home/mokhtar/app/remixtape/node_modules/mailing/node_modules/esbuild/lib/main.js:1033:28
    at /home/mokhtar/app/remixtape/node_modules/mailing/node_modules/esbuild/lib/main.js:978:67
    at buildResponseToResult (/home/mokhtar/app/remixtape/node_modules/mailing/node_modules/esbuild/lib/main.js:1031:7)
    at /home/mokhtar/app/remixtape/node_modules/mailing/node_modules/esbuild/lib/main.js:1143:14
    at responseCallbacks.<computed> (/home/mokhtar/app/remixtape/node_modules/mailing/node_modules/esbuild/lib/main.js:680:9)
    at handleIncomingPacket (/home/mokhtar/app/remixtape/node_modules/mailing/node_modules/esbuild/lib/main.js:735:9)
    at Socket.readFromStdout (/home/mokhtar/app/remixtape/node_modules/mailing/node_modules/esbuild/lib/main.js:656:7)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Readable.push (node:internal/streams/readable:234:10)
    at Pipe.onStreamRead (node:internal/stream_base_commons:190:23) {
  errors: [
    {
      detail: undefined,
      id: '',
      location: [Object],
      notes: [],
      pluginName: '',
      text: 'Expected "from" but found "-"'
    }
  ],
  warnings: []
}

To Reproduce Steps to reproduce the behavior:

  1. Create an email with a dash in the filename i.e. reset-password.tsx
  2. Run npx mailing preview
  3. See error in the logs

Expected behavior I would expect my email templates to get picked up and work even if their file names contain dashes

Desktop (please complete the following information):

alexfarrill commented 1 year ago

@m5r This is released in 0.9.11. Thanks again for the PR and for using Mailing :)