More cleanups for actual distributable builds set to proper environment
This commit is contained in:
@@ -45,7 +45,7 @@
|
|||||||
"budgets": [
|
"budgets": [
|
||||||
{
|
{
|
||||||
"type": "anyComponentStyle",
|
"type": "anyComponentStyle",
|
||||||
"maximumWarning": "6kb"
|
"maximumWarning": "8kb"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"fileReplacements": [
|
"fileReplacements": [
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
"budgets": [
|
"budgets": [
|
||||||
{
|
{
|
||||||
"type": "anyComponentStyle",
|
"type": "anyComponentStyle",
|
||||||
"maximumWarning": "6kb"
|
"maximumWarning": "8kb"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"fileReplacements": [
|
"fileReplacements": [
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
"budgets": [
|
"budgets": [
|
||||||
{
|
{
|
||||||
"type": "anyComponentStyle",
|
"type": "anyComponentStyle",
|
||||||
"maximumWarning": "6kb"
|
"maximumWarning": "8kb"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"fileReplacements": [
|
"fileReplacements": [
|
||||||
@@ -106,7 +106,7 @@
|
|||||||
"budgets": [
|
"budgets": [
|
||||||
{
|
{
|
||||||
"type": "anyComponentStyle",
|
"type": "anyComponentStyle",
|
||||||
"maximumWarning": "6kb"
|
"maximumWarning": "8kb"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"fileReplacements": [
|
"fileReplacements": [
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
"budgets": [
|
"budgets": [
|
||||||
{
|
{
|
||||||
"type": "anyComponentStyle",
|
"type": "anyComponentStyle",
|
||||||
"maximumWarning": "6kb"
|
"maximumWarning": "8kb"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"fileReplacements": [
|
"fileReplacements": [
|
||||||
@@ -146,7 +146,7 @@
|
|||||||
"budgets": [
|
"budgets": [
|
||||||
{
|
{
|
||||||
"type": "anyComponentStyle",
|
"type": "anyComponentStyle",
|
||||||
"maximumWarning": "6kb"
|
"maximumWarning": "8kb"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"fileReplacements": [
|
"fileReplacements": [
|
||||||
|
|||||||
+24
-24
@@ -13,8 +13,7 @@ const Readable = require('stream').Readable;
|
|||||||
const Adb = require('@devicefarmer/adbkit').Adb;
|
const Adb = require('@devicefarmer/adbkit').Adb;
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const request = require('request');
|
|
||||||
//const progress = require('request-progress');
|
|
||||||
//without this, there's a bug in electron that makes facebook pages ruin everything, see https://github.com/electron/electron/issues/25469
|
//without this, there's a bug in electron that makes facebook pages ruin everything, see https://github.com/electron/electron/issues/25469
|
||||||
app.commandLine.appendSwitch('disable-features', 'CrossOriginOpenerPolicy');
|
app.commandLine.appendSwitch('disable-features', 'CrossOriginOpenerPolicy');
|
||||||
|
|
||||||
@@ -94,20 +93,19 @@ class ADB {
|
|||||||
},
|
},
|
||||||
rejectUnauthorized: process.env.NODE_ENV !== 'dev',
|
rejectUnauthorized: process.env.NODE_ENV !== 'dev',
|
||||||
};
|
};
|
||||||
request(url, options, (error, response, body) => {
|
fetch(url, options).then((response) => {
|
||||||
if (error) {
|
if (!response.ok || response.body == null) {
|
||||||
reject(error);
|
console.log(response.statusText, response.status, response.headers);
|
||||||
} else {
|
return reject(response.statusText);
|
||||||
try {
|
|
||||||
const found = JSON.parse(body).found;
|
|
||||||
if (!found) {
|
|
||||||
updateStatus('APK is not in the blacklist. Installing...');
|
|
||||||
}
|
|
||||||
resolve(found);
|
|
||||||
} catch (e) {
|
|
||||||
reject(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
response.json().then(body => {
|
||||||
|
let found = body.found;
|
||||||
|
if (!found) {
|
||||||
|
updateStatus('APK is not in the blacklist. Installing...');
|
||||||
|
}
|
||||||
|
resolve(found);
|
||||||
|
|
||||||
|
}).catch(reject);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -150,20 +148,24 @@ class ADB {
|
|||||||
return `${percentage}%`;
|
return `${percentage}%`;
|
||||||
}
|
}
|
||||||
installFromToken(token, cb, ecb) {
|
installFromToken(token, cb, ecb) {
|
||||||
|
let url = `${getEnvCfg().http_url || 'https://api.sidequestvr.com'}/install-from-key`;
|
||||||
let options = {
|
let options = {
|
||||||
url: `${getEnvCfg().http_url || 'https://api.sidequestvr.com'}/install-from-key`,
|
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json',
|
Accept: 'application/json',
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
Origin: getEnvCfg().web_url || 'https://sidequestvr.com',
|
Origin: getEnvCfg().web_url || 'https://sidequestvr.com',
|
||||||
},
|
},
|
||||||
rejectUnauthorized: process.env.NODE_ENV !== 'dev',
|
// rejectUnauthorized: process.env.NODE_ENV !== 'dev',
|
||||||
json: { token: token },
|
body: JSON.stringify({ token: token }),
|
||||||
};
|
};
|
||||||
console.log("IFT:", options)
|
console.log("IFT:", url, options)
|
||||||
request(options.url, options, (error, response, body) => {
|
fetch(url, options).then(response => {
|
||||||
if (!error && body.data && body.data.apps && body.data.apps.length) {
|
if (!response.ok || response.body == null) {
|
||||||
|
console.log(response.statusText, response.status, response.headers);
|
||||||
|
return ecb('Unable to fetch package');
|
||||||
|
}
|
||||||
|
response.json().then(body => {
|
||||||
let tasks = [];
|
let tasks = [];
|
||||||
console.log("IFT Body", body);
|
console.log("IFT Body", body);
|
||||||
for (let i = 0; i < body.data.apps.length; i++) {
|
for (let i = 0; i < body.data.apps.length; i++) {
|
||||||
@@ -192,9 +194,7 @@ class ADB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
cb(tasks);
|
cb(tasks);
|
||||||
} else {
|
}).catch(ecb);
|
||||||
ecb(error || 'Nothing to install.');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
endLogcat() {
|
endLogcat() {
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
// This file is overwritten by the build process
|
||||||
|
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
|
require('./config');
|
||||||
|
|
||||||
export function getEnvCfg() {
|
export function getEnvCfg() {
|
||||||
switch (process.env['SQ_ENV_CFG']) {
|
const cfg = process.env['SQ_ENV_CFG'] || global.SQ_ENV_CFG;
|
||||||
|
console.log('SQ_ENV_CFG:', cfg);
|
||||||
|
switch (cfg) {
|
||||||
case 'test':
|
case 'test':
|
||||||
return {
|
return {
|
||||||
web_url: 'https://sidetestvr.com',
|
web_url: 'https://sidetestvr.com',
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
const fs = require('node:fs');
|
||||||
|
let cfg = ""
|
||||||
|
|
||||||
|
if (process.argv[2]) {
|
||||||
|
cfg = process.argv[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Output should be in the build-electron folder
|
||||||
|
fs.writeFileSync(__dirname + "/../build-electron/config.js", `global.SQ_ENV_CFG = "${cfg}";`)
|
||||||
+9
-8
@@ -16,13 +16,13 @@
|
|||||||
"start:local": "concurrently \"yarn electron-build && yarn platform-tools && wait-on http-get://localhost:4205/ && cross-env NODE_ENV=dev SQ_ENV_CFG=local electron .\" \"cd desktop-app && ng serve -c local --port 4205\"",
|
"start:local": "concurrently \"yarn electron-build && yarn platform-tools && wait-on http-get://localhost:4205/ && cross-env NODE_ENV=dev SQ_ENV_CFG=local electron .\" \"cd desktop-app && ng serve -c local --port 4205\"",
|
||||||
"start:localhost": "concurrently \"yarn electron-build && yarn platform-tools && wait-on http-get://localhost:4205/ && cross-env NODE_ENV=dev SQ_ENV_CFG=localhost electron .\" \"cd desktop-app && ng serve -c localhost --port 4205\"",
|
"start:localhost": "concurrently \"yarn electron-build && yarn platform-tools && wait-on http-get://localhost:4205/ && cross-env NODE_ENV=dev SQ_ENV_CFG=localhost electron .\" \"cd desktop-app && ng serve -c localhost --port 4205\"",
|
||||||
"postinstall": "electron-builder install-app-deps && cd desktop-app && yarn install",
|
"postinstall": "electron-builder install-app-deps && cd desktop-app && yarn install",
|
||||||
"dist": "yarn electron-build && yarn platform-tools && yarn app-build && env-cmd --silent electron-builder --publish onTagOrDraft",
|
"dist": "yarn electron-build && yarn platform-tools && yarn app-build && node build-electron/make-config && env-cmd --silent electron-builder --publish onTagOrDraft",
|
||||||
"build:win": "yarn electron-build && yarn platform-tools && yarn app-build && cross-env NODE_ENV=production electron-builder --win",
|
"build:win": "yarn electron-build && yarn platform-tools && yarn app-build && node build-electron/make-config && cross-env NODE_ENV=production electron-builder --win",
|
||||||
"build:linux": "yarn electron-build && yarn platform-tools && yarn app-build && cross-env NODE_ENV=production electron-builder --linux",
|
"build:linux": "yarn electron-build && yarn platform-tools && yarn app-build && node build-electron/make-config && cross-env NODE_ENV=production electron-builder --linux",
|
||||||
"dist-test": "yarn electron-build && yarn platform-tools && yarn app-build-test && cross-env NODE_ENV=production SQ_ENV_CFG=test electron-builder",
|
"dist-test": "yarn electron-build && yarn platform-tools && yarn app-build-test && node build-electron/make-config test && cross-env NODE_ENV=production SQ_ENV_CFG=test electron-builder",
|
||||||
"dist-sidetest": "yarn electron-build && yarn platform-tools && yarn app-build-test && cross-env NODE_ENV=production SQ_ENV_CFG=test electron-builder",
|
"dist-sidetest": "yarn electron-build && yarn platform-tools && yarn app-build-test && node build-electron/make-config test && cross-env NODE_ENV=production SQ_ENV_CFG=test electron-builder",
|
||||||
"dist-fried": "yarn electron-build && yarn platform-tools && yarn app-build-fried && cross-env NODE_ENV=production SQ_ENV_CFG=fried electron-builder",
|
"dist-fried": "yarn electron-build && yarn platform-tools && yarn app-build-fried && node build-electron/make-config fried && cross-env NODE_ENV=production SQ_ENV_CFG=fried electron-builder",
|
||||||
"dist-localhost": "yarn electron-build && yarn platform-tools && yarn app-build-localhost && cross-env SQ_ENV_CFG=localhost electron-builder --linux",
|
"dist-localhost": "yarn electron-build && yarn platform-tools && yarn app-build-localhost && node build-electron/make-config localhost && cross-env SQ_ENV_CFG=localhost electron-builder --linux",
|
||||||
"angular": "cd desktop-app && ng serve --port 4205",
|
"angular": "cd desktop-app && ng serve --port 4205",
|
||||||
"angular:test": "cd desktop-app && ng serve -c test --port 4205",
|
"angular:test": "cd desktop-app && ng serve -c test --port 4205",
|
||||||
"angular:test2": "cd desktop-app && ng serve -c test2 --port 4205",
|
"angular:test2": "cd desktop-app && ng serve -c test2 --port 4205",
|
||||||
@@ -85,7 +85,8 @@
|
|||||||
"build-electron/state-storage.js",
|
"build-electron/state-storage.js",
|
||||||
"build-electron/window.js",
|
"build-electron/window.js",
|
||||||
"build-electron/env-config.js",
|
"build-electron/env-config.js",
|
||||||
"build-electron/external-urls.js"
|
"build-electron/external-urls.js",
|
||||||
|
"build-electron/config.js"
|
||||||
],
|
],
|
||||||
"asarUnpack": [
|
"asarUnpack": [
|
||||||
"build/**/*"
|
"build/**/*"
|
||||||
|
|||||||
Reference in New Issue
Block a user