feat(cli): Allow prebuild from monorepo expo-template-bare-minimum template#41383
feat(cli): Allow prebuild from monorepo expo-template-bare-minimum template#41383
expo-template-bare-minimum template#41383Conversation
|
Subscribed to pull request
Generated by CodeMention |
8ca39b2 to
4bb4bee
Compare
4bb4bee to
5d446ff
Compare
| /** Returns the `local-template` target path, only for the `expo/expo` monorepo */ | ||
| const getMonorepoTemplatePath = async () => { | ||
| const cliPath = path.dirname(require.resolve('@expo/cli/package.json')); | ||
| const localTemplateOriginPath = path.join(cliPath, 'local-template'); |
There was a problem hiding this comment.
i would lean toward to use __dirname/../../... than resolving @expo/cli/package.json again. think the case where people in a project outside of expo/expo and execute expo-cli from expo/expo. maybe good to keep behavior consistent
$ cd sdk54
$ /path/to/expo/expo/packages/@expo/cli/build/bin/cli prebuildThere was a problem hiding this comment.
We use require.resolve('@expo/cli') pretty often because the build/ output path is shifted, i.e. it shifts to build/src/. That in itself is (currently) consistent of course, but we use this pattern in other places in the CLI to prevent this from being based on a different path (since the src/ path doesn't match the build path unfortunately, and we don't use a bundling/build tool that accounts for this and modifies the path)
Co-authored-by: Kudo Chien <kudo@expo.dev>
7e79a96 to
e5c6626
Compare
…template (#41383) # Why > [!NOTE] > Supersedes #41306. > This hides the template way in a CLI dev-only dependency, so it's not as publicly visible, since it's only meant for our own testing and monorepo. We're often making changes to local templates, e.g.: - #41264 - #39418 Since we don't have a concept of local templates, we then have to make sure to specify a local prebuild template manually. However, this seems pretty redundant because `expo-template-bare-minimum` is just a package and in the monorepo. Failing to apply template changes to prebuild CNG folders often causes build issues on `main` as we upgrade React Native. Applying the monorepo template automatically seems like a good idea, since we then automatically test against any template changes on `main`. # How - Add `packages/@expo/cli/local-template -> templates/expo-template-bare-minimum` symlink - Exclude `/local-template` symlink explicitly in CLI's `.npmignore` - Extend `resolveLocalTemplateAsync` to try to load from `@expo/cli/local-template` locally first This means in `expo/expo`, we'll now always look at the up-to-date `templates/expo-template-bare-minimum` contents, instead of `expo/template.tgz` # Test Plan - CI covers this behaviour # Checklist - [x] I added a `changelog.md` entry and rebuilt the package sources according to [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) --------- Co-authored-by: Kudo Chien <kudo@expo.dev>
# Why See CI failure in: https://github.com/expo/expo/actions/runs/19916741962/job/57096975273 Caused by symlink added in: #41383 # How - ~~Update the workspaces pattern to only find Expo package folders by workspace specifier name (mirroring the path in `Project.ts` and root `package.json:workspaces`)~~ - Ignore `local-template` in `@expo/cli` # Test Plan - CI should pass the mentioned run # Checklist <!-- Please check the appropriate items below if they apply to your diff. --> - [ ] I added a `changelog.md` entry and rebuilt the package sources according to [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
# Why See CI failure in: https://github.com/expo/expo/actions/runs/19916741962/job/57096975273 Caused by symlink added in: #41383 # How - ~~Update the workspaces pattern to only find Expo package folders by workspace specifier name (mirroring the path in `Project.ts` and root `package.json:workspaces`)~~ - Ignore `local-template` in `@expo/cli` # Test Plan - CI should pass the mentioned run # Checklist <!-- Please check the appropriate items below if they apply to your diff. --> - [ ] I added a `changelog.md` entry and rebuilt the package sources according to [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
Why
Note
Supersedes #41306.
This hides the template way in a CLI dev-only dependency, so it's not as publicly visible, since it's only meant for our own testing and monorepo.
We're often making changes to local templates, e.g.:
node -eforexpo-modules-autolinkinginvocation inPodfilecommand #41264Since we don't have a concept of local templates, we then have to make sure to specify a local prebuild template manually. However, this seems pretty redundant because
expo-template-bare-minimumis just a package and in the monorepo.Failing to apply template changes to prebuild CNG folders often causes build issues on
mainas we upgrade React Native.Applying the monorepo template automatically seems like a good idea, since we then automatically test against any template changes on
main.How
packages/@expo/cli/local-template -> templates/expo-template-bare-minimumsymlink/local-templatesymlink explicitly in CLI's.npmignoreresolveLocalTemplateAsyncto try to load from@expo/cli/local-templatelocally firstThis means in
expo/expo, we'll now always look at the up-to-datetemplates/expo-template-bare-minimumcontents, instead ofexpo/template.tgzTest Plan
Checklist
changelog.mdentry and rebuilt the package sources according to this short guidenpx expo prebuild& EAS Build (eg: updated a module plugin).