react-native ios build main.jsbundle
This commit is contained in:
parent
d993e0af9b
commit
ffc75d4b91
101
src/build.ts
101
src/build.ts
|
|
@ -132,38 +132,77 @@ export default async function build(cmd: any) {
|
|||
let result;
|
||||
if (mode === 'production') {
|
||||
//cd native/android && cross-env NODE_ENV=production ./gradlew assembleRelease
|
||||
result = spawn.sync(
|
||||
`cd android`,
|
||||
[
|
||||
'&& cross-env',
|
||||
`NODE_ENV=${mode}`,
|
||||
'OAK_PLATFORM=native',
|
||||
`OAK_DEV_MODE=${devMode}`,
|
||||
'./gradlew assembleRelease',
|
||||
].filter(Boolean),
|
||||
{
|
||||
cwd,
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
}
|
||||
);
|
||||
if (platform === 'android') {
|
||||
result = spawn.sync(
|
||||
`cd android`,
|
||||
[
|
||||
'&& cross-env',
|
||||
`NODE_ENV=${mode}`,
|
||||
'OAK_PLATFORM=native',
|
||||
`OAK_DEV_MODE=server`,
|
||||
'./gradlew assembleRelease',
|
||||
].filter(Boolean),
|
||||
{
|
||||
cwd,
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
}
|
||||
);
|
||||
}
|
||||
else {
|
||||
// cd native && cross-env NODE_ENV=staging OAK_PLATFORM=native OAK_DEV_MODE=server react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'
|
||||
result = spawn.sync(
|
||||
`cd native`,
|
||||
[
|
||||
'&& cross-env',
|
||||
`NODE_ENV=${mode}`,
|
||||
'OAK_PLATFORM=native',
|
||||
`OAK_DEV_MODE=server`,
|
||||
"react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'",
|
||||
].filter(Boolean),
|
||||
{
|
||||
cwd,
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
}
|
||||
);
|
||||
}
|
||||
} else if (mode === 'staging') {
|
||||
//cd native/android && cross-env NODE_ENV=production ./gradlew assembleStaging
|
||||
result = spawn.sync(
|
||||
`cd android`,
|
||||
[
|
||||
'&& cross-env',
|
||||
`NODE_ENV=${mode}`,
|
||||
'OAK_PLATFORM=native',
|
||||
`OAK_DEV_MODE=${devMode}`,
|
||||
'./gradlew assembleStaging',
|
||||
].filter(Boolean),
|
||||
{
|
||||
cwd,
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
}
|
||||
);
|
||||
if (platform === 'android') {
|
||||
result = spawn.sync(
|
||||
`cd android`,
|
||||
[
|
||||
'&& cross-env',
|
||||
`NODE_ENV=${mode}`,
|
||||
'OAK_PLATFORM=native',
|
||||
`OAK_DEV_MODE=server`,
|
||||
'./gradlew assembleStaging',
|
||||
].filter(Boolean),
|
||||
{
|
||||
cwd,
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
}
|
||||
);
|
||||
}
|
||||
else {
|
||||
result = spawn.sync(
|
||||
`cd native`,
|
||||
[
|
||||
'&& cross-env',
|
||||
`NODE_ENV=${mode}`,
|
||||
'OAK_PLATFORM=native',
|
||||
`OAK_DEV_MODE=server`,
|
||||
"react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'",
|
||||
].filter(Boolean),
|
||||
{
|
||||
cwd,
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
}
|
||||
);
|
||||
}
|
||||
} else {
|
||||
result = spawn.sync(
|
||||
`cross-env`,
|
||||
|
|
@ -173,7 +212,7 @@ export default async function build(cmd: any) {
|
|||
`OAK_DEV_MODE=${devMode}`,
|
||||
'react-native',
|
||||
'start',
|
||||
cmd.resetCache && '--reset-cache',
|
||||
cmd.reset && '--reset-cache',
|
||||
].filter(Boolean),
|
||||
{
|
||||
cwd,
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ program
|
|||
.option('-d, --subDir <subDirName>', 'subDirName')
|
||||
.option('-p, --port <port>', 'port')
|
||||
.option('-dm, --devMode <devMode>', 'devMode')
|
||||
.option('--resetCache', 'react native start --reset-cache')
|
||||
.option('--reset', 'react native start --reset-cache')
|
||||
.description('build project of start on demand')
|
||||
.action(build);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue