Skip to content

Commit 6e1283f

Browse files
committed
convert server and tic-tac-toe to use state
1 parent d24d57c commit 6e1283f

97 files changed

Lines changed: 1822 additions & 2007 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscode/launch.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,23 @@
55
"version": "0.2.0",
66
"configurations": [
77
{
8-
"type": "node",
8+
"name": "tic-tac-toe",
9+
"request": "launch",
10+
"runtimeArgs": ["run-script", "start:tic-tac-toe-server"],
11+
"runtimeExecutable": "npm",
12+
"skipFiles": ["<node_internals>/**"],
13+
"type": "pwa-node"
14+
},
15+
{
16+
"type": "pwa-node",
917
"request": "launch",
1018
"name": "Jest Current File",
11-
"program": "${workspaceFolder}/node_modules/.bin/jest",
12-
"args": ["${relativeFile}"],
19+
"runtimeArgs": ["jest", "${fileBasename}"],
20+
"runtimeExecutable": "npx",
21+
"skipFiles": ["<node_internals>/**"],
1322
"console": "integratedTerminal",
1423
"internalConsoleOptions": "neverOpen",
15-
"windows": {
16-
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
17-
}
24+
"cwd": "${fileDirname}"
1825
}
1926
]
2027
}

common/config/rush/browser-approved-packages.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
},
3737
{
3838
"name": "@prisel/state",
39-
"allowedCategories": [ "prototype" ]
39+
"allowedCategories": [ "production", "prototype" ]
4040
},
4141
{
4242
"name": "@protobuf-ts/plugin",
@@ -96,7 +96,7 @@
9696
},
9797
{
9898
"name": "@types/lodash",
99-
"allowedCategories": [ "production", "tools" ]
99+
"allowedCategories": [ "production", "prototype", "tools" ]
100100
},
101101
{
102102
"name": "@types/long",
@@ -112,15 +112,15 @@
112112
},
113113
{
114114
"name": "@types/prismjs",
115-
"allowedCategories": [ "tools" ]
115+
"allowedCategories": [ "prototype", "tools" ]
116116
},
117117
{
118118
"name": "@types/react",
119-
"allowedCategories": [ "tools" ]
119+
"allowedCategories": [ "prototype", "tools" ]
120120
},
121121
{
122122
"name": "@types/react-dom",
123-
"allowedCategories": [ "tools" ]
123+
"allowedCategories": [ "prototype", "tools" ]
124124
},
125125
{
126126
"name": "@types/shortid",

common/config/rush/pnpm-lock.yaml

Lines changed: 20 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
scripts:
22
clean: rm -rf ./lib ./dist
33
ts-check: tsc --project tsconfig-build.json
4-
build: rollup --config --silent
4+
build-umd: rollup --config --silent
5+
build-cjs: tsc --project tsconfig.buildcjs.json
6+
build-esm: tsc --project tsconfig.buildesm.json
7+
build-types: tsc --project tsconfig.buildtypes.json

packages/client/package.json

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,23 @@
1212
},
1313
"license": "MIT",
1414
"author": "Yiou Chen <chen.yiou1992@gmail.com>",
15-
"main": "./lib/index.cjs.js",
16-
"module": "./lib/index.esm.js",
17-
"browser": "./lib/index.umd.js",
18-
"types": "./dist/index.d.ts",
15+
"main": "./dist/cjs/index.js",
16+
"module": "./dist/esm/index.js",
17+
"browser": "./dist/umd/index.umd.js",
1918
"directories": {
20-
"lib": "./",
21-
"test": "__test__"
19+
"lib": "src",
20+
"test": "src/__test__"
2221
},
2322
"files": [
24-
"lib"
23+
"dist"
2524
],
25+
"types": "./dist/types/index.d.ts",
26+
"exports": {
27+
"import": "./dist/esm/index.js",
28+
"require": "./dist/cjs/index.js"
29+
},
2630
"scripts": {
27-
"build": "nps clean ts-check build",
31+
"build": "nps clean build-types build-cjs build-esm build-umd",
2832
"fix": "tslint --project tsconfig.json --fix",
2933
"lint": "tslint --project tsconfig.json",
3034
"test": "jest --runInBand --detectOpenHandles"

packages/client/rollup.config.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
import { browserBuild, cjsAndEsBuild } from '@prisel/configs/rollupHelper';
22
import pkg from './package.json';
33

4-
export default [
5-
browserBuild(/* entry= */ 'dist/index.js', /* pkgJson= */ pkg),
6-
cjsAndEsBuild(/* entry= */ 'dist/index.js', /* pkgJson= */ pkg),
7-
];
4+
export default [browserBuild(/* entry= */ 'dist/cjs/index.js', /* pkgJson= */ pkg)];
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
assert,
33
assertExist,
4+
newRequestId,
45
newRequestManager,
56
Packet,
67
Request,
@@ -178,7 +179,7 @@ export class Client<T = State> {
178179
}
179180

180181
public newId() {
181-
return this.requestManager.newId();
182+
return newRequestId();
182183
}
183184

184185
protected processPacket(packet: Packet) {

0 commit comments

Comments
 (0)