Skip to content

Commit b9ec86a

Browse files
authored
Merge pull request #13 from TRPGEngine/master
v0.1.4
2 parents 1f7f213 + 4c0a1e8 commit b9ec86a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+2003
-469
lines changed

Diff for: .circleci/config.yml

+75-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ version: 2.1
22
# orbs:
33
# node: circleci/[email protected]
44
jobs:
5-
"Build Electron App":
5+
node:
6+
working_directory: ~/trpg
67
docker:
78
- image: circleci/node
89
steps:
@@ -11,14 +12,41 @@ jobs:
1112
name: update-npm
1213
command: 'sudo npm install -g npm@latest'
1314
- restore_cache:
14-
key: dependency-cache-{{ checksum "package.json" }}
15+
key: dependency-cache-{{ checksum "package.json" }}-{{ arch }}
16+
- run:
17+
name: install-npm-wee
18+
command: npm install
19+
- save_cache:
20+
key: dependency-cache-{{ checksum "package.json" }}-{{ arch }}
21+
paths:
22+
- node_modules
23+
24+
"Build Electron App":
25+
# TODO: 需要重新测试一下
26+
working_directory: ~/trpg
27+
docker:
28+
- image: circleci/node
29+
steps:
30+
- checkout
31+
# 更新node依赖
32+
- restore_cache:
33+
key: dependency-cache-{{ checksum "package.json" }}-{{ arch }}
1534
- run:
1635
name: install-npm-wee
1736
command: npm install
18-
- save_cache: # special step to save the dependency cache
19-
key: dependency-cache-{{ checksum "package.json" }}
37+
- save_cache:
38+
key: dependency-cache-{{ checksum "package.json" }}-{{ arch }}
39+
paths:
40+
- node_modules
41+
# 更新electron依赖
42+
- restore_cache:
43+
key: electron-cache-{{ checksum "package.json" }}-{{ arch }}
44+
- run:
45+
name: install-npm-wee
46+
command: npm install
47+
- save_cache:
48+
key: electron-cache-{{ checksum "package.json" }}-{{ arch }}
2049
paths:
21-
- ./node_modules
2250
- ~/.cache/electron
2351
- run:
2452
name: prepare-env
@@ -28,12 +56,53 @@ jobs:
2856
command: npm run package-all
2957
- store_artifacts:
3058
path: ./dist
59+
"Build Android App":
60+
working_directory: ~/trpg
61+
docker:
62+
- image: circleci/android:api-28-node8-alpha
63+
steps:
64+
- checkout
65+
# 更新node依赖
66+
- restore_cache:
67+
key: dependency-cache-{{ checksum "package.json" }}-{{ arch }}
68+
- run:
69+
name: install-npm-wee
70+
command: npm install
71+
- save_cache:
72+
key: dependency-cache-{{ checksum "package.json" }}-{{ arch }}
73+
paths:
74+
- node_modules
75+
# cache gradle
76+
- restore_cache:
77+
key: gradle-cache-{{ checksum "android/build.gradle" }}-{{ arch }}
78+
- run:
79+
name: packageDebug
80+
command: cd ./android && ./gradlew app:packageDebug
81+
- save_cache:
82+
key: gradle-cache-{{ checksum "android/build.gradle" }}-{{ arch }}
83+
paths:
84+
- ~/.gradle/
85+
- store_artifacts:
86+
path: ./android/app/build/outputs/apk/
3187
workflows:
3288
version: 2
3389
build:
3490
jobs:
35-
# - Build Electron App
91+
- node:
92+
filters:
93+
branches:
94+
only:
95+
- release
3696
- Build Electron App:
97+
requires:
98+
- node
99+
filters:
100+
branches:
101+
only:
102+
- release
103+
- Build Android App:
104+
requires:
105+
- node
37106
filters:
38107
branches:
39108
only:

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ package-lock.json
44
yarn.lock
55
config/local.js
66
.sentryclirc
7+
.buildcache/
8+
build/metro/conf.json
79

810

911
# Logs

Diff for: .prettierrc.json

+6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
"options": {
1616
"parser": "json"
1717
}
18+
},
19+
{
20+
"files": "*.{tsx,ts}",
21+
"options": {
22+
"parser": "typescript"
23+
}
1824
}
1925
]
2026
}

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# TRPG Game
22

