Skip to content

Commit 060ee6e

Browse files
committed
Keep dependency refresh surgical and verify sample logger
1 parent f02f109 commit 060ee6e

25 files changed

Lines changed: 1405 additions & 1077 deletions

‎.github/workflows/build.yml‎

Lines changed: 59 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
11
name: Build
22
on: [push, pull_request]
33

4-
concurrency:
5-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
6-
cancel-in-progress: true
7-
84
permissions:
95
contents: read
6+
id-token: write
7+
packages: write
108

119
jobs:
12-
version:
13-
name: Determine build version
14-
runs-on: ubuntu-latest
15-
outputs:
16-
version: ${{ steps.version.outputs.version }}
10+
build:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os:
15+
- ubuntu-latest
16+
- macos-latest
17+
- windows-latest
18+
node_version:
19+
- 24
20+
name: Node ${{ matrix.node_version }} on ${{ matrix.os }}
1721
steps:
1822
- name: Checkout
19-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
23+
uses: actions/checkout@v7
2024
with:
2125
fetch-depth: 0
22-
persist-credentials: false
23-
- name: Setup .NET SDK for MinVer
24-
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
25-
with:
26-
dotnet-version: "10.0.x"
27-
- name: Build Version
28-
id: version
26+
- name: Build Reason
2927
shell: bash
3028
run: |
3129
branch=${GITHUB_REF##*/}.
@@ -38,124 +36,68 @@ jobs:
3836
elif [[ "${GITHUB_REF}" = refs/pull* ]]; then
3937
branch=""
4038
fi
41-
39+
echo "GIT_BRANCH_SUFFIX=$branch" >> $GITHUB_ENV
40+
echo "ref: $GITHUB_REF event: $GITHUB_EVENT_NAME branch_suffix: $branch"
41+
- name: Setup Node.js environment
42+
uses: actions/setup-node@v7
43+
with:
44+
node-version: ${{ matrix.node_version }}
45+
registry-url: "https://registry.npmjs.org"
46+
- name: Cache node_modules
47+
uses: actions/cache@v6
48+
with:
49+
path: node_modules
50+
key: ${{ matrix.node_version }}-${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }}
51+
- name: Setup .NET SDK for MinVer
52+
uses: actions/setup-dotnet@v6
53+
with:
54+
dotnet-version: "10.0.x"
55+
- name: Build Version
56+
id: version
57+
shell: bash
58+
run: |
4259
dotnet tool install --global minver-cli --version 7.0.0
43-
version=$(minver --tag-prefix v --default-pre-release-identifiers "preview.${branch}0" --minimum-major-minor 3.0)
60+
version=$(minver --tag-prefix v --default-pre-release-identifiers "preview.${GIT_BRANCH_SUFFIX}0" --minimum-major-minor 3.0)
4461
45-
if [ -n "$branch" ]; then
46-
branch_name="${branch%.}"
62+
# If on a non-main branch, insert branch name before the height (last numeric segment)
63+
if [ -n "$GIT_BRANCH_SUFFIX" ]; then
64+
branch_name="${GIT_BRANCH_SUFFIX%.}"
4765
if [[ "$version" != *"$branch_name"* ]]; then
48-
version=$(echo "$version" | sed -E "s/\.([0-9]+)$/.${branch}\1/")
66+
version=$(echo "$version" | sed -E "s/\.([0-9]+)$/.${GIT_BRANCH_SUFFIX}\1/")
4967
fi
5068
fi
5169
52-
echo "version=$version" >> "$GITHUB_OUTPUT"
70+
echo "version=$version" >> $GITHUB_OUTPUT
5371
echo "Version: $version"
54-
echo "### Version: $version" >> "$GITHUB_STEP_SUMMARY"
72+
echo "### Version: $version" >> $GITHUB_STEP_SUMMARY
5573
56-
build:
57-
needs: version
58-
runs-on: ${{ matrix.os }}
59-
strategy:
60-
matrix:
61-
os:
62-
- ubuntu-latest
63-
- macos-latest
64-
- windows-latest
65-
node_version:
66-
- 24
67-
name: Node ${{ matrix.node_version }} on ${{ matrix.os }}
68-
steps:
69-
- name: Checkout
70-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
71-
with:
72-
persist-credentials: false
73-
- name: Setup Node.js environment
74-
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
75-
with:
76-
node-version: ${{ matrix.node_version }}
77-
registry-url: "https://registry.npmjs.org"
78-
cache: npm
79-
cache-dependency-path: package-lock.json
80-
- name: Apply Build Version
81-
env:
82-
BUILD_VERSION: ${{ needs.version.outputs.version }}
83-
run: node scripts/set-build-version.mjs
84-
- name: Install Dependencies
85-
run: npm ci
74+
npm install --global replace-in-files-cli
75+
replace-in-files --string="3.0.0-dev" --replacement=$version packages/core/src/configuration/Configuration.ts
76+
replace-in-files --string="3.0.0-dev" --replacement=$version **/package*.json
77+
npm ci
8678
- name: Build
8779
run: npm run build
8880
- name: Lint
8981
run: npm run lint
9082
- name: Run Tests
9183
run: npm test
92-
93-
publish-release:
94-
name: Publish npm release
95-
if: startsWith(github.ref, 'refs/tags/v')
96-
needs: [version, build]
97-
runs-on: ubuntu-latest
98-
permissions:
99-
contents: read
100-
id-token: write # Required for npm trusted publishing.
101-
steps:
102-
- name: Checkout
103-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
104-
with:
105-
persist-credentials: false
106-
- name: Setup Node.js environment
107-
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
108-
with:
109-
node-version: 24
110-
registry-url: "https://registry.npmjs.org"
111-
cache: npm
112-
cache-dependency-path: package-lock.json
113-
- name: Apply Build Version
114-
env:
115-
BUILD_VERSION: ${{ needs.version.outputs.version }}
116-
run: node scripts/set-build-version.mjs
117-
- name: Install Dependencies
118-
run: npm ci
119-
- name: Build
120-
run: npm run build
12184
- name: Publish Release Packages
85+
if: startsWith(github.ref, 'refs/tags/v') && matrix.os == 'ubuntu-latest'
12286
run: npm publish --workspaces --access public
123-
124-
publish-github:
125-
name: Publish GitHub CI packages
126-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/') && contains(needs.version.outputs.version, '-')
127-
needs: [version, build]
128-
runs-on: ubuntu-latest
129-
permissions:
130-
contents: read
131-
packages: write # Required to publish with GITHUB_TOKEN.
132-
steps:
133-
- name: Checkout
134-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
135-
with:
136-
persist-credentials: false
137-
- name: Setup Node.js environment
138-
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
87+
- name: Setup GitHub CI Node.js environment
88+
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/heads/') && matrix.os == 'ubuntu-latest' && contains(steps.version.outputs.version, '-')
89+
uses: actions/setup-node@v7
13990
with:
140-
node-version: 24
141-
registry-url: "https://registry.npmjs.org"
142-
cache: npm
143-
cache-dependency-path: package-lock.json
144-
- name: Apply Build Version
145-
env:
146-
BUILD_VERSION: ${{ needs.version.outputs.version }}
147-
run: node scripts/set-build-version.mjs
148-
- name: Install Dependencies
149-
run: npm ci
150-
- name: Build
151-
run: npm run build
152-
- name: Setup GitHub Packages registry
153-
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
154-
with:
155-
node-version: 24
91+
node-version: ${{ matrix.node_version }}
15692
registry-url: "https://npm.pkg.github.com"
15793
scope: "@exceptionless"
15894
- name: Push GitHub CI Packages
159-
run: node scripts/publish-ci-packages.mjs # zizmor: ignore[use-trusted-publishing] GitHub Packages uses GITHUB_TOKEN.
95+
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/heads/') && matrix.os == 'ubuntu-latest' && contains(steps.version.outputs.version, '-')
96+
shell: bash
97+
run: |
98+
TAG_BRANCH="${GIT_BRANCH_SUFFIX%.}"
99+
TAG_BRANCH="${TAG_BRANCH:-main}"
100+
TAG_BRANCH="${TAG_BRANCH//\//-}"
101+
npm publish --workspaces --access public --tag "ci-${TAG_BRANCH}" || true
160102
env:
161-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

