Skip to content

Commit 39c3e32

Browse files
authored
feat: document releasing and cleanup (#134)
1 parent 33f1c38 commit 39c3e32

File tree

28 files changed

+4756
-2455
lines changed

28 files changed

+4756
-2455
lines changed

.prettierrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ tabWidth: 2
33
semi: false
44
singleQuote: true
55
proseWrap: always
6-
printWidth: 100
6+
printWidth: 90

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# Changelog
22

3+
## v2.0.0
4+
5+
Updated to OpenTelemetry v2.0.0.
6+
7+
**Breaking** changes:
8+
9+
- `configurureOpentelemetry` now returns a configured SDK instance (either `NodeSDK` or `WebSDK`)
10+
which you must start to actually setup OpenTelemetry:
11+
12+
```js
13+
const uptrace = require('@uptrace/node')
14+
const sdk = uptrace.configureOpentelemetry({})
15+
sdk.start()
16+
```
17+
18+
- `uptrace.shutdown` is replaced with `sdk.shutdown`.
19+
- `uptrace.traceUrl` is replaced with `sdk.traceUrl`.
20+
- `uptrace.reportException` is replaced with `sdk.reportException`.
21+
322
## v1.12.0
423

524
- Updated OpenTelemetry to

RELEASING.md

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# Releasing Uptrace JS Packages
2+
3+
This guide explains how to build, test, and release the Uptrace JavaScript packages managed with
4+
**pnpm** in a monorepo.
5+
6+
---
7+
8+
## Quick Reference
9+
10+
For experienced developers, here’s the release flow in short:
11+
12+
```sh
13+
pnpm -r exec ncu -u # Update dependencies
14+
pnpm install # Install and build
15+
pnpm -r run build # Build all packages
16+
17+
pnpm changeset # Create changesets
18+
git commit -am "chore: changesets"
19+
20+
pnpm changeset version # Bump versions
21+
pnpm install
22+
git commit -am "chore: version bump"
23+
24+
pnpm publish -r --no-git-checks
25+
```
26+
27+
---
28+
29+
## 1. Updating Dependencies
30+
31+
To update all dependencies across every package:
32+
33+
```sh
34+
pnpm -r exec ncu -u
35+
```
36+
37+
- `-r` runs the command recursively for each workspace package.
38+
- `ncu` (npm-check-updates) bumps versions in `package.json`.
39+
- After updating, reinstall and test:
40+
41+
```sh
42+
pnpm install
43+
pnpm -r run build
44+
```
45+
46+
---
47+
48+
## 2. Building Packages
49+
50+
To install dependencies and build every package:
51+
52+
```sh
53+
pnpm install
54+
```
55+
56+
To rebuild only (without reinstalling):
57+
58+
```sh
59+
pnpm -r run build
60+
```
61+
62+
> The `-r` flag runs the `build` script in all workspace packages.
63+
64+
---
65+
66+
## 3. Running Examples Locally (Without Publishing)
67+
68+
You can run examples using the **local packages** before publishing to npm.
69+
70+
1. Navigate to an example directory:
71+
72+
```sh
73+
cd example/basic-node
74+
```
75+
76+
2. Link the local Uptrace package in `package.json`:
77+
78+
```json
79+
"dependencies": {
80+
"@uptrace/node": "link:../../packages/uptrace-node"
81+
}
82+
```
83+
84+
3. Install dependencies without affecting the workspace:
85+
86+
```sh
87+
pnpm install --ignore-workspace
88+
```
89+
90+
4. Run the example:
91+
92+
```sh
93+
UPTRACE_DSN="" make
94+
```
95+
96+
---
97+
98+
## 4. Releasing a New Version
99+
100+
Releases use [Changesets](https://github.com/changesets/changesets) for versioning and changelogs.
101+
102+
### Step 1 – Create Changesets
103+
104+
Document your changes and choose version bumps:
105+
106+
```sh
107+
pnpm changeset
108+
# Commit the generated changeset files
109+
git add .
110+
git commit -m "chore: add changesets"
111+
```
112+
113+
### Step 2 – Bump Versions
114+
115+
Apply version changes and update lockfiles:
116+
117+
```sh
118+
pnpm changeset version
119+
pnpm install
120+
git add .
121+
git commit -m "chore: version bump"
122+
```
123+
124+
### Step 3 – Publish to npm
125+
126+
Publish all updated packages:
127+
128+
```sh
129+
pnpm publish -r --no-git-checks
130+
```
131+
132+
**Notes:**
133+
134+
- Ensure you’re logged into npm: `npm whoami`.
135+
- Run a final build check before publishing:
136+
137+
```sh
138+
pnpm -r run build
139+
```
140+
141+
---
142+
143+
## Troubleshooting
144+
145+
- **Workspace packages not linking?** Run `pnpm install` again at the root to refresh symlinks.
146+
147+
- **Changeset not creating versions?** Ensure you’ve committed all changes before
148+
`pnpm changeset version`.
149+
150+
- **Authentication issues on publish?** Log in with `npm login` and ensure you have publish rights.

example/basic-node/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
all:
2-
node main.js
2+
node --trace-deprecation main.js

example/basic-node/main.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ const otel = require('@opentelemetry/api')
55
const uptrace = require('@uptrace/node')
66

77
// Start OpenTelemetry SDK and invoke instrumentations to patch the code.
8-
uptrace.configureOpentelemetry({
8+
const sdk = uptrace.configureOpentelemetry({
99
// Set dsn or UPTRACE_DSN env var.
1010
//dsn: '',
1111
serviceName: 'myservice',
1212
serviceVersion: '1.0.0',
1313
})
14+
sdk.start()
1415

1516
// Create a tracer. Usually, tracer is a global variable.
1617
const tracer = otel.trace.getTracer('app_or_package_name', '1.0.0')
@@ -35,10 +36,10 @@ tracer.startActiveSpan('main-operation', (main) => {
3536
// End the span when the operation we are measuring is done.
3637
main.end()
3738

38-
console.log(uptrace.traceUrl(main))
39+
console.log(sdk.traceUrl(main))
3940
})
4041

4142
setTimeout(async () => {
4243
// Send buffered spans and free resources.
43-
await uptrace.shutdown()
44+
await sdk.shutdown()
4445
})

0 commit comments

Comments
 (0)