I need to package the xmlbuilder module (it's a new dependency for another module I own) but packaging it has raised some interesting questions.
The javascript source in the npm package, which is what the packaging guidelines tell us to use as the source, is compiled from coffee script and also doesn't include any source.
We've worked around similar situations in the past by having a second source archive which contains the tests pulled from github, but in this case there's an extra issue - the tests work on the original coffee script source not the compiled javascript.
In any case the coffee script is the real source, so shouldn't I really be packaging the github tar ball and building the js from that as part of the rpm?
Tom
IMO, the javascript is the compiled code; coffeescript is just a mid step language. So, you should convert coffee to javascript during the %build phase. As source used for the RPM you can use of course the .tar.gz from upstream, as-is. Sergio
-----Original Message----- From: nodejs-bounces@lists.fedoraproject.org [mailto:nodejs-bounces@lists.fedoraproject.org] On Behalf Of Tom Hughes Sent: quinta-feira, 28 de Novembro de 2013 21:43 To: Node.js on Fedora Subject: xmlbuilder
I need to package the xmlbuilder module (it's a new dependency for another module I own) but packaging it has raised some interesting questions.
The javascript source in the npm package, which is what the packaging guidelines tell us to use as the source, is compiled from coffee script and also doesn't include any source.
We've worked around similar situations in the past by having a second source archive which contains the tests pulled from github, but in this case there's an extra issue - the tests work on the original coffee script source not the compiled javascript.
In any case the coffee script is the real source, so shouldn't I really be packaging the github tar ball and building the js from that as part of the rpm?
Tom
-- Tom Hughes (tom@compton.nu) http://compton.nu/ _______________________________________________ nodejs mailing list nodejs@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/nodejs
On Thu, Nov 28, 2013 at 2:43 PM, Tom Hughes tom@compton.nu wrote:
I need to package the xmlbuilder module (it's a new dependency for another module I own) but packaging it has raised some interesting questions.
The javascript source in the npm package, which is what the packaging guidelines tell us to use as the source, is compiled from coffee script and also doesn't include any source.
The "Using tarballs from the npm registry" section of the guidelines is deliberately a SHOULD because of edge cases like this. I'll see about adding a little extra explanation to that section about valid exceptions like coffeescript/typescript/etc. building and tests to make things more clear in the future.
We've worked around similar situations in the past by having a second source archive which contains the tests pulled from github, but in this case there's an extra issue - the tests work on the original coffee script source not the compiled javascript.
Only because they hardcode the path to the coffee-script source in their require() statements. (Which is mostly unavoidable.)
To make them run against the compiled JS instead, just fix up the require calls with sed:
sed -i 's,src/([a-z]*).coffee,lib/\1,g' test/*
In any case the coffee script is the real source, so shouldn't I really be packaging the github tar ball and building the js from that as part of the rpm?
Yes. We've generally always interpreted the general "no precompiled anything" guideline to apply to JavaScript compiled from languages like CoffeeScript. (Or CSS compiled from LESS, etc.) The new web JS guidelines state this explicitly; the Node.js ones really should too now.
As it happens, the only software written in CoffeeScript currently in the distro is the "coffee-script" package itself. It also uses the sources from GitHub, because while the npm tarball does ship the coffee and compiled sources side-by-side, the Cakefile needed to perform bootstrapping only exists in git, and the package does indeed bootstrap the compiler/interpreter from the original coffee sources during %build to comply with the guidelines.
The coffee-script package is also unique in that it needs to ship both the coffee and JS sources to permit debugging/introspection of CoffeeScript source run without pre-compilation. This is not generally needed, so in your case you can stick with upstream's strategy of only shipping the final compiled JS in the binary RPM.
-T.C.
nodejs@lists.fedoraproject.org