jstransformers / jstransformer

Normalize the API of any JSTransformer.
http://npm.im/jstransformer
MIT License
152 stars 12 forks source link

Implement missing transformers #1

Closed ForbesLindesay closed 9 years ago

ForbesLindesay commented 9 years ago

This project aims to replace transformers with a large collection of separate libraries, each of which able to be separately maintained, tested and updated. Each library will implement some subset of the API in this module, and may optionally return a string body rather than the {body: String, dependencies: Array.<String>} format (lots of file formats don't actually have dependencies so it wouldn't really make sense). This module can then be used to fully normalise that interface, including implementing the methods that are otherwise not implemented.

Here is a list of all the modules that need implementing

Once all of these have been implemented, we can switch jade to look for these rather than transformers. I'll need as many collaborators as possible for this, so if you're willing to contribute a transformer, let me know and I'll add you to the organisation. P.S. note that we add jstransformer to the keywords in package.json for all transformers, so they can be found at https://www.npmjs.com/browse/keyword/jstransformer

tunnckoCore commented 9 years ago

:sparkles: postcss :sparkles: transform CSS to JSON AST using postcss.parse()

tunnckoCore commented 9 years ago

:sparkles: myth :sparkles: done

TimothyGu commented 9 years ago

@tunnckoCore, I am not exactly satisfied with the quality of the new modules.

  1. jstransformer-css has a very confusing name. It is impossible to tell that it is a CSS parser just from its name. Even though css is the name of the module I think it would make more sense if a more descriptive name is used.
  2. Stuff like this
  3. Stuff like this
  4. I also don't feel comfortable with https://github.com/jstransformers/jstransformer-postcss#author. That kind of destroys the unity of jstransfomers as an organization.

I would also suggest looking at the existing modules to get a feel on how everything works, to preserve some sense of unity among all the modules: https://github.com/jstransformers/jstransformer-jade/blob/master/package.json#L16-L20

I also do not think we should do things like:

matrix:
  allow_failures:
    - node_js: "0.10"

or

node_js:
  - 0.11

If we don't support 0.10 why test it at all? Plus nobody uses Node.js 0.11 (or at least nobody encourages using 0.11 now that 0.12 is out). Those are just plain useless.

Also, these files are also up for discussion:

tunnckoCore commented 9 years ago
  1. its better to be than jstransformer-reworkcss, actually it is just transform from css to json, so dont see the problem
  2. i cant understand whats the problem is. just describes that pkg is published as v0.1.1
  3. always add it because I dont want in every change to go to the shitty coveralls.io website to regen it and get it and etc, and etc.

If we don't support 0.10 why test it at all? Plus nobody uses Node.js 0.11 (or at least nobody encourages using 0.11 now that 0.12 is out). Those are just plain useless.

templates, templates, templates. I must change them soon. Also they are the reason for the author and etc stuff. I just forgot that.

TimothyGu commented 9 years ago
  1. its better to be than jstransformer-reworkcss

Have you considered jstransformer-css-parse?

  1. always add it because I dont want in every change to go to the shitty coveralls.io website to regen it and get it and etc, and etc.

See how it is already done in other modules. You do NOT need to add the token to the Git repo, as coveralls now support Travis CI out-of-the-box. No tokens needed.

Posting the token unencrypted is a security hole, and can be exploited. See for example davidbau/seedrandom#17 and proof of concept.

templates, templates, templates. I must change them soon. Also they are the reason for the author and etc stuff. I just forgot that.

Yes I understand. I am planning on create a boilerplates repo under the org to make it easier to create new modules.

tunnckoCore commented 9 years ago

No tokens needed.

hm, thanks, good to know.

ForbesLindesay commented 9 years ago

As part of the www I was thinking of creating a not so we could have a button that anyone (within reason) could create a new repo with appropriate boilerplate set up and be given admin rights.

As for naming I'd much prefer css-parse but I can see why you went with css. The convention is to use the module name, but in this case that isn't very descriptive.

What I had in mind for rework was using rework and taking a list of plugins to do css to css transformation.

ForbesLindesay commented 9 years ago

For versioning, don't duplicate the version. You already put that in the heading of the changelig anyway. Look at github.com/jadejs/jade for an example of how the change log should look.

We may want to create tooling around change logs or an additional www page in the future so we should be careful to keep that consistent.

tunnckoCore commented 9 years ago

What I had in mind for rework was using rework and taking a list of plugins to do css to css transformation.

cool. and seems it is better that I didn't get the jstransformer-reworkcss name :)

tunnckoCore commented 9 years ago

habits, bite me, lol

It was better you start with these things before any else.

tunnckoCore commented 9 years ago

Can I use different promise library?

ForbesLindesay commented 9 years ago

It should just be jstransformer-rework as that's the module name. We don't generally append the output format to the name.

Also postcss should output the transformed css rather than an ast. We could have a separate postcss-parser transform.

tunnckoCore commented 9 years ago

You're added to the npm, guys. :)

btw, about

I'll write a bot at some point to add all of the owners on GitHub as owners on npm :)

I called it package-ownership https://github.com/tunnckoCore/blankr/issues/23

TimothyGu commented 9 years ago

@tunnckoCore

I called it package-ownership tunnckoCore/blankr#23

BTW, the bot itself literally takes only 6 lines of Bash code. Problem is we don't know where to store the owner information.

