frintjs / frint

Modular JavaScript framework for building scalable and reactive applications
https://frint.js.org/
MIT License
756 stars 37 forks source link

frint-cli: Introduce "new" command #325

Closed discosultan closed 6 years ago

discosultan commented 7 years ago

About

Closes https://github.com/Travix-International/frint/issues/220

Introduces the frint new command which will replace frint init in the future. For more information, see the issue above.

frint new <directory> --example <example>

where:


Testing

Can be tested running the following script:

mkdir test1
cd test1
frint new
cd ..
frint new test2
frint new test3 --example router
frint new test4 --example frintjs/frint/tree/frint-router/examples/router

The script will generate four test folders in the current working dir for various frint new scenarios.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 97.277% when pulling 4377d24d2d8b676e7862fb5995b3ebb9c2cdad42 on impl-new-cmd into 0123345c85a38174aadb0aef1d6744dfcafeaadc on master.

fahad19 commented 7 years ago

please also update the README of frint-cli.

and also the root README of the repo under Quickstart.

discosultan commented 7 years ago

@fahad19 Before updating all the docs, is the command interface final? I mean mostly naming for params: path & example and using the structure --<param>=<value>.

fahad19 commented 7 years ago

if --path is already present in the command, do we need an additional --example too?

fahad19 commented 7 years ago

The <name> option can be renamed as <directory> or something more descriptive to avoid any confusion. I first thought <name> is for example's name :)

alexmiranda commented 7 years ago

I think both --name and --example are confusing flags in this context. If you're creating a new project, I suppose you want to determine the --template instead of the location/name of the example project it will download. Just my opinion but I'm ok with the current flags if you've had discussions on it already.

discosultan commented 7 years ago

if --path is already present in the command, do we need an additional --example too?

Currently they are separated in order not to always have to specify the full path with <example>. If you don't specify <path>, it will default to the official repo. Alternative would be to make <example> "smarter" to figure out itself whether it is defined as a full path or only an example name.

The option can be renamed as or something more descriptive to avoid any confusion. I first thought is for example's name :)

I agree only because all it currently does is create and name a directory. If it were to also transform package.json, for example, to name the application, then <name> would feel better. But this is something that can be changed in the future without compat issues. Therefore, I'll rename it to <directory> 😁.

discosultan commented 7 years ago

I think both --name and --example are confusing flags in this context. If you're creating a new project, I suppose you want to determine the --template instead of the location/name of the example project it will download. Just my opinion but I'm ok with the current flags if you've had discussions on it already.

Yeah, it's a bit confusing, because the intents of scaffolding a template vs setting up an example are sort of mixed. But previous frint init worked the same way, so I'm happy with keeping it the way it is.

markvincze commented 7 years ago

I kinda like the way dotnet new works:

So you can do:

Not saying that we should do the same, just wanted to mention as an example.

fahad19 commented 7 years ago

this is the guide from Ember CLI for example: https://ember-cli.com/user-guide/#using-ember-cli

Angular: https://github.com/angular/angular-cli#generating-and-serving-an-angular-project-via-a-development-server

markvincze commented 7 years ago

Also with Yeoman, the name of the template (which I think is the most important thing) is a non-flag argument.

discosultan commented 7 years ago

@markvincze Yeah, that's the difficult part - there are so many different CLI schemes out there. This particular impl is based on a scheme used by Node Express framework CLI.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 97.277% when pulling 10c5dba71f59c0cfc3a031039e3972689f9cb9e0 on impl-new-cmd into 0123345c85a38174aadb0aef1d6744dfcafeaadc on master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 97.277% when pulling 61a527eab62a243de2de4d7f9ff5a335b73c8249 on impl-new-cmd into 0123345c85a38174aadb0aef1d6744dfcafeaadc on master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 97.277% when pulling 61a527eab62a243de2de4d7f9ff5a335b73c8249 on impl-new-cmd into 0123345c85a38174aadb0aef1d6744dfcafeaadc on master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 97.277% when pulling 0380698041d71c0fdc8b552245de9053607ec0d9 on impl-new-cmd into 0123345c85a38174aadb0aef1d6744dfcafeaadc on master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 97.277% when pulling 96363e5d6b669ac8c3f01614ef0ba9045e9aea02 on impl-new-cmd into 0123345c85a38174aadb0aef1d6744dfcafeaadc on master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 97.277% when pulling edd992b6d7680e9b16aa3a5ee21fb5942c7ebc0b on impl-new-cmd into 0123345c85a38174aadb0aef1d6744dfcafeaadc on master.

discosultan commented 7 years ago

Very good point, @jackTheRipper ! We should definitely make both tools "feel" the same. We still have frint init, but I'm not aware of how appix CLI works. We might want to review both of them and make necessary adjustments before this PR gets merged.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.2%) to 97.432% when pulling b98f46d15a1bbf0934a933495467f8e4eaf30b9a on impl-new-cmd into 0123345c85a38174aadb0aef1d6744dfcafeaadc on master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.2%) to 97.432% when pulling 7e8ce3a65fb6acfc959edfa74a34a7d448db4283 on impl-new-cmd into 0123345c85a38174aadb0aef1d6744dfcafeaadc on master.

fahad19 commented 6 years ago

@discosultan: any update on this? :)

discosultan commented 6 years ago

I need to compare it to appix to ensure interface similarity. Hopefully will get to it soon :)

discosultan commented 6 years ago

@fahad19 I think this one is good to go now.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.009%) to 97.272% when pulling db97d2fcf9ff6daeb1a1c8ffc1024d8628202b34 on impl-new-cmd into 8e8622405ac4e1f0a5ca5c856bd0ae6c6d136f51 on master.

fahad19 commented 6 years ago

@discosultan: awesome work! 🎉

this PR is gonna be highly impactful for beginners!

do you think it is wise to wait until we move to frintjs org before we merge this? the download URL can then point to the correct URL then.

let me know what you think.

discosultan commented 6 years ago

@fahad19 Sure, I don't see any reason to rush it. Let's make the switch to new org, then I will update the init and new commands and then we can merge it.

fahad19 commented 6 years ago

cool! 👍

Refs #355

fahad19 commented 6 years ago

@discosultan: can merge as soon as the URL is updated.

discosultan commented 6 years ago

@fahad19: will update after lunch

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 97.272% when pulling 4da40f0fdb44c557b997bfacfc8547ea48224758 on impl-new-cmd into f8cd1bdad3050c3f1d39b3cb0d3a43ac02bb54f8 on master.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 97.272% when pulling 8618ab5f2fb3529308834bab1cf2f4be4ddd49b9 on impl-new-cmd into f8cd1bdad3050c3f1d39b3cb0d3a43ac02bb54f8 on master.

discosultan commented 6 years ago

All should be done now

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 97.272% when pulling 8618ab5f2fb3529308834bab1cf2f4be4ddd49b9 on impl-new-cmd into f8cd1bdad3050c3f1d39b3cb0d3a43ac02bb54f8 on master.