adonisjs / mail

AdonisJS Email Provider
MIT License
106 stars 34 forks source link

Not template folder included, problem with provider #48

Closed bitkidd closed 4 years ago

bitkidd commented 4 years ago

Tried to install @adonisjs/mail@alpha package and got several issues. The first one is that no template folder in build directory, so node ace invoke cannot proceed. The second is somehow related to provider itself:

Error: Make sure export default the provider from /node_modules/@adonisjs/mail/build/providers/MailProvider.js

Package version

4.0.0 or alpha

Node.js and npm version

12.16.3 6.14.4

Sample Code (to reproduce the issue)

None

BONUS (a sample repo to reproduce the issue)

Just get @adonisjs/mail@alpha

RomainLanz commented 4 years ago

Hey @bitkidd! 👋

This module isn't ready for Adonis 5 yet. You can join our Discord Server or follow us on Twitter to know when it will be!

Closing in the meanwhile.

msrumon commented 4 years ago

Could this be the reason? https://github.com/adonisjs/mail/blob/d1b8e49d39a95aa8aee187a2120a01dbc22820d5/providers/MailProvider.ts#L13 This should be

export default class MailProvider {

By the way, I solved provider error by manually editing the file: node_modules/@adonisjs/mail/build/providers/MailProvider.js and line 29: exports.MailProvider = MailProvider; exports.default = MailProvider; Now I'm trying to solve the other error (template file not found)...

thetutlage commented 4 years ago

I suggest looking at the other AdonisJS packages especially sessions to see how we are doing it there. Otherwise I will look into in sometime (not 100% sure of the timeline, but getting this package ready for usage is one of my top priorities)

msrumon commented 4 years ago

Ran these two commands: npm i @adonisjs/mail@alpha and then node ace invoke @adonisjs/mail. Now everything went okay, but I get these compilation errors:

error TS2688: Cannot find type definition file for '@adonisjs/mail'.
config/mail.ts:9:10 - error TS2305: Module '"@ioc:Adonis/Addons/Mail"' has no exported member 'MailerConfigContract'.

9 import { MailerConfigContract } from '@ioc:Adonis/Addons/Mail'
           ~~~~~~~~~~~~~~~~~~~~
config/mail.ts:48:13 - error TS2352: Conversion of type 'string | boolean | null | undefined' to type 'number' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  Type 'true' is not comparable to type 'number'.

48       port: Env.get('SMTP_PORT') as number,
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
contracts/mail.ts:9:12 - error TS2303: Circular definition of import alias 'MailDrivers'.

9   import { MailDrivers } from '@ioc:Adonis/Addons/Mail'
             ~~~~~~~~~~~
contracts/mail.ts:9:12 - error TS2459: Module '"@ioc:Adonis/Addons/Mail"' declares 'MailDrivers' locally, but it is not exported.

9   import { MailDrivers } from '@ioc:Adonis/Addons/Mail'
             ~~~~~~~~~~~

  contracts/mail.ts:9:12
    9   import { MailDrivers } from '@ioc:Adonis/Addons/Mail'
                 ~~~~~~~~~~~
    'MailDrivers' is declared here.

Although I am seeing everything is okay... https://github.com/adonisjs/mail/blob/6ff20e7a8fefac6bfb31b00852f9548efc77c717/adonis-typings/mail.ts#L148-L157 https://github.com/adonisjs/mail/blob/6ff20e7a8fefac6bfb31b00852f9548efc77c717/adonis-typings/mail.ts#L172-L175 ...but can't understand what's going wrong here. VS Code only suggests MailersList interface from @ioc:Adonis/Addons/Mail. I hope you'll look into this at your earliest.

RomainLanz commented 4 years ago

This package isn't ready for V5, we never communicated on it for a reason. Closing and locking this.