understanding-npm | A regularly updating survey of the npm community | Graphics library

 by   nodesource JavaScript Version: Current License: MIT

kandi X-RAY | understanding-npm Summary

kandi X-RAY | understanding-npm Summary

understanding-npm is a JavaScript library typically used in User Interface, Graphics, WebGL applications. understanding-npm has a Permissive License and it has low support. However understanding-npm has 2 bugs and it has 4 vulnerabilities. You can download it from GitHub.

A regularly updating survey of the npm community.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              understanding-npm has a low active ecosystem.
              It has 404 star(s) with 45 fork(s). There are 20 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 1 open issues and 7 have been closed. On average issues are closed in 125 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of understanding-npm is current.

            kandi-Quality Quality

              understanding-npm has 2 bugs (0 blocker, 0 critical, 2 major, 0 minor) and 10 code smells.

            kandi-Security Security

              understanding-npm has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              OutlinedDot
              understanding-npm code analysis shows 4 unresolved vulnerabilities (4 blocker, 0 critical, 0 major, 0 minor).
              There are 0 security hotspots that need review.

            kandi-License License

              understanding-npm is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              understanding-npm releases are not available. You will need to build from source code and install.
              Installation instructions, examples and code snippets are available.
              understanding-npm saves you 542 person hours of effort in developing the same functionality from scratch.
              It has 1270 lines of code, 0 functions and 80 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of understanding-npm
            Get all kandi verified functions for this library.

            understanding-npm Key Features

            No Key Features are available at this moment for understanding-npm.

            understanding-npm Examples and Code Snippets

            No Code Snippets are available at this moment for understanding-npm.

            Community Discussions

            QUESTION

            How to correctly require types from dependencies in typescript?
            Asked 2019-Feb-06 at 18:23

            I have a question regarding resolving types in my project. So basically I have packageA -> packageB-v1 -> packageC-v1, and I would like to use a type declared in packageC-v1 within packageA.

            All packages are created by myself, and they are all typescript packages that generate declaration files by setting declaration: true in tsconfig.json file, they each expose multiple *.d.ts files in their dist folder. There is no corresponding @types/* package for types.

            In this case, how should I import types correctly? So far I've tried:

            1. import SomeType from 'packageB-v1/node_modules/packageC-v1/dist/SomeType'. This works, but I don't like that packageA needs to know where packageC is installed as it could change depends on package manage tool (npm/yarn), or the install orders (See https://medium.com/learnwithrahul/understanding-npm-dependency-resolution-84a24180901b). I've seen issues that due to different versions of packageC, the types are not the same and tsc is not ok with it. That could happen when there is another dependency like packageA -> packageB-v1 -> packageBB-v1 -> packageC-v2, where npm will install packageC-v2 instead of packageC-v1 under packageB/node_modules.
            2. First export the necessary types SomeType from packageB-v1 by export SomeType from 'packageC-v1', then from packageA I can import SomeType from 'packageB-v1'. This works too, however, this also means packageB-v1 is on the hook to re-export all types from all of its dependencies (there could be many of them) that its consumers may need. That is not usually possible. Also, I've heard re-export may generate different types depends on each case.
            3. In packageA's package.json file, add the dependency to packageC-v1 explicitly, even it's actually not directly depend on it. So we could use import SomeType from 'packageC-v1/SomeType. Unfortunately, this won't work either as we may have another dependency chain like packageA -> packageD-v1 -> packageC-v2. In that case, which packageC version we should install under packageA? This approach is bad also because even though typescript won't actually include packageC in generated JS bundle from packageA for using interfaces only, it may do that for enums.

            The last way I haven't try is to create my own @types/packageC-v1 and publish it (and my other ts packages). However if I am writing these packages for a private org, that means we need to maintain an internal types repository, as well as maintain the paired versions of packages and types associate with them. Even if I managed to do that, I can still see many issues with this approach in terms of version mismatch, global declaration conflict, or namescope conflict (it is also true in the DefinetelyTyped/types approach).

            I am not sure if these make sense to you, and really need some bits of advice here.

            ...

            ANSWER

            Answered 2019-Feb-03 at 19:50

            Let's start with a triviality: if a package A needs something from package C, then C by definition is a direct dependency of A.

            You say you have a reason for not including C in dependencies of A

            we may have another dependency chain like packageA -> packageD-v1 -> packageC-v2

            In this case, if A uses types from C-v1, how is this supposed to work? I can see only two possibilities:

            1. A does not need types from C when using packageD. (by the way, why does it need C types for using packageB then?)

            2. C types did not change, so C types from C-v1 are compatible with C-v2

            The only solution I can see for both #1 and #2 is to split out types from C into separate package, for example C-types, and make it a dev dependency of A.

            The types in C-types should not be the d.ts files generated by TypeScript, these should be all the interfaces, types and enums (but not classes, classes are an implementation detail and should stay in C) from C, moved out into regular .ts file included in separate package.

            You will have to publish C-types in npm repo in the same way as C is published, with generated .d.ts and empty .js files, for each version of C. I don't think having empty .js files is a problem, but if it is, you can just publish manually written .d.ts files (however I don't know to type-check them before publishing, without having another package using them). There's no need to publish C-types through DefinitelyTyped and have them in @types scope - it's a mere convention, not a requirement. You just have to tell everyone in your org to use C-types instead of @types/C.

            You say that with this approach

            I can still see many issues with this approach in terms of version mismatch, global declaration conflict, or namescope conflict (it is also true in the DefinetelyTyped/types approach)

            First things first, having global declarations is strongly discouraged - modules were invented for a reason, and every name used anywhere should be explicitly imported from somewhere.

            And if your A uses types from C, you will have exactly the same problems with versioning with different versions of C. Splitting types out of C will just make you think about these problems beforehand, instead of hoping that things will "just work".

            Source https://stackoverflow.com/questions/54506313

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install understanding-npm

            Before you can run the site on your machine, you'll need to ensure that you have the latest version of Node installed (especially important is npm@2, which we use for scoped module support).

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/nodesource/understanding-npm.git

          • CLI

            gh repo clone nodesource/understanding-npm

          • sshUrl

            git@github.com:nodesource/understanding-npm.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link