https://github.com/nativescript-community/expo-nativescript
A monorepo of various libraries from the Expo ecosystem, ported to NativeScript.
https://github.com/nativescript-community/expo-nativescript
Last synced: about 1 year ago
JSON representation
A monorepo of various libraries from the Expo ecosystem, ported to NativeScript.
- Host: GitHub
- URL: https://github.com/nativescript-community/expo-nativescript
- Owner: nativescript-community
- License: other
- Created: 2020-12-24T17:47:34.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2020-12-24T17:51:09.000Z (over 5 years ago)
- Last Synced: 2025-05-13T01:12:36.730Z (about 1 year ago)
- Language: TypeScript
- Size: 1.54 MB
- Stars: 24
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @nativescript-community/expo-nativescript
## About
This is a monorepo of various libraries from the [Expo ecosystem](https://docs.expo.io/versions/latest/), which is primarily a React Native ecosystem, adapted for use with NativeScript. The endgame is for the Expo ecosystem (or at least Expo [Unimodules](https://www.youtube.com/watch?v=-9CJZRv7uOY), which are [a large part of it](https://docs.expo.io/bare/unimodules-full-list/)) to be fully supported on NativeScript as it is on React Native. But this is a long way off for now!
## Getting involved
For more information on this project (and particularly if you'd like to help – especially so if it's for getting the Android side working), you can contact Jamie Birch on Twitter via [@LinguaBrowse](https://twitter.com/intent/follow?screen_name=LinguaBrowse), or on the [NativeScript Slack](https://app.slack.com/client/T0L97VCSY/CJ2B77CJ1) in the `#react` channel, or on the [NativeScript Discord](https://discord.com/channels/603595811204366337/606457751995940866), again in the `#react` channel.
## ⚠️ Before you start ⚠️
Be warned: It's in proof-of-concept stage right now. Expo Contacts (and Expo Permissions, which it depends upon) is working fully on iOS. Android support is blocked, however – [see details](packages/expo-nativescript-adapter/README.md) in the `expo-nativescript-adapter` project.
Please don't look too closely at [apps/demo](apps/demo) and [apps/demo-angular](apps/demo-angular), as I have only been developing with [demo-react](apps/demo-react). They're there only as templates to be filled in properly later.
I hope at some point to simplify this monorepo by removing the packages [expo-permissions](packages/expo-permissions) and [expo-nativescript-react-native-shim](packages/expo-nativescript-react-native-shim), which only exist to support Android. But for now, we have to put up with them.
And as Android support still isn't working even with best-effort hacks, I'll only be publishing [expo-nativescript-adapter](packages/expo-nativescript-adapter), [expo-permissions-nativescript-plugin](packages/expo-permissions-nativescript-plugin), and [expo-contacts-nativescript-plugin](packages/expo-contacts-nativescript-plugin) to npm for now.
## Monorepo setup
Run these commands:
```sh
# Installs all dependencies (will likely take several minutes):
npm run setup
# Builds the packages that the demo apps will use:
npm start
# Select: @nativescript-community.build-all
# Runs the React demo on an iOS simulator (or device, if connected):
npm start
# Select: apps.demo-react.ios
```
# What are these packages?
As this project grows, we aim to implement, for each Expo Unimodule such as `expo-contacts`, a corresponding `@nativescript-community/expo-contacts-nativescript-plugin` NativeScript plugin.
expo-contacts-nativescript-plugin
The Expo SDK's Contacts API, implemented for NativeScript, using the exact same expo-contacts native code and largely a copy-paste of the TypeScript code. Developed with reference to the now-removed expo-contacts-flutter-plugin.
expo-nativescript-adapter
An implementation of all the Expo APIs (e.g. module registration and function-calling) for NativeScript. Essentially a port of @unimodules/react-native-adapter to Nativescript (with reference to the now-removed expo-flutter-adapter).
expo-nativescript-react-native-shim
A shim for any interfaces from the React Native ecosystem that Expo plugins rely upon. Currently only relevant to the Android implementation of expo-permissions, implementing the PermissionAwareActivity and PermissionListener interfaces.
expo-permissions
A fork of expo-permissions (distinguished by namespacing it under the @nativescript-community organisation), differing only by changing the Android code to make it easier for NativeScript to build. No success yet.
expo-permissions-nativescript-plugin
The Expo SDK's Permissions API, implemented for NativeScript, using the exact same expo-permissions native code and largely a copy-paste of the TypeScript code. Developed with reference to the now-removed expo-permissions-flutter-plugin.
# How to operate this monorepo?
This workspace manages the suite of plugins listed above.
In general, when in doubt with what to do, just `npm start`.
## How to add a new package to workspace?
```
npm run add
```
At the prompt, enter the name of the new package.
- This adds a plugin harness in `packages` with the necessary boilerplate to just start developing
- Updates all demo app flavors to support demoing the new package
- Adds shared code in `tools/demo` where you can write demo code **once** and share across all demo flavors
- Updates build tooling to support the new package
- Updates the `npm start` interactive display
- Updates the README here to list the new package
## How to add Angular compatibility to a package
```
npm run add-angular
```
At the prompt, enter the name of the package to add an `angular` folder to it with the necessary boilerplate to provide Angular support to the package.
## How to focus on just 1 package to develop in isolation
```
npm start
```
- Choose the focus commands for the package you wish to focus on and hit enter.
- All the demo app's will be updated to isolate that 1 package and for supported IDE's (currently VS Code), the source code will also become isolated in the workspace.
Note: _good to always clean the demo you plan to run after focusing. (You can clean any demo from `npm start` as well)_
## How to publish packages?
```
npm run publish-packages
```
- You will be prompted for the package names to publish. Leaving blank and hitting enter will publish them all.
- You will then be prompted for the version to use. Leaving blank will auto bump the patch version (it also handles prerelease types like alpha, beta, rc, etc. - It even auto tags the corresponding prelease type on npm).
- You will then be given a brief sanity check 🧠😊
Made with ❤️
## Why don't we hoist `@nativescript/android` and `@nativescript/ios` in this monorepo?
See https://github.com/NativeScript/nativescript-cli/issues/5444