Closed superkhau closed 9 years ago
I am not a big fan of Makefiles in Node projects, because they don't work on Windows. AFAIK, shelljs should make it super easy to write shell-like scripts in Node.
Also the convention is to add targets like selfupdate
to package.json, so that one can run npm run selfupdate
.
Last but not least, I'd like to see a command that will add all modifications to git index. This is the final user experience I have in my mind:
$ npm run selfupdate
$ git commit -m 'Update to loopback template x.y.z'
$ git push
when asked for the application name, press
Please print this help message from the update script. Most people don't read docs :)
$ npm run selfupdate
Rebuilding the example. When asked for the application name, press <enter>
Another thing to consider: store the version of generator-loopback
and loopback-workspace
that generated the app. That's out of scope of this PR though.
Please print this help message from the update script. Most people don't read docs :)
Good idea. Added. ;)
@bajtos I'm having trouble executing slc loopback
using shelljs
(or even `child_process.exec for that matter) due to the yeoman prompt. Here is a gist: https://gist.github.com/superkhau/696826a05035c7c5e1b8
Basically gets stuck and you can't "press enter" to accept the value. Do you have a solution around this? I'm going to fall back to modifying the Makefile with the smaller items you proposed.
Anyways, the current experience is pretty close to what you're saying:
$ make
$ git commit -m 'Update to loopback template x.y.z'
$ git push
is pretty close to:
$ npm run selfupdate
$ git commit -m 'Update to loopback template x.y.z'
$ git push
I am blocked on using shelljs
(or child_process.exec
for that matter) until we can figure out how to get "non-interactive" mode working with those libraries (ie. can't press shelljs
).
The two other things we need to decide are:
shelljs
as suggested by @bajtos, but it doesn't work ATM with the yeoman prompts)selfupdate
target in package.json
?
npm run selfupdate
instead of make
(overkill in that I will have to write the logic to re-insert the target back into the newly scaffolded package.json
)npm run
targets are good for usual projects, but the purpose of this project is to have a self-updating script that we (internal users) can execute easily?@bajtos @raymondfeng @ritch Thoughts?
@superkhau Based on your comments, since the effort required to rework the Makefile to shelljs
script is non-trivial, it is OK to stick to Makefile. Let's not spend too much time on this.
@bajtos TY, merging.
Wrong button. ;p