Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating from TSDX to microbundle #49

Merged
merged 18 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript',
],
}
3 changes: 2 additions & 1 deletion examples/with-next.js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"dev": "next",
"build": "next build",
"start": "next start",
"type-check": "tsc"
"type-check": "tsc",
"test": ""
},
"dependencies": {
"@signalwire/web": "0.0.0",
Expand Down
33,347 changes: 17,613 additions & 15,734 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,23 @@
"postinstall": "manypkg check",
"changeset": "changeset",
"clean": "manypkg exec rm -rf node_modules && manypkg exec rm -rf dist && rm -rf node_modules",
"build": "manypkg run @signalwire/core build && manypkg run @signalwire/webrtc build && manypkg run @signalwire/web build && manypkg run @signalwire/node build",
"test": "manypkg exec npm run test",
"build": "manypkg exec rm -rf dist && manypkg run @signalwire/core build && manypkg run @signalwire/webrtc build && manypkg run @signalwire/web build && manypkg run @signalwire/node build",
edolix marked this conversation as resolved.
Show resolved Hide resolved
"prettier": "prettier --write .",
"start:web": "concurrently \"manypkg run @signalwire/core start\" \"manypkg run @signalwire/web start\" \"manypkg run @signalwire/webrtc start\" \"manypkg run @signalwire/web example\"",
"start:next": "concurrently \"manypkg run @signalwire/web start\" \"manypkg run with-next.js dev\""
},
"dependencies": {
"@babel/core": "^7.13.16",
"@babel/preset-env": "^7.13.15",
"@babel/preset-typescript": "^7.13.0",
"@changesets/cli": "^2.14.1",
"@manypkg/cli": "^0.17.0",
"babel-jest": "^25.5.1",
"concurrently": "^6.0.0",
"jest": "^25.5.4",
"microbundle": "^0.13.0",
"prettier": "^2.2.1",
"tsdx": "^0.14.1",
"tslib": "^2.1.0",
"typescript": "^4.2.3"
}
}
5 changes: 5 additions & 0 deletions packages/core/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
transform: {
'\\.[jt]sx?$': ['babel-jest', { configFile: './../../babel.config.js' }],
},
}
16 changes: 9 additions & 7 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"name": "@signalwire/core",
"private": true,
"version": "0.0.0",
"source": "src/index.ts",
"main": "dist/index.js",
"module": "dist/core.esm.js",
"typings": "dist/core/src/index.d.ts",
"exports": "./dist/index.modern.js",
"module": "dist/index.esm.js",
"types": "dist/core/src/index.d.ts",
"files": [
"dist",
"src"
Expand All @@ -12,11 +15,10 @@
"node": ">=10"
},
"scripts": {
"start": "tsdx watch --tsconfig tsconfig.build.json --verbose --noClean",
"build": "tsdx build --tsconfig tsconfig.build.json",
"test": "tsdx test",
"lint": "tsdx lint",
"prepare": "tsdx build"
"start": "microbundle watch -f modern --tsconfig tsconfig.build.json",
"build": "microbundle --external none -f modern,es,cjs --define process.env.NODE_ENV=production --tsconfig ./tsconfig.build.json --target node",
"test": "NODE_ENV=test jest",
"prepare": "npm run build"
},
"dependencies": {
"@reduxjs/toolkit": "^1.5.1",
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/BaseComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class BaseComponent implements Emitter {

destroy() {
this._destroyer?.()
this.removeAllListeners()
}

execute({ method, params }: { method: string; params: Record<string, any> }) {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/Session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export class Session {
}

this._socket.close()
// @ts-ignore
delete this._socket
// clearTimeout(this._reconnectTimeout)
// this.subscriptions.clear()
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/redux/features/session/sessionSaga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export function* sessionChannelWatcher({
method: 'video.message',
params: {
message: VertoResult(id, method),
node_id: null,
node_id: nodeId,
},
})
)
Expand All @@ -115,7 +115,7 @@ export function* sessionChannelWatcher({
method: 'video.message',
params: {
message: VertoResult(id, method),
node_id: null,
node_id: nodeId,
},
})
)
Expand Down
5 changes: 5 additions & 0 deletions packages/node/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
transform: {
'\\.[jt]sx?$': ['babel-jest', { configFile: './../../babel.config.js' }],
},
}
15 changes: 8 additions & 7 deletions packages/node/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"name": "@signalwire/node",
"version": "0.0.0",
"source": "src/index.ts",
"main": "dist/index.js",
"module": "dist/node.esm.js",
"typings": "dist/node/src/index.d.ts",
"exports": "./dist/index.modern.js",
"module": "dist/index.esm.js",
"types": "dist/node/src/index.d.ts",
"files": [
"dist",
"src"
Expand All @@ -12,11 +14,10 @@
"node": ">=10"
},
"scripts": {
"start": "tsdx watch --tsconfig tsconfig.build.json --verbose --noClean",
"build": "tsdx build --tsconfig tsconfig.build.json",
"test": "tsdx test",
"lint": "tsdx lint",
"prepare": "tsdx build"
"start": "microbundle watch -f modern --tsconfig tsconfig.build.json",
"build": "microbundle --external none -f modern,es,cjs --define process.env.NODE_ENV=production --tsconfig ./tsconfig.build.json --target node",
"test": "NODE_ENV=test jest",
"prepare": "npm run build"
},
"dependencies": {
"@signalwire/core": "0.0.0"
Expand Down
7 changes: 0 additions & 7 deletions packages/node/tsdx.config.js

This file was deleted.

5 changes: 5 additions & 0 deletions packages/react-native/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
transform: {
'\\.[jt]sx?$': ['babel-jest', { configFile: './../../babel.config.js' }],
},
}
15 changes: 8 additions & 7 deletions packages/react-native/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"name": "@signalwire/react-native",
"version": "0.0.0",
"source": "src/index.ts",
"main": "dist/index.js",
"module": "dist/react-native.esm.js",
"typings": "dist/react-native/src/index.d.ts",
"exports": "./dist/index.modern.js",
"module": "dist/index.esm.js",
"types": "dist/react-native/src/index.d.ts",
"files": [
"dist",
"src"
Expand All @@ -12,11 +14,10 @@
"node": ">=10"
},
"scripts": {
"start": "tsdx watch --tsconfig tsconfig.build.json --verbose --noClean",
"build": "tsdx build --tsconfig tsconfig.build.json",
"test": "tsdx test",
"lint": "tsdx lint",
"prepare": "tsdx build"
"start": "microbundle watch -f modern --tsconfig tsconfig.build.json",
"build": "microbundle --external none -f modern,es,cjs --define process.env.NODE_ENV=production --tsconfig ./tsconfig.build.json --target node",
"test": "NODE_ENV=test jest",
"prepare": "npm run build"
},
"dependencies": {
"@signalwire/core": "0.0.0",
Expand Down
7 changes: 0 additions & 7 deletions packages/react-native/tsdx.config.js

This file was deleted.

Loading