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;
|
let result;
|
||||||
if (mode === 'production') {
|
if (mode === 'production') {
|
||||||
//cd native/android && cross-env NODE_ENV=production ./gradlew assembleRelease
|
//cd native/android && cross-env NODE_ENV=production ./gradlew assembleRelease
|
||||||
result = spawn.sync(
|
if (platform === 'android') {
|
||||||
`cd android`,
|
result = spawn.sync(
|
||||||
[
|
`cd android`,
|
||||||
'&& cross-env',
|
[
|
||||||
`NODE_ENV=${mode}`,
|
'&& cross-env',
|
||||||
'OAK_PLATFORM=native',
|
`NODE_ENV=${mode}`,
|
||||||
`OAK_DEV_MODE=${devMode}`,
|
'OAK_PLATFORM=native',
|
||||||
'./gradlew assembleRelease',
|
`OAK_DEV_MODE=server`,
|
||||||
].filter(Boolean),
|
'./gradlew assembleRelease',
|
||||||
{
|
].filter(Boolean),
|
||||||
cwd,
|
{
|
||||||
stdio: 'inherit',
|
cwd,
|
||||||
shell: true,
|
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') {
|
} else if (mode === 'staging') {
|
||||||
//cd native/android && cross-env NODE_ENV=production ./gradlew assembleStaging
|
//cd native/android && cross-env NODE_ENV=production ./gradlew assembleStaging
|
||||||
result = spawn.sync(
|
if (platform === 'android') {
|
||||||
`cd android`,
|
result = spawn.sync(
|
||||||
[
|
`cd android`,
|
||||||
'&& cross-env',
|
[
|
||||||
`NODE_ENV=${mode}`,
|
'&& cross-env',
|
||||||
'OAK_PLATFORM=native',
|
`NODE_ENV=${mode}`,
|
||||||
`OAK_DEV_MODE=${devMode}`,
|
'OAK_PLATFORM=native',
|
||||||
'./gradlew assembleStaging',
|
`OAK_DEV_MODE=server`,
|
||||||
].filter(Boolean),
|
'./gradlew assembleStaging',
|
||||||
{
|
].filter(Boolean),
|
||||||
cwd,
|
{
|
||||||
stdio: 'inherit',
|
cwd,
|
||||||
shell: true,
|
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 {
|
} else {
|
||||||
result = spawn.sync(
|
result = spawn.sync(
|
||||||
`cross-env`,
|
`cross-env`,
|
||||||
|
|
@ -173,7 +212,7 @@ export default async function build(cmd: any) {
|
||||||
`OAK_DEV_MODE=${devMode}`,
|
`OAK_DEV_MODE=${devMode}`,
|
||||||
'react-native',
|
'react-native',
|
||||||
'start',
|
'start',
|
||||||
cmd.resetCache && '--reset-cache',
|
cmd.reset && '--reset-cache',
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
{
|
{
|
||||||
cwd,
|
cwd,
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ program
|
||||||
.option('-d, --subDir <subDirName>', 'subDirName')
|
.option('-d, --subDir <subDirName>', 'subDirName')
|
||||||
.option('-p, --port <port>', 'port')
|
.option('-p, --port <port>', 'port')
|
||||||
.option('-dm, --devMode <devMode>', 'devMode')
|
.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')
|
.description('build project of start on demand')
|
||||||
.action(build);
|
.action(build);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue