Skip to content

Commit

Permalink
bug #580 Turbo mercure package abandoned (weaverryan)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 2.x branch.

Discussion
----------

Turbo mercure package abandoned

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| Tickets       | Fix #578
| License       | MIT

Hi!

The `symfony/ux-turbo-mercure` package is now abandoned - see #578 - and instead now lives in `symfony/ux-turbo`. That's actually already the case in 2.6.0, but in 2.6.1, we will move the actual Stimulus controller as well.

This moves the controller, fixes the autoloading & updates the README and CHANGELOG. I tested locally on ux.symfony.com (you can see those changes here too, though I'll need to update the package properly in that project after this is merged).

Cheers!

Commits
-------

0747273 Turbo mercure package abandoned
  • Loading branch information
weaverryan committed Dec 2, 2022
2 parents 25b7635 + 0747273 commit 2c2eead
Show file tree
Hide file tree
Showing 21 changed files with 47 additions and 208 deletions.
15 changes: 15 additions & 0 deletions src/Turbo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 7 additions & 1 deletion src/Turbo/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
"webpackMode": "eager",
"fetch": "eager",
"enabled": true
},
"mercure-turbo-stream": {
"main": "dist/turbo_stream_controller.js",
"fetch": "eager",
"enabled": false
}
}
},
Expand All @@ -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"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -31,7 +31,7 @@ describe('TurboStreamController', () => {
}));

container = mountDOM(
'<div data-testid="turbo-stream-mercure" data-controller="symfony--ux-turbo-mercure--turbo-stream" data-symfony--ux-turbo-mercure--turbo-stream-hub-value="https://example.com/.well-known/mercure" data-symfony--ux-turbo-mercure--turbo-stream-topic-value="foo"></div>'
'<div data-testid="turbo-stream-mercure" data-controller="symfony--ux-turbo--mercure-turbo-stream" data-symfony--ux-turbo--mercure-turbo-stream-hub-value="https://example.com/.well-known/mercure" data-symfony--ux-turbo--mercure-turbo-stream-topic-value="foo"></div>'
);
});

Expand All @@ -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'
);
});
Expand Down
3 changes: 1 addition & 2 deletions src/Turbo/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
16 changes: 13 additions & 3 deletions src/Turbo/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 0 additions & 19 deletions src/Turbo/src/Bridge/Mercure/LICENSE

This file was deleted.

15 changes: 0 additions & 15 deletions src/Turbo/src/Bridge/Mercure/README.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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 <kevin@dunglas.fr>
*/
Expand Down Expand Up @@ -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()]
);
}
Expand Down
1 change: 0 additions & 1 deletion src/Turbo/src/Bridge/Mercure/assets/jest.config.js

This file was deleted.

26 changes: 0 additions & 26 deletions src/Turbo/src/Bridge/Mercure/assets/package.json

This file was deleted.

44 changes: 0 additions & 44 deletions src/Turbo/src/Bridge/Mercure/composer.json

This file was deleted.

4 changes: 2 additions & 2 deletions src/Turbo/tests/app/assets/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
1 change: 0 additions & 1 deletion src/Turbo/tests/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 2 additions & 4 deletions ux.symfony.com/assets/controllers.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,8 @@
"turbo-core": {
"enabled": true,
"fetch": "eager"
}
},
"@symfony/ux-turbo-mercure": {
"turbo-stream": {
},
"mercure-turbo-stream": {
"enabled": true,
"fetch": "lazy"
}
Expand Down
3 changes: 1 addition & 2 deletions ux.symfony.com/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.*",
Expand All @@ -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",
Expand Down
80 changes: 1 addition & 79 deletions ux.symfony.com/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion ux.symfony.com/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 0 additions & 3 deletions ux.symfony.com/symfony.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down

0 comments on commit 2c2eead

Please sign in to comment.