praekeltfoundation / jspot

Extracts gettext strings from Javascript files into pot files
BSD 3-Clause "New" or "Revised" License
12 stars 2 forks source link

Allow external extractors to be plugged in via the cli #24

Closed justinvdm closed 9 years ago

justinvdm commented 10 years ago

From the discussion on #11, the plan is to allow external extractors to be plugged in via the cli. The command might look something like:

$ jspot extract foo.html bar.jst baz.js quux.hbs -e html:hbs -e jst:jspot-jst

We could maybe have each -e first look for a bundled extractor (which I'd like to keep to just js and hbs, at least for now), and fall back to trying to require a module name (in the example above, jspot-jst).

davidlgj commented 9 years ago

Hello,

just a heads up, I've started working on this over here: https://github.com/davidlgj/jspot/tree/feature/cli-extractors

It works for me(™), but since it lacks test I didn't want to create a PR :)

ps. thanks for jspot!

justinvdm commented 9 years ago

@davidlgj thanks! Took a look, and realised that we actually aren't that far away from support this now. I adapted the bit you added, and added some tests. Just figuring out why travis isn't happy and I'll declare this PR ready for review.

davidlgj commented 9 years ago

Cool!

I guess that the problem travis has is because of the path.resolve()in the second require. Since the test uses a ./ in its module path the code is dependant on what is the current working directory, maybe travis doesn't cd to the project dir before doing npm test?

justinvdm commented 9 years ago

Ready for review.

justinvdm commented 9 years ago

@davidlgj Ya, the problem was with the one custom extractor fixture. I forgot for a second that require-ing is relative to the module's dir if a relative path is given.

davidlgj commented 9 years ago

Looks good from my side :+1: Thanks for writing the tests.

justinvdm commented 9 years ago

@davidlgj @JSteunou jspot 0.3.6 released with this

JSteunou commented 9 years ago

Hoho exiting news! I was a bit off the topic (lot of work) but I'll take a look for sure. Great work guys!