-
Notifications
You must be signed in to change notification settings - Fork 119
/
test.js
96 lines (87 loc) · 2.55 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/* eslint-disable import/no-extraneous-dependencies */
require('colors');
const path = require('path');
const spawn = require('cross-spawn');
const helpers = require('yeoman-test');
const appName = 'TestApp';
function createProject() {
console.log('## Creating project ##'.cyan);
spawn.sync('react-native', ['init', appName], {
cwd: __dirname,
stdio: 'inherit',
});
}
function installLint() {
console.log('## Installing Lint ##'.cyan);
return helpers
.run(path.join(__dirname, 'generators/lint'))
.cd(path.join(__dirname, appName))
.withOptions({ skipInstall: false })
.toPromise();
}
function installBase() {
console.log('## Installing Base Project ##'.cyan);
return helpers
.run(path.join(__dirname, 'generators/base'))
.cd(path.join(__dirname, appName))
.withOptions({ skipInstall: false })
.withPrompts({ appName })
.toPromise();
}
function installJest() {
console.log('## Installing Jest ##'.cyan);
return helpers
.run(path.join(__dirname, 'generators/jest'))
.cd(path.join(__dirname, appName))
.withOptions({ skipInstall: false })
.withPrompts({ appName })
.toPromise();
}
function installFastlane() {
console.log('## Installing Fastlane ##'.cyan);
return helpers
.run(path.join(__dirname, 'generators/fastlane'))
.cd(path.join(__dirname, appName))
.withOptions({ skipInstall: false })
.withPrompts({
companyName: 'BAM',
appName,
projectName: appName,
stagingAppId: 'tech.bam.rntest.staging',
prodAppId: 'tech.bam.rntest',
matchGit: process.env.RN_MATCH_GIT,
appleId: process.env.RN_APPLE_ID,
stagingAppleTeamId: process.env.RN_STAGING_APPLE_TEAM_ID,
prodAppleTeamId: process.env.RN_PROD_APPLE_TEAM_ID,
itunesTeamId: process.env.RN_ITUNES_TEAM_ID,
keystorePassword: 'TestTest',
hockeyAppToken: process.env.RN_HOCKEY_APP_TOKEN,
})
.toPromise();
}
function installBitrise() {
console.log('## Installing Bitrise ##'.cyan);
return helpers
.run(path.join(__dirname, 'generators/bitrise'))
.cd(path.join(__dirname, appName))
.withOptions({ skipInstall: false })
.withPrompts({
reactNativeDirectory: '.',
androidProdAppId: 'tech.bam.rntest',
})
.toPromise();
}
function testProject() {
console.log('## Testing Project ##'.cyan);
spawn.sync('npm', ['test'], {
cwd: path.join(__dirname, appName),
stdio: 'inherit',
});
}
createProject();
installLint()
.then(installBase)
.then(installJest)
.then(installFastlane)
.then(installBitrise)
.then(testProject);