3+
[![CircleCI](https://circleci.com/gh/TRPGEngine/Client/tree/release.svg?style=svg)](https://circleci.com/gh/TRPGEngine/Client/tree/release)
34
[![Build Status](https://travis-ci.org/TRPGEngine/Client.svg?branch=master)](https://travis-ci.org/TRPGEngine/Client)
45
[![Release](https://img.shields.io/github/release/TRPGEngine/Client.svg)](https://github.com/TRPGEngine/Client/releases)
56
[![Downloads](https://img.shields.io/github/downloads/TRPGEngine/Client/total.svg)](https://github.com/TRPGEngine/Client/releases)

Diff for: android/app/build.gradle

+8-3
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ project.ext.react = [
7777
]
7878

7979
apply from: "../../node_modules/react-native/react.gradle"
80+
apply from: "../../node_modules/react-native-sentry/sentry.gradle"
81+
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
8082

8183
/**
8284
* Set this to true to create two separate APKs instead of one:
@@ -154,10 +156,13 @@ android {
154156
}
155157

156158
dependencies {
159+
implementation project(':react-native-webview')
160+
implementation project(':react-native-sentry')
161+
implementation project(':react-native-code-push')
157162
implementation project(':react-native-gesture-handler')
158-
api project(':jcore-react-native')
159-
api project(':jpush-react-native')
160-
api project(':react-native-image-picker')
163+
implementation project(':jcore-react-native')
164+
implementation project(':jpush-react-native')
165+
implementation project(':react-native-image-picker')
161166
implementation fileTree(dir: "libs", include: ["*.jar"])
162167
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
163168
implementation "com.facebook.react:react-native:+" // From node_modules

Diff for: android/app/src/main/assets/fonts/antfill.ttf

46 KB
Binary file not shown.

Diff for: android/app/src/main/assets/fonts/antoutline.ttf

90 KB
Binary file not shown.

Diff for: android/app/src/main/java/com/moonrailgun/trpg/MainApplication.java

+12
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import android.app.Application;
44

55
import com.facebook.react.ReactApplication;
6+
import com.reactnativecommunity.webview.RNCWebViewPackage;
7+
import io.sentry.RNSentryPackage;
8+
import com.microsoft.codepush.react.CodePush;
69
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
710
import com.imagepicker.ImagePickerPackage;
811
import com.facebook.react.ReactNativeHost;
@@ -21,6 +24,12 @@ public class MainApplication extends Application implements ReactApplication {
2124
private boolean SHUTDOWN_LOG = false;
2225

2326
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
27+
28+
@Override
29+
protected String getJSBundleFile() {
30+
return CodePush.getJSBundleFile();
31+
}
32+
2433
@Override
2534
public boolean getUseDeveloperSupport() {
2635
return BuildConfig.DEBUG;
@@ -30,6 +39,9 @@ public boolean getUseDeveloperSupport() {
3039
protected List<ReactPackage> getPackages() {
3140
return Arrays.<ReactPackage>asList(
3241
new MainReactPackage(),
42+
new RNCWebViewPackage(),
43+
new RNSentryPackage(),
44+
new CodePush(getResources().getString(R.string.reactNativeCodePush_androidDeploymentKey), getApplicationContext(), BuildConfig.DEBUG),
3345
new RNGestureHandlerPackage(),
3446
new ImagePickerPackage(),
3547
new JPushPackage(SHUTDOWN_TOAST, SHUTDOWN_LOG)

Diff for: android/app/src/main/res/values/strings.xml

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<resources>
2+
<string moduleConfig="true" name="reactNativeCodePush_androidDeploymentKey">HmPwKOiecDiKJkPRxSotOUVl254WHJLG-sMo4</string>
23
<string name="app_name">TRPG</string>
34
</resources>

Diff for: android/settings.gradle

+6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
rootProject.name = 'trpg'
2+
include ':react-native-webview'
3+
project(':react-native-webview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview/android')
4+
include ':react-native-sentry'
5+
project(':react-native-sentry').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sentry/android')
6+
include ':react-native-code-push'
7+
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
28
include ':react-native-gesture-handler'
39
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
410
include ':jcore-react-native'

Diff for: babel.config.js

-4
This file was deleted.

Diff for: build/gulpfile.js

+32
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const path = require('path');
22
const gulp = require('gulp');
33
const replace = require('gulp-replace');
4+
const jeditor = require("gulp-json-editor");
45
const log = require('fancy-log');
56
const PluginError = require('plugin-error');
67
const {
@@ -80,6 +81,37 @@ gulp.task(
8081
})
8182
);
8283

84+
gulp.task('build:createBuilderPackage', function() {
85+
return gulp.src('../package.json').pipe(jeditor((json) => {
86+
json.main = './entry.js';
87+
return json;
88+
})).pipe(gulp.dest('../.buildcache/'))
89+
})
90+
91+
gulp.task(
92+
'package:builder',
93+
series('default', function(callback) {
94+
const builder = require('electron-builder');
95+
const Platform = builder.Platform;
96+
const builderConfig = require('../config/builder.config.js');
97+
log('[electron-builder]', 'start building...');
98+
99+
builder
100+
.build({
101+
targets: Platform.MAC.createTarget(),
102+
config: builderConfig,
103+
})
104+
.then(() => {
105+
log('[electron-builder]', 'building completed!');
106+
callback();
107+
})
108+
.catch((err) => {
109+
log('[electron-builder]', 'building error:');
110+
throw new Error(err);
111+
});
112+
})
113+
);
114+
83115
// 将字体文件复制到设备对应目录
84116
gulp.task('copyIconfont', function() {
85117
return gulp

0 commit comments

Comments
 (0)