Bower: replace the latest dependency version by its actual number - javascript

My bower.json:
{
"...." : "...."
"name": "myproject",
"dependencies": {
"angular": "1.2.20",
"bootstrap": "latest"
}
}
I'd like to replace "latest" in bootstrap dependency by its actual version number. Is there any way to do that via bower command ? (not via a custom script)

No, bower doesn't have shrinkwrap feature.
It is a long-standing issue: https://github.com/bower/bower/issues/505

Related

how can I update to specific version of child dependency on a module

npm version: 7.24.2
someone know update a child dependency, I have the dependency:
vue-tel-input
and this dependency has the dependency libphonenumber-js with version: ^1.9.6
I want to update this libphonenumber-js to ^1.10.12
I already tried with:
https://docs.npmjs.com/cli/v8/configuring-npm/package-json?fbclid=IwAR2lAcPyu2XTTR5srKIEOpr1v8HM6UZL66WC42IG_8c3UU_u_vXeSPAL8J8#overrides
https://stackoverflow.com/a/48524488
any idea?
I don't think you can do that easily with your current setup.
you can either update to npm v8.3+, which supports overrides or use yarn with resolutions
more info:
overrides(npm):
https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides
package.json
"overrides": {
"vue-tel-input": {
"libphonenumber-js": "^1.10.12"
}
}
resolutions(yarn):
https://classic.yarnpkg.com/en/docs/selective-version-resolutions/
package.json
"resolutions": {
"libphonenumber-js": "^1.10.12"
}
alternatively, you can manage the package-lock.json file manually to define the version
"vue-tel-input": {
"version": "5.11.0",
"resolved": "https://registry.npmjs.org/vue-tel-input/-/vue-tel-input-5.11.0.tgz",
"integrity": "sha512-kw13LdbnSH+Zk5Qb06vflG7Abu6QsM1cQyKvTA9T4kaZeARvyvKo9YZmziy7WiSuar932DWRjGI0SJnban4a2A==",
"requires": {
"core-js": "^3.14.0",
"libphonenumber-js": "^1.9.6",
"vue": "^2.6.14"
}
},
you might be able to change "libphonenumber-js": "^1.9.6" to use ^1.10.12
but wanted to point out that when I did a fresh install, it did install 1.10.12
"node_modules/libphonenumber-js": {
"version": "1.10.12",
"resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.12.tgz",
"integrity": "sha512-xTFBs3ipFQNmjCUkDj6ZzRJvs97IyazFHBKWtrQrLiYs0Zk0GANob1hkMRlQUQXbJrpQGwnI+/yU4oyD4ohvpw=="
},
Because ^ will update to the latest minor version (2nd number), it should use a specific version, so in this case, because you're going from 1.9.* to 1.10.* and using ^1.9.6 you may be able to just remove your lock file and re-install to get 1.10.12

package.json engines field with tilde followed by greater than sign (~>)

If a package.json file has an engines field like this:
"engines" : {
"node" : "~>12"
},
What does the ~> mean?
engines Sets which versions of Node.js and other commands this package/app work on
example:
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0",
"yarn": "^0.13.0"
}
So if you see ~>12.0.1 it means to install version 12.0.1 or the latest patch version such as 12.0.4

How to specify published package.json with library publishing in angular 6?

Creating node modules with Angular6 should be quiet easy. The Documentation tells you these steps:
ng generate library YOUR-LIBRARY
ng build YOUR-LIBRARY --prod
cd dist/YOUR-LIBRARY && npm publish
This will add for instance a new project inside your angular.json, create a new directory inside /projects and compile/transpile your package into /dist/YOUR-LIBRARY. Thats super nice, BUT I cannot find the configuration approach to specify the exported package.json inside the dist directory.
I've tried to modify the package.json inside /projects but it does not have any effect on the distributed package.json.
It allways looks like:
{
"name": "YOUR-LIBRARY",
"version": "0.0.1",
"peerDependencies": {
"#angular/common": "^6.0.0-rc.0 || ^6.0.0",
"#angular/core": "^6.0.0-rc.0 || ^6.0.0"
},
"main": "bundles/nls-guilloche.umd.js",
"module": "fesm5/nls-guilloche.js",
"es2015": "fesm2015/nls-guilloche.js",
"esm5": "esm5/nls-guilloche.js",
"esm2015": "esm2015/nls-guilloche.js",
"fesm5": "fesm5/nls-guilloche.js",
"fesm2015": "fesm2015/nls-guilloche.js",
"typings": "nls-guilloche.d.ts",
"metadata": "nls-guilloche.metadata.json",
"sideEffects": false,
"dependencies": {
"tslib": "^1.9.0"
}
}
I cannot even change the version tag or add any information. Sure, manually it would work, but this cannot be the solution, can it?
As of Angular 12.x each library has a package.json that gets generated and that file is the one that gets copied over into the output directory (dist/ in your case).
It looks something like this when it's generated:
// projects/my-lib/package.json
{
"name": "my-lib",
"version": "0.0.1",
"peerDependencies": {
"#angular/common": "^12.0.0",
"#angular/core": "^12.0.0"
},
"dependencies": {
"tslib": "^2.1.0"
}
}

Bower v1.5.2 : EINVALID errors when installing dependencies

Since updating bower to version 1.5.2, a get EINVALID error when bower is installing :
font-awesome : The "main" field cannot contain font, image, audio, or video files
select2 : The name has to end with a lower case character from a to z
bootstrap-datetimepicker : The "main" field cannot contain minified files
...
With previous version of bower (1.3.12), there was no error.
Is that possible to ignore this errors?
My bower.json file :
{
"name": "project",
"version": "1.0.0",
"dependencies": {
"jquery": "components/jquery#~2.1.1",
"js-cookie": "~2.0",
"bootswatch-scss": "~3",
"bootstrap-sass-official": "3.3.*",
"select2-bootstrap-css" : ">=1.4.6",
"tinymce": "4.2.*",
"bootstrap-table": "~1.8",
"bootstrap-datepicker": "~1.4",
"eonasdan-bootstrap-datetimepicker": "~4.15",
"moment": "~2.10",
"select2-bootstrap-theme": "0.1.0-beta.4",
"hinclude": "0.9.*"
}
}
Update
At this time, I regress to version 1.3.12
npm uninstall bower -g
npm install -g bower#1.3.12

Bower dependency tilde in Node

In bower (a node dependency package manager), on some dependencies the version is preceded by a tilde. What does this mean?
{
"name": "mean",
"version": "1.0.0",
"dependencies": {
"bootstrap": "3.0.0",
"angular": "~1.0.6"
}
{
~1.2.3 := >=1.2.3-0 <1.3.0-0 "Reasonably close to 1.2.3". When using
tilde operators, prerelease versions are supported as well, but a
prerelease of the next significant digit will NOT be satisfactory, so
1.3.0-beta will not satisfy ~1.2.3.
From the documentation of the underlying semver

Categories