-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8a7d177
commit 0ca8ea4
Showing
19 changed files
with
12,875 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module.exports = { | ||
root: true, | ||
extends: ['@react-native-community', 'plugin:json/recommended'], | ||
ignorePatterns: [ | ||
'.bundle/', | ||
'dist/', | ||
'android/', | ||
'ios/', | ||
'node_modules/', | ||
'**/node_modules/', | ||
'/**/node_modules/*', | ||
], | ||
overrides: [ | ||
{ | ||
files: ['*.json','*.ts','*.tsx','*.js','*.jsx'], | ||
}, | ||
], | ||
rules: { | ||
'semi': ['error', 'never'], | ||
'curly': ['error', 'multi-line'], | ||
'object-curly-spacing': [ 'error', 'always' ], | ||
'dot-notation': 'off', | ||
'react/jsx-uses-react': 'off', | ||
'react/react-in-jsx-scope': 'error', | ||
'react/no-unstable-nested-components': 'off', | ||
'react-native/no-inline-styles': 'off', | ||
'no-new': 'off', | ||
'@typescript-eslint/no-shadow': 'off', | ||
'@typescript-eslint/semi': ['error', 'never'], | ||
'@typescript-eslint/no-unused-vars': [ | ||
'warn', { | ||
'vars': 'all', | ||
'args': 'none', | ||
'ignoreRestSiblings': false, | ||
}], | ||
'prettier/prettier': 'off', | ||
}, | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Build & Publish | ||
|
||
on: [push] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' | ||
cache: 'yarn' | ||
registry-url: 'https://registry.npmjs.org' | ||
- name: Install modules | ||
run: yarn install --immutable | ||
- name: Run Lint | ||
run: yarn lint | ||
|
||
publish: | ||
runs-on: ubuntu-latest | ||
needs: test | ||
if: startsWith(github.ref, 'refs/tags/release-') | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' | ||
cache: 'yarn' | ||
registry-url: 'https://registry.npmjs.org' | ||
- name: Install modules | ||
run: yarn install --immutable | ||
- name: Build | ||
run: yarn run build | ||
- name: Publish to npm | ||
run: npm publish --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# OSX | ||
.DS_Store | ||
Thumbs.db | ||
|
||
# VSCode | ||
.vscode/ | ||
jsconfig.json | ||
|
||
# Xcode | ||
build/ | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
xcuserdata | ||
*.xccheckout | ||
*.moved-aside | ||
DerivedData | ||
*.hmap | ||
*.ipa | ||
*.xcuserstate | ||
ios/.xcode.env.local | ||
project.xcworkspace | ||
|
||
# Android/IntelliJ | ||
build/ | ||
android/.idea | ||
.project | ||
.settings | ||
.gradle/ | ||
local.properties | ||
*.hprof | ||
android/app/libs | ||
.cxx/ | ||
*.keystore | ||
!debug.keystore | ||
|
||
# BUCK | ||
buck-out/ | ||
\.buckd/ | ||
|
||
# node.js | ||
node_modules | ||
npm-debug.log | ||
yarn-debug.log | ||
yarn-error.log | ||
.npmrc | ||
|
||
# IDEs and editors | ||
.project | ||
.classpath | ||
.c9/ | ||
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
|
||
# IDE - VSCode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
|
||
# Expo | ||
.expo/ | ||
|
||
# Temporary files created by Metro to check the health of the file watcher | ||
.metro-health-check* | ||
|
||
# Yarn | ||
.yarn/* | ||
!.yarn/patches | ||
!.yarn/plugins | ||
!.yarn/releases | ||
!.yarn/sdks | ||
!.yarn/versions | ||
|
||
# Typescript | ||
tsconfig.tsbuildinfo | ||
|
||
# generated by bob | ||
dist/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
compressionLevel: mixed | ||
enableGlobalCache: true | ||
nodeLinker: node-modules | ||
yarnPath: .yarn/releases/yarn-4.1.1.cjs |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,42 @@ | ||
[![npm](https://img.shields.io/npm/v/expo-firebase-app-distribution.svg)](https://www.npmjs.com/package/expo-firebase-app-distribution) | ||
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) | ||
[![CI Status](https://github.com/nbottarini/expo-firebase-app-distribution/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/nbottarini/expo-firebase-app-distribution/actions) | ||
|
||
# expo-firebase-app-distribution | ||
Expo plugin for firebase app distribution | ||
|
||
## Installation | ||
|
||
Npm: | ||
``` | ||
$ npm install --save expo-firebase-app-distribution @react-native-firebase/app @react-native-firebase/app @react-native-firebase/app-distribution | ||
``` | ||
|
||
Yarn: | ||
``` | ||
$ yarn add expo-firebase-app-distribution @react-native-firebase/app @react-native-firebase/app @react-native-firebase/app-distribution | ||
``` | ||
|
||
Add plugins to your app.json: | ||
```json | ||
{ | ||
"expo": { | ||
"android": { | ||
"googleServicesFile": "./google-services.json", | ||
"package": "com.mycorp.myapp" | ||
}, | ||
"ios": { | ||
"googleServicesFile": "./GoogleService-Info.plist", | ||
"bundleIdentifier": "com.mycorp.myapp" | ||
}, | ||
"plugins": [ | ||
"@react-native-firebase/app", | ||
"expo-firebase-app-distribution" | ||
] | ||
} | ||
} | ||
``` | ||
|
||
## Usage | ||
|
||
Please refer to React Native Firebase App Distribution [docs](https://rnfirebase.io/app-distribution/usage). |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./dist') |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: ['module:metro-react-native-babel-preset'], | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"name": "expo-firebase-app-distribution", | ||
"version": "0.1.0", | ||
"description": "Expo Config plugin for react-native-firebase-app-distribution", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"author": "Nicolás Bottarini <nicolasbottarini@gmail.com>", | ||
"license": "MIT", | ||
"homepage": "https://github.com/nbottarini/expo-firebase-app-distribution#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/nbottarini/expo-firebase-app-distribution.git" | ||
}, | ||
"keywords": [ | ||
"expo", | ||
"firebase", | ||
"app-distribution" | ||
], | ||
"files": [ | ||
"dist", | ||
"app.plugin.js" | ||
], | ||
"scripts": { | ||
"build": "yarn run tsc --build", | ||
"lint": "yarn run eslint . && yarn run tsc --noEmit" | ||
}, | ||
"dependencies": { | ||
"expo-build-properties": "~0.11.1" | ||
}, | ||
"packageManager": "yarn@4.1.1", | ||
"peerDependencies": { | ||
"@react-native-firebase/app": "^19.0.0", | ||
"@react-native-firebase/app-distribution": "^19.0.0", | ||
"expo": "^50" | ||
}, | ||
"engines": { | ||
"node": ">= 18.0.0" | ||
}, | ||
"devDependencies": { | ||
"@react-native-community/eslint-config": "~3.2.0", | ||
"@react-native-firebase/app-distribution": "~19.0.0", | ||
"@types/node": "~20.12.7", | ||
"@types/react": "~18.2.39", | ||
"@types/react-native": "~0.73.0", | ||
"eslint": "~8.57.0", | ||
"eslint-plugin-json": "~3.1.0", | ||
"expo": "~50.0.14", | ||
"metro-react-native-babel-preset": "~0.77.0", | ||
"react": "~18.2.0", | ||
"react-native": "~0.73.6", | ||
"typescript": "~5.4.4" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { ConfigPlugin } from '@expo/config-plugins' | ||
import { WarningAggregator, withAppBuildGradle } from 'expo/config-plugins' | ||
|
||
export const appDistributionPlugin = 'com.google.firebase.appdistribution' | ||
|
||
export const withApplyDistPlugin: ConfigPlugin = config => { | ||
return withAppBuildGradle(config, config => { | ||
if (config.modResults.language === 'groovy') { | ||
config.modResults.contents = applyPlugin(config.modResults.contents) | ||
} else { | ||
WarningAggregator.addWarningAndroid( | ||
'expo-firebase-app-distribution', | ||
`Cannot automatically configure app build.gradle if it's not groovy`, | ||
) | ||
} | ||
return config | ||
}) | ||
} | ||
|
||
export function applyPlugin(appBuildGradle: string) { | ||
const perfPattern = new RegExp(`apply\\s+plugin:\\s+['"]${appDistributionPlugin}['"]`) | ||
if (!appBuildGradle.match(perfPattern)) { | ||
appBuildGradle += `\napply plugin: '${appDistributionPlugin}'` | ||
} | ||
return appBuildGradle | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { ConfigPlugin, WarningAggregator, withProjectBuildGradle } from '@expo/config-plugins' | ||
|
||
const appDistributionClassPath = 'com.google.firebase:firebase-appdistribution-gradle' | ||
const appDistributionVersion = '4.0.1' | ||
|
||
/** | ||
* Update `<project>/build.gradle` by adding google-services dependency to buildscript | ||
*/ | ||
export const withBuildscriptDependency: ConfigPlugin = config => { | ||
return withProjectBuildGradle(config, config => { | ||
if (config.modResults.language === 'groovy') { | ||
config.modResults.contents = setBuildscriptDependency(config.modResults.contents) | ||
} else { | ||
WarningAggregator.addWarningAndroid( | ||
'expo-firebase-app-distribution', | ||
`Cannot automatically configure project build.gradle if it's not groovy`, | ||
) | ||
} | ||
return config | ||
}) | ||
} | ||
|
||
export function setBuildscriptDependency(buildGradle: string) { | ||
// TODO: Find a more stable solution for this | ||
if (!buildGradle.includes(appDistributionClassPath)) { | ||
return buildGradle.replace( | ||
/dependencies\s?{/, | ||
`dependencies { | ||
classpath '${appDistributionClassPath}:${appDistributionVersion}'`, | ||
) | ||
} | ||
|
||
return buildGradle | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ConfigPlugin, createRunOncePlugin, withPlugins } from '@expo/config-plugins' | ||
import { withApplyDistPlugin } from './android/applyPlugin' | ||
import { withBuildscriptDependency } from './android/buildscriptDependency' | ||
|
||
const withRnFirebaseAppDistribution: ConfigPlugin = config => { | ||
return withPlugins(config, [withBuildscriptDependency, withApplyDistPlugin]) | ||
} | ||
|
||
const pak = require('@react-native-firebase/app-distribution/package.json') | ||
export default createRunOncePlugin(withRnFirebaseAppDistribution, pak.name, pak.version) |
Oops, something went wrong.