Skip to content

Commit 8a71aab

Browse files
Florian-SchoppFlorian Schopp
andauthored
Schopp/fix async (#378)
* Fixed async handling * fixed tests * Fixed version * Fixing ci * Fixed eslint * Testing new ci * Trying with old version * Fixing * Added release * Fixed example * Testing ci stuff * Fixed version * Finalized tests * Deleted dry-run * Deleted comment --------- Co-authored-by: Florian Schopp <schopp@hbkworld.com>
1 parent 4be6d3f commit 8a71aab

15 files changed

Lines changed: 74 additions & 99 deletions

File tree

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ env:
44
on:
55
release:
66
types: [created]
7+
pull_request:
8+
branches:
9+
- master
710

811
jobs:
912
build:
@@ -20,6 +23,7 @@ jobs:
2023
- run: npm test
2124

2225
publish-npm:
26+
if: startsWith(github.ref, 'refs/tags/v')
2327
needs: build
2428
runs-on: ubuntu-latest
2529
steps:
@@ -29,6 +33,9 @@ jobs:
2933
node-version: ${{ env.NODE_VERSION }}
3034
registry-url: https://registry.npmjs.org/
3135
- run: npm ci
36+
- run: git config --global user.email "schopp@hbkworld.com"
37+
- run: git config --global user.name "Florian Schopp"
38+
- run: npm version ${{ env.RELEASE_VERSION }}
3239
- run: npm run build
3340
- run: npm publish
3441
env:

examples/balls/client/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Jet client-server communications:
33
*/
44
import { select, selectAll, pointer } from 'd3-selection'
5-
import { Fetcher, Peer } from '../../../src'
5+
import { Fetcher, Peer } from '../../../lib'
66
import { canvasSize } from '../defs'
77
import { ballType } from '../server'
88

examples/balls/server/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
22

3-
import { Daemon, Method, Peer, State } from '../../../src'
3+
import { Daemon, Method, Peer, State } from '../../../lib'
44
import { canvasSize } from '../defs'
55

66
var port = parseInt(process.argv[2]) || 8081

examples/chat/client/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
/*
22
* Jet client-server communications:
33
*/
4-
import { Fetcher, Peer } from '../../../src'
4+
import { Peer } from '../../../lib/3_jet/peer/index.js'
5+
import { Fetcher } from '../../../lib/3_jet/peer/fetcher.js'
56
import './base.css'
7+
import { LogLevel } from '../../../lib/jet.js'
68

7-
const peer = new Peer({ url: 'ws://localhost:8081/' })
9+
const peer = new Peer({
10+
url: 'ws://localhost:8081/',
11+
log: { logName: '', logCallbacks: [console.log], logLevel: LogLevel.socket }
12+
})
813

914
const renderMessages = (messages: { value: string[] }) => {
1015
const messageContainer = document.getElementById('messages')!

examples/chat/server/index.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
22

3-
import { Daemon, Method, Peer, State } from '../../../src'
3+
import { Daemon, LogLevel, Method, Peer, State } from '../../../lib/jet.js'
44

55
const wsPort = parseInt(process.argv[2]) || 8081
66
const internalPort = 10222
@@ -21,7 +21,8 @@ console.log('listening on port', wsPort)
2121

2222
// Create Jet Peer
2323
const peer = new Peer({
24-
port: internalPort
24+
port: internalPort,
25+
log: { logName: '', logCallbacks: [console.log], logLevel: LogLevel.socket }
2526
})
2627

2728
// the messages state is simply an array
@@ -44,10 +45,13 @@ const clear = new Method('chat/clear')
4445
clear.on('call', () => {
4546
messages.value([])
4647
})
47-
4848
peer
4949
.connect()
50-
.then(() =>
51-
Promise.all([peer.add(messages), peer.add(append), peer.add(clear)])
52-
)
50+
.then(() => {
51+
peer.batch(() => {
52+
peer.add(messages)
53+
peer.add(append)
54+
peer.add(clear)
55+
})
56+
})
5357
.then(() => {})

examples/chat/webpack.config.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@ const clientConfig = {
7373
]
7474
}
7575

76-
module.exports = [clientConfig, serverConfig]
76+
module.exports = [serverConfig,clientConfig]

examples/todo/client/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Jet client-server communications:
33
*/
4-
import { Fetcher, Peer, PublishMessage, ValueType } from '../../../src'
4+
import { Fetcher, Peer, PublishMessage, ValueType } from '../../../lib'
55
import { Todo } from '../server/Todo'
66
import './base.css'
77

examples/todo/server/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Daemon, Method, Peer, State, ValueType } from '../../../src'
1+
import { Daemon, Method, Peer, State, ValueType } from '../../../lib'
22
import { Todo } from './Todo'
33

44
var port = parseInt(process.argv[2]) || 8081

examples/todo/webpack.config.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ const clientConfig = {
7474
]
7575
}
7676

77-
module.exports = [clientConfig, serverConfig]
77+
module.exports = [serverConfig,clientConfig]

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)