‎.npmrc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
legacy-peer-deps=true
22
min-release-age=7
3+
min-release-age-exclude[]=source-map-js

‎eslint.config.mjs‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,6 @@ export default defineConfig(
4444
]
4545
}
4646
},
47-
{
48-
files: ["scripts/**/*.mjs"],
49-
...tseslint.configs.disableTypeChecked,
50-
languageOptions: {
51-
...tseslint.configs.disableTypeChecked.languageOptions,
52-
globals: {
53-
console: "readonly",
54-
process: "readonly"
55-
}
56-
}
57-
},
5847
eslintConfigPrettier,
5948
{
6049
plugins: {

‎example/browser/index.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ <h1>Error Submission</h1>
1515
<button onclick="throwReferenceError('function-does-exist')">Throw uncaught reference error</button>
1616
<button id="throw-jquery-ajax-error">Throw jQuery ajax error</button>
1717
<button id="throw-promise-unhandled-rejection">Throw promise unhandled rejection</button>
18-
<button id="throw-browser-extension-error">Throw browser extension error</button>
18+
<button id="throw-browser-extension-error">Throw brower extension error</button>
1919

2020
<h1>Log Submission</h1>
2121
<button class="submit-log">Submit log event</button>

‎example/browser/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"access": "restricted"
1818
},
1919
"devDependencies": {
20-
"vite": "^8.2.2"
20+
"vite": "^8.3.1"
2121
},
2222
"dependencies": {
2323
"@exceptionless/browser": "3.0.0-dev",
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import assert from "node:assert/strict";
2+
import { afterEach, test } from "vitest";
3+
import { JSDOM } from "jsdom";
4+
5+
import { TextAreaLogger } from "../text-area-logger.js";
6+
7+
let dom;
8+
afterEach(() => {
9+
dom?.window.close();
10+
delete globalThis.document;
11+
});
12+
13+
function createDocument(readyState) {
14+
dom = new JSDOM('<textarea id="log"></textarea>');
15+
globalThis.document = dom.window.document;
16+
Object.defineProperty(document, "readyState", { value: readyState });
17+
return document.getElementById("log");
18+
}
19+
20+
test("logs literal text and preserves the textarea's edited value", () => {
21+
const element = createDocument("complete");
22+
element.value = "edited text";
23+
const logger = new TextAreaLogger("log");
24+
logger.info("<b>literal</b> & text");
25+
assert.match(element.value, /^edited text\n.* \[info\] <b>literal<\/b> & text$/);
26+
assert.equal(element.innerHTML, "");
27+
});
28+
29+
test("flushes buffered messages when the document becomes ready", () => {
30+
const element = createDocument("loading");
31+
const logger = new TextAreaLogger("log");
32+
logger.info("<script>literal</script>");
33+
logger.warn("second message");
34+
assert.equal(element.value, "");
35+
document.dispatchEvent(new dom.window.Event("DOMContentLoaded"));
36+
assert.match(element.value, /\[info\] <script>literal<\/script>\n.* \[warn\] second message$/);
37+
assert.deepEqual(logger.messageBuffer, []);
38+
logger.error("third message");
39+
assert.match(element.value, /second message\n.* \[error\] third message$/);
40+
});
41+
42+
test("logs immediately when DOMContentLoaded has already fired", () => {
43+
const element = createDocument("interactive");
44+
new TextAreaLogger("log").info("ready");
45+
assert.match(element.value, /\[info\] ready$/);
46+
});
47+
48+
test("forwards every level to the supplied logger", () => {
49+
createDocument("complete");
50+
const calls = [];
51+
const target = Object.fromEntries(["trace", "info", "warn", "error"].map((level) => [level, (message) => calls.push([level, message])]));
52+
const logger = new TextAreaLogger("log", target);
53+
for (const level of ["trace", "info", "warn", "error"]) logger[level](level);
54+
assert.deepEqual(calls, [
55+
["trace", "trace"],
56+
["info", "info"],
57+
["warn", "warn"],
58+
["error", "error"]
59+
]);
60+
});
61+
62+
test("requires an element id", () => {
63+
assert.throws(() => new TextAreaLogger(""), /elementId is required/);
64+
});

‎example/browser/text-area-logger.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export class TextAreaLogger {
66

77
this.logger = logger;
88
this.messageBuffer = [];
9-
if (document.readyState === "complete") {
9+
if (document.readyState !== "loading") {
1010
this.element = document.getElementById(elementId);
1111
} else {
1212
document.addEventListener("DOMContentLoaded", () => {

‎example/expo/package.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
},
1515
"dependencies": {
1616
"@exceptionless/react-native": "3.0.0-dev",
17-
"@expo/metro-runtime": "~57.0.15",
17+
"@expo/metro-runtime": "~57.0.16",
1818
"@react-native-async-storage/async-storage": "2.2.0",
19-
"expo": "~57.0.22",
19+
"expo": "~57.0.25",
2020
"expo-application": "~57.0.3",
21-
"expo-constants": "~57.0.18",
21+
"expo-constants": "~57.0.19",
2222
"expo-dev-client": "~57.0.19",
2323
"expo-device": "~57.0.2",
2424
"expo-splash-screen": "~57.0.9",
@@ -28,7 +28,7 @@
2828
"react-native": "0.86.3",
2929
"react-native-safe-area-context": "~5.7.0",
3030
"react-native-screens": "~4.26.2",
31-
"react-native-web": "^0.21.2"
31+
"react-native-web": "^0.21.3"
3232
},
3333
"devDependencies": {
3434
"@react-native/js-polyfills": "^0.86.3",

‎example/nextjs/AGENTS.md‎

Lines changed: 0 additions & 9 deletions
This file was deleted.

‎example/nextjs/CLAUDE.md‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)