tunnckoCore commented 9 years ago

I try it, but not works for me on centos.

Problem is we don't know where to store the owner information.

meta repository as in regexps, datetime and there we store all discussions, questions and etc.

hemanth commented 9 years ago

A big :+1: for a meta repository, it's proven to be very useful multiple number of times.

TimothyGu commented 9 years ago

^^ +1 too. Created: https://github.com/jstransformers/meta

TimothyGu commented 9 years ago

@tunnckoCore said:

I try it, but not works for me on centos.

Yes, because that depends on the up-to-dateness of the ownership of the jstransformer package, which right now only has one owner.

tunnckoCore commented 9 years ago

toml and ini added to the list.

tunnckoCore commented 9 years ago

@ForbesLindesay feel free to change purpose of postcss and css transformers, your ideas seems better

tunnckoCore commented 9 years ago

:sparkles: toml :sparkles: done

tunnckoCore commented 9 years ago

https://github.com/Leonidas-from-XIV/node-xml2js - added to the list

tunnckoCore commented 9 years ago

:sparkles: toffee :sparkles: done :sparkles: xml2js :sparkles: done :sparkles: mini-handlebars :sparkles: done

:sparkles: j140 :sparkles: added, btw mega powerful for just 140bytes lib, but using with :sparkles: octet :sparkles: added

:sparkles: handlebars :sparkles: PR added more tests and render methods

tunnckoCore commented 9 years ago

:sparkles: gray-matter :sparkles: done

tunnckoCore commented 9 years ago

:sparkles: lodash :sparkles: added

ForbesLindesay commented 9 years ago

Don't forget to push your code before commenting here

tunnckoCore commented 9 years ago

@ForbesLindesay yea. With "added" I mean "added to the list" :)

btw, about template cruft, no problems I'll update all my libs in org as soon as I create basic project generator for jstransformers - workin on that now :) thought that isn't a problem? :)

TimothyGu commented 9 years ago

@tunnckoCore please add the new libraries to the "potential extras" instead of the main list. Also, you can try porting the ones from transformers first THEN adding extras.

tunnckoCore commented 9 years ago

please add the new libraries to the "potential extras"

@TimothyGu sorry, done and okey.

stoeffel commented 9 years ago

I created a transformer for jsx. If you like I can pass it over to you guys. https://github.com/stoeffel/jstransformer-jsx

hemanth commented 9 years ago

Nice @stoeffel.

Update: Sorted the list and looks like jqtpl is depreciated, so stroked it.

tunnckoCore commented 9 years ago

@jstransformers/owners btw, I reimplement the rework and postcss transforms to match @ForbesLindesay expectations and ideas - css to css transformation. I thought the following would be the best:

tunnckoCore commented 9 years ago

will commit them tomorrow :)

ForbesLindesay commented 9 years ago

@tunnckoCore That sounds ideal

stoeffel commented 9 years ago

I have moved jstransformer-jsx from stoeffel/jstransformer-jsx to jstransformers/jstransformer-jsx.

tunnckoCore commented 9 years ago

I'm back again :) All is done, going to normalize/update my other libs in org.

RobLoach commented 9 years ago

Thoughts on jstransformer-es6-templates? It's a bit hacky, so I'm not sure if it's something for /jstransformers.

tunnckoCore commented 9 years ago

:+1: I think for it before few days, but using https://github.com/medikoo/es6-template-strings instead.

tunnckoCore commented 9 years ago

@RobLoach seems to be better to use medikoo's package, its more up-to-date.

RobLoach commented 9 years ago

I think for it before few days, but using https://github.com/medikoo/es6-template-strings instead.

Thanks! Good find.... Updated and moved to here: https://github.com/jstransformers/jstransformer-es6-template-strings

tunnckoCore commented 9 years ago

@RobLoach see the commit comment :)

RobLoach commented 9 years ago

@stoeffel Used generator-jstransformer for jstransformer-es6-template-strings, jstransformer-whiskers and jstransformer-styl. It worked perfectly :+1: .

tunnckoCore commented 9 years ago

@RobLoach yep, but yeoman is too big and too shitty, same as gulp. lol

btw, should run add-owners for ur packages :)

tunnckoCore commented 9 years ago

:100: jstransformer-absurd :100: added to the list and almost finished, it is little tricky because not so node-friendly api.

stoeffel commented 9 years ago

@RobLoach nice :sunglasses:

tunnckoCore commented 9 years ago

hm.. both coffeekup and coffeecup looks very outdated and are similar, so i think we should implement only one of them?

tunnckoCore commented 9 years ago

coffeekup - done

tunnckoCore commented 9 years ago

list is sorted again added to the list

ForbesLindesay commented 9 years ago

I'm not sure about the explosion of postcss based transformers. I feel like maybe we should be taking the approach of the less transformer and accepting a plugins option instead of having a jstransformer per plugin. One very real downside of the approach we are taking at the moment is that a pipeline of postcss transformations could have very poor performance.

tunnckoCore commented 9 years ago

a plugins option

Yea, we will, I'll update postcss, rework and styl later today. But they are almost separate transformation tools, commonly used and it will be just sugar of doing install jstransformer-postcss, install cssnext, install autoprefixer separately.

This dont have bad side.

is that a pipeline of postcss transformations could have very poor performance.

And? This isn't jstransformer(s) problem.