How to check the version of custom npm modules? - typescript-playground

I create a TypeScript Playground with custom npm modules in Plugins panel right side. But there is no version information for these npm modules. Where can I find the version information? Can I add a custom npm module with a specific version?

Related

How to find compatible dependency version for a given nodeJS version

Suppose I am upgrading my node version from 14 LTS to 16.18.1 LTS version. After that I need to upgrade my react project node modules to latest & compatible versions.
Can anyone advice me how to find out compatible version of a node module for a given node version?
Hope I understood you correctly. you can use the npm view <package_name> command to see more information about what is required.
If you want to know what dependencies React 17.0.1 requires you can use these commands and get these outputs
npm view react#17.0.1 dependencies
{ 'loose-envify': '^1.1.0', 'object-assign': '^4.1.1' }
npm view react#17.0.1 engines
{ node: '>=0.10.0' }
Then you know you what dependency versions and node versions you require.
You can do the same with npm view <package> peerDependencies

How to make Node.js NPM package to work with Typescript projects

I'm the owner of "memphis-dev" npm package, I want Typescript users will be able to work with this package natively.
What can I do besides refactor the entire code into TS?

How to use 2 different versions of the same node dependency in package.json?

I am working on a react js application where I am using Material-UI v5.0.0 for my UI components.
This new version replaces the package names from #material-ui/* prefix with #mui/*:
#material-ui/system -> #mui/system
#material-ui/styles -> #mui/styles
#material-ui/lab -> #mui/lab
In my project I am also using another dependency for displaying a calendar on 1 page which has a peer dependency of Material-UI v4.12.3 which imports material libraries like #material-ui/system.
How should I manage my dependencies in package.json so that I can use Material-UI v5.0.0 for majority of my UI/UX and still be able to use the dependency just for a specific UI screen.
Should I npm install both material UI v5.0.0 and v4.12.3 or is there a better way of doing this ?
With npm or yarn you may install specific packages under aliased names enabling you to use the same package under two different versions to do so you may
npm install <alias>#npm:<pkg_name><#version> # for npm
yarn add <alias>#npm:<pkg_name><#version> # for yarn
Example:
Installing Material-UI
npm install v5n#npm:#mui/material#5.0.0
npm install v4n#npm:#mui/material#4.12.3
Then you may require them as
import Button from 'v5/Button';

Bundling NPM module for OFFLINE distribution (with all dependencies)

How can I create a tarball package for distribution (with all its dependencies)?
The package needs to contain the actual module + all its dependencies since it will be installed locally/offline due to internet restrictions on the organization.
I tried adding the dependencies to bundledDependencies in package.json then running npm pack. But the generated tarball does not include any dependencies I have listed.
I also tried using a module called npm-pack-all but it does not work as I intended.
Any way I can do this? Preferably without the need for additional npm modules.
Help is really appreciated. Thanks!
npm pack with bundledDependencies worked well for me:
I am using node v10.15.0 and npm v6.4.1
It even bundled the dependencies that my dependencies need/have.

How to use experimental features in React?

I'm trying to play with an experimental feature in React. Specifically react-call-return.
This is included as a package in React, but when installing latest from npm react-call-return is not included.
Is it possible to install this specific package from the repo with npm without having to clone the entire repo? The package does exist on npm but at the moment it isn't being used: react-call-return.
Any ideas on how to use this experimental feature?

Resources