[types] Get types properly exporting as part of the build

This commit is contained in:
Chris Bianca 2017-11-17 16:17:27 +00:00
parent 746faad043
commit fbe73f5dcb
20 changed files with 588 additions and 822 deletions

View File

@ -1,3 +1,16 @@
{
"presets": ["react-native"]
"env": {
"development": {
"presets": ["react-native"],
"plugins": [
"transform-flow-strip-types"
]
},
"publish": {
"presets": ["react-native-syntax"],
"plugins": [
"transform-flow-strip-types"
]
}
}
}

View File

@ -73,11 +73,14 @@
.*/node_modules/protobufjs/src/bower.json
.*/node_modules/grpc/node_modules/protobufjs/src/bower.json
# Ignore dist folder
.*/dist/.*
[include]
node_modules/fbjs/lib
[libs]
lib/flow.js
lib/types/flow.js
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow
node_modules/fbjs/flow/lib

2
.gitignore vendored
View File

@ -76,4 +76,4 @@ local.properties
**/ios/Pods/**
**/ios/ReactNativeFirebaseDemo.xcworkspace/
dist

View File

@ -1,5 +0,0 @@
import Firebase from './lib/firebase';
export const AdMob = require('./lib/modules/admob');
export default Firebase;

View File

8
lib/index.js Normal file
View File

@ -0,0 +1,8 @@
/**
* @flow
*/
import Firebase from './modules/core/firebase';
export const AdMob = require('./modules/admob');
export default Firebase;

View File

@ -1,5 +1,5 @@
// @flow
import INTERNALS from './../../internals';
import INTERNALS from '../../utils/internals';
import { generatePushID, isFunction, isAndroid, isIOS, isString, nativeToJSError } from './../../utils';
import type Auth from './';

View File

@ -2,7 +2,7 @@
* @flow
* User representation wrapper
*/
import INTERNALS from './../../internals';
import INTERNALS from '../../utils/internals';
import type Auth from './';

View File

