Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Conversation

@Julien-R44
Copy link
Contributor

Proposed changes

As proposed here : adonisjs/core#3709

 _ _ _ _ ____ / \ __| | ___ _ __ (_)___ | / ___| / _ \ / _` |/ _ \| '_ \| / __|_ | \___ \ / ___ \ (_| | (_) | | | | \__ \ |_| |___) | /_/ \_\__,_|\___/|_| |_|_|___/\___/|____/ CUSTOMIZE PROJECT .... > Setup Japa ( testing framework ) and its preset for AdonisJS? (y/N) · true 

Types of changes

What types of changes does your code introduce?

Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
@RomainLanz
Copy link
Collaborator

Should we have yes as a default instead of no?

@Julien-R44
Copy link
Contributor Author

Totally agree ! Done

@Julien-R44
Copy link
Contributor Author

Btw, I would also be in favor to have a "yes" by default on the installation of prettier and eslint, but it's another subject

@thetutlage
Copy link
Member

thetutlage commented May 5, 2022

Do we really want to do this?

What is the alternative to Japa right now when it comes to testing AdonisJS apps?

If you use Jest, you cannot go too far, because there will be no helpers to login users during HTTP requests, no helpers to easily migrate/rollback database.

@Julien-R44
Copy link
Contributor Author

Julien-R44 commented May 5, 2022

It should be possible to use TestUtils from another test runner, no?
For example migrations, from what I see it seems possible ( tell me if I'm wrong )

For Auth on the other hand it seems more complicated because it depends on Japa. But the user should be able to create his own helpers to facilitate his tests or it is simply impossible?

@thetutlage
Copy link
Member

thetutlage commented May 5, 2022

For Auth on the other hand it seems more complicated because it depends on Japa. But the user should be able to create his own helpers to facilitate his tests or it is simply impossible?

It's possible. But no one has done it so far, so I am not sure what are we optimizing for, by making the Japa test runner optional.

If someone comes with a good Jest implementation, then yes we can make it optional. But right now, we are doing it just for the sake of modularity.


Now someone might ask, well what's the issue in being modular?
The issue is decision fatigue. Why are we making others select/ignore packages which does not have a good alternative anyways. Infact, I was thinking to pre-install lucid and auth for api and web boilerplates

@thetutlage
Copy link
Member

Here is a small proposal. I think discuss it in long term too (if required)

  • The web and api boilerplate to always come with lucid and auth
  • We can drop the tests runner from the slim boilerplate and keep it for those who wants to configure every bit by hand

Again, the reason others use AdonisJS because it comes with everything you need to build an end to end application. And minimalists anyways drop off and use express or something similar

@Julien-R44
Copy link
Contributor Author

Okay, I understand and I even agree.
I have no argument for this PR except that it is indeed more "modular", but as you say, there is no serious alternative, so it is not really relevant. I jumped on the PR without thinking about it when I saw Romain's ping 😅

I also agree to integrate lucid and auth by default. But I think that, more widely, it is worth discussing my proposal here: #43

IMO, the best solution would probably be to propose the installation of these packages during create-adonis-ts-app. In my case, most of my AdonisJS applications use mailer/lucid/auth/Redis/drive.

I like this full-featured side of AdonisJS, and it would be great to have all the tools I need in one command line.
Today, as it is, I'll have to do npm install && node ace configure on all the packages I'll need, and it's a bit boring.

@thetutlage
Copy link
Member

I like this full-featured side of AdonisJS, and it would be great to have all the tools I need in one command line.

Yup, I agree. We can have a default set of packages and then additional one's can be configured with CLI flags.

Let's see if @RomainLanz has something else in mind that we cannot see.

My take is to make the initial boilerplates even more opinionated vs making them modular.

@mikesaintsg
Copy link

@thetutlage I would say you have somewhat of a point for now, but we have already been using our own custom runners (using just japa/core)

If the runner can at least be dropped from the slim version as you mentioned before, then that would be good enough for me.

Personally, I was drawn to AdonisJS since it isn't as opinionated as Laravel and with much less boilerplate.

@RomainLanz
Copy link
Collaborator

Sorry for the late reply.

I like the idea to be able to customize the application the way we want during the scaffolding process.
Some people may not want to have the testing framework at all.

IMO, removing it from default installation is the way to go. We stay opinionated and modular, we don't force people to use our module, we give them the opportunity to use whatever they want.

@thetutlage
Copy link
Member

I like the idea to be able to customize the application the way we want during the scaffolding process. Some people may not want to have the testing framework at all.

This will hamper the experience for the once that needs a fully featured scaffold by default (that is the majority of users). Just making them answer 7-8 prompts.

I will keep the web and api boilerplates highly opinionated and keep the slim one as slim and minimalists can go with the slim one

@Julien-R44
Copy link
Contributor Author

We could keep the three default boilerplates and add a "custom" next to them? When the user selects "custom" instead of "web/api/slim" then at that point we do prompts the user what they want to install?

@RomainLanz
Copy link
Collaborator

This will hamper the experience for the once that needs a fully featured scaffold by default (that is the majority of users). Just making them answer 7-8 prompts.

I am not sure about that, but if it is a concern, we could add a --customize that asks before installing dependencies; if this option is not provided, then we use the "default" for each boilerplate. What do you think?

@thetutlage
Copy link
Member

thetutlage commented May 9, 2022

We could keep the three default boilerplates and add a "custom" next to them? When the user selects "custom" instead of "web/api/slim" then at that point we do prompts the user what they want to install?

Trust me, if we do a poll today, then 90% will be in the favor of just install lucid, auth and japa by default. Yes, 10% needs more control. But there is no way we can cater 100% of people with our choices.

Infact, we can drop slim and add custom and let the user cherry pick every small bit

@thetutlage
Copy link
Member

I am not sure about that, but if it is a concern, we could add a --customize that asks before installing dependencies; if this option is not provided, then we use the "default" for each boilerplate. What do you think?

Not a bad idea

@RomainLanz
Copy link
Collaborator

RomainLanz commented May 9, 2022

But I agree; when people select a boilerplate, it looks like everything should be set up, and no question should be asked.

Now the question would be: what happened with prettier& eslint or with Encore?

I like the idea of having a tailored boilerplate that lets the user cherry-pick what he wants.

@thetutlage
Copy link
Member

Now the question would be: what happened with prettier& eslint or with Encore?

Yeah, these are tricky one's and I think I have some reasoning behind them (atleast I have told this to myself :) )

Prettier and EsLint both are not part of the framework, so if I don't use the settings suggested by the framework, then it is very easy for me to install them afterwards with my own/team settings. Also, here the chances of using our defaults are low. If, I am part of a team, I will prefer to use the team settings.

Regarding Encore. Yes, let's install it by default. One less question to answer

@Julien-R44
Copy link
Contributor Author

So, to recap:

  • Boilerplate web:

    • Lucid
    • Repl
    • Session
    • View
    • Auth
    • Japa
    • Bouncer
    • Shield (?)
    • Mailer (?)
  • Boilerplate API :

    • Lucid
    • Repl
    • Session
    • Auth
    • Japa
    • Bouncer
    • Shield (?)
    • Mailer (?)
  • "Boilerplate" Custom comes only with core/repl and we prompts the user for installing every AdonisJS packages, so :

    • Lucid
    • Repl
    • Session
    • Auth
    • Japa
    • Bouncer
    • Shield
    • Mailer
    • Ally
    • Drive
    • i18n
    • Encore
    • Redis

The three boilerplate ask the user if he wants to install eslint /prettier

That are going to be a lot of prompts for the custom version, but personally, I'm totally okay with that, and that will be my default choice for all my future applications because I will not have to do x npm install x && node ace configure x. And I can also avoid installing packages that will be useless in my case. For example, I could very well make an API without Lucid

Now I'm not sure I understand the interest in the --customize flag proposed by Romain. If I select the web boilerplate with this flag, finally it's like using the "custom" boilerplate? So what would be the point? The questions will have a default answer of "yes" in case the package is integrated into the boilerplate in question?

@RomainLanz
Copy link
Collaborator

Now I'm not sure I understand the interest in the --customize flag proposed by Romain. If I select the web boilerplate with this flag, finally it's like using the "custom" boilerplate? So what would be the point? The questions will have a default answer of "yes" in case the package is integrated into the boilerplate in question?

I am not sure it would be useful with the tailored boilerplate, at least, not at the beginning with the amount of packages we have.

The goal of that flag would be to customize the selected boilerplate, but we can forget about it for the moment.

@thetutlage
Copy link
Member

@Julien-R44 Yup, I am onboard with the choices

@RomainLanz
Copy link
Collaborator

Instead of having a y/n choice, what do you think of having a select with some options pre-selected?

@thetutlage
Copy link
Member

Instead of having a y/n choice, what do you think of having a select with some options pre-selected?

For the slim boilerplate?

@RomainLanz
Copy link
Collaborator

Instead of having a y/n choice, what do you think of having a select with some options pre-selected?

For the slim boilerplate?

Yes, for the custom/tailored/slim

@thetutlage
Copy link
Member

Yup. That does make sense

@Julien-R44
Copy link
Contributor Author

Ok cool guys, thanks !
I'll add this on my todo list and try to propose something in the next weeks

@Julien-R44 Julien-R44 closed this May 17, 2022
@Julien-R44 Julien-R44 deleted the feat/prompt-japa-install branch May 17, 2022 08:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

5 participants