Skip to content

Commit

Permalink
feat: upgrade deps and aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
Tylor Steinberger committed Oct 11, 2017
1 parent 91f8bf6 commit ca7c1c7
Show file tree
Hide file tree
Showing 28 changed files with 196 additions and 157 deletions.
24 changes: 11 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,25 @@
"author": "Motorcycle",
"license": "MIT",
"devDependencies": {
"@motorcycle/loader": "^3.0.0",
"@motorcycle/test": "2.0.0",
"cache-loader": "1.0.3",
"@motorcycle/loader": "3.0.0",
"@motorcycle/test": "2.1.0",
"fork-ts-checker-webpack-plugin": "0.2.8",
"happypack": "4.0.0",
"html-webpack-plugin": "2.30.1",
"husky": "0.14.3",
"lint-staged": "4.2.1",
"prettier": "1.7.0",
"thread-loader": "1.1.1",
"lint-staged": "4.2.3",
"prettier": "1.7.4",
"ts-loader": "2.3.7",
"typescript": "2.5.2",
"typescript": "2.5.3",
"webpack": "3.6.0",
"webpack-dev-server": "2.8.2"
"webpack-dev-server": "2.9.1"
},
"dependencies": {
"@motorcycle/dom": "16.0.0",
"@motorcycle/mostly-dom": "4.0.0",
"@motorcycle/run": "4.0.0",
"@motorcycle/stream": "2.0.0",
"@motorcycle/types": "2.0.0"
"@motorcycle/dom": "16.1.0",
"@motorcycle/mostly-dom": "4.1.0",
"@motorcycle/run": "4.1.0",
"@motorcycle/stream": "2.1.0",
"@motorcycle/types": "2.1.0"
},
"lint-staged": {
"*.ts": [
Expand Down
3 changes: 2 additions & 1 deletion src/application/Application.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ApplicationSinks, ApplicationSources, Seconds, State } from './types'
import { constant, filter, hold, map, sample, startWith, switchLatest } from '@motorcycle/stream'

import { areAllLevelsCompleted } from '@base/domain/model/areAllLevelsCompleted'
import { areAllLevelsCompleted } from 'domain/model/areAllLevelsCompleted'
import { elapsedTime } from './elapsedTime'
import { initialState } from './initialState'
import { keepState } from './keepState'
Expand All @@ -11,6 +11,7 @@ export function Application({ go$, level$ }: ApplicationSinks): ApplicationSourc
const heldLevel$ = hold(level$)
const maze$ = map(loadMaze, heldLevel$)
const initialState$ = map(initialState, maze$)
console.log(go$)
const state$ = hold<State>(switchLatest(map(keepState(go$), initialState$)))
const levelCompleted$ = map(({ levelCompleted }) => levelCompleted, state$)
const allLevelsCompleted$ = startWith(
Expand Down
2 changes: 1 addition & 1 deletion src/application/constants.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from '@base/domain/model/constants'
export * from 'domain/model/constants'
2 changes: 1 addition & 1 deletion src/application/loadMaze.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Level, Maze } from './types'

import { mazes } from '@base/domain/model'
import { mazes } from 'domain/model'

export function loadMaze(level: Level): Maze {
const maze = mazes[level > 0 ? level : 0]
Expand Down
2 changes: 1 addition & 1 deletion src/application/moveBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Coordinate, Maze, MoveBox } from './types'
import { curry, equals, length } from '167'

import { BLANK } from './constants'
import { tryMove } from '@base/domain/model'
import { tryMove } from 'domain/model'

export const moveBox: MoveBox = curry(function moveBox(
maze: Maze,
Expand Down
2 changes: 1 addition & 1 deletion src/application/movePlayer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Direction, Maze, MovePlayer, State } from './types'
import { curry, equals, increment, map } from '167'
import { isLevelCompleted, tryMove } from '@base/domain/model'
import { isLevelCompleted, tryMove } from 'domain/model'

import { adjacentLocation } from './adjacentLocation'
import { mazeWithBoxes } from './mazeWithBoxes'
Expand Down
6 changes: 3 additions & 3 deletions src/application/types.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Boxes, Coordinate, Direction, Maze, State } from '@base/domain/model'
import { Boxes, Coordinate, Direction, Maze, State } from 'domain/model'
import { EffectfulComponent, Stream } from '@motorcycle/types'
import { NonnegativeInteger, PositiveInteger } from '@base/common/types'
import { NonnegativeInteger, PositiveInteger } from 'common/types'

// Re-export, so UI doesn’t query the domain directly.
export * from '@base/domain/model/types'
export * from 'domain/model/types'

export type ApplicationComponent = EffectfulComponent<ApplicationSinks, ApplicationSources>

Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { UI, UISinks, UISources } from '@base/ui'
import { UI, UISinks, UISources } from 'ui'

import { Application } from '@base/application'
import { Application } from 'application'
import { constant } from '@motorcycle/stream'
import { createDocumentDomSource } from '@motorcycle/dom'
import { makeDomComponent } from '@motorcycle/mostly-dom'
Expand Down
2 changes: 1 addition & 1 deletion src/domain/model/areAllLevelsCompleted.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { increment, not } from '167'

import { Level } from './types'
import { mazes } from '@base/domain/model'
import { mazes } from 'domain/model'

export const areAllLevelsCompleted = (completed: boolean, level: Level): boolean =>
completed && not(mazes[increment(level)]) ? true : false
2 changes: 1 addition & 1 deletion src/domain/model/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Matrix2D, NonnegativeInteger } from '@base/common/types'
import { Matrix2D, NonnegativeInteger } from 'common/types'

export type Mazes = ReadonlyArray<Maze>

Expand Down
2 changes: 1 addition & 1 deletion src/ui/UI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { directionKeys, key, keyed, resetKeys, startKeys } from './interaction'
import { id, increment, not } from '167'
import { sokoban, startScreen } from './views'

import { Direction } from '@base/application/types'
import { Direction } from 'application/types'
import { NO_LEVEL } from './constants'
import { Stream } from '@motorcycle/types'
import { canIncrementLevel } from './canIncrementLevel'
Expand Down
2 changes: 1 addition & 1 deletion src/ui/goInDirection.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Direction } from '@base/application/types'
import { Direction } from 'application/types'

export const goInDirection = (direction: Direction, shouldMove: boolean) =>
shouldMove ? direction : false
2 changes: 1 addition & 1 deletion src/ui/interaction/directionKeys.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Direction } from '@base/application/types'
import { Direction } from 'application/types'

export const directionKeys: { [key: string]: Direction } = {
ArrowUp: 'up',
Expand Down
2 changes: 1 addition & 1 deletion src/ui/mazeSize.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Maze } from '@base/application/types'
import { Maze } from 'application/types'
import { MazeSize } from './types'
import { TILE_SIZE } from './constants'
import { length } from '167'
Expand Down
4 changes: 2 additions & 2 deletions src/ui/pictureOfMaze/drawRow.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Coordinate, Direction, Latitude, Longitude, Tile } from '@base/application/types'
import { Coordinate, Direction, Latitude, Longitude, Tile } from 'application/types'
import { curry, map } from '167'

import { Dimension } from '@base/common/types'
import { Dimension } from 'common/types'
import { DrawRow } from './types'
import { VNodes } from '../views/types'
import { drawTileAt } from './drawTileAt'
Expand Down
2 changes: 1 addition & 1 deletion src/ui/pictureOfMaze/drawTileAt.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Coordinate, Direction, Tile } from '@base/application/types'
import { Coordinate, Direction, Tile } from 'application/types'
import { blank, player, sprites } from '../sprites'

import { VNode } from '@motorcycle/mostly-dom'
Expand Down
2 changes: 1 addition & 1 deletion src/ui/pictureOfMaze/pictureOfMaze.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { flatten, map } from '167'

import { State } from '@base/application/types'
import { State } from 'application/types'
import { VNode } from '@motorcycle/mostly-dom'
import { VNodes } from '../views/types'
import { drawRow } from './drawRow'
Expand Down
4 changes: 2 additions & 2 deletions src/ui/pictureOfMaze/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Coordinate, Direction, Longitude, Tile } from '@base/application/types'
import { Coordinate, Direction, Longitude, Tile } from 'application/types'

import { Dimension } from '@base/common/types'
import { Dimension } from 'common/types'
import { VNodes } from '../views/types'

export type DrawRow = {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/sprites/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { TILE_CENTER, TILE_SIZE } from '../constants'
import { VNode, svg } from '@motorcycle/mostly-dom'

import { Degrees } from './types'
import { Direction } from '@base/application/types'
import { Direction } from 'application/types'

const { rect, circle, g, path } = svg

Expand Down
2 changes: 1 addition & 1 deletion src/ui/sprites/sprites.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { blank, box, ground, storage, wall } from './'

import { Tile } from '@base/application/types'
import { Tile } from 'application/types'
import { VNode } from '@motorcycle/mostly-dom'

export const sprites: { [key in Tile]: (playerOrBlank: VNode, key: string) => VNode } = {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/sprites/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { NonnegativeInteger } from '@base/common/types'
import { NonnegativeInteger } from 'common/types'

export type Degrees = NonnegativeInteger
4 changes: 2 additions & 2 deletions src/ui/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ApplicationSinks, ApplicationSources, Level } from '@base/application/types'
import { ApplicationSinks, ApplicationSources, Level } from 'application/types'
import { DomSinks, DomSources } from '@motorcycle/mostly-dom'

import { DomSource } from '@motorcycle/dom'
import { NonnegativeInteger } from '@base/common/types'
import { NonnegativeInteger } from 'common/types'

export type UISources = DomSources &
ApplicationSources & { readonly document: DomSource<Document, Event> }
Expand Down
2 changes: 1 addition & 1 deletion src/ui/views/sokoban/secondsToTime.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NonnegativeInteger } from '@base/common/types'
import { NonnegativeInteger } from 'common/types'
import { Time } from './types'

export function secondsToTime(seconds: NonnegativeInteger): Time {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/views/sokoban/sokoban.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { VNode, div } from '@motorcycle/mostly-dom'

import { MazeSize } from '../../types'
import { NonnegativeInteger } from '@base/common/types'
import { NonnegativeInteger } from 'common/types'
import { SokobanView } from './types'
import { VNodes } from '../types'
import { completedAllLevels } from './completedAllLevels'
Expand Down
4 changes: 2 additions & 2 deletions src/ui/views/sokoban/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MazeSize } from '../../types'
import { NonnegativeInteger } from '@base/common/types'
import { Seconds } from '@base/application/types'
import { NonnegativeInteger } from 'common/types'
import { Seconds } from 'application/types'
import { VNode } from '@motorcycle/mostly-dom'
import { VNodes } from '../types'

Expand Down
13 changes: 11 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,17 @@
"noUnusedLocals": true,
"baseUrl": "./src",
"paths": {
"@base/*": [
"*"
"application/*": [
"./application/*"
],
"common/*": [
"./common/*"
],
"domain/*": [
"./domain/*"
],
"ui/*": [
"./ui/*"
]
}
},
Expand Down
18 changes: 6 additions & 12 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ module.exports = {
{
test: /\.ts?$/,
use: [
{
loader: 'cache-loader',
},
{
loader: 'thread-loader',
options: {
// there should be 1 cpu for the fork-ts-checker-webpack-plugin
workers: os.cpus().length - 1,
},
},
{
loader: '@motorcycle/loader',
options: {
Expand All @@ -45,7 +35,7 @@ module.exports = {
{
loader: 'ts-loader',
options: {
happyPackMode: true, // IMPORTANT! use happyPackMode mode to speed-up compilation and reduce errors reported to webpack
happyPackMode: true,
},
},
],
Expand All @@ -62,7 +52,11 @@ module.exports = {
mainFields: ['module', 'jsnext:main', 'browser', 'main'],
extensions: ['.ts', '.js'],
alias: {
'@base': path.resolve(__dirname, 'src/'),
// "@": srcPath,
application: path.join(srcPath, 'application'),
common: path.join(srcPath, 'common'),
domain: path.join(srcPath, 'domain'),
ui: path.join(srcPath, 'ui')
},
},
output: {
Expand Down
Loading

0 comments on commit ca7c1c7

Please sign in to comment.