Is there something special one has to do to get co...
# box-products
p
Is there something special one has to do to get commandbox to suggest an update on a package. Let me explain, I install the previous CFWheels version using:
Copy code
install cfwheels-base-template@2.3.0
Then issue an update command:
Copy code
update
and the results I see shows there is a newer version but it doesn't give an update to update to it:
Copy code
❯ update
Resolving Dependencies, please wait...
╔════════════════╤═══════════╤════════╤════════╤═══════════╗
║ Package        │ Installed │ Update │ Latest │ Location  ║
╠════════════════╪═══════════╪════════╪════════╪═══════════╣
║ cfwheels@2.3.0 │ 2.3.0     │ 2.3.0  │ 2.4.0  │ /cfwheels ║
╚════════════════╧═══════════╧════════╧════════╧═══════════╝
Key: Update Available   Major Update Available

There are no outdated dependencies!
I feel like, I'm missing something in my packages submitted to ForgeBox that says something to the effect of "Updates version 2.3.0".
b
@Peter Amiri This all boils down to the semver range in your box.json
When you do a normal install
Copy code
install foo
then we just grab whatever the latest stable version of
foo
is and the version is stored as a caret range in the box.json
Copy code
"^1.2.3"
So when you run the
update
or
outdated
commands, you're essentially asking CommandBox which versions of Forgebox satisfy that range
And in the case of a caret range, it would be any stable minor update up to but not including a major bump
however, when you install an EXACT VERSION, you're pinning that exact version and telling CommandBox never to consider anything outside of that.
So the only version that will satisfy
2.3.0
is...
2.3.0
!
p
Thanks @bdw429s, so right now my semvar range is really not a range. Got it. I should change that to ^2.3.0
b
If you want CommandBox to use a range of versions you need to put a semver range in the box.json
If that's the range you want, then yes
note there are many many types of ranges you can use (basically we support everything npm supports!) https://commandbox.ortusbooks.com/package-management/semantic-versioning#ranges
p
I knew I was being stupid, but didn't know why. I could have asked my wife, she has a long list but didn't think that would help
b
Example:
Copy code
install "foo@1.x || >=2.5.0 || 5.0.0 - 7.2.3"
🙂
Nah, not "stupid" at all. This is a common question for anyone coming into package management 😉