The Upgrading Ruby on Rails Guide has no mention of package.json or your npm package dependencies.
But Rails is of course increasingly moving to using such.
A Rails app generated under Rails 6.0.x might have a package.json that looks like:
{
"name": "rails6034demo",
"private": true,
"dependencies": {
"@rails/actioncable": "^6.0.0",
"@rails/activestorage": "^6.0.0",
"@rails/ujs": "^6.0.0",
"@rails/webpacker": "4.3.0"
},
"version": "0.1.0",
"devDependencies": {
"webpack-dev-server": "^3.11.0"
}
}
A Rails app generated with 6.1.x might have a package.json that looks like:
{
"name": "rails61app",
"private": true,
"dependencies": {
"@rails/actioncable": "^6.0.0",
"@rails/activestorage": "^6.0.0",
"@rails/ujs": "^6.0.0",
"@rails/webpacker": "5.2.1",
"turbolinks": "^5.2.0"
},
"version": "0.1.0",
"devDependencies": {
"webpack-dev-server": "^3.11.1"
}
}
Not actually too different. But… do you have to (or is it advised that you?) do something with your npm dependencies on upgrading an app to a new rails version?
The Rails 6.1 package.json says that ^6.0.0
is fine for most of the @rails/
dependencies… but is this true? There is a 6.1.0 and a 6.1.1 of eg @rails/actioncable
– but if you upgraded a Rails 6.0.0 app to 6.1, it’s probably using @rails/actioncable
6.0.0 – is it important that you update it to be using 6.1.0 or 6.1.1 instead?
-
Is Rails 6.1 generating a wrong spec in package.json, should it be generating one insisting on at least 6.1.0 of these rails deps?
-
Upon upgrading, is there something you should do to upgrade your
@rails/
dependencies, and should the Upgrading Rails guide explain this?
The 6.1 package.json says "@rails/webpacker": "5.2.1",
, whereas the 6.0 package.json says "@rails/webpacker": "4.3.0"
.
Upon upgrading my app from 6.0 to 6.1, do I need to edit my package.json for @rails/webpacker
?
In general, I still feel pretty unsure in my use of webpacker. I am not certain what I should be doing here upon upgrades; I think perhaps the Upgrading Rails guide should address it?