Closed agoat closed 7 years ago
When you install the contao/standard-edition
4.3.5
, contao-components/jquery
1.12.4
will be installed: https://github.com/contao/standard-edition/blob/4.3.5/composer.lock#L363-L364
2.x or 3.x of jQuery are not used for backwards compatibility reasons I suppose.
So is the reason backwards compatibility??
I changed this in my installation to jQuery 3.1.1 and didn't find any problem by now.
I changed this in my installation to jQuery 3.1.1 and didn't find any problem by now.
It is not about you though ;). Other users might encounter problems with their JavasScripts, if the jQuery version is suddenly 2.x or 3.x instead of 1.x.
But should we stick with an old jQuery version? jQuery 2 was released in 2013. Now there is version 3 since last year.
It is not about you though ;). Other users might encounter problems with their JavasScripts, if the jQuery version is suddenly 2.x or 3.x instead of 1.x.
There is a jQuery Migration Plugin to restore deprecated features. Although I don't think, we should integrate this by default.
IMO upgrading jQuery to 3.x with the next minor version of contao (4.4) can be a solution.
With every minor upgrade you have to fix some problems anyway. To check and maybe correct the js scripts is only one extra step.
IMO upgrading jQuery to 3.x with the next minor version of contao (4.4) can be a solution.
Technically you can only do that with a major version change (i.e. Contao 5).
Technically you can only do that with a major version change (i.e. Contao 5).
So we will stick with jQuery 1.x until 2020?
Technically you can only do that with a major version change (i.e. Contao 5).
That is not generally correct. I understand the idea behind it, but be aware that Semantic Versioning applies to the Contao APIs and not plugins. In an ideal world, you can manually adjust your local dependencies if you need jQuery 2 instead of jQuery 3. However, that is rather complicated for a regular user.
A solution could be to add a version selection instead of just a checkbox, and migrate existing installations to v2 to keep BC.
That is not generally correct. I understand the idea behind it, but be aware that Semantic Versioning applies to the Contao APIs and not plugins.
See https://github.com/contao/core/issues/8411#issuecomment-241273031 for example. MooTools is not updated to 1.6 because of semantic versioning. Exceptions were made for security fixes (see further comments).
I know what you mean. But the better term would be because of the fear of breaking websites and not because of semantic versioning ;-)
see http://semver.org/#what-should-i-do-if-i-update-my-own-dependencies-without-changing-the-public-api
But the better term would be because of the fear of breaking websites and not because of semantic versioning ;-)
But that's the point of semantic versioning (also) is it not? ;)
Contao offers the ability to integrate jQuery in the page layout. If you have a Contao 4.3 installation and use jQuery in your own scripts and then update to Contao 4.4, which supposedly bumped the version of jQuery from 1.x to 3.x, your JavaScripts and may be your whole website may not work anymore. This should not happen when you do a feature release update of Contao, should it?
You can install version 2 by adding the following to your root composer.json
file:
"require": {
"contao-components/jquery": "^2.2"
}
For version 3, you need to add this:
"require": {
"contao-components/jquery": "^3.0"
}
This will not work!
When I insert this to the root composer.json
file, composer returns the following:
(17:30:21) [/.../cms/contao4-clean] composer update --dry-run
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- contao-components/all 6.0.0 requires contao-components/jquery ^1.11.3 -> satisfiable by contao-components/jquery[1.11.3, 1.12.0, 1.12.1, 1.12.2, 1.12.3, 1.12.4] but these conflict with your requirements or minimum-stability.
- contao/core-bundle 4.3.5 requires contao-components/jquery ^1.11.3 -> satisfiable by contao-components/jquery[1.11.3, 1.12.0, 1.12.1, 1.12.2, 1.12.3, 1.12.4] but these conflict with your requirements or minimum-stability.
- contao/installation-bundle 4.3.5 requires contao/core-bundle ^4.3 -> satisfiable by contao/core-bundle[4.3.1, 4.3.2, 4.3.3, 4.3.4, 4.3.5].
- contao/core-bundle 4.3.1 requires contao-components/all ~6.0 -> satisfiable by contao-components/all[6.0.0].
- contao/core-bundle 4.3.2 requires contao-components/all ^6.0 -> satisfiable by contao-components/all[6.0.0].
- contao/core-bundle 4.3.3 requires contao-components/all ^6.0 -> satisfiable by contao-components/all[6.0.0].
- contao/core-bundle 4.3.4 requires contao-components/all ^6.0 -> satisfiable by contao-components/all[6.0.0].
- Installation request for contao/installation-bundle ^4.3.5 -> satisfiable by contao/installation-bundle[4.3.5].
You have to change this in the contao/core-bundle.
This is because you still have the contao-components/all
repository. Try this:
"require": {
"contao-components/jquery": "^3.0 as 1.11.3"
}
We will no longer be using contao-components/all
in Contao 4.4.
I don't have the contao-components/all installed. And this is not the only thing generating a conflict.
As you may see in the composer output above the contao/core-bundle
4.3.5 requires contao-components/jquery
^1.11.3
so it will not install version 2.0.0 or higher. But I required contao-components/jquery
^3.0
in the root composer.json
and now we have a conflict.
The only way is to change this in the contao/core-bundle
. So I have to modify the core-bundle.
That's why I made an Issue.
JQuery 1.x is very old. Shouldn't we generally upgrade to 3.x?
And this is not the only thing generating a conflict.
According to your composer output, it is.
As you may see in the composer output above the contao/core-bundle 4.3.5 requires contao-components/jquery ^1.11.3 so it will not install version 2.0.0 or higher. But I required contao-components/jquery ^3.0 in the root composer.json and now we have a conflict.
That's why @leofeyer suggested to use
"contao-components/jquery": "^3.0 as 1.11.3"
Post your complete, current composer.json
.
According to your composer output, it is.
No it isn't (I think). Look at the second line of the problem listing:
contao/core-bundle 4.3.5 requires contao-components/jquery ^1.11.3 -> satisfiable by contao-components/jquery[1.11.3, 1.12.0, 1.12.1, 1.12.2, 1.12.3, 1.12.4] but these conflict with your requirements or minimum-stability.
That's why @leofeyer suggested to use
contao-components/jquery": "^3.0 as 1.11.3"
And this will not work in composer, too:
[UnexpectedValueException]
Could not parse version constraint ^3.0 as 1.11.3: Invalid version string "^3.0" in "^3.0 as 1.11.3", the alias source must be an exact version, if it is a branch name you should prefix it with dev-
You have to specify an exact version:
contao-components/jquery": "3.1.1 as 1.11.3"
The following composer.json
will work:
{
"name": "contao/standard-edition",
"type": "project",
"description": "Contao Open Source CMS",
"license": "LGPL-3.0+",
"authors": [
{
"name": "Leo Feyer",
"homepage": "https://github.com/leofeyer"
}
],
"require": {
"php": ">=5.5.0",
"symfony/symfony": "^2.8|^3.0",
"symfony/monolog-bundle": "^2.8",
"symfony/swiftmailer-bundle": "^2.3",
"sensio/distribution-bundle": "^5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"doctrine/doctrine-bundle": "^1.6",
"lexik/maintenance-bundle": "^2.0",
"contao/calendar-bundle": "^4.3.2",
"contao/comments-bundle": "^4.3",
"contao/core-bundle": "^4.3.5",
"contao/faq-bundle": "^4.3",
"contao/installation-bundle": "^4.3.5",
"contao/listing-bundle": "^4.3",
"contao/news-bundle": "^4.3",
"contao/newsletter-bundle": "^4.3",
"swiftmailer/swiftmailer": "^5.4.5",
"incenteev/composer-parameter-handler": "^2.0",
"contao-components/jquery": "3.1.1 as 1.11.3"
},
"require-dev": {
"contao/manager-bundle": "^4.3"
},
"autoload": {
"classmap": [
"app/AppCache.php",
"app/AppKernel.php"
]
},
"config": {
"component-dir": "assets",
"preferred-install": "dist"
},
"extra": {
"branch-alias": {
"dev-develop": "4.4.x-dev"
},
"incenteev-parameters": {
"file": "app/config/parameters.yml",
"env-map": {
"secret": "CONTAO_RANDOM_SECRET"
}
},
"symfony-app-dir": "app",
"symfony-bin-dir": "bin",
"symfony-var-dir": "var",
"symfony-web-dir": "web",
"symfony-assets-install": "relative"
},
"scripts": {
"post-install-cmd": [
"Contao\\CoreBundle\\Composer\\ScriptHandler::generateRandomSecret",
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Contao\\CoreBundle\\Composer\\ScriptHandler::addDirectories",
"Contao\\CoreBundle\\Composer\\ScriptHandler::generateSymlinks"
],
"post-update-cmd": [
"Contao\\CoreBundle\\Composer\\ScriptHandler::generateRandomSecret",
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Contao\\CoreBundle\\Composer\\ScriptHandler::addDirectories",
"Contao\\CoreBundle\\Composer\\ScriptHandler::generateSymlinks"
]
}
}
But this has to be adjusted whenever contao/core-bundle
changes the version for contao-components/jquery
.
Yeah, switching the jQuery version does not seem to be possible (at least not without always having to specify an exact version).
You can try "contao-components/jquery": "dev-feature/3.x as 1.11.3"
.
With Contao 4.4 this seems to work: "contao-components/jquery": "3.2.1 as 1.12.4",
Is there a reason why the contao/core-bundle is only requiring
version 1.11.3
of thecontao-components/jquery
package?Since version 1.12.4 is available, a new contao 4 installation will install this version. But there is also a 'new' jQuery 3.1.1 version in the
contao-components/jquery
repository!?