Skip to content

Commit 66e3963

Browse files
committed
Fix build issue if no key file provided
1 parent c70633a commit 66e3963

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
const fs = require("fs");
2-
const path = require("path");
1+
const fs = require('fs');
2+
const path = require('path');
33

4-
const ENV_FILE = path.resolve(__dirname, "..", ".env");
4+
const ENV_FILE = path.resolve(__dirname, '..', '.env');
5+
const KEY_FILE = path.resolve(__dirname, '..', '..', '..', 'oauth_key.json');
56

67
if (fs.existsSync(ENV_FILE)) {
78
fs.rmSync(ENV_FILE);
89
}
910

10-
const CLIENT_ID = JSON.parse(
11-
fs.readFileSync(path.resolve(__dirname, "..", "..", "..", "oauth_key.json"))
12-
).web.client_id;
11+
let clientId = 'NOT_PROVIDED';
1312

14-
fs.writeFileSync(ENV_FILE, "REACT_APP_CLIENT_ID=" + CLIENT_ID);
13+
if (fs.existsSync(KEY_FILE)) {
14+
clientId = JSON.parse(fs.readFileSync(KEY_FILE)).web.client_id;
15+
}
16+
17+
fs.writeFileSync(ENV_FILE, 'REACT_APP_CLIENT_ID=' + clientId);

0 commit comments

Comments
 (0)