From 0747273fdd6b0f17e525a3ebba62ac26a18df8af Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Thu, 1 Dec 2022 09:44:53 -0500 Subject: [PATCH] Turbo mercure package abandoned --- src/Turbo/CHANGELOG.md | 15 ++++ .../assets/dist/turbo_stream_controller.js | 0 src/Turbo/assets/package.json | 8 +- .../assets/src/turbo_stream_controller.ts | 0 .../test/turbo_stream_controller.test.ts | 6 +- src/Turbo/composer.json | 3 +- src/Turbo/doc/index.rst | 16 +++- .../Bridge/Mercure/{src => }/Broadcaster.php | 0 src/Turbo/src/Bridge/Mercure/LICENSE | 19 ----- src/Turbo/src/Bridge/Mercure/README.md | 15 ---- .../{src => }/TurboStreamListenRenderer.php | 4 +- .../src/Bridge/Mercure/assets/jest.config.js | 1 - .../src/Bridge/Mercure/assets/package.json | 26 ------ src/Turbo/src/Bridge/Mercure/composer.json | 44 ---------- src/Turbo/tests/app/assets/app.js | 4 +- src/Turbo/tests/app/package.json | 1 - ux.symfony.com/assets/controllers.json | 6 +- ux.symfony.com/composer.json | 3 +- ux.symfony.com/composer.lock | 80 +------------------ ux.symfony.com/package.json | 1 - ux.symfony.com/symfony.lock | 3 - 21 files changed, 47 insertions(+), 208 deletions(-) rename src/Turbo/{src/Bridge/Mercure => }/assets/dist/turbo_stream_controller.js (100%) rename src/Turbo/{src/Bridge/Mercure => }/assets/src/turbo_stream_controller.ts (100%) rename src/Turbo/{src/Bridge/Mercure => }/assets/test/turbo_stream_controller.test.ts (79%) rename src/Turbo/src/Bridge/Mercure/{src => }/Broadcaster.php (100%) delete mode 100644 src/Turbo/src/Bridge/Mercure/LICENSE delete mode 100644 src/Turbo/src/Bridge/Mercure/README.md rename src/Turbo/src/Bridge/Mercure/{src => }/TurboStreamListenRenderer.php (94%) delete mode 100644 src/Turbo/src/Bridge/Mercure/assets/jest.config.js delete mode 100644 src/Turbo/src/Bridge/Mercure/assets/package.json delete mode 100644 src/Turbo/src/Bridge/Mercure/composer.json diff --git a/src/Turbo/CHANGELOG.md b/src/Turbo/CHANGELOG.md index 80cb37099ce..b87468c2d5f 100644 --- a/src/Turbo/CHANGELOG.md +++ b/src/Turbo/CHANGELOG.md @@ -1,5 +1,20 @@ # CHANGELOG +## 2.6.1 + +- The `symfony/ux-turbo-mercure` package was abandoned and moved into this package. + If you were previously using `symfony/ux-turbo-mercure`, you can remove it + and only install mecure-bundle: + + ``` + composer require symfony/mercure-bundle + composer remove symfony/ux-turbo-mercure + ``` + + After upgrading this package to 2.6.1, you should have a new entry in + `assets/controllers.json` called `mercure-turbo-stream`. Change + `enabled: false` to `enabled: true`. + ## 2.6.0 - [BC BREAK] The `assets/` directory was moved from `Resources/assets/` to `assets/`. Make diff --git a/src/Turbo/src/Bridge/Mercure/assets/dist/turbo_stream_controller.js b/src/Turbo/assets/dist/turbo_stream_controller.js similarity index 100% rename from src/Turbo/src/Bridge/Mercure/assets/dist/turbo_stream_controller.js rename to src/Turbo/assets/dist/turbo_stream_controller.js diff --git a/src/Turbo/assets/package.json b/src/Turbo/assets/package.json index 93c75acc22a..f2e65c531f2 100644 --- a/src/Turbo/assets/package.json +++ b/src/Turbo/assets/package.json @@ -11,6 +11,11 @@ "webpackMode": "eager", "fetch": "eager", "enabled": true + }, + "mercure-turbo-stream": { + "main": "dist/turbo_stream_controller.js", + "fetch": "eager", + "enabled": false } } }, @@ -20,6 +25,7 @@ }, "devDependencies": { "@hotwired/turbo": "^7.1.0", - "@hotwired/stimulus": "^3.0.0" + "@hotwired/stimulus": "^3.0.0", + "jest-canvas-mock": "^2.3.0" } } diff --git a/src/Turbo/src/Bridge/Mercure/assets/src/turbo_stream_controller.ts b/src/Turbo/assets/src/turbo_stream_controller.ts similarity index 100% rename from src/Turbo/src/Bridge/Mercure/assets/src/turbo_stream_controller.ts rename to src/Turbo/assets/src/turbo_stream_controller.ts diff --git a/src/Turbo/src/Bridge/Mercure/assets/test/turbo_stream_controller.test.ts b/src/Turbo/assets/test/turbo_stream_controller.test.ts similarity index 79% rename from src/Turbo/src/Bridge/Mercure/assets/test/turbo_stream_controller.test.ts rename to src/Turbo/assets/test/turbo_stream_controller.test.ts index 3c9fe84f36e..e010417f6c1 100644 --- a/src/Turbo/src/Bridge/Mercure/assets/test/turbo_stream_controller.test.ts +++ b/src/Turbo/assets/test/turbo_stream_controller.test.ts @@ -16,7 +16,7 @@ import TurboStreamController from '../src/turbo_stream_controller'; const startStimulus = () => { const application = Application.start(); - application.register('symfony--ux-turbo-mercure--turbo-stream', TurboStreamController); + application.register('symfony--ux-turbo--mercure-turbo-stream', TurboStreamController); }; /* eslint-disable no-undef */ @@ -31,7 +31,7 @@ describe('TurboStreamController', () => { })); container = mountDOM( - '
' + '
' ); }); @@ -44,7 +44,7 @@ describe('TurboStreamController', () => { // smoke test expect(getByTestId(container, 'turbo-stream-mercure')).toHaveAttribute( - 'data-symfony--ux-turbo-mercure--turbo-stream-topic-value', + 'data-symfony--ux-turbo--mercure-turbo-stream-topic-value', 'foo' ); }); diff --git a/src/Turbo/composer.json b/src/Turbo/composer.json index eacb75511d2..7e63de9da10 100644 --- a/src/Turbo/composer.json +++ b/src/Turbo/composer.json @@ -24,8 +24,7 @@ ], "autoload": { "psr-4": { - "Symfony\\UX\\Turbo\\": "src/", - "Symfony\\UX\\Turbo\\Bridge\\Mercure\\": "src/Bridge/Mercure/src" + "Symfony\\UX\\Turbo\\": "src/" } }, "autoload-dev": { diff --git a/src/Turbo/doc/index.rst b/src/Turbo/doc/index.rst index b3281e600fe..a69fc062a56 100644 --- a/src/Turbo/doc/index.rst +++ b/src/Turbo/doc/index.rst @@ -383,9 +383,19 @@ Start by installing `the Mercure support`_ on your project: .. code-block:: terminal - $ composer require symfony/ux-turbo-mercure - $ yarn install --force - $ yarn encore dev + $ composer require symfony/mercure-bundle + +Then, enable the "mercure stream" controller in ``assets/controllers.json``: + +.. code-block:: diff + + "@symfony/ux-turbo": { + "mercure-turbo-stream": { + + "enabled": true, + - "enabled": false, + "fetch": "lazy" + } + }, The easiest way to have a working development (and production-ready) environment is to use `Symfony Docker`_, which comes with diff --git a/src/Turbo/src/Bridge/Mercure/src/Broadcaster.php b/src/Turbo/src/Bridge/Mercure/Broadcaster.php similarity index 100% rename from src/Turbo/src/Bridge/Mercure/src/Broadcaster.php rename to src/Turbo/src/Bridge/Mercure/Broadcaster.php diff --git a/src/Turbo/src/Bridge/Mercure/LICENSE b/src/Turbo/src/Bridge/Mercure/LICENSE deleted file mode 100644 index efb17f98e7d..00000000000 --- a/src/Turbo/src/Bridge/Mercure/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2021 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/src/Turbo/src/Bridge/Mercure/README.md b/src/Turbo/src/Bridge/Mercure/README.md deleted file mode 100644 index 1bae5b3cf9c..00000000000 --- a/src/Turbo/src/Bridge/Mercure/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Symfony Turbo-Mercure - -This library integrates [Symfony UX Turbo](https://symfony.com/bundles/ux-turbo/current/index.html) -with [Mercure](https://mercure.rocks/) to allow you to broadcast real-time page -updates to anyone using your site. - -**This repository is a READ-ONLY sub-tree split**. See -https://github.com/symfony/ux to create issues or submit pull requests. - -## Resources - -* [Documentation](https://symfony.com/bundles/ux-turbo-mercure/current/index.html) -* [Report issues](https://github.com/symfony/ux/issues) and - [send Pull Requests](https://github.com/symfony/ux/pulls) - in the [main Symfony UX repository](https://github.com/symfony/ux) diff --git a/src/Turbo/src/Bridge/Mercure/src/TurboStreamListenRenderer.php b/src/Turbo/src/Bridge/Mercure/TurboStreamListenRenderer.php similarity index 94% rename from src/Turbo/src/Bridge/Mercure/src/TurboStreamListenRenderer.php rename to src/Turbo/src/Bridge/Mercure/TurboStreamListenRenderer.php index dca7e0b786b..768aa702522 100644 --- a/src/Turbo/src/Bridge/Mercure/src/TurboStreamListenRenderer.php +++ b/src/Turbo/src/Bridge/Mercure/TurboStreamListenRenderer.php @@ -18,7 +18,7 @@ use Twig\Environment; /** - * Renders the attributes to load the "turbo-stream-mercure" controller. + * Renders the attributes to load the "mercure-turbo-stream" controller. * * @author Kévin Dunglas */ @@ -52,7 +52,7 @@ public function renderTurboStreamListen(Environment $env, $topic): string return $this->stimulusTwigExtension->renderStimulusController( $env, - 'symfony/ux-turbo-mercure/turbo-stream', + 'symfony/ux-turbo/mercure-turbo-stream', ['topic' => $topic, 'hub' => $this->hub->getPublicUrl()] ); } diff --git a/src/Turbo/src/Bridge/Mercure/assets/jest.config.js b/src/Turbo/src/Bridge/Mercure/assets/jest.config.js deleted file mode 100644 index 82bc3b2edec..00000000000 --- a/src/Turbo/src/Bridge/Mercure/assets/jest.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../../../../../../jest.config.js'); diff --git a/src/Turbo/src/Bridge/Mercure/assets/package.json b/src/Turbo/src/Bridge/Mercure/assets/package.json deleted file mode 100644 index 0b5f5b7bb6f..00000000000 --- a/src/Turbo/src/Bridge/Mercure/assets/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "@symfony/ux-turbo-mercure", - "description": "Mercure integration for Symfony UX Turbo", - "license": "MIT", - "private": true, - "version": "0.1.0", - "symfony": { - "controllers": { - "turbo-stream": { - "main": "dist/turbo_stream_controller.js", - "webpackMode": "eager", - "fetch": "eager", - "enabled": true - } - } - }, - "peerDependencies": { - "@hotwired/turbo": "^7.0.1", - "@hotwired/stimulus": "^3.0.0" - }, - "devDependencies": { - "@hotwired/turbo": "^7.0.1", - "jest-canvas-mock": "^2.3.0", - "@hotwired/stimulus": "^3.0.0" - } -} diff --git a/src/Turbo/src/Bridge/Mercure/composer.json b/src/Turbo/src/Bridge/Mercure/composer.json deleted file mode 100644 index c0eedf581de..00000000000 --- a/src/Turbo/src/Bridge/Mercure/composer.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "symfony/ux-turbo-mercure", - "type": "library", - "description": "Mercure bridge for Symfony UX Turbo", - "keywords": [ - "symfony-ux", - "turbo", - "hotwire", - "mercure" - ], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Kévin Dunglas", - "email": "kevin@dunglas.fr" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "autoload": { - "psr-4": { - "Symfony\\UX\\Turbo\\Bridge\\Mercure\\": "src/" - } - }, - "require": { - "php": ">=7.2.5", - "symfony/mercure-bundle": "^0.3", - "symfony/twig-bundle": "^5.2|^6.0", - "symfony/ux-turbo": "^2.0" - }, - "suggest": { - "symfony/expression-language": "To use expression language in topics" - }, - "extra": { - "thanks": { - "name": "symfony/ux-turbo", - "url": "https://github.com/symfony/ux" - } - }, - "minimum-stability": "dev" -} diff --git a/src/Turbo/tests/app/assets/app.js b/src/Turbo/tests/app/assets/app.js index 03b443e2cbf..3e6d848aeb8 100644 --- a/src/Turbo/tests/app/assets/app.js +++ b/src/Turbo/tests/app/assets/app.js @@ -8,9 +8,9 @@ */ import { Application } from "@hotwired/stimulus"; -import TurboStreamMercureController from "@symfony/ux-turbo-mercure/dist/turbo_stream_controller"; +import TurboStreamMercureController from "@symfony/ux-turbo/dist/turbo_stream_controller"; const application = Application.start(); -application.register("symfony--ux-turbo-mercure--turbo-stream", TurboStreamMercureController); +application.register("symfony--ux-turbo--mercure-turbo-stream", TurboStreamMercureController); console.log('test app initialized'); diff --git a/src/Turbo/tests/app/package.json b/src/Turbo/tests/app/package.json index 606b049df83..f607a9549b1 100644 --- a/src/Turbo/tests/app/package.json +++ b/src/Turbo/tests/app/package.json @@ -2,7 +2,6 @@ "devDependencies": { "@hotwired/turbo": "^7.0.1", "@symfony/ux-turbo": "file:../../assets", - "@symfony/ux-turbo-mercure": "file:../../src/Bridge/Mercure/assets", "@symfony/webpack-encore": "^0.32.0", "core-js": "^3.0.0", "regenerator-runtime": "^0.13.2", diff --git a/ux.symfony.com/assets/controllers.json b/ux.symfony.com/assets/controllers.json index bcad1aa9367..9fe2b3aaf70 100644 --- a/ux.symfony.com/assets/controllers.json +++ b/ux.symfony.com/assets/controllers.json @@ -71,10 +71,8 @@ "turbo-core": { "enabled": true, "fetch": "eager" - } - }, - "@symfony/ux-turbo-mercure": { - "turbo-stream": { + }, + "mercure-turbo-stream": { "enabled": true, "fetch": "lazy" } diff --git a/ux.symfony.com/composer.json b/ux.symfony.com/composer.json index 1e343d8ca61..c6b2c74ee8f 100644 --- a/ux.symfony.com/composer.json +++ b/ux.symfony.com/composer.json @@ -22,7 +22,7 @@ "symfony/flex": "^2", "symfony/form": "6.0.*", "symfony/framework-bundle": "6.0.*", - "symfony/mercure-bundle": "^0.3.4", + "symfony/mercure-bundle": "^0.3.5", "symfony/monolog-bundle": "^3.0", "symfony/notifier": "6.0.*", "symfony/proxy-manager-bridge": "6.0.*", @@ -38,7 +38,6 @@ "symfony/ux-react": "2.x-dev", "symfony/ux-swup": "2.x-dev", "symfony/ux-turbo": "2.x-dev", - "symfony/ux-turbo-mercure": "2.x-dev", "symfony/ux-twig-component": "2.x-dev", "symfony/ux-typed": "2.x-dev", "symfony/ux-vue": "2.x-dev", diff --git a/ux.symfony.com/composer.lock b/ux.symfony.com/composer.lock index bcf77ade6c7..a6c532ee63e 100644 --- a/ux.symfony.com/composer.lock +++ b/ux.symfony.com/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9e7c247a0d3a97df3ddfa7cc8c0f45af", + "content-hash": "6a570d9df68c24d7f0d8542793616bb9", "packages": [ { "name": "babdev/pagerfanta-bundle", @@ -7795,83 +7795,6 @@ ], "time": "2022-09-08T14:28:44+00:00" }, - { - "name": "symfony/ux-turbo-mercure", - "version": "2.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/ux-turbo-mercure.git", - "reference": "39b3827979347c1b2168233625070df73d9a49f5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/ux-turbo-mercure/zipball/39b3827979347c1b2168233625070df73d9a49f5", - "reference": "39b3827979347c1b2168233625070df73d9a49f5", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/mercure-bundle": "^0.3", - "symfony/twig-bundle": "^5.2|^6.0", - "symfony/ux-turbo": "^2.0" - }, - "suggest": { - "symfony/expression-language": "To use expression language in topics" - }, - "default-branch": true, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/ux-turbo", - "url": "https://github.com/symfony/ux" - } - }, - "autoload": { - "psr-4": { - "Symfony\\UX\\Turbo\\Bridge\\Mercure\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Kévin Dunglas", - "email": "kevin@dunglas.fr" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Mercure bridge for Symfony UX Turbo", - "homepage": "https://symfony.com", - "keywords": [ - "hotwire", - "mercure", - "symfony-ux", - "turbo" - ], - "support": { - "source": "https://github.com/symfony/ux-turbo-mercure/tree/2.x" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-11-01T17:19:11+00:00" - }, { "name": "symfony/ux-twig-component", "version": "2.x-dev", @@ -11295,7 +11218,6 @@ "symfony/ux-react": 20, "symfony/ux-swup": 20, "symfony/ux-turbo": 20, - "symfony/ux-turbo-mercure": 20, "symfony/ux-twig-component": 20, "symfony/ux-typed": 20, "symfony/ux-vue": 20 diff --git a/ux.symfony.com/package.json b/ux.symfony.com/package.json index 4a20802e779..712f1329ee2 100644 --- a/ux.symfony.com/package.json +++ b/ux.symfony.com/package.json @@ -24,7 +24,6 @@ "@symfony/ux-react": "file:vendor/symfony/ux-react/Resources/assets", "@symfony/ux-swup": "file:vendor/symfony/ux-swup/Resources/assets", "@symfony/ux-turbo": "file:vendor/symfony/ux-turbo/Resources/assets", - "@symfony/ux-turbo-mercure": "file:vendor/symfony/ux-turbo-mercure/Resources/assets", "@symfony/ux-typed": "file:vendor/symfony/ux-typed/Resources/assets", "@symfony/ux-vue": "file:vendor/symfony/ux-vue/Resources/assets", "@symfony/webpack-encore": "^2.0.0", diff --git a/ux.symfony.com/symfony.lock b/ux.symfony.com/symfony.lock index 90d9747277c..819b3d71933 100644 --- a/ux.symfony.com/symfony.lock +++ b/ux.symfony.com/symfony.lock @@ -562,9 +562,6 @@ "symfony/ux-turbo": { "version": "v2.1.0" }, - "symfony/ux-turbo-mercure": { - "version": "v2.1.0" - }, "symfony/ux-twig-component": { "version": "v2.1.0" },