Coder Social home page Coder Social logo

Comments (7)

danielpeintner avatar danielpeintner commented on July 20, 2024

Mhh, correct. I think wot-typescript-definitions is a core dependency.

Hence, I assume this needs to be fixed for other packages (e.g., binding-coap etc) also.

I will provide a fix.

from node-wot.

danielpeintner avatar danielpeintner commented on July 20, 2024

Related question: in package.json of binding-fujitsu there is the following case

  "devDependencies": {
    "@node-wot/td-tools": "0.6.1",
    ...
  },
  "dependencies": {
    "@node-wot/core": "0.6.1",
    ...
  }

@node-wot/core refers to @node-wot/td-tools as default dependency. Hence this is broken also, I believe.

According to my understanding devDependencies should be used only if the dependency

  • is used for building the code (TypeScript dependencies) or
  • if it is necessary for tests only

In any other case it should be put as dependencies.

@hasbel any opinion?

from node-wot.

hasbel avatar hasbel commented on July 20, 2024

There is no need to add the typescript definitions to the dependencies of the bindings. They have core as a dependency and core should provide the type definitions for them.

Your understanding of devDependencies is correct, but types are a bit special in the sense that they may only be needed during development, but may also be exported as well in some cases.

In general, if a type definition (be it wot-typescript-definitions or any other @type/<name> from definitelyTyped) is exported, it needs to be included in dependencies, otherwise it can be in devDependencies.

For example, if we look inside the distfolder of a binding, we can see that inside the *.d.tstypescript definitions, there is no mention of the wot-typescript-definitions. However inside core, we can see that they are mentioned in many places, including for example comsumed-thing.d.ts.

As for fujitsu binding, you are right, @node-wot/td-tools should be in dependencies because is needed for the code to run.

from node-wot.

danielpeintner avatar danielpeintner commented on July 20, 2024

As for fujitsu binding, you are right, @node-wot/td-tools should be in dependencies because is needed for the code to run.

I will look into that more closely but I think in this case we can even safely remove "@node-wot/td-tools" from "devDependencies" without the need of adding it to "dependencies".

i.e. @node-wot/core depends on @node-wot/td-tools

Doing so in all package.json would clean-up the dependencies...

from node-wot.

h0ru5 avatar h0ru5 commented on July 20, 2024

I stumbled across this as well.

I now have the -definitions in the devDependencies of my project, which is logically the right place in my opinion:

  • they are needed so I can build
  • they are not needed at runtime

However, AFAIK there is no way to tell yarn/npm that whoever imports this package in runtime should have this other dependency in his dev-Deps. (might be there is a way)

so runtime dependencies makes sense, but has the risk to be inconsistent should the wot-typescript-definitions have changes that are not reflected in node-wot (exposedThing.writeProperty(...) is such an example currently)

My suggestion would be to re-expose the types, so that users of node-wot can import them from core (or a specific definitons module) that will always be code-compliant (but can deviate from the standard if it evolved away)

from node-wot.

danielpeintner avatar danielpeintner commented on July 20, 2024

I pushed a commit (see 20ce754) that cleans-up some dependencies and fixes the problem from @hasbel

Unfortunately implicit dependencies need to be put as an additional dependency if the types are used. I did not find another good solution for it..

@hasbel @h0ru5
Shall we do some more changes or leave it like this?

from node-wot.

danielpeintner avatar danielpeintner commented on July 20, 2024

No response and I assume issue is fixed by now.

Feel free to re-open the issue if this is not the case.

from node-wot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.