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

Paolo Haji phaji at redhat.com
Wed Mar 15 13:43:09 UTC 2017


Hello everyone,

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 the PR
<https://github.com/feedhenry-raincatcher/raincatcher-mediator/pull/16>.
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 at latest is 0.3.1, so either 0.4.0 or 1.0.0)

The typescript version, once compiled and published, is practically a
drop-in replacement except for a small API change in the topics utility:

- topics.prefix('foo') becomes topics.withPrefix('foo')
- topics.entity('foo') becomes topics.withEntity('foo')

Also, some of the dev modules required for building won't run on node 0.10
(they use Set
<https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Set>),
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

On Mon, Feb 13, 2017 at 2:39 PM, Paolo Haji <phaji at redhat.com> wrote:

> 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/20170315/6c8e02dd/attachment.htm>


More information about the Feedhenry-raincatcher mailing list