@ -3,8 +3,8 @@
* Auth representation wrapper
*/
import User from './User';
import ModuleBase from './../../utils/ModuleBase';
import INTERNALS from './../../internals';
import ModuleBase from '../../utils/ModuleBase';
import INTERNALS from '../../utils/internals';
import ConfirmationResult from './ConfirmationResult';
// providers
@ -17,7 +17,7 @@ import FacebookAuthProvider from './providers/FacebookAuthProvider';
import PhoneAuthListener from './PhoneAuthListener';
import type FirebaseApp from '../../firebase-app';
import type FirebaseApp from '../core/firebase-app';
export default class Auth extends ModuleBase {
static _NAMESPACE = 'auth';

View File

@ -1,21 +0,0 @@
/**
* @flow
*/
// todo move out
export class ReferenceBase extends Base {
constructor(path: string) {
super();
this.path = path || '/';
}
/**
* The last part of a Reference's path (after the last '/')
* The key of a root Reference is null.
* @type {String}
* {@link https://firebase.google.com/docs/reference/js/firebase.database.Reference#key}
*/
get key(): string | null {
return this.path === '/' ? null : this.path.substring(this.path.lastIndexOf('/') + 1);
}
}

View File

@ -3,23 +3,21 @@
*/
import { NativeModules } from 'react-native';
import INTERNALS from './internals';
import { isObject, isAndroid } from './utils';
import INTERNALS from '../../utils/internals';
import { isObject, isAndroid } from '../../utils';
import AdMob, { statics as AdMobStatics } from './modules/admob';
import Auth, { statics as AuthStatics } from './modules/auth';
import Analytics from './modules/analytics';
import Crash from './modules/crash';
import Performance from './modules/perf';
import RemoteConfig from './modules/config';
import Storage, { statics as StorageStatics } from './modules/storage';
import Database, { statics as DatabaseStatics } from './modules/database';
import Messaging, { statics as MessagingStatics } from './modules/messaging';
import Firestore, { statics as FirestoreStatics } from './modules/firestore';
import Links, { statics as LinksStatics } from './modules/links';
import Utils, { statics as UtilsStatics } from './modules/utils';
import type { FirebaseOptions } from './firebase';
import AdMob, { statics as AdMobStatics } from '../admob';
import Auth, { statics as AuthStatics } from '../auth';
import Analytics from '../analytics';
import Crash from '../crash';
import Performance from '../perf';
import RemoteConfig from '../config';
import Storage, { statics as StorageStatics } from '../storage';
import Database, { statics as DatabaseStatics } from '../database';
import Messaging, { statics as MessagingStatics } from '../messaging';
import Firestore, { statics as FirestoreStatics } from '../firestore';
import Links, { statics as LinksStatics } from '../links';
import Utils, { statics as UtilsStatics } from '../utils';
const FirebaseCoreModule = NativeModules.RNFirebase;

View File

@ -4,23 +4,23 @@
*/
import { NativeModules, NativeEventEmitter } from 'react-native';
import INTERNALS from './internals';
import INTERNALS from '../../utils/internals';
import FirebaseApp from './firebase-app';
import { isObject, isString } from './utils';
import { isObject, isString } from '../../utils';
// module imports
import AdMob, { statics as AdMobStatics } from './modules/admob';
import Auth, { statics as AuthStatics } from './modules/auth';
import Analytics from './modules/analytics';
import Crash from './modules/crash';
import Performance from './modules/perf';
import Links, { statics as LinksStatics } from './modules/links';
import RemoteConfig from './modules/config';
import Storage, { statics as StorageStatics } from './modules/storage';
import Database, { statics as DatabaseStatics } from './modules/database';
import Messaging, { statics as MessagingStatics } from './modules/messaging';
import Firestore, { statics as FirestoreStatics } from './modules/firestore';
import Utils, { statics as UtilsStatics } from './modules/utils';
import AdMob, { statics as AdMobStatics } from '../admob';
import Auth, { statics as AuthStatics } from '../auth';
import Analytics from '../analytics';
import Crash from '../crash';
import Performance from '../perf';
import Links, { statics as LinksStatics } from '../links';
import RemoteConfig from '../config';
import Storage, { statics as StorageStatics } from '../storage';
import Database, { statics as DatabaseStatics } from '../database';
import Messaging, { statics as MessagingStatics } from '../messaging';
import Firestore, { statics as FirestoreStatics } from '../firestore';
import Utils, { statics as UtilsStatics } from '../utils';
const FirebaseCoreModule = NativeModules.RNFirebase;

View File

@ -17,7 +17,7 @@ import {
generatePushID,
} from './../../utils';
import INTERNALS from './../../internals';
import INTERNALS from '../../utils/internals';
// track all event registrations by path
let listeners = 0;

View File

@ -9,10 +9,10 @@ import FieldValue from './FieldValue';
import GeoPoint from './GeoPoint';
import Path from './Path';
import WriteBatch from './WriteBatch';
import INTERNALS from './../../internals';
import INTERNALS from '../../utils/internals';
import type DocumentSnapshot from './DocumentSnapshot';
import type FirebaseApp from '../../firebase-app';
import type FirebaseApp from '../core/firebase-app';
import type QuerySnapshot from './QuerySnapshot';
type CollectionSyncEvent = {

View File

@ -3,9 +3,9 @@ import { NativeModules } from 'react-native';
// import { version as ReactVersion } from 'react';
// import ReactNativeVersion from 'react-native/Libraries/Core/ReactNativeVersion';
import INTERNALS from './../../internals';
import { isIOS } from './../../utils';
import PACKAGE from './../../../package.json';
import INTERNALS from '../../utils/internals';
import { isIOS } from '../../utils';
import PACKAGE from '../../../package.json';
const FirebaseCoreModule = NativeModules.RNFirebase;
@ -128,4 +128,3 @@ export const statics = {
// 'react-native-firebase': PACKAGE.version,
// },
};

View File

@ -3,12 +3,12 @@
*/
import { NativeModules } from 'react-native';
import Log from '../utils/log';
import INTERNALS from './../internals';
import FirebaseCore from './../firebase';
import { nativeWithApp } from './../utils';
import Log from './log';
import INTERNALS from './internals';
import FirebaseCore from '../modules/core/firebase';
import { nativeWithApp } from '../utils';
import type FirebaseApp from '../firebase-app';
import type FirebaseApp from '../modules/core/firebase-app';
const logs = {};

View File

@ -3,9 +3,9 @@
*/
import { Platform, NativeModules } from 'react-native';
import EventEmitter from './utils/emitter/EventEmitter';
import ModuleBase from './utils/ModuleBase';
import SyncTree from './utils/SyncTree';
import EventEmitter from './emitter/EventEmitter';
import ModuleBase from './ModuleBase';
import SyncTree from './SyncTree';
const DEFAULT_APP_NAME = Platform.OS === 'ios' ? '__FIRAPP_DEFAULT' : '[DEFAULT]';

1231
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +1,28 @@
{
"name": "react-native-firebase",
"version": "3.1.0",
"version": "3.1.1-alpha.4",
"author": "Invertase <contact@invertase.io> (http://invertase.io)",
"description": "A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Admob, Analytics, Auth, Crash Reporting, Cloud Firestore, Database, Dynamic Links, Messaging (FCM), Remote Config, Storage and Performance.",
"main": "index",
"main": "dist/index.js",
"scripts": {
"build": "npm run build-lib && npm run build-flow",
"build-flow": "flow-copy-source -i */__tests__* lib dist",
"build-lib": "BABEL_ENV=publish babel lib -d dist --ignore __tests__",
"clean": "rimraf dist/",
"flow": "flow",
"lint": "eslint ./src",
"dev": "npm run compile -- --watch",
"build": "./node_modules/.bin/babel --source-maps=true --out-dir=dist .",
"publish_pages": "gh-pages -d public/",
"docs-serve-local": "docsify serve docs",
"prepublish": "npm run clean && npm run build",
"postinstall": "opencollective postinstall",
"test-cli": "node ./bin/test.js",
"tests-packager": "cd tests && npm run start",
"tests-npm-install": "cd tests && npm install",
"tests-pod-install": "cd tests && npm run ios:pod:install",
"tests-watch-start": "npm run test-cli watch init start",
"tests-watch-stop": "npm run test-cli watch stop",
"postinstall": "opencollective postinstall"
"tests-watch-stop": "npm run test-cli watch stop"
},
"files": [
"dist"
],
"repository": {
"type": "git",
"url": "https://github.com/invertase/react-native-firebase.git"
@ -70,9 +74,11 @@
"fbjs": "*"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-eslint": "^7.0.0",
"babel-jest": "^14.1.0",
"babel-preset-react-native": "^1.9.0",
"babel-preset-react-native-syntax": "^1.0.0",
"debug": "^2.2.0",
"enzyme": "^2.4.1",
"eslint": "^4.11.0",
@ -82,9 +88,11 @@
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.4.0",
"flow-bin": "^0.56.0",
"flow-copy-source": "^1.2.1",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-native": "^0.48.0",
"react-native": "^0.50.3",
"rimraf": "^2.6.2",
"shelljs": "^0.7.8",
"wml": "0.0.82"
},