Repository navigation
fix(upgrade): check for other extensions in flarum.extensions - #62
Merged
Merged
Conversation
1.x code checked for another extension with app.initializers.has(name).
An initializer is not always named after its extension, and 2.0 renamed
three of core's, so fof/username-request's check for 'flarum/nicknames',
for one, is always false in 2.0. The misc frontend step was meant to
rename those three, but never ran: it looked for this.currentTag after
an earlier change had replaced it.
- app.initializers.has('name') becomes 'id' in flarum.extensions where
the ID is certain: a bundled extension's, or one composer.json names.
Other checks get a @todo.
- A replacement that changes the code as text no longer loses its change
when a later one in the same step returns the syntax tree it was given.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: no issue.
Changes proposed in this pull request:
1.x code checked whether another extension was enabled with
app.initializers.has(name). An initializer isn't always named after its extension, and 2.0 renamed three of core's (flarum/framework#4003), so checks like fof/username-request'shas('flarum/nicknames')are always false in 2.0. The misc frontend step was meant to rename those three, but it never ran. It only ran on files containingthis.currentTag, and an earlier change in the same step had already rewritten that. Nowapp.initializers.has('name')becomes'id' in flarum.extensionswherever the ID is certain: a bundled extension's, or one the extension'scomposer.jsonnames (inrequire,require-dev,suggestoroptional-dependencies), by its ID or its package name. Any other check gets a@TODO, placed above its statement so it can't land inside JSX.This also fixes the step machinery. When a replacement changed the code as text, a later replacement in the same step still got the syntax tree from before that change. If the later one returned that tree, the text change was lost. Across the corpus that dropped changes in four real form modals, for example Sami's
SearchStateimport move in fof/byobu'sAddRecipientModal.Reviewers should focus on:
gtdxyz-flarum-badges), so converting blindly would turn working checks into ones that are always false.@TODO. All three are third-party extensions their callers don't list incomposer.json. With and without the machinery fix, the frontend steps give the same output for 6,234 file runs, except the four modals above.Screenshot
N/A
Necessity
Confirmed
yarn testinjs/). (yarn test: 295 tests, plus Prettier, ESLint andtsc.)composer test). (N/A)Required changes:
None.