How to install same libraries in different name - javascript

I am Japanese web developer and I am not good at English , sorry.
I am using library by npm.
I forked the library and I remade it.
I changed my package.json like this.
"libraryName": "git+https://github.com/MyGitName/libraryName#master",
"npm install" worked properly.
But now I want to import same library in different name.
I want to subtend them by branches.
package.json
"libraryName1": "git+https://github.com/MyGitName/libraryName#master1",
"libraryName2": "git+https://github.com/MyGitName/libraryName#master2",
TypeScript
import library as libraryName1 from "libraryName1";
import library as libraryName2 from "libraryName2";
I want to do something like this.
Anyone know the way to do this?
What I tried.↓
1.yarn install -g
2.yarn add lodash2#npm:lodash#2.x
3.edit package.json like this.
"libraryName1": "git+https://github.com/MyGitName/libraryName#master1",
"libraryName2": "git+https://github.com/MyGitName/libraryName#master2",
4.yarn add libraryName1
↑ error occured.

This is not possible with npm currently. You could use yarn instead of npm to solve this. Otherwise you need to publish your own npm package.
package.json example to install both bootstrap 3 and 4. This only works with yarn.
"dependencies": {
"bootstrap": "^4.1.3",
"bootstrap3": "git://github.com/twbs/bootstrap#3.3.7"
}
Sources:
Install multiple versions of a dependency #5499
Yarn tip: You can alias a package by using...

Related

How to install a react-three/fiber and react-three/drei version compatible with "react": "^17.0.2"?

I having trouble with the installation of react-three/fiber and react-three/drei. Please tell me how to install a downgrade version of the two packages. I can't change the version of my react and react-dom because some packages might be affected by the changes.
You can target a specific version in the package.json file, try something like this:
package.json
"dependencies": {
...
"#react-three/fiber": "7.0.6"
"#react-trhee/drei": "7.5.1"
...
}
After the changes you will have to delete the node_modules and reinstall
Alternatively if you already uninstall/remove the packages, you can target specific versions by doing:
npm install [package]#[version]
or
yarn add [package]#[version]
For eaxmple npm install #react-three/fiber#7.0.6

How use third-party plugins after install in npm?

I install plugin (for instance normalize.css or jQuery) with npm install command.
npm install normalize.css --save
npm install jquery --save
I see them in package.json
"dependencies": {
"normalize.css": "^7.0.0"
}
What next? How i can use it in my project? I'm using gulp and I do not know what to do next.
There are two main ways to make use of it.
Approach 1: use normalize.css as a starting point for your own project’s base CSS, customising the values to match the design’s requirements.
Approach 2: include normalize.css untouched and build upon it, overriding the defaults later in your CSS if necessary.

After update ember-cli 2.11.0 version how to npm instead of bower?

When I updated ember-cli to 2.11.0 and I found EMBER NO LONGER SUPPLIED VIA bower. So I check npm instead of bower, but I don't know what to do.
Such as moment.js use bower look like:
bower.json
"dependencies": {
...
"moment": "2.14.1"
}
ember-cli-build.js
...
app.import('bower_components/moment/moment.js');
...
.jshintrc
...
"moment": true,
...
This way can run in help and controller.
But I use npm and set ember-cli-build.js code app.import('node_modules/moment/moment.js'); had errors.
And cssaslo have this problem.
What is best way to npm instead of bower in ember-cli? Thanks.
Through ember-browserify
npm install ember-browserify --save-dev
npm install moment --save-dev
you can import it by import moment from 'npm:moment'
Try ember-cli-moment-shim
ember packages are not served through bower. It does not mean you can't use bower at all. You can still use bower.json and include it like you did.
You can have it in vendor folder and include it ember-cli-build.js file . but for moment.js inclusion. this is not the right way.
I prefer 1 or 2 options. and 3 and 4 is not applicable in this case.

Is there an NPM location where I can download Gulp 4 or a pre-release of Gulp 4?

I'm using a package.son where I list all the Gulp NPM modules. In that file I have "gulp": "3.8.11",
I would like to use Gulp4 and I read here some different ways to access it:
http://stackoverflow.com/questions/33429727/how-do-i-install-gulp-4
But is it possible to also do this with a package.json? When I try to look at versions of "gulp" the auto part of Visual Studio doesn't prompt me for anything more than a 3.9 version.
Also is there a way that I could have some tasks use Gulp3 and others uses Gulp4?
Duplicate, but regardless:
npm install gulpjs/gulp#4.0 --save-dev
That adds this to the package.json:
"gulp": "gulpjs/gulp#4.0"
Here is the only solution that I could get to work:
"gulp-4.0.build": "4.0.0-build.a271520",
Note that the version details on the right were added automatically by Visual Studio.

Pointing package.json to a specific React commit installs react-tools (not react)

When I add this line to my package.json:
"react": "git://github.com/facebook/react.git#08e4420019f74b7c93e64f59c443970359102530"
...and then run npm install, I find node_modules/react-tools installed when I expect to see node_modules/react.
What am I doing wrong here?
The code at git://github.com/facebook/react.git is not the same code that gets installed when you npm install react. Instead, the code contains a series of build steps that are used to build the npm package. As far as I know, there is not a way to easily use a specific SHA of the React repo as an npm package; you would need to clone the repo, build the project, and copy it somewhere you can require it.

Categories

Resources