Skip to content
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

[router]: allow custom file extension for renderRouter #26510

Merged
merged 5 commits into from
Jan 22, 2024

Conversation

marklawlor
Copy link
Contributor

Why

renderRouter currently appends .js to all filenames. This is undocumented and also makes writing tests that depend on the extension (e.g. duplicate routes) difficult.

This change will only append .js is no valid extension is provided.

E.g this is now allowed and allows for better duplicate route tests.

  renderRouter({
    "(app)/page.js": () => null,
    "(app)/page.tsx": () => null,
  });

How

There are many duplicate route tests as part of the getRoutes() PR. I'm separating this logic to reduce the size of the PR

Test Plan

The tests for this will be part of the getRoutes refactor PR

Checklist

@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Jan 19, 2024
Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com>
@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels Jan 19, 2024
@marklawlor marklawlor self-assigned this Jan 19, 2024
@marklawlor marklawlor merged commit b68571c into main Jan 22, 2024
10 checks passed
@marklawlor marklawlor deleted the marklawlor/router/context-stub-extensions branch January 22, 2024 22:25
marklawlor added a commit that referenced this pull request Feb 28, 2024
`renderRouter` currently appends `.js` to all filenames. This is
undocumented and also makes writing tests that depend on the extension
(e.g. duplicate routes) difficult.

This change will only append `.js` is no valid extension is provided.

E.g this is now allowed and allows for better duplicate route tests.

```
  renderRouter({
    "(app)/page.js": () => null,
    "(app)/page.tsx": () => null,
  });
```

There are many duplicate route tests as part of the `getRoutes()` PR.
I'm separating this logic to reduce the size of the PR

The tests for this will be part of the `getRoutes` refactor PR

<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).

---------

Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com>
@brentvatne brentvatne added the published Changes from the PR have been published to npm label Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: fingerprint compatible bot: passed checks ExpoBot has nothing to complain about published Changes from the PR have been published to npm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants