Skip to content

Commit 6635793

Browse files
authored
Merge pull request #14 from TRPGEngine/master
v0.1.5
2 parents b9ec86a + 55822ce commit 6635793

File tree

131 files changed

+2040
-756
lines changed

Some content is hidden

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

131 files changed

+2040
-756
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ config/local.js
66
.sentryclirc
77
.buildcache/
88
build/metro/conf.json
9-
9+
build/emoji/emoji/
10+
android/gradle.properties
1011

1112
# Logs
1213
logs

android/app/build.gradle

+29-10
Original file line numberDiff line numberDiff line change
@@ -123,21 +123,27 @@ android {
123123
}
124124
}
125125

126-
// // 签名相关
127-
// signingConfigs {
128-
// release {
129-
// storeFile file(MYAPP_RELEASE_STORE_FILE)
130-
// storePassword MYAPP_RELEASE_STORE_PASSWORD
131-
// keyAlias MYAPP_RELEASE_KEY_ALIAS
132-
// keyPassword MYAPP_RELEASE_KEY_PASSWORD
133-
// }
134-
// }
126+
// 签名相关
127+
signingConfigs {
128+
release {
129+
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
130+
storeFile file(MYAPP_RELEASE_STORE_FILE)
131+
storePassword MYAPP_RELEASE_STORE_PASSWORD
132+
keyAlias MYAPP_RELEASE_KEY_ALIAS
133+
keyPassword MYAPP_RELEASE_KEY_PASSWORD
134+
}
135+
}
136+
}
135137

136138
buildTypes {
137139
release {
138140
minifyEnabled enableProguardInReleaseBuilds
139141
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
140-
// signingConfig signingConfigs.release // 使用签名
142+
signingConfig signingConfigs.release // 使用签名
143+
}
144+
145+
debug {
146+
applicationIdSuffix ".test"
141147
}
142148
}
143149
// applicationVariants are e.g. debug, release
@@ -151,11 +157,24 @@ android {
151157
output.versionCodeOverride =
152158
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
153159
}
160+
161+
// 定义输出文件命名
162+
def outputFile = output.outputFile
163+
if (outputFile != null && outputFile.name.endsWith('.apk')) {
164+
def fileName
165+
if (variant.buildType.name.equals('release')) {
166+
fileName = "TRPGEngine-v${defaultConfig.versionName}_${defaultConfig.versionCode}.apk"
167+
} else {
168+
fileName = "TRPGEngine-v${defaultConfig.versionName}-beta.apk"
169+
}
170+
output.apkData.outputFileName = fileName
171+
}
154172
}
155173
}
156174
}
157175

