Getting app name from package.json

This commit is contained in:
Bruno Lemos
2017-03-09 00:45:24 -03:00
parent 165d3b51af
commit e136a6574f
6 changed files with 17 additions and 7 deletions

View File

@@ -2,6 +2,8 @@
import { AppRegistry } from 'react-native';
import { name as appName } from './package.json';
import App from './src/';
AppRegistry.registerComponent('devhub', () => App);
AppRegistry.registerComponent(appName, () => App);

View File

@@ -2,6 +2,8 @@
import { AppRegistry } from 'react-native';
import { name as appName } from './package.json';
import App from './src/';
AppRegistry.registerComponent('devhub', () => App);
AppRegistry.registerComponent(appName, () => App);

View File

@@ -5,8 +5,9 @@ import { AppRegistry } from 'react-native';
import './web/src/index.css';
import App from './src/';
import { name as appName } from './package.json';
AppRegistry.registerComponent('devhub', () => App);
AppRegistry.runApplication('devhub', {
AppRegistry.registerComponent(appName, () => App);
AppRegistry.runApplication(appName, {
rootTag: document.getElementById('root'),
});

View File

@@ -2,6 +2,8 @@
import GitHubAPI from 'github';
import { name as appName } from '../../package.json';
const PUBLIC_EVENTS: 'PUBLIC_EVENTS' = 'PUBLIC_EVENTS';
const REPO_EVENTS: 'REPO_EVENTS' = 'REPO_EVENTS';
const REPO_ISSUE_EVENTS: 'REPO_ISSUE_EVENTS' = 'REPO_ISSUE_EVENTS';
@@ -18,7 +20,7 @@ const MARK_NOTIFICATION_THREAD_AS_READ: 'MARK_NOTIFICATION_THREAD_AS_READ' = 'MA
const MARK_ALL_NOTIFICATIONS_AS_READ_FOR_REPO: 'MARK_ALL_NOTIFICATIONS_AS_READ_FOR_REPO' = 'MARK_ALL_NOTIFICATIONS_AS_READ_FOR_REPO';
const github = new GitHubAPI({
agent: 'devhub',
agent: appName,
// debug: process.env.NODE_ENV !== 'production',
});

View File

@@ -2,8 +2,9 @@ import qs from 'qs';
import { Linking } from 'react-native';
import { getUrlParamsIfMatches, listenForNextUrl } from './helpers';
import { name as appName } from '../../../package.json';
const callbackURL = 'devhub://oauth/github';
const callbackURL = `${appName}://oauth/github`;
export default async function (serverURL, scopes = []) {
const scopesStr = (scopes || []).join(' ');

View File

@@ -5,6 +5,8 @@ import { Linking, Platform } from 'react-native';
import { get } from '../../immutable';
import { name as appName } from '../../../../package.json';
import type {
GithubIssue,
GithubPullRequest,
@@ -112,7 +114,7 @@ function openURL(url: string) {
} else {
// replace http with devhub:// so the app deeplinking will handle this
// the app will decide if it will push an app screen or open the web browser
_url = _url.replace(/(http[s]?)/, 'devhub');
_url = _url.replace(/(http[s]?)/, appName);
}
return Linking.openURL(_url);