How to prevent bower to install some dependencies - bower

I am using bower for the first time.
I installed bootstrap but it pulled jquery with it, but I don't want it to be pulled as I load it in another way.
I tried to add ignore dependency but it installs it again:
{
"name": "myapp",
"private": true,
"dependencies": {
"angular": "~1.4.8",
"bootstrap": "~3.3.6"
},
"ignoredDependencies": [
"jquery"
]
}
How to stop bower getting jquery?
I am using bower in visual studio 2015 how I can check what bower version vs use?

Related

how to use es module but not commonjs with electron 16?

How to use esm with electron 16?
When I make the type in package.json to module, the script electron . doesnt work well.
{
"name": "electronapp",
"version": "1.0.0",
"main": "main.js",
"type": "module",
...
}
I stumbled upon the same problem when trying to create a new project with Vue 3 and Vite in electron. I found a nice starter template at GitHub.
Unfortunately, with the first update of the packages, there was the problem that some of the packages had switched to pure ESM.
The problem that electron has with ESM is very clear from the issue on GitHub: https://github.com/electron/electron/issues/21457.
Electron use ESM, but not for the files it receives via the config. Electron tries to include these files with "require", which fails.
However, a solution is also presented, which can be used well.
Point your eletron toward a cjs file.
In package.json:
"type": "module",
"main": "main.cjs"
In main.cjs:
import('./application.mjs');
After that, to import electron, use this in your esm part:
const require = createRequire(import.meta.url);
const { BrowserWindow, app: electronApp, ipcMain } = require('electron');
But this is only a rough outline of the solution. I forked the starter package and installed the solution there in the ESM branch: https://github.com/studioalex/electron-vue-template/tree/ESM.

Rails/Yarn: Following tutorial leaves package.json file in my project. Should I get rid of this?

While trying to learn how to use yarn with rails a tutorial I was following, instructed me to run yarn init in my project, creating what seems like a useless package.json file, since this isn't going to be a yarn package but a ruby/rails application.
Here is the package.json file:
{
"name": "myapplication",
"private": true,
"dependencies": {
"bootstrap": "^4.3.1",
"font-awesome": "^4.7.0",
"jquery": "^3.4.1",
"popper.js": "^1.15.0"
}
}
Maybe I'm misunderstanding what this file is for but it seems more like a *.gemspec type file for a javascript package than an important file for a Rails application. I understand the importance of having yarn.lock included in git but I don't see why I need package.json. Can I add it to .gitignore or even delete it?
The yarn.lock file gets generated by yarn after resolving and installing the dependencies defined in package.json. Thus, you should check in this file.
Unlike Ruby, Node uses the same file to define a package and to define a projects dependencies.

cannot change bower components folder

I'm trying to override bower's component folder following the answers in this question: How to change bower's default components folder?
this is my bower.json file (with all the things I've tried)
{
"name": "sample-app",
"version": "1.0.0",
"directory": "public/libs/",
"componentsDirectory": "public/libs/",
"dependencies": {
"jquery": "latest"
}
}
and this is my .bowerrc:
{
"directory": "public/libs/",
"componentsDirectory": "public/libs/"
}
I've tried a couple more things, but the settings just seems to be ignored, and the components are installed to bower_components
these are the versions I'm using:
$ bower -v
1.2.8
$ npm -v
1.3.24
$ node -v
v0.10.25
I have a github of this working. It's not the identical code you have above, but if you can get this to work, you should be able to iterate from there.
If you are running Bower on Windows, you should make sure that you have selected Run Git from the Windows Command Prompt(second option) during GIT Installation. Then it'll work!!
Refer link here

How to rename a component in installed with Bower

Given that bower support installing items that do not technically exist in the global bower namespace the following problem can arise.
Bower install https://github.com/bitovi/canjs.com/archive/v1.1.6.zip
results in
Components
|- v1.1.6
|--bower.json
|-- (complete installation of all required pieces here).
This can lead to potential confusion and maintenance problems down the road as it is now on the developer to recall that "can.js" lives in v1.1.6. Clearly there are fixes that one can implement (i.e. pointing all items using can.js to this directory) but this doesn't solve the core problem.
bower.json looks like this:
{
"name": "v1.1.6",
"main" : "",
"version": "0.0.0",
"repository": {
"type": "asset",
"url": "https://github.com/bitovi/canjs.com/archive/v1.1.6.zip"
}
}
Is renaming the directory and updating the bower.json enough or is there another resource that needs to be updated as well?
Yes updating bower.json is enough. In the next bower major release (1.0.0), you can name a package when installing. In your case you would so something like this:
bower install canjs=git://github.com/bitovi/canjs.com.git#~1.1.6
You can try out this new feature by installing bower-canary: npm install -g -f bower-canary

bower install take repo, not specific files in main

I am trying to install some js files via bower. My repo has a bower.json with a main property, however the whole repo gets installed to components/, not just the files in the dist/custom/ dir.
Here is what my bower.rc looks like
{
"name": "jquery-m",
"version": "2.0.2mup",
"description": "Meetup custom build of jQuery 2.0, used on mobile",
"main": [ "./dist/custom/" ],
"license": "MIT"
}
Is this the way bower is supposed to work? I thought it was possible just to specify certain files with your main property.
Yes, this is how Bower is meant to work. Bower-installer looks like a more lightweight solution than Grunt to solve the exact requirement you're describing and get just the files you need to be deployed to production.
Yes, that's how Bower works.
It always look for the matching tag on the repo; if cannot find one, it goes with the default branch, and download it.
The unique usage I've seen so far for the main property of a bower.json file is for integration, for example with build tools, like Grunt (there are lots of other bower related tasks, just Google around) and others.
This is a common misconception.
As stated in Bower documentation, the main property is a string/array listing the primary endpoints of your package.
Bower package maintainers (and maybe users, using the overrides property) can use the ignore property, which is an array of paths not needed in production that you want Bower to ignore when installing your package.
Example:
{
"name": "stackoverflow",
"version": "1.0.0",
"ignore": [
"test/**",
".jshintrc"
],
"dependencies": {
"foo": "~1.1"
}
}

Resources