Skip to content
Snippets Groups Projects
Commit 70f7aba1 authored by Joshua Sedler's avatar Joshua Sedler :cartwheel_tone2:
Browse files

Merge branch '3490266-regression-newest-3.2.x' into '3.x'

Issue #3490266: Regression: Newest 3.2.x version uses vue.runtime.global.prod.js instead of vue.global.prod.js

See merge request !10
parents 4d4faa5e aea40f09
No related branches found
No related tags found
No related merge requests found
Pipeline #352223 canceled
...@@ -22,7 +22,7 @@ The Vue.js Drupal module provides a bridge between Drupal and the Vue.js framewo ...@@ -22,7 +22,7 @@ The Vue.js Drupal module provides a bridge between Drupal and the Vue.js framewo
3. Update the vuejs module via composer: `composer update 'drupal/vuejs'` 3. Update the vuejs module via composer: `composer update 'drupal/vuejs'`
4. Navigate to the `admin/config/development/vue` page. 4. Navigate to the `admin/config/development/vue` page.
5. Set the installation type to "Local library". 5. Set the installation type to "Local library".
6. Set the library path to `/package/dist/vue.runtime.global.prod.js` if not already defined so. 6. Set the library path to `/package/dist/vue.global.prod.js` if not already defined so.
### Library installation via manual download ### Library installation via manual download
...@@ -31,7 +31,7 @@ The Vue.js Drupal module provides a bridge between Drupal and the Vue.js framewo ...@@ -31,7 +31,7 @@ The Vue.js Drupal module provides a bridge between Drupal and the Vue.js framewo
2. Extract the tar inside the drupal `libraries/vue` folder. 2. Extract the tar inside the drupal `libraries/vue` folder.
3. Navigate to the `admin/config/development/vuejs` page. 3. Navigate to the `admin/config/development/vuejs` page.
4. Set the installation type to "Local library". 4. Set the installation type to "Local library".
5. Set the library path to `/libraries/vue/package/dist/vue.runtime.global.prod.js` if not already defined so. 5. Set the library path to `/libraries/vue/package/dist/vue.global.prod.js` if not already defined so.
#### Vue 2 #### Vue 2
1. Download `https://registry.npmjs.org/vue/-/vue-2.7.16.tgz` 1. Download `https://registry.npmjs.org/vue/-/vue-2.7.16.tgz`
......
vue: vue:
enabled: true enabled: true
installation: cdn installation: cdn
path: //unpkg.com/vue@3.5.13/dist/vue.runtime.global.prod.js path: //unpkg.com/vue@3.5.13/dist/vue.global.prod.js
cdn_provider: unpkg cdn_provider: unpkg
cdn_version: 3.5.13 cdn_version: 3.5.13
petitevue: petitevue:
......
...@@ -97,7 +97,7 @@ final class SettingsForm extends ConfigFormBase { ...@@ -97,7 +97,7 @@ final class SettingsForm extends ConfigFormBase {
'#title' => $this->t('Library path'), '#title' => $this->t('Library path'),
'#default_value' => $vueSettings['path'], '#default_value' => $vueSettings['path'],
'#attributes' => [ '#attributes' => [
'placeholder' => '/libraries/vue/package/dist/vue.runtime.global.prod.js', 'placeholder' => '/libraries/vue/package/dist/vue.global.prod.js',
], ],
'#description' => $this->t('The path to the library file. See <a href=:link>here</a> for more infos on how to setup the vue library locally. Leave empty to disable the library.', [':link' => Url::fromRoute('help.page', ['name' => 'vuejs'])->toString()]), '#description' => $this->t('The path to the library file. See <a href=:link>here</a> for more infos on how to setup the vue library locally. Leave empty to disable the library.', [':link' => Url::fromRoute('help.page', ['name' => 'vuejs'])->toString()]),
'#states' => [ '#states' => [
...@@ -255,7 +255,7 @@ final class SettingsForm extends ConfigFormBase { ...@@ -255,7 +255,7 @@ final class SettingsForm extends ConfigFormBase {
if ($vueFormValues['installation'] === 'cdn' && (bool) $enableVueLibrary) { if ($vueFormValues['installation'] === 'cdn' && (bool) $enableVueLibrary) {
// The file name differs from Vue 2 to Vue 3, so we need to do a version // The file name differs from Vue 2 to Vue 3, so we need to do a version
// compare here: // compare here:
$fileName = version_compare($vueFormValues['cdn_version'], '3.0.0', '>=') ? 'vue.runtime.global.prod.js' : 'vue.global.prod.js'; $fileName = version_compare($vueFormValues['cdn_version'], '3.0.0', '>=') ? 'vue.global.prod.js' : 'vue.min.js';
switch ($vueFormValues['cdn_provider']) { switch ($vueFormValues['cdn_provider']) {
case 'jsdelivr': case 'jsdelivr':
$vueFormValues['path'] = '//cdn.jsdelivr.net/npm/vue@' . $vueFormValues['cdn_version'] . '/dist/' . $fileName; $vueFormValues['path'] = '//cdn.jsdelivr.net/npm/vue@' . $vueFormValues['cdn_version'] . '/dist/' . $fileName;
......
...@@ -137,3 +137,24 @@ function vuejs_update_93003(&$sandbox) { ...@@ -137,3 +137,24 @@ function vuejs_update_93003(&$sandbox) {
// Clear library discovery cache, so the new settings are picked up: // Clear library discovery cache, so the new settings are picked up:
\Drupal::service('library.discovery')->clearCachedDefinitions(); \Drupal::service('library.discovery')->clearCachedDefinitions();
} }
/**
* Fixes regression.
*
* Introduced in https://www.drupal.org/project/vuejs/issues/3488596.
*/
function vuejs_update_93004(&$sandbox) {
$config_factory = \Drupal::configFactory();
$config = $config_factory->getEditable('vuejs.settings');
// Set the vue config:
$vueConfig = $config->get('vue');
$vuePath = $vueConfig['path'];
if (str_contains($vuePath, 'vue.runtime.global.prod.js')) {
$vuePath = str_replace('vue.runtime.global.prod.js', 'vue.global.prod.js', $vuePath);
}
elseif (str_contains($vuePath, 'vue.global.prod.js') && version_compare($vueConfig['cdn_version'], '3.0.0', '<')) {
$vuePath = str_replace('vue.global.prod.js', 'vue.min.js', $vuePath);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment