Skip to content

Commit 33021ec

Browse files
committed
Some build and watch changes
1 parent 32deb33 commit 33021ec

File tree

9 files changed

+54
-22
lines changed

9 files changed

+54
-22
lines changed

.vscode/tasks.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,41 @@
3333
"script": "lint",
3434
"problemMatcher": "$eslint-stylish",
3535
"label": "npm: lint"
36+
},
37+
{
38+
"type": "npm",
39+
"script": "watch --workspace=packages/browser",
40+
"isBackground": true,
41+
"problemMatcher": "$tsc",
42+
"label": "npm: watch browser"
43+
},
44+
{
45+
"type": "npm",
46+
"script": "watch --workspace=packages/core",
47+
"isBackground": true,
48+
"problemMatcher": "$tsc",
49+
"label": "npm: watch core"
50+
},
51+
{
52+
"type": "npm",
53+
"script": "watch --workspace=packages/react",
54+
"isBackground": true,
55+
"problemMatcher": "$tsc",
56+
"label": "npm: watch react"
57+
},
58+
{
59+
"type": "npm",
60+
"script": "watch --workspace=packages/vue",
61+
"isBackground": true,
62+
"problemMatcher": "$tsc",
63+
"label": "npm: watch vue"
64+
},
65+
{
66+
"type": "npm",
67+
"script": "watch --workspace=packages/node",
68+
"isBackground": true,
69+
"problemMatcher": "$tsc",
70+
"label": "npm: watch node"
3671
}
3772
]
3873
}

example/browser/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Exceptionless } from "../../node_modules/@exceptionless/browser/dist/index.min.js";
1+
import { Exceptionless } from "../../node_modules/@exceptionless/browser/dist/index.bundle.js";
22
import { divide } from "./math.js";
33
import { TextAreaLogger } from "./text-area-logger.js";
44

packages/angularjs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
"./package.json": "./package.json"
3232
},
3333
"scripts": {
34-
"build": "tsc -p tsconfig.json",
35-
"watch": "tsc -p tsconfig.json -w --preserveWatchOutput",
34+
"build": "tsc -p tsconfig.json && esbuild src/index.ts --bundle --sourcemap --target=es2017 --format=esm --outfile=dist/index.bundle.js && esbuild src/index.ts --bundle --minify --sourcemap --target=es2019 --format=esm --outfile=dist/index.bundle.min.js",
35+
"watch": "tsc -p ../core/tsconfig.json -w --preserveWatchOutput & tsc -p tsconfig.json -w --preserveWatchOutput & esbuild src/index.ts --bundle --sourcemap --target=es2017 --format=esm --watch --outfile=dist/index.bundle.js",
3636
"test": ""
3737
},
3838
"sideEffects": false,

packages/browser/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
"testEnvironment": "jsdom"
4646
},
4747
"scripts": {
48-
"build": "tsc -p tsconfig.json && esbuild src/index.ts --bundle --minify --sourcemap --target=es2019 --format=esm --outfile=dist/index.min.js",
49-
"watch": "tsc -p tsconfig.json -w --preserveWatchOutput",
48+
"build": "tsc -p tsconfig.json && esbuild src/index.ts --bundle --sourcemap --target=es2017 --format=esm --outfile=dist/index.bundle.js && esbuild src/index.ts --bundle --minify --sourcemap --target=es2019 --format=esm --outfile=dist/index.bundle.min.js",
49+
"watch": "tsc -p ../core/tsconfig.json -w --preserveWatchOutput & tsc -p tsconfig.json -w --preserveWatchOutput & esbuild src/index.ts --bundle --sourcemap --target=es2017 --format=esm --watch --outfile=dist/index.bundle.js",
5050
"test": ""
5151
},
5252
"sideEffects": false,

packages/core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
"resolver": "jest-ts-webcompat-resolver"
4343
},
4444
"scripts": {
45-
"build": "tsc -p tsconfig.json",
46-
"watch": "tsc -p tsconfig.json -w --preserveWatchOutput",
45+
"build": "tsc -p tsconfig.json && esbuild src/index.ts --bundle --sourcemap --target=es2017 --format=esm --outfile=dist/index.bundle.js && esbuild src/index.ts --bundle --minify --sourcemap --target=es2019 --format=esm --outfile=dist/index.bundle.min.js",
46+
"watch": "tsc -p tsconfig.json -w --preserveWatchOutput & esbuild src/index.ts --bundle --sourcemap --target=es2017 --format=esm --watch --outfile=dist/index.bundle.js",
4747
"test": "jest"
4848
},
4949
"sideEffects": false,

packages/core/src/submission/DefaultSubmissionClient.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ export class DefaultSubmissionClient implements ISubmissionClient {
3333
return response;
3434
}
3535

36-
public async submitUserDescription(
37-
referenceId: string,
38-
description: UserDescription,
39-
): Promise<Response> {
36+
public async submitUserDescription(referenceId: string, description: UserDescription): Promise<Response> {
4037
const url = `${this.config.serverUrl}/api/v2/events/by-ref/${encodeURIComponent(referenceId)
4138
}/user-description`;
4239

@@ -50,10 +47,7 @@ export class DefaultSubmissionClient implements ISubmissionClient {
5047
return response;
5148
}
5249

53-
public async submitHeartbeat(
54-
sessionIdOrUserId: string,
55-
closeSession: boolean,
56-
): Promise<Response<void>> {
50+
public async submitHeartbeat(sessionIdOrUserId: string, closeSession: boolean): Promise<Response<void>> {
5751
const url =
5852
`${this.config.heartbeatServerUrl}/api/v2/events/session/heartbeat?id=${sessionIdOrUserId}&close=${closeSession}`;
5953
return await this.apiFetch<void>(url, {
@@ -90,12 +84,15 @@ export class DefaultSubmissionClient implements ISubmissionClient {
9084
const rateLimitRemaining: number = parseInt(response.headers.get(this.RateLimitRemainingHeader) || "", 10);
9185
const settingsVersion: number = parseInt(response.headers.get(this.ConfigurationVersionHeader) || "", 10);
9286

87+
const responseText = await response.text();
88+
const data = responseText && responseText.length > 0 ? JSON.parse(responseText) as T : null;
89+
9390
return new Response<T>(
9491
response.status,
9592
response.statusText,
9693
rateLimitRemaining,
9794
settingsVersion,
98-
await response.json() as T,
95+
data,
9996
);
10097
}
10198

packages/node/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
"testEnvironment": "node"
4444
},
4545
"scripts": {
46-
"build": "tsc -p tsconfig.json",
47-
"watch": "tsc -p tsconfig.json -w --preserveWatchOutput",
46+
"build": "tsc -p tsconfig.json && esbuild src/index.ts --bundle --sourcemap --platform=node --target=node12 --format=cjs --outfile=dist/index.bundle.js",
47+
"watch": "tsc -p ../core/tsconfig.json -w --preserveWatchOutput & tsc -p tsconfig.json -w --preserveWatchOutput & esbuild src/index.ts --bundle --platform=node --sourcemap --target=node12 --format=cjs --watch --outfile=dist/index.bundle.js",
4848
"test": "jest"
4949
},
5050
"sideEffects": false,

packages/react/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
"./package.json": "./package.json"
3232
},
3333
"scripts": {
34-
"build": "tsc -p tsconfig.json",
35-
"watch": "tsc -p tsconfig.json -w --preserveWatchOutput",
34+
"build": "tsc -p tsconfig.json && esbuild src/index.ts --bundle --sourcemap --target=es2017 --format=esm --outfile=dist/index.bundle.js && esbuild src/index.ts --bundle --minify --sourcemap --target=es2019 --format=esm --outfile=dist/index.bundle.min.js",
35+
"watch": "tsc -p ../core/tsconfig.json -w --preserveWatchOutput & tsc -p tsconfig.json -w --preserveWatchOutput & esbuild src/index.ts --bundle --sourcemap --target=es2017 --format=esm --watch --outfile=dist/index.bundle.js",
3636
"test": ""
3737
},
3838
"sideEffects": false,

packages/vue/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
"./package.json": "./package.json"
3131
},
3232
"scripts": {
33-
"build": "tsc -p tsconfig.json",
34-
"watch": "tsc -p tsconfig.json -w --preserveWatchOutput",
33+
"build": "tsc -p tsconfig.json && esbuild src/index.ts --bundle --sourcemap --target=es2017 --format=esm --outfile=dist/index.bundle.js && esbuild src/index.ts --bundle --minify --sourcemap --target=es2019 --format=esm --outfile=dist/index.bundle.min.js",
34+
"watch": "tsc -p tsconfig.json -w --preserveWatchOutput & && esbuild src/index.ts --bundle --sourcemap --target=es2017 --format=esm --watch --outfile=dist/index.bundle.js &",
3535
"test": ""
3636
},
3737
"sideEffects": false,

0 commit comments

Comments
 (0)