<div dir="ltr">Hello everyone,<div><br></div><div>So I was talking with Wojtek and since he's going to do some changes to the mediator, and master is up to par with the feature-set on which the typescript branch was started from, we want to go ahead and merge <a href="https://github.com/feedhenry-raincatcher/raincatcher-mediator/pull/16">the PR</a>.</div><div>I've cherry-picked/ported all the relevant PRs to master done recently, and after merging we should probably go for a minor or even major version bump (current fh-wfm-mediator@latest is 0.3.1, so either 0.4.0 or 1.0.0)<br></div><div><br></div><div>The typescript version, once compiled and published, is practically a drop-in replacement except for a small API change in the topics utility:</div><div><br></div><div>- topics.prefix('foo') becomes topics.withPrefix('foo')</div><div>- topics.entity('foo') becomes topics.withEntity('foo')<br></div><div><br></div><div>Also, some of the dev modules required for building won't run on node 0.10 (they use <a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Set">Set</a>), so we can't keep it on the Travis matrix on this module, but others that will depend on the built version of it will still run on 0.10 AFAIK</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 13, 2017 at 2:39 PM, Paolo Haji <span dir="ltr"><<a href="mailto:phaji@redhat.com" target="_blank">phaji@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Following up on the previous thread on this subject.<div><br></div><div>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).</div><div><br></div><div>But currently the high-level worries when moving to TS are:</div><div><br></div><div><ol><li>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)</li><li>Delete the original lib/ tree from source control and .gitignore it since it'll be generated by the TS compiler</li><li>Configure npm to include only the needed files via .npmignore or <a href="https://docs.npmjs.com/files/package.json#files" target="_blank">package.json.files</a>. You can check out what would be published to npm via <a href="https://docs.npmjs.com/cli/pack" target="_blank">npm pack</a></li><li>Tests in TS can be run with <a href="https://github.com/TypeStrong/ts-node" target="_blank">ts-node</a> on top of grunt-mocha-test<br></li><li>Make it so the public exports of your module use the special `export = X` TS syntax (if you need module.exports = X)</li><li>You can still use `export default` for internals, but non-es6 consumers will have to use it through `require('my-module').default`</li></ol><div>PR for this is up at <a href="https://github.com/feedhenry-raincatcher/raincatcher-mediator/pull/16" target="_blank">https://github.com/<wbr>feedhenry-raincatcher/<wbr>raincatcher-mediator/pull/16</a></div></div></div>
</blockquote></div><br></div>