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

feature(cli): allow using github url as template when prebuilding #26631

Merged
merged 8 commits into from
Jan 23, 2024

Conversation

byCedric
Copy link
Member

@byCedric byCedric commented Jan 23, 2024

Why

Porting functionality over from #26554 to expo prebuild --template ...

How

  • Added Tar createGlobFilter based on picomatch
  • Implemented identical strip and filter strategies from create-expo
  • Fixed template name when running prebuild with a git template

Test Plan

  • $ bun create expo ./test --template expo-template-bare-minimum@49
  • $ cd ./test
  • $ bun install && bun expo prebuild --no-install
  • $ git commit -m 'chore: initial changes'
  • $ expod prebuild --no-install --template https://github.com/expo/expo/tree/sdk-49/templates/expo-template-bare-minimum
  • Result should be similar.

One cool thing here is that you can even specify specific commit in the template. E.g.

$ expod prebuild --no-install --template https://github.com/expo/expo/tree/30072b9637f0d2b964fe7f47f99f0e369336913a/templates/expo-template-bare-minimum

This would help us testing unreleased canaries, fixes and other stuff 😄

Checklist

@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Jan 23, 2024
@byCedric byCedric marked this pull request as ready for review January 23, 2024 15:41
Comment on lines 112 to 117
ignore: [
'**/.gitattributes',
'**/.npmignore',
'**/ios/HelloWorld.xcworkspace/**',
'**/ios/.xcode.env.local',
],
Copy link
Member Author

Choose a reason for hiding this comment

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

Let me try if we can add inverse ignores. If we keep dot: false (default), and explicitly add !**/ios/.xcode.env as ignore, we could get rid of some options here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Negative ignores breaks picomatch, but we can provide multiple globs in the filter.

@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels Jan 23, 2024
@byCedric byCedric merged commit 6d664b5 into main Jan 23, 2024
6 checks passed
@byCedric byCedric deleted the @bycedric/cli/template-github-url branch January 23, 2024 16:55
byCedric added a commit that referenced this pull request Jan 23, 2024
# Why

Backporting from #26631

# How

- Added filtering logic from `expo prebuild --template <github-url>`

# Test Plan

See tests

- `$ bun create expo ./test --template expo-template-bare-minimum@49`
- `$ cd ./test`
- `$ rm -rf android ios`
- `$ bun expo prebuild`
- `$ git add . && git commit -m 'chore: initial prebuild'`
- Delete everything, except `.git`
- `$ create-expod . --no-install --template
https://github.com/expo/expo/tree/sdk-49/templates/expo-template-bare-minimum`
- Configure `com.test` in `app.json` as `android.package` and
`ios.bundleIdentifier`
- `$ bun install && bun expo prebuild --clean`
- Result should pretty much be the same (there might be some differences
in lockfiles and native files 🤷)

> ℹ️ In these examples `create-expod` is an alias for `node
<create-expo>/build/index.js`

# Checklist

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

- [x] 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).
byCedric added a commit that referenced this pull request Jan 23, 2024
…6631)

# Why

Porting functionality over from #26554 to `expo prebuild --template ...`

# How

- Added Tar `createGlobFilter` based on `picomatch`
- Implemented identical `strip` and `filter` strategies from
`create-expo`
- Fixed template name when running `prebuild` with a git template

# Test Plan

- `$ bun create expo ./test --template expo-template-bare-minimum@49`
- `$ cd ./test`
- `$ bun install && bun expo prebuild --no-install`
- `$ git commit -m 'chore: initial changes'`
- `$ expod prebuild --no-install --template
https://github.com/expo/expo/tree/sdk-49/templates/expo-template-bare-minimum`
- Result should be similar.

One cool thing here is that you can even specify specific commit in the
template. E.g.

```
$ expod prebuild --no-install --template https://github.com/expo/expo/tree/30072b9637f0d2b964fe7f47f99f0e369336913a/templates/expo-template-bare-minimum
```

This would help us testing unreleased canaries, fixes and other stuff 😄 


# Checklist

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

- [x] 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).
@brentvatne brentvatne added the published Changes from the PR have been published to npm label Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: fingerprint changed 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