Merge pull request 'write script to use env variables' (#100) from andy/start-script into master
Reviewed-on: railbird/railbird-mobile#100
This commit is contained in:
commit
bbbcffcfcb
@ -7,8 +7,8 @@
|
||||
"start:android": "expo start --android",
|
||||
"start:ios": "expo start --ios",
|
||||
"android": "expo run:android",
|
||||
"android:dev": "NODE_ENV=development expo run:android",
|
||||
"android:prod": "NODE_ENV=production expo run:android",
|
||||
"android:dev": "node ./start.js development",
|
||||
"android:test": "node ./start.js test",
|
||||
"ios": "expo run:ios",
|
||||
"ios:dev": "NODE_ENV=development expo run:ios",
|
||||
"ios:prod": "NODE_ENV=production expo run:ios",
|
||||
|
16
start.js
Normal file
16
start.js
Normal file
@ -0,0 +1,16 @@
|
||||
const { spawn } = require("child_process");
|
||||
|
||||
const envName = process.argv[2];
|
||||
|
||||
const expoStart = spawn("expo", ["start", "-c"]);
|
||||
|
||||
expoStart.stdout.on("data", (data) => {
|
||||
if (data.toString().includes("Logs for your project will appear below")) {
|
||||
expoStart.kill("SIGINT");
|
||||
}
|
||||
});
|
||||
|
||||
expoStart.on("close", () => {
|
||||
const env = { ...process.env, NODE_ENV: envName };
|
||||
spawn("expo", ["run:android"], { env, stdio: "inherit" });
|
||||
});
|
Loading…
Reference in New Issue
Block a user