meanjs / mean

MEAN.JS - Full-Stack JavaScript Using MongoDB, Express, AngularJS, and Node.js -
http://meanjs.org
MIT License
4.87k stars 1.98k forks source link

feat(ES6-7): switch from Es5 to es6-7, add babel for production, delete uglify #1954

Closed PierreBrisorgueil closed 6 years ago

PierreBrisorgueil commented 6 years ago

begin switch from es5 to 6-7 with lebab https://lebab.io , on server side only.

I can add this on client side with gulp-babel to transpil, i will have a look on this.

like other PR we need to end fix travis to check build, but in local everything seems to be ok

lirantal commented 6 years ago

Seems like we need to rebase this one as well!

PierreBrisorgueil commented 6 years ago

done, failed due to bower, I think we have nothing to fix if we merge yarn PR :)

PierreBrisorgueil commented 6 years ago

@lirantal i have push the client side in ES6 on this PR too

work done :

Actually, just the production build use babel. Development use client side in ES6, works fine.

All new dependencies are added in devDependencies part ( due to gulp-babel readme.md)

I'm wainting this merge to update all dependencies and other quick PR. Can't really touch the code before that.

/!\ we always have a problem with webdriver-manager update https://travis-ci.org/meanjs/mean/jobs/353785079

lirantal commented 6 years ago

I think development build should also use babel. It should be consistent so if bug happens in dev they would be discovered before they show up on prod due to babeling or something. So let's make sure we use everywhere the same setup regardless of the env.

lirantal commented 6 years ago

Great stuff @PierreBrisorgueil!

PierreBrisorgueil commented 6 years ago

thx, ok, I realized this to follow the principle of uglify today, clean code realized only for the prod. Browsers are often portable ES6, and free to dev who wants to go into detail to activate babel in dev :)

I'll take a look on this, but it comes to build and minify in public/dist in the dev environment on watch, maybe it should be a choice. We have to see how long it takes :)

lirantal commented 6 years ago

@PierreBrisorgueil ok appreciate it. ping me back what you end up going for and let's review

PierreBrisorgueil commented 6 years ago

@lirantal

I finished a first version with some modifications. I changed some gulp tasks for that. And added gulp-if-env.

The only thing changed that isn't in the optics of using babel is the call of '' env: prod ',' lint '" in the prod task. I did not understand the goal actually, the build task already contain lint and is also called. So I removed this double call of lint, and move the configuration of the env at the start of the prod task.

For babel :

in dev

in prod

Another change is that I deleted the watch on the production part. I do not think it makes sense. for me we should also delete nodemon ... But I can look to add him again, if we need this in the stack. As the file names change each time in prod (gulp-rev) there is just a little problem to manage to refresh the template with the right dependencies.

I didn't have time to watch the TRAVIS problem for the moment. It's really strange, sometimes it's ok, sometimes no ..

lirantal commented 6 years ago

gonna be a bit busy for a while but I want to push this forward and merge when we have a stable and working setup!

pinging @meanjs/contributors @meanjs/core if anyone can further review and follow-up please