[Feedhenry-raincatcher] TypeScript version of raincatcher-mediator ready

Paolo Haji phaji at redhat.com
Mon Feb 13 16:39:02 UTC 2017


Following up on the previous thread on this subject.

So the final steps of the conversion of the module to typescript weren't as
straightforward, the biggest gotcha was that apparently the es6 module spec
makes it so you can't do `module.exports = X`. and `export default X`
actually becomes `exports.default = X` (more on this on a upcoming blog
post).

But currently the high-level worries when moving to TS are:


   1. Since we use the lib/ directory to contain our js files, put TS code
   in a src/ directory and configure the compiler to output to the lib/
   directory (js + d.ts typing files + js.map source maps)
   2. Delete the original lib/ tree from source control and .gitignore it
   since it'll be generated by the TS compiler
   3. Configure npm to include only the needed files via .npmignore or
   package.json.files <https://docs.npmjs.com/files/package.json#files>.
   You can check out what would be published to npm via npm pack
   <https://docs.npmjs.com/cli/pack>
   4. Tests in TS can be run with ts-node
   <https://github.com/TypeStrong/ts-node> on top of grunt-mocha-test
   5. Make it so the public exports of your module use the special `export
   = X` TS syntax (if you need module.exports = X)
   6. You can still use `export default` for internals, but non-es6
   consumers will have to use it through `require('my-module').default`

PR for this is up at
https://github.com/feedhenry-raincatcher/raincatcher-mediator/pull/16
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/feedhenry-raincatcher/attachments/20170213/c2855403/attachment.htm>


More information about the Feedhenry-raincatcher mailing list