Create new arch module template: cpp-lib#12481
Merged
jonthysell merged 11 commits intomicrosoft:mainfrom Jan 18, 2024
Merged
Conversation
## Description Adds a new `cpp-lib` template designed to be applied on top of the new projects created by the (now recommended) `create-react-native-library` script. ### Type of Change - New feature (non-breaking change which adds functionality) - This change requires a documentation update ### Why Devs need to add windows support to native modules in a way which can be consumed by the new arch RNW apps (i.e. the `cpp-app` template). Resolves #12480 ### What Create a new `cpp-lib` template which can be applied on top of the template created by `npx create-react-native-library`, adding Windows support for a turbo module. It will also automatically apply the `cpp-app` template to the example project if it exists. ## Screenshots <img width="441" alt="image" src="https://github.com/microsoft/react-native-windows/assets/10852185/f5f31727-a233-419c-8afe-ad91f797abb2"> ## Testing Verified the new template could be applied to a fresh library created by `create-react-native-library` and that example app autolinks, builds, and runs correctly. ## Changelog Should this change be included in the release notes: yes Created a new arch module template: cpp-lib
acoates-ms
reviewed
Dec 5, 2023
acoates-ms
reviewed
Dec 5, 2023
acoates-ms
reviewed
Dec 5, 2023
jonthysell
commented
Jan 16, 2024
| const cmd = isYarn ? 'yarn' : 'npm i'; | ||
|
|
||
| try { | ||
| await exec(cmd, options?.logging ? {stdio: 'inherit'} : {}); |
Contributor
Author
There was a problem hiding this comment.
This works for cpp-app both locally and in CI. This also works for cpp-lib locally. But for some reason (probably to do with the lib template using yarn 2+) this fails in CI. So I've added this here to notify the user they need to run it locally if it happens to fail, but I'll need to follow up and see if I can fix this in CI.
acoates-ms
approved these changes
Jan 17, 2024
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.
Description
Adds a new
cpp-libtemplate designed to be applied on top of the new projects created by the (now recommended)create-react-native-libraryscript. Also updates thecpp-apptemplate to be able to autolink and run these new libraries.Type of Change
Why
Devs need to add windows support to native modules in a way which can be consumed by the new arch RNW apps (i.e. the
cpp-apptemplate).Resolves #12480
What
Create a new
cpp-libtemplate which can be applied on top of the template created bynpx create-react-native-library, adding Windows support for a turbo module. It will also automatically apply thecpp-apptemplate to the example project if it exists.Screenshots
Testing
Verified the new template could be applied to a fresh library created by
create-react-native-libraryand that example app autolinks, builds, and runs correctly.Changelog
Should this change be included in the release notes: yes
Created a new arch module template: cpp-lib
Microsoft Reviewers: Open in CodeFlow