158176
dependencies {
177+
implementation project(':react-native-fast-image')
159178
implementation project(':react-native-webview')
160179
implementation project(':react-native-sentry')
161180
implementation project(':react-native-code-push')

android/app/src/main/java/com/moonrailgun/trpg/MainApplication.java

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

55
import com.facebook.react.ReactApplication;
6+
import com.dylanvann.fastimage.FastImageViewPackage;
67
import com.reactnativecommunity.webview.RNCWebViewPackage;
78
import io.sentry.RNSentryPackage;
89
import com.microsoft.codepush.react.CodePush;
@@ -39,6 +40,7 @@ public boolean getUseDeveloperSupport() {
3940
protected List<ReactPackage> getPackages() {
4041
return Arrays.<ReactPackage>asList(
4142
new MainReactPackage(),
43+
new FastImageViewPackage(),
4244
new RNCWebViewPackage(),
4345
new RNSentryPackage(),
4446
new CodePush(getResources().getString(R.string.reactNativeCodePush_androidDeploymentKey), getApplicationContext(), BuildConfig.DEBUG),

android/settings.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
rootProject.name = 'trpg'
2+
include ':react-native-fast-image'
3+
project(':react-native-fast-image').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fast-image/android')
24
include ':react-native-webview'
35
project(':react-native-webview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview/android')
46
include ':react-native-sentry'

build/emoji/fetch-github-emoji.js

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
const path = require('path');
2+
const axios = require('axios');
3+
const fs = require('fs-extra');
4+
5+
fs.ensureDir(path.resolve(__dirname, './emoji'));
6+
7+
function fetchEmojiAndSave(name, url) {
8+
return axios
9+
.get(url, {
10+
responseType: 'arraybuffer',
11+
})
12+
.then((res) => {
13+
const data = res.data;
14+
console.log('保存表情:', name);
15+
return fs.outputFile(
16+
path.resolve(__dirname, `./emoji/${name}.png`),
17+
data
18+
);
19+
})
20+
.catch((err) => {
21+
const item = { name, url };
22+
console.error('保存失败:', item);
23+
24+
errorList.push(item);
25+
});
26+
}
27+
28+
const errorList = [];
29+
30+
axios
31+
.get('https://api.github.com/emojis')
32+
.then((res) => {
33+
const data = res.data;
34+
35+
const list = [];
36+
for (const name in data) {
37+
if (data.hasOwnProperty(name)) {
38+
const url = data[name];
39+
40+
list.push(fetchEmojiAndSave(name, url));
41+
}
42+
}
43+
44+
return Promise.all(list);
45+
})
46+
.then((list) => {
47+
console.log(`保存完毕, 共${list.length}个文件, 失败${errorList.length}个`);
48+
49+
fs.outputJson(path.resolve(__dirname, 'errorList.json'), errorList);
50+
});

build/husky/commit-msg.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
const fs = require('fs');
2+
const _ = require('lodash');
3+
const commitFile = process.env['HUSKY_GIT_PARAMS'];
4+
const allowScope = require('./lib/allow-scope');
5+
const allowTag = require('./lib/allow-tag');
6+
const re = new RegExp(
7+
`:(${allowTag.join('|')}): \\[(${allowScope.join('|')})\\] .*?`
8+
);
9+
10+
const msg = fs.readFileSync(commitFile, {
11+
encoding: 'utf-8',
12+
});
13+
const firstLine = _.trim(_.head(msg.split('\n')));
14+
const tipCommitFormat = `
15+
${firstLine}
16+
17+
————————————————————
18+
19+
你的提交不合法, 推荐的提交格式:
20+
:tag: [scope] any string
21+
22+
允许的tag:
23+
${allowTag.join(', ')}
24+
允许的scope:
25+
${allowScope.join(', ')}
26+
`;
27+
28+
if (!re.test(firstLine)) {
29+
console.log(tipCommitFormat);
30+
process.exit(1);
31+
}

build/husky/lib/allow-scope.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = ['app', 'web', 'all', 'layout', 'redux'];

build/husky/lib/allow-tag.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = ['star', 'hammer', 'bug', 'fire'];

build/metro/babel-transformer.js

+3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ const getBabelRC = (function() {
4444

4545
// specify babel rc path
4646
let projectBabelRCPath = path.resolve(__dirname, 'babel.config.js');
47+
if (NODE_ENV === 'production') {
48+
projectBabelRCPath = path.resolve(__dirname, 'babel.config.prod.js');
49+
}
4750
console.log('loading babel config:', projectBabelRCPath);
4851
if (fs.existsSync(projectBabelRCPath)) {
4952
babelRC.extends = projectBabelRCPath;

build/metro/babel.config.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
module.exports = {
2-
presets: ['module:metro-react-native-babel-preset'],
2+
presets: [
3+
'module:metro-react-native-babel-preset',
4+
'@babel/preset-typescript',
5+
],
36
plugins: [
47
[
58
'transform-inline-environment-variables',

build/metro/babel.config.prod.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
presets: [
3+
'module:metro-react-native-babel-preset',
4+
'@babel/preset-typescript',
5+
],
6+
plugins: [
7+
[
8+
'transform-inline-environment-variables',
9+
{
10+
include: ['NODE_ENV', 'PLATFORM', 'TRPG_HOST'],
11+
},
12+
],
13+
['import', { libraryName: '@ant-design/react-native' }],
14+
[
15+
'module-resolver',
16+
{
17+
alias: {
18+
config: './build/metro/conf.json',
19+
},
20+
},
21+
],
22+
],
23+
};

ios/trpg.xcodeproj/project.pbxproj

+19
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
05FA81C8D74E40B498A3FD25 /* libRNSentry.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F0221B1BC594CA0A4B87F38 /* libRNSentry.a */; };
6262
96FCD085381F419EAEB3E77F /* libRNSentry-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2EF15C5C86004DA6B2824FD1 /* libRNSentry-tvOS.a */; };
6363
290D07911A1D4F089C449AAC /* libRNCWebView.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5FE6D0A548BC403283D4A5DF /* libRNCWebView.a */; };
64+
B2E85485AF564F8EA63A3C92 /* libFastImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 90E43C7B47BB464F811FB540 /* libFastImage.a */; };
6465
/* End PBXBuildFile section */
6566

6667
/* Begin PBXContainerItemProxy section */
@@ -397,6 +398,8 @@
397398
2EF15C5C86004DA6B2824FD1 /* libRNSentry-tvOS.a */ = {isa = PBXFileReference; name = "libRNSentry-tvOS.a"; path = "libRNSentry-tvOS.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
398399
EB325C6FC2034BE380F48CEB /* RNCWebView.xcodeproj */ = {isa = PBXFileReference; name = "RNCWebView.xcodeproj"; path = "../node_modules/react-native-webview/ios/RNCWebView.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
399400
5FE6D0A548BC403283D4A5DF /* libRNCWebView.a */ = {isa = PBXFileReference; name = "libRNCWebView.a"; path = "libRNCWebView.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
401+
46CFEDE41E444372BBE0B79D /* FastImage.xcodeproj */ = {isa = PBXFileReference; name = "FastImage.xcodeproj"; path = "../node_modules/react-native-fast-image/ios/FastImage.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
402+
90E43C7B47BB464F811FB540 /* libFastImage.a */ = {isa = PBXFileReference; name = "libFastImage.a"; path = "libFastImage.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
400403
/* End PBXFileReference section */
401404

402405
/* Begin PBXFrameworksBuildPhase section */
@@ -443,6 +446,7 @@
443446
7CB18947996B486BA380C730 /* libCodePush.a in Frameworks */,
444447
05FA81C8D74E40B498A3FD25 /* libRNSentry.a in Frameworks */,
445448
290D07911A1D4F089C449AAC /* libRNCWebView.a in Frameworks */,
449+
B2E85485AF564F8EA63A3C92 /* libFastImage.a in Frameworks */,
446450
);
447451
runOnlyForDeploymentPostprocessing = 0;
448452
};
@@ -652,6 +656,7 @@
652656
28D17C9C888B441B915FE585 /* CodePush.xcodeproj */,
653657
CC54BC22BF41412290AD44BB /* RNSentry.xcodeproj */,
654658
EB325C6FC2034BE380F48CEB /* RNCWebView.xcodeproj */,
659+
46CFEDE41E444372BBE0B79D /* FastImage.xcodeproj */,
655660
);
656661
name = Libraries;
657662
sourceTree = "<group>";
@@ -1324,6 +1329,7 @@
13241329
"\"$(SRCROOT)/$(TARGET_NAME)\"",
13251330
"\"$(SRCROOT)/$(TARGET_NAME)\"",
13261331
"\"$(SRCROOT)/$(TARGET_NAME)\"",
1332+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
13271333
);
13281334
HEADER_SEARCH_PATHS = (
13291335
"$(inherited)",
@@ -1334,6 +1340,7 @@
13341340
"$(SRCROOT)/../node_modules/react-native-code-push/ios/CodePush/**",
13351341
"$(SRCROOT)/../node_modules/react-native-sentry/ios/**",
13361342
"$(SRCROOT)/../node_modules/react-native-webview/ios",
1343+
"$(SRCROOT)/../node_modules/react-native-fast-image/ios/FastImage/**",
13371344
);
13381345
};
13391346
name = Debug;
@@ -1364,6 +1371,7 @@
13641371
"\"$(SRCROOT)/$(TARGET_NAME)\"",
13651372
"\"$(SRCROOT)/$(TARGET_NAME)\"",
13661373
"\"$(SRCROOT)/$(TARGET_NAME)\"",
1374+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
13671375
);
13681376
HEADER_SEARCH_PATHS = (
13691377
"$(inherited)",
@@ -1374,6 +1382,7 @@
13741382
"$(SRCROOT)/../node_modules/react-native-code-push/ios/CodePush/**",
13751383
"$(SRCROOT)/../node_modules/react-native-sentry/ios/**",
13761384
"$(SRCROOT)/../node_modules/react-native-webview/ios",
1385+
"$(SRCROOT)/../node_modules/react-native-fast-image/ios/FastImage/**",
13771386
);
13781387
};
13791388
name = Release;
@@ -1403,6 +1412,7 @@
14031412
"$(SRCROOT)/../node_modules/react-native-code-push/ios/CodePush/**",
14041413
"$(SRCROOT)/../node_modules/react-native-sentry/ios/**",
14051414
"$(SRCROOT)/../node_modules/react-native-webview/ios",
1415+
"$(SRCROOT)/../node_modules/react-native-fast-image/ios/FastImage/**",
14061416
);
14071417
};
14081418
name = Debug;
@@ -1431,6 +1441,7 @@
14311441
"$(SRCROOT)/../node_modules/react-native-code-push/ios/CodePush/**",
14321442
"$(SRCROOT)/../node_modules/react-native-sentry/ios/**",
14331443
"$(SRCROOT)/../node_modules/react-native-webview/ios",
1444+
"$(SRCROOT)/../node_modules/react-native-fast-image/ios/FastImage/**",
14341445
);
14351446
};
14361447
name = Release;
@@ -1469,6 +1480,7 @@
14691480
"\"$(SRCROOT)/$(TARGET_NAME)\"",
14701481
"\"$(SRCROOT)/$(TARGET_NAME)\"",
14711482
"\"$(SRCROOT)/$(TARGET_NAME)\"",
1483+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
14721484
);
14731485
HEADER_SEARCH_PATHS = (
14741486
"$(inherited)",
@@ -1479,6 +1491,7 @@
14791491
"$(SRCROOT)/../node_modules/react-native-code-push/ios/CodePush/**",
14801492
"$(SRCROOT)/../node_modules/react-native-sentry/ios/**",
14811493
"$(SRCROOT)/../node_modules/react-native-webview/ios",
1494+
"$(SRCROOT)/../node_modules/react-native-fast-image/ios/FastImage/**",
14821495
);
14831496
};
14841497
name = Debug;
@@ -1517,6 +1530,7 @@
15171530
"\"$(SRCROOT)/$(TARGET_NAME)\"",
15181531
"\"$(SRCROOT)/$(TARGET_NAME)\"",
15191532
"\"$(SRCROOT)/$(TARGET_NAME)\"",
1533+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
15201534
);
15211535
HEADER_SEARCH_PATHS = (
15221536
"$(inherited)",
@@ -1527,6 +1541,7 @@
15271541
"$(SRCROOT)/../node_modules/react-native-code-push/ios/CodePush/**",
15281542
"$(SRCROOT)/../node_modules/react-native-sentry/ios/**",
15291543
"$(SRCROOT)/../node_modules/react-native-webview/ios",
1544+
"$(SRCROOT)/../node_modules/react-native-fast-image/ios/FastImage/**",
15301545
);
15311546
};
15321547
name = Release;
@@ -1564,13 +1579,15 @@
15641579
"\"$(SRCROOT)/$(TARGET_NAME)\"",
15651580
"\"$(SRCROOT)/$(TARGET_NAME)\"",
15661581
"\"$(SRCROOT)/$(TARGET_NAME)\"",
1582+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
15671583
);
15681584
HEADER_SEARCH_PATHS = (
15691585
"$(inherited)",
15701586
"$(SRCROOT)/../node_modules/react-native-gesture-handler/ios/**",
15711587
"$(SRCROOT)/../node_modules/react-native-code-push/ios/CodePush/**",
15721588
"$(SRCROOT)/../node_modules/react-native-sentry/ios/**",
15731589
"$(SRCROOT)/../node_modules/react-native-webview/ios",
1590+
"$(SRCROOT)/../node_modules/react-native-fast-image/ios/FastImage/**",
15741591
);
15751592
};
15761593
name = Debug;
@@ -1608,13 +1625,15 @@
16081625
"\"$(SRCROOT)/$(TARGET_NAME)\"",
16091626
"\"$(SRCROOT)/$(TARGET_NAME)\"",
16101627
"\"$(SRCROOT)/$(TARGET_NAME)\"",
1628+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
16111629
);
16121630
HEADER_SEARCH_PATHS = (
16131631
"$(inherited)",
16141632
"$(SRCROOT)/../node_modules/react-native-gesture-handler/ios/**",
16151633
"$(SRCROOT)/../node_modules/react-native-code-push/ios/CodePush/**",
16161634
"$(SRCROOT)/../node_modules/react-native-sentry/ios/**",
16171635
"$(SRCROOT)/../node_modules/react-native-webview/ios",
1636+
"$(SRCROOT)/../node_modules/react-native-fast-image/ios/FastImage/**",
16181637
);
16191638
};
16201639
name = Release;

metro.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ fs.writeJson(configFilePath, config);
1616
module.exports = {
1717
resolver: {
1818
blacklistRE: blacklist([/src\/web/]),
19+
sourceExts: ['js', 'ts', 'tsx'],
1920
},
2021
transformer: {
2122
babelTransformerPath: path.resolve(

0 commit comments

Comments
 (0)