ungoldman / module-init

:checkered_flag: Create a new node module with all the right stuff.
ISC License
71 stars 8 forks source link

initiate a module that uses ES2015 with transpilation #27

Closed Flet closed 9 years ago

Flet commented 9 years ago

Is there any interest in adding another option to module-init to initialize a module structured to be written in ES2015 and using transpilation by babel?

This little boilerplate seems to cover the standard practices for transpiled packages: https://github.com/vinniegarcia/es6-module-starter - it includes a lot of extra non-ES2015 stuff that is not pertinent, but you get the idea.

The biggest structural change is all code being in /src and being transpiled to /dist, with the package.json pointing to dist/index.js for the "main" attribute.

The the directory layout may be different enough to warrant a totally separate CLI package (module-init-next??), but it could also be achieved here with enough work (separate templates directory?).

I guess it depends on @ngoldman's vision for this module. Any thoughts?

Flet commented 9 years ago

Looking deeper at this, I think the template change would really just be package.json... and with full mustache now, we may be able to achieve this in a single file.

If we decide to add default test.js/index.js (in #14), we would have to think about how to deal with it... separate templates or more conditionals (or go bananas with something like recast heh).

ungoldman commented 9 years ago

This might be a little out of scope for now -- I think module-init is pretty close to doing everything it was designed to do. Adding transpilation build tools is venturing into the land of yeoman style generators (as opposed to just the bare bones boilerplate usable by any node module). That said, I like the idea of a module-init-next or something like that.

Flet commented 9 years ago

Cool! Thanks for the clarification!

ungoldman commented 9 years ago

Noticed this the other day, may be useful/interesting: https://github.com/yoshuawuyts/copy-template-dir

Flet commented 9 years ago

Yeah this is cool for sure! It only does replacement though, so conditional stuff would need to be rethought.