Skip to content

Commit 5f89784

Browse files
Merge pull request cerebral#119 from cerebral/removeDefault
fix(overmind): remove default exports, update documentation
2 parents 679f727 + a6844b0 commit 5f89784

File tree

37 files changed

+102
-116
lines changed

37 files changed

+102
-116
lines changed

packages/demos/react-typescript-todomvc/src/app/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import Overmind, { TApp } from 'overmind'
2-
import createConnect, { TConnect } from 'overmind-react'
1+
import { Overmind, TApp } from 'overmind'
2+
import { TConnect, createConnect } from 'overmind-react'
33

44
import * as actions from './actions'
55
import * as effects from './effects'
@@ -15,10 +15,8 @@ declare module 'overmind' {
1515
interface App extends TApp<typeof config> {}
1616
}
1717

18-
const app = new Overmind(config)
18+
export const app = new Overmind(config)
1919

2020
export type Connect = TConnect<typeof app>
2121

2222
export const connect = createConnect(app)
23-
24-
export default app

packages/node_modules/overmind-angular/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import OvermindApp, { BaseApp, EventType } from 'overmind'
1+
import { BaseApp, EventType, Overmind } from 'overmind'
22

33
export type TConnect<App extends BaseApp> = {
44
app: {
@@ -14,7 +14,7 @@ export type TConnect<App extends BaseApp> = {
1414

1515
let nextComponentId = 0
1616

17-
export default <App extends OvermindApp<any>>(app: App) => () => {
17+
export const createConnect = <App extends Overmind<any>>(app: App) => () => {
1818
const componentId = nextComponentId++
1919
let componentInstanceId = 0
2020

packages/node_modules/overmind-devtools/src/BackendConnector.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ipcRenderer } from 'electron'
2+
23
import { AppMessage } from './app/types'
34

45
type Message = {
@@ -8,7 +9,7 @@ type Message = {
89

910
type MessageCallback = (message: Message) => void
1011

11-
class BackendConnector {
12+
export class BackendConnector {
1213
port: string
1314
messageCallback: MessageCallback
1415
constructor() {

packages/node_modules/overmind-devtools/src/app/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import Overmind, { TApp } from 'overmind'
2-
import createConnect, { TConnect } from 'overmind-react'
1+
import { Overmind, TApp } from 'overmind'
2+
import { TConnect, createConnect } from 'overmind-react'
33

44
import * as actions from './actions'
55
import * as effects from './effects'

packages/node_modules/overmind-react/src/index.test.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import App, { TAction, TApp } from 'overmind'
1+
import { Overmind, TAction, TApp } from 'overmind'
22
import * as React from 'react'
33
import * as renderer from 'react-test-renderer'
44

5-
import createConnect, { TConnect } from './'
5+
import { TConnect, createConnect } from './'
66

77
describe('React', () => {
88
test('should connect state and actions to stateless components', () => {
@@ -31,7 +31,7 @@ describe('React', () => {
3131
}
3232
}>
3333

34-
const app = new App(config)
34+
const app = new Overmind(config)
3535

3636
type Action<Input = void, Output = any> = TAction<IApp, Input, Output>
3737

@@ -73,7 +73,7 @@ describe('React', () => {
7373
}
7474
}>
7575

76-
const app = new App(config)
76+
const app = new Overmind(config)
7777

7878
type Action<Input = void, Output = any> = TAction<IApp, Input, Output>
7979

@@ -119,7 +119,7 @@ describe('React', () => {
119119
}
120120
}>
121121

122-
const app = new App(config)
122+
const app = new Overmind(config)
123123

124124
type Action<Input = void, Output = any> = TAction<IApp, Input, Output>
125125

@@ -150,7 +150,7 @@ describe('React', () => {
150150
})
151151

152152
test('should preserve component name', () => {
153-
const app = new App({})
153+
const app = new Overmind({})
154154
const connect = createConnect(app)
155155

156156
class FooComponent extends React.Component<TConnect<typeof app>> {

packages/node_modules/overmind-react/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import OvermindApp, { BaseApp, EventType } from 'overmind'
1+
import { BaseApp, EventType, Overmind } from 'overmind'
22
import * as React from 'react'
33

44
export type IReactComponent<P = any> =
@@ -27,7 +27,7 @@ export type TConnect<App extends BaseApp> = {
2727

2828
let nextComponentId = 0
2929

30-
export default <App extends OvermindApp<any>>(app: App) => {
30+
export const createConnect = <App extends Overmind<any>>(app: App) => {
3131
return <Props>(
3232
Component: IReactComponent<Props & TConnect<App>>
3333
): IReactComponent<Omit<Props & TConnect<App>, keyof TConnect<App>>> => {

packages/node_modules/overmind-vue/src/Index.test.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { JSDOM } from 'jsdom'
2-
import App from 'overmind'
3-
import createConnect from './'
2+
import { Overmind } from 'overmind'
3+
4+
import { createConnect } from './'
45
const Vue = require('vue/dist/vue')
56

67
const dom = new JSDOM()
78

89
describe('Vue', () => {
910
it('should mount with connected app', () => {
10-
const app = new App({
11+
const app = new Overmind({
1112
state: {
1213
foo: 'bar',
1314
},
@@ -21,7 +22,7 @@ describe('Vue', () => {
2122
expect(vm.app.state.foo).toBe('bar')
2223
})
2324
it('should expose actions', (done) => {
24-
const app = new App({
25+
const app = new Overmind({
2526
state: {
2627
foo: 'bar',
2728
},
@@ -46,7 +47,7 @@ describe('Vue', () => {
4647
it('should expose reaction', (done) => {
4748
expect.assertions(1)
4849
let hasReacted = false
49-
const app = new App({
50+
const app = new Overmind({
5051
state: {
5152
foo: 'bar',
5253
},

packages/node_modules/overmind-vue/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import OvermindApp, { BaseApp, EventType } from 'overmind'
1+
import { BaseApp, EventType, Overmind } from 'overmind'
22
import Vue, { ComponentOptions } from 'vue'
33

44
export type TConnect<App extends BaseApp> = {
@@ -20,7 +20,7 @@ type DefaultComputed = { [key: string]: any }
2020

2121
let nextComponentId = 0
2222

23-
export default <App extends OvermindApp<any>>(app: App) => <
23+
export const createConnect = <App extends Overmind<any>>(app: App) => <
2424
V extends Vue & App,
2525
Data extends DefaultData<V>,
2626
Methods extends DefaultMethods<V>,

packages/node_modules/overmind/src/Action.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
ActionExecution,
55
StopExecution,
66
} from 'action-chain'
7-
import ProxyStateTree, { Mutation } from 'proxy-state-tree'
7+
import { Mutation, ProxyStateTree } from 'proxy-state-tree'
88

99
type OperatorCallback<BaseContext, Value, NewValue = Value> = (
1010
ctx: BaseContext & {
@@ -52,7 +52,7 @@ export const createOperators = (proxyStateTree, actionChain) => ({
5252
debounce: (ms) => new ActionClass(proxyStateTree, actionChain).debounce(ms),
5353
})
5454

55-
export default class ActionClass<
55+
export class ActionClass<
5656
BaseContext,
5757
InitialValue,
5858
Value = InitialValue

packages/node_modules/overmind/src/Devtools.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function debounce(func, wait) {
4646
}
4747
}
4848

49-
export default class Devtools {
49+
export class Devtools {
5050
private buffer: string[] = []
5151
private ws: WebSocket = null
5252
private isConnected: boolean = false

0 commit comments

Comments
 (0)