dawson-org / dawson-cli

A serverless web framework for Node.js on AWS (CloudFormation, CloudFront, API Gateway, Lambda)
https://dawson.sh
GNU General Public License v3.0
713 stars 25 forks source link

Support for individual project babel configuration #163

Closed rakistner closed 7 years ago

rakistner commented 7 years ago

The validateBabelRc() function on line 237 in src/config.js throws an error when there's a .babelrc file in the project root directory, and asks for a babel: {} property in the package.json file instead, however nothing was done with that property, and a babel override would be nice to extend the base config to include other presets and plugins for syntax support, transforms, react, etc..

lusentis commented 7 years ago

Thank you very much for your PR! Have you had a chance to test this already? I'll merge today if everything is OK.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-2.2%) to 68.393% when pulling 2c60b112152b3c105abd20e7f52f3305a38d2f58 on rakistner:master into ab9f6e4794e0f0762a30281fc99f630615c284f5 on dawson-org:master.

rakistner commented 7 years ago

I updated config.js to resolve the package.json file as recommended. Needed to update compile.js function to include plugins. This worked locally through a yarn add installation, but did not work through the global cli installation, so I was able to resolve this by also updating the installDeps.js function. This worked with compiling React, Marko, and plain JSX so far.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-2.09%) to 68.515% when pulling 13274c8f937dfe3abb46a1b0a6c456a94d588a46 on rakistner:master into ab9f6e4794e0f0762a30281fc99f630615c284f5 on dawson-org:master.

lusentis commented 7 years ago

Great, thank you! I've rebased so I can squash & merge, just let me test this change on a few projects today.

In a future, we'll need to cleanup the whole babel configuration logic.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-2.2%) to 68.439% when pulling dd71fb4ab6515868f4bebce62067ff901fceaed2 on rakistner:master into b15193b1c9dbaf95e0cf1bf7c9281d5e5f83030c on dawson-org:master.

lusentis commented 7 years ago

Hi @rakistner, I've pushed some changes, primarily cleanups and refactors of the old code. Now the babel-specific part is (almost) in a single file https://github.com/rakistner/dawson-cli/blob/master/src/libs/language-javascript-latest/_babelHelpers.js and should be more clear to read.

If you can test the updated code on your codebase too, then I'll merge and release!

Thank you very much for your help so far!

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-2.2%) to 68.439% when pulling 560bd8ab93dfe8547f3cd38cf35116be3e01273b on rakistner:master into 4e21e604b45a7b2ef9eccce1fcafd09e661a2e46 on dawson-org:master.

rakistner commented 7 years ago

Beautiful! Ran it through a bunch of babel configs, and everything worked great. The warning is great, and it outputs nice verbose babel errors when the config fails which are easy to trace and change with the babel config. I love it.

lusentis commented 7 years ago

Great! Thank you very much for your time. I'll merge now and publish to npm tomorrow (GMT), laptop is broken and have to use office's PC :(