Skip to content

Changing to support next version of stimulus bridge with "fetch" mode #735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 2, 2021
Merged

Changing to support next version of stimulus bridge with "fetch" mode #735

merged 1 commit into from
Feb 2, 2021

Conversation

weaverryan
Copy link
Member

Partner to symfony/stimulus-bridge#15 and symfony/ux#53

The tricky part about this is that, if the user has stimulus-bridge 1.x, then their controllers.json file needs webpackMode. If they have stimulus-bridge "next" (we're thinking it'll be 2.0), then their controllers.json file needs fetch. This means that Flex has a "hard break" and sorta just needs to assume that the user has the "new" version.

We made the decision - to go from webpackMode to fetch because the setting no longer is truly the same as webpackMode. However, if we wanted to make the upgrade path easier, we could revert that and use webpackMode in 2.0 as well (instead of changing to fetch).

@stof
Copy link
Member

stof commented Feb 1, 2021

if you want to avoid a hard break, you could actually set both keys in Flex. stimulus-bridge will ignore the key it does not need.

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BC break is fine to my side.
We could maybe make flex turn existing webpackMode entries into fetch?

@weaverryan
Copy link
Member Author

if you want to avoid a hard break, you could actually set both keys in Flex. stimulus-bridge will ignore the key it does not need

I've just done that 👍 symfony/ux#53

We could maybe make flex turn existing webpackMode entries into fetch?

👍 It indeed does this :)

{
$this->tempDir = sys_get_temp_dir().'/flex-package-json-'.substr(md5(uniqid('', true)), 0, 6);
(new Filesystem())->mirror(__DIR__.'/Fixtures/packageJson', $this->tempDir);

$this->synchronizer = new PackageJsonSynchronizer($this->tempDir);
}

public function tearDown(): void
protected function tearDown(): void
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fabbot-motivated change

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fabbot is great!

@@ -149,7 +149,7 @@ private function registerWebpackResources(array $phpPackages)
}
}

file_put_contents($controllersJsonPath, json_encode($newControllersJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)."\n");
file_put_contents($controllersJsonPath, json_encode($newControllersJson, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES)."\n");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fabbot motivated

tgalopin added a commit to symfony/ux that referenced this pull request Feb 1, 2021
…ge#15 (weaverryan)

This PR was merged into the main branch.

Discussion
----------

Changing webpackMode to fetch - see symfony/stimulus-bridge#15

| Q             | A
| ------------- | ---
| Bug fix?      | yes(ish)
| New feature?  | no
| Tickets       | none
| License       | MIT

Hi!

If symfony/stimulus-bridge#15 is merged, this updates the keys for all the UX packages.

The old `webpackMode` is kept for now. This will prevent errors if you're using an "old" Flex version (a version before this PR symfony/flex#735). We can remove that... eventually...

Cheers!

Commits
-------

27f7115 Adding fetch - see symfony/stimulus-bridge#15
@tgalopin
Copy link
Contributor

tgalopin commented Feb 2, 2021

Thanks @weaverryan.

@tgalopin tgalopin merged commit 0c1d93d into symfony:main Feb 2, 2021
@weaverryan weaverryan deleted the stimulus-bridge-fetch branch March 4, 2021 15:19
fullstackdeveloperwebapp added a commit to fullstackdeveloperwebapp/ux that referenced this pull request Aug 1, 2023
…ge#15 (weaverryan)

This PR was merged into the main branch.

Discussion
----------

Changing webpackMode to fetch - see symfony/stimulus-bridge#15

| Q             | A
| ------------- | ---
| Bug fix?      | yes(ish)
| New feature?  | no
| Tickets       | none
| License       | MIT

Hi!

If symfony/stimulus-bridge#15 is merged, this updates the keys for all the UX packages.

The old `webpackMode` is kept for now. This will prevent errors if you're using an "old" Flex version (a version before this PR symfony/flex#735). We can remove that... eventually...

Cheers!

Commits
-------

27f7115 Adding fetch - see symfony/stimulus-bridge#15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants