Skip to content

Commit

Permalink
Fix issue where NODE_ENV was not set in production, causing file load…
Browse files Browse the repository at this point in the history
…s to fail
  • Loading branch information
Nick-Lucas committed Nov 8, 2021
1 parent 5a160d0 commit 30fb93b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import fs from 'fs'
import path from 'path'
import { NODE_ENV } from 'app/lib/env'

let bashPath = ''
if (process.env.NODE_ENV === 'production') {
if (NODE_ENV === 'production') {
bashPath = path.resolve(process.resourcesPath, 'bashrc')
} else {
bashPath = path.resolve(__dirname, './bashrc')
Expand Down
7 changes: 7 additions & 0 deletions packages/giterm/app/renderer/lib/env.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if (process.env.NODE_ENV == undefined) {
process.env.NODE_ENV = 'production'
}

type Env = 'production' | 'development' | 'test'

export const NODE_ENV: Env = process.env.NODE_ENV as Env
3 changes: 2 additions & 1 deletion packages/giterm/app/renderer/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { createStore, applyMiddleware, combineReducers, compose } from 'redux'
import createSagaMiddleware from 'redux-saga'
import * as Sentry from '@sentry/electron'
import * as ReactRedux from 'react-redux'
import { NODE_ENV } from 'app/lib/env'

// Reducers
import * as reducers from './reducers'
Expand All @@ -14,7 +15,7 @@ function configureStore() {
const composeEnhancers = (() => {
const compose_ =
window && (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
if (process.env.NODE_ENV === 'development' && compose_) {
if (NODE_ENV === 'development' && compose_) {
return compose_
}
return compose
Expand Down
2 changes: 2 additions & 0 deletions packages/giterm/app/sentry.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as Sentry from '@sentry/electron'

process.env.NODE_ENV ||= 'production'

Sentry.init({
dsn: 'https://[email protected]/5412064',
enabled: process.env.NODE_ENV === 'production' || !!process.env.FORCE_SENTRY,
Expand Down
2 changes: 1 addition & 1 deletion packages/giterm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "giterm",
"version": "0.20.2",
"version": "0.20.3",
"description": "A git gui for terminal lovers",
"homepage": "https://github.com/Nick-Lucas/giterm",
"main": "init.js",
Expand Down

0 comments on commit 30fb93b

Please sign in to comment.