Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add improvements for dev mode #93

Merged
merged 10 commits into from Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions docker-compose.yaml
Expand Up @@ -8,6 +8,7 @@ services:
dockerfile: Dockerfile.ui-builder
environment:
BRANCH: ${BRANCH}
UI_BUILD_FOLDER: /ui-build
volumes:
- ui-build:/ui-build

Expand All @@ -20,6 +21,7 @@ services:
ELECTRON_CACHE: /root/.cache/electron
ELECTRON_BUILDER_CACHE: /root/.cache/electron-builder
BRANCH: ${BRANCH}
UI_BUILD_FOLDER: /ui-build
volumes:
- ui-build:/ui-build
- ./dist:/dist
Expand All @@ -35,6 +37,7 @@ services:
ELECTRON_CACHE: /root/.cache/electron
ELECTRON_BUILDER_CACHE: /root/.cache/electron-builder
BRANCH: ${BRANCH}
UI_BUILD_FOLDER: /ui-build
volumes:
- ui-build:/ui-build
- ./dist:/dist
Expand All @@ -50,6 +53,7 @@ services:
ELECTRON_CACHE: /root/.cache/electron
ELECTRON_BUILDER_CACHE: /root/.cache/electron-builder
BRANCH: ${BRANCH}
UI_BUILD_FOLDER: /ui-build
volumes:
- ui-build:/ui-build
- ./dist:/dist
Expand Down
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -22,7 +22,7 @@
"extract-zip": "^2.0.1",
"find-free-port": "^2.0.0",
"github-markdown-css": "^4.0.0",
"grenache-grape": "^0.9.8",
"grenache-grape": "git+https://github.com/bitfinexcom/grenache-grape.git",
"js-yaml": "^4.0.0",
"lodash": "^4.17.15",
"new-github-issue-url": "^0.2.1",
Expand All @@ -32,11 +32,11 @@
},
"devDependencies": {
"app-builder-bin": "^3.5.13",
"electron": "13.1.2",
"electron": "13.1.6",
"electron-builder": "22.11.7",
"node-gyp": "7.1.2",
"node-pre-gyp": "^0.11.0",
"standard": "^14.3.1"
"standard": "^16.0.3"
},
"standard": {
"globals": [
Expand Down
14 changes: 10 additions & 4 deletions scripts/build-ui.sh
Expand Up @@ -3,13 +3,13 @@
set -x

export CI_ENVIRONMENT_NAME=production
export SKIP_PREFLIGHT_CHECK=true

ROOT="$PWD"
frontendFolder="$ROOT/bfx-report-ui"
pathToTriggerElectronLoad="$frontendFolder/src/utils/triggerElectronLoad.js"
pathToFonts="$frontendFolder/src/styles/fonts"
uiBuildFolder=/ui-build
uiReadyFile="$uiBuildFolder/READY"
uiBuildFolder="$frontendFolder/build"
branch=master

source $ROOT/scripts/update-submodules.sh
Expand All @@ -22,7 +22,13 @@ if [ "$BRANCH" != "" ]
then
branch=$BRANCH
fi
if [ "$UI_BUILD_FOLDER" != "" ]
then
uiBuildFolder=$UI_BUILD_FOLDER
fi

mkdir $uiBuildFolder 2>/dev/null
uiReadyFile="$uiBuildFolder/READY"
rm -rf $uiBuildFolder/*

function usage {
Expand Down Expand Up @@ -89,10 +95,10 @@ sed -i -e \
"s/showFrameworkMode: false/showFrameworkMode: true/g" \
$frontendFolder/src/config.js

rm -f "$ROOT/.eslintrc"

mv -f "$ROOT/.eslintrc" "$ROOT/eslint-conf-disabled-for-ui"
npm i --no-audit
npm run build
mv -f "$ROOT/eslint-conf-disabled-for-ui" "$ROOT/.eslintrc"

if ! [ -s "$frontendFolder/build/index.html" ]; then
exit 1
Expand Down
12 changes: 10 additions & 2 deletions scripts/init.sh
Expand Up @@ -7,6 +7,7 @@ branch=master
dbDriver=better-sqlite
lastCommitFileName=lastCommit.json
isZipReleaseFile="isZipRelease"
bfxStagingUrl="https://api.staging.bitfinex.com"

source $ROOT/scripts/get-conf-value.sh
source $ROOT/scripts/escape-string.sh
Expand Down Expand Up @@ -62,7 +63,13 @@ expressFolder="$frontendFolder/bfx-report-express"
backendFolder="$ROOT/bfx-reports-framework"

linuxLauncherFolder="$ROOT/build/linux-launcher"
uiBuildFolder=/ui-build

uiBuildFolder="$frontendFolder/build"
if [ "$UI_BUILD_FOLDER" != "" ]
then
uiBuildFolder=$UI_BUILD_FOLDER
fi
mkdir $uiBuildFolder 2>/dev/null
uiReadyFile="$uiBuildFolder/READY"

mkdir $ROOT/dist 2>/dev/null
Expand Down Expand Up @@ -104,8 +111,9 @@ sed -i -e \
$backendFolder/config/service.report.json

if [ $isDevEnv != 0 ]; then
escapedBfxStagingUrl=$(escapeString $bfxStagingUrl)
sed -i -e \
"s/\"restUrl\": \".*\"/\"restUrl\": \"https:\/\/test.bitfinex.com\"/g" \
"s/\"restUrl\": \".*\"/\"restUrl\": \"$escapedBfxStagingUrl\"/g" \
$backendFolder/config/service.report.json
fi

Expand Down
9 changes: 6 additions & 3 deletions src/change-sync-frequency.js
Expand Up @@ -176,7 +176,8 @@ module.exports = () => {
...alertOptions,
text,
inputValue: timeFormat.value === timeData.timeFormat
? timeData.value : 1,
? timeData.value
: 1,
inputAttributes: {
min: 1,
max: 31,
Expand All @@ -189,7 +190,8 @@ module.exports = () => {
...alertOptions,
text,
inputValue: timeFormat.value === timeData.timeFormat
? timeData.value : 2,
? timeData.value
: 2,
inputAttributes: {
min: 1,
max: 23,
Expand All @@ -202,7 +204,8 @@ module.exports = () => {
...alertOptions,
text,
inputValue: timeFormat.value === timeData.timeFormat
? timeData.value : 20,
? timeData.value
: 20,
inputAttributes: {
min: 10,
max: 59,
Expand Down
2 changes: 1 addition & 1 deletion src/error-manager/render-markdown-template.js
Expand Up @@ -10,7 +10,7 @@ const templateByDefault = fs.readFileSync(
path.join(__dirname, 'github-issue-template.md'),
'utf8'
)
const placeholderPattern = new RegExp(/\$\{[a-zA-Z0-9]+\}/, 'g')
const placeholderPattern = /\$\{[a-zA-Z0-9]+\}/g

// The GitHub GET endpoint for opening a new issue
// has a restriction for maximum length of a URL: 8192 bytes
Expand Down
9 changes: 8 additions & 1 deletion src/helpers/get-debug-info.js
Expand Up @@ -9,11 +9,18 @@ const productName = 'Bitfinex Report'

const { getAppUpdateConfigSync } = require('../auto-updater')

const appUpdateConfig = getAppUpdateConfigSync()
const packageJson = require(path.join(appDir, 'package.json'))

let lastCommit = { hash: '-', date: '-' }
let appUpdateConfig = {}

try {
appUpdateConfig = getAppUpdateConfigSync()
} catch (err) {
console.debug(err)

appUpdateConfig = packageJson.build.publish
}
try {
lastCommit = require(path.join(appDir, 'lastCommit.json'))
} catch (err) {
Expand Down
14 changes: 7 additions & 7 deletions src/window-creators.js
Expand Up @@ -56,9 +56,9 @@ const _createWindow = async (
manage
} = isMainWindow
? windowStateKeeper({
defaultWidth,
defaultHeight
})
defaultWidth,
defaultHeight
})
: {}
const _props = {
autoHideMenuBar: true,
Expand All @@ -82,10 +82,10 @@ const _createWindow = async (

const startUrl = pathname
? url.format({
pathname,
protocol: 'file:',
slashes: true
})
pathname,
protocol: 'file:',
slashes: true
})
: 'app://-'

if (!pathname) {
Expand Down