While it was kind of nice having everything at the top level, the number of files is now getting a bit unwieldy and hard to understand, so I took a stab at organizing the directories without introducing too much nesting. Test Plan: - Ran `npm run serve` to ensure that local builds still work - Ran `npm run prepack` then `open dist/release/index.html` to ensure that release builds still work - Ran `scripts/deploy.sh` to ensure that the deployed version of the site will still work when I eventually redeploy - Ran `npm run jest` to ensure that tests still work correctly
31 lines
940 B
TypeScript
31 lines
940 B
TypeScript
import {h, render} from 'preact'
|
|
import {createApplicationStore, ApplicationState} from './store'
|
|
import {Provider} from 'preact-redux'
|
|
import {createContainer} from './lib/typed-redux'
|
|
import {Application} from './views/application'
|
|
|
|
console.log(`speedscope v${require('../package.json').version}`)
|
|
|
|
declare const module: any
|
|
if (module.hot) {
|
|
module.hot.dispose(() => {
|
|
// Force the old component go through teardown steps
|
|
render(<div />, document.body, document.body.lastElementChild || undefined)
|
|
})
|
|
module.hot.accept()
|
|
}
|
|
|
|
const lastStore: any = (window as any)['store']
|
|
const store = createApplicationStore(lastStore ? lastStore.getState() : {})
|
|
;(window as any)['store'] = store
|
|
|
|
const ApplicationContainer = createContainer(Application, (state: ApplicationState) => state)
|
|
|
|
render(
|
|
<Provider store={store}>
|
|
<ApplicationContainer />
|
|
</Provider>,
|
|
document.body,
|
|
document.body.lastElementChild || undefined,
|
|
)
|