Simplify project config

This commit is contained in:
Aria Minaei 2021-06-18 20:35:01 +02:00
parent c72647c1e5
commit 39a2645d65
27 changed files with 79 additions and 87 deletions

View file

@ -32,7 +32,7 @@ export default class Studio {
this.publicApi = new TheatreStudio(this)
this.atomP = this._store.atomP
if ($env.NODE_ENV !== 'test') {
if (process.env.NODE_ENV !== 'test') {
this.ui = new UI(this)
}

View file

@ -26,6 +26,7 @@ import get from 'lodash-es/get'
import type {Store} from 'redux'
import {persistStateOfStudio} from './persistStateOfStudio'
import {isSheetObject} from '@theatre/shared/instanceTypes'
import globals from '@theatre/shared/globals'
export type Drafts = {
historic: Draft<StudioHistoricState>
@ -59,7 +60,7 @@ export default class StudioStore {
this._atom = atomFromReduxStore(this._reduxStore)
this.atomP = this._atom.pointer
if ($env.disableStatePersistence !== true) {
if (globals.disableStatePersistence !== true) {
const d = defer<void>()
this.initialized = d.promise
persistStateOfStudio(this._reduxStore, () => {

View file

@ -5,6 +5,8 @@ import type {FullStudioState} from '@theatre/studio/store/index'
import debounce from 'lodash-es/debounce'
import type {Store} from 'redux'
const studioPersistenceKey = 'theatrejs:0.3/studio'
export const persistStateOfStudio = (
reduxStore: Store<FullStudioState>,
onInitialize: () => void,
@ -13,7 +15,7 @@ export const persistStateOfStudio = (
reduxStore.dispatch(studioActions.replacePersistentState(s))
}
const storageKey = $env.studioPersistenceKey + '.persistent'
const storageKey = studioPersistenceKey + '.persistent'
const getState = () => reduxStore.getState().$persistent
loadFromPersistentStorage()

View file

@ -9,7 +9,7 @@ export default class UIRootWrapper extends React.Component<{
componentDidMount() {
const self = this
if (
$env.NODE_ENV === 'development' &&
process.env.NODE_ENV !== 'production' &&
typeof module === 'object' &&
module &&
module.hot

View file

@ -11,7 +11,7 @@ const studioPrivateAPI = new Studio()
export const studio = studioPrivateAPI.publicApi
export default studio
if ($env.NODE_ENV !== 'test') {
if (process.env.NODE_ENV !== 'test') {
studio.ui.show()
}