es4x icon indicating copy to clipboard operation
es4x copied to clipboard

Enhance the initial use of this function

Open yuangu opened this issue 5 years ago • 4 comments

I have a idea. Auto create a typescript project by run es4x init with --typescript or -t 。It's not manual copy file by sample. And “mvnDependencies ” added to the package.json by default. Because a lot of people don't know about it。 If you agree, I can modify this code. ^_^

yuangu avatar Aug 17 '20 07:08 yuangu

@yuangu I've been also thinking of something like this for a while. Currently I think the workflow is quite tedious and does not feel natural, a user needs to do:

npm init
es4x init
# manually add ts dependencies

I've read about npm init command a while ago here: https://www.stefanjudis.com/today-i-learned/npm-init-uses-npx-under-the-hood/

I was thinking back then that if we would have a create module (which I would host under the @es4x user) we could automate the whole thing as:

npm init @es4x --typescript

Where the last flag would be optional and when not present would just create a bare bones js project. As a starting point we could look how vue is doing it here:

https://github.com/vitejs/create-vite-app

As it already supports several templates. With this in place we could then remove the init command from es4x-pm as it would be useless.

Is this something you would be interested in contribute?

pmlopes avatar Aug 17 '20 07:08 pmlopes

@yuangu I've added the following pull request:

https://github.com/reactiverse/es4x/pull/375

This will allow you later to start a project with:

npm init es4x-app -t ts

for TypeScript and without args for JavaScript.

Let me know if you want to improve the templates / add any interesting missing files...

pmlopes avatar Aug 24 '20 12:08 pmlopes

i am strong against all that for the following reasons.

  • We need to stop using npm as deployment option it is not a good fit for the project and it would not even exist on systems without graalvm or nodejs installed
  • When the npm from nodejs is used the nodejs version will not be used by this apps at all.
  • We should not need a additional nodejs installation or graalvm node which is slow to install es4x.

While i agree that scalfolding a project is a nice thing i am for maven only package management. and scalefolding via template skeleton dirs maybe but that needs to work with bash only or java out of the box.

frank-dspeed avatar Sep 01 '20 17:09 frank-dspeed

I agree with some of the points. I think that as we currently can work with http modules (just like deno), the missing part is that we can't really define dependencies so a build tool is still needed. If the current tool, could work the reverse, from maven dependencies fetch npm then we can avoid a build tool.

pmlopes avatar Sep 22 '20 20:09 pmlopes