Describe the bug
I was having an issue with BuddyWorks deploying your lovely Vite plugin to a site this morning. After repeated rm -Rf cms/vendor && cms/composer.lock
commands I looked in the composer.lock
file to see where the mismatch was happening.
Then I saw this:
{
"name": "nystudio107/craft-plugin-vite",
"version": "1.0.19",
"source": {
"type": "git",
"url": "https://github.com/nystudio107/craft-plugin-vite.git",
"reference": "db53fdb759dd8f7b5716f809997630bce30719c1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nystudio107/craft-plugin-vite/zipball/db53fdb759dd8f7b5716f809997630bce30719c1",
"reference": "db53fdb759dd8f7b5716f809997630bce30719c1",
"shasum": ""
},
"require": {
"craftcms/cms": "^3.0.0"
},
"type": "library",
"autoload": {
"psr-4": {
"nystudio107\\pluginvite\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "nystudio107",
"homepage": "https://nystudio107.com"
}
],
"description": "Plugin Vite is the conduit between Craft CMS plugins and Vite, with manifest.json & HMR support",
"keywords": [
"craftcms",
"plugin",
"vite"
],
"support": {
"docs": "https://github.com/nystudio107/craft-plugin-vite/blob/v1/README.md",
"issues": "https://github.com/nystudio107/craft-plugin-vite/issues",
"source": "https://github.com/nystudio107/craft-plugin-vite/tree/1.0.19"
},
"funding": [
{
"url": "https://github.com/khalwat",
"type": "github"
}
],
"time": "2021-12-16T20:28:56+00:00"
}
In my composer.json
I have this:
"nystudio107/craft-vite": "1.0.20",
It also appears that there's a mismatch in how the plugin is named. I noticed this first when BuddyWorks gave me this error:
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.
Problem 1
- nystudio107/craft-vite is locked to version 1.0.20 and an update of this package was not requested.
- You can only install one version of a package, so only one of these can be installed: nystudio107/craft-vite[1.0.20].
Action failed: see logs above for details
Container exited with status code other than 0
After looking through the composer.lock
file I noticed this too:
{
"name": "nystudio107/craft-vite",
"version": "1.0.20",
"source": {
"type": "git",
"url": "https://github.com/nystudio107/craft-vite.git",
"reference": "b0e6c60f4d24909547b8572ddf44ab2598ce7a41"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nystudio107/craft-vite/zipball/b0e6c60f4d24909547b8572ddf44ab2598ce7a41",
"reference": "b0e6c60f4d24909547b8572ddf44ab2598ce7a41",
"shasum": ""
},
"require": {
"craftcms/cms": "^3.0.0",
"nystudio107/craft-plugin-vite": "^1.0.19"
},
"type": "craft-plugin",
"extra": {
"name": "Vite",
"handle": "vite",
"developer": "nystudio107",
"developerUrl": "https://nystudio107.com",
"documentationUrl": "https://github.com/nystudio107/craft-vite/blob/master/README.md",
"changelogUrl": "https://raw.githubusercontent.com/nystudio107/craft-vite/master/CHANGELOG.md",
"class": "nystudio107\\vite\\Vite"
},
"autoload": {
"psr-4": {
"nystudio107\\vite\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "nystudio107",
"homepage": "https://nystudio107.com"
}
],
"description": "Allows the use of the Vite.js next generation frontend tooling with Craft CMS",
"keywords": [
"Craft",
"cms",
"craft-plugin",
"craftcms",
"vite"
],
"support": {
"docs": "https://github.com/nystudio107/craft-vite/blob/master/README.md",
"issues": "https://github.com/nystudio107/craft-vite/issues",
"source": "https://github.com/nystudio107/craft-vite/tree/1.0.20"
},
"funding": [
{
"url": "https://github.com/khalwat",
"type": "github"
}
],
"time": "2021-12-16T20:30:21+00:00"
},
So it seems that Vite is installed twice, which is breaking our deployments. You can see from that latest json blob that craft-vite is requiring the craft-vite-plugin
Perhaps it's just because you need to update this line to the right version?
https://github.com/nystudio107/craft-vite/blob/develop/composer.json#L26
I think that may be causing the You can only install one version of a package, so only one of these can be installed: nystudio107/craft-vite[1.0.20].
issue BW is squawking about.
Expected behaviour
I'd expect that the upgrade would also update the composer.lock
file appropriately as the lock file's version doesn't match what's in the main composer.json file.
Versions
- Plugin version: 1.0.20
- Craft version: Craft Pro 3.7.28
Thanks again for another amazing plugin!