Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addon version upgrade / convert to typescript #110

Open
0815fox opened this issue Oct 13, 2021 · 5 comments
Open

Addon version upgrade / convert to typescript #110

0815fox opened this issue Oct 13, 2021 · 5 comments

Comments

@0815fox
Copy link

0815fox commented Oct 13, 2021

I am about to provide a pull request which upgrades this addon to typescript. Seems to me that the API is based on Version 0.12.0 of gateway-addon-adapter, which was not Typescript back those days. So I have to raise that version as well

Now I got stuck with three questions:

  1. I read

This should NEVER be included as an add-on dependency

which makes totally sense. However, is the intension to add it as devDependency in order to get ts typings?
2. For the moment I did so, however, then the question arises: Which version of gateway-addon-node should I refer to? Ignoring all alpha versions I would tend to 1.0.1-0 (which might be alpha as well or what does -0 mean?) So v1.0.0 would be the only remaining non alpha version (which also seems strange).
3. How does the addon manager know, which interface version the addon complies to? Can't find it in the manifest.

@benfrancis
Copy link
Member

I am about to provide a pull request which upgrades this addon to typescript.

"Upgrades" is a matter of opinion ;) Personally I am regretting ever allowing TypeScript into the code base and would rather not add any more, but I may be be alone in holding that view.

The same question came up in WebThingsIO/wot-adapter#9 Maybe @tim-hellhake or @relu91 can provide answers to your questions?

@0815fox
Copy link
Author

0815fox commented Oct 15, 2021

"Upgrades" is a matter of opinion ;) Personally I am regretting ever allowing TypeScript into the code base and would rather not add any more, but I may be be alone in holding that view.

Well, that this project uses typescript (as opposed to plain javascript) was one of the major reasons for my decision to use and support it. I'am no fan of microsoft but IMO that's the first time they've come up with something really good. Of course I respect your opinion but could you somewhat explain why you came to that conclusion and also how decisions are made in this project.

The same question came up in WebThingsIO/wot-adapter#9 Maybe @tim-hellhake or @relu91 can provide answers to your questions?

Well my opinion about that is, that it is a dev dependency - this also marks that this addon kind of relys on the interfaces exposed by that module.

@0815fox
Copy link
Author

0815fox commented Oct 15, 2021

Oh, I did not stumble across https://github.com/WebThingsIO/wot-adapter . Having that seen I'm asking my self if it's even worth spending any energy on this adapter.

@relu91
Copy link

relu91 commented Oct 15, 2021

The same question came up in WebThingsIO/wot-adapter#9 Maybe @tim-hellhake or @relu91 can provide answers to your questions?

Well my opinion about that is, that it is a dev dependency - this also marks that this addon kind of relys on the interfaces exposed by that module.

As far as understood it's a little bit controversial. The modern approach (i.e., > npm7) suggest using only peerDependencies since it is the right place to express a plug-in -- runtime relationship. However, npm6 does not install automatically peerDependencies and this creates a bunch of problems when releasing and building the plug-in. Since everything here is still npm6 compliance package-lock.json v1 in wot-adapter we are using a safe approach which is basically having gateway-addon both as peerDependency and devDependency. About the version, It depends on which version of the https://github.com/WebThingsIO/gateway/ do you want to target, 1.1.0 is using ^1.0.1-alpha.1

Oh, I did not stumble across https://github.com/WebThingsIO/wot-adapter . Having that seen I'm asking my self if it's even worth spending any energy on this adapter.

Having said the above, we have two choices here:

  1. Keep maintaining this adapter as a legacy to interact with old web things implementations.
  2. Support legacy web things in wot-adapter

Personally, I feel like it still makes sense to keep maintaining this adapter as introducing legacy logic in wot-adapter feels dirty to me. Therefore, translating to TS might help keep the entire code base type safe and detect bugs at compile time. But I think the final decision here is Ben's and Tim's.

@benfrancis
Copy link
Member

benfrancis commented Oct 16, 2021

@0815fox wrote:

could you somewhat explain why you came to that conclusion and also how decisions are made in this project.

This is not really the place for an in-depth discussion about TypeScript (my bad, sorry), that's a discussion for elsewhere. My initial skepticism about TypeScript has only be reinforced by my experience of using it for the last few months, for me it causes more problems than it solves. I think the ship has sailed regarding TypeScript on the back end of WebThings Gateway though.

The current governance process for WebThings is outlined here.

@relu91 wrote:

  1. Keep maintaining this adapter as a legacy to interact with old web things implementations.

I also prefer this option, and FWIW I expect this adapter to continue to exist for some time. As a minimum until all the WebThings Framework libraries are made W3C compliant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants