Skip to content

Commit

Permalink
feat: scripts to bump otel-web + session-recorder versions; add `vers…
Browse files Browse the repository at this point in the history
…ion` script command (#155)

* feat: script to update version (otel-web)

* feat: script to update version (session-recorder)

* feat: add version script

* docs: add changeset
  • Loading branch information
wrn14897 authored Jun 20, 2024
1 parent 7ec128c commit 398e858
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 34 deletions.
7 changes: 7 additions & 0 deletions .changeset/six-bees-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@hyperdx/otel-web-session-recorder': patch
'@hyperdx/otel-web': patch
'@hyperdx/browser': patch
---

feat: scripts to bump otel-web + session-recorder versions
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"ci:build": "npx nx run-many --target=build",
"ci:unit": "npx nx run-many --target=ci:unit",
"ci:lint": "npx nx run-many --target=ci:lint",
"version": "changeset version && npx nx run-many --target=postversion",
"release": "npx nx run-many --target=build && yarn changeset publish && git push --follow-tags",
"prepare": "husky install"
},
Expand Down
2 changes: 2 additions & 0 deletions packages/otel-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
"scripts": {
"start": "npm-run-all -s compile start:_execute",
"start:_execute": "node utils/devServer/runDevServer.js",
"prebuild": "npm run postversion",
"build": "npm-run-all -s compile:*",
"compile": "npm-run-all -s compile:*",
"compile:browser": "rollup -c",
"compile:tsc": "tsc --build tsconfig.cjs.json tsconfig.esm.json",
"postversion": "node ./scripts/version-update.mjs",
"test:unit:watch": "karma start",
"test:unit:ci": "nyc karma start --single-run --no-auto-watch --browsers ChromeHeadless",
"test:unit:ci-node": "env TS_NODE_TRANSPILE_ONLY=true nyc mocha",
Expand Down
14 changes: 14 additions & 0 deletions packages/otel-web/scripts/version-update.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { readFileSync, writeFileSync } from 'fs';
import { resolve } from 'path';

// This script is ran when the root package is updated (which happens before child packages)
const packageJsonUrl = resolve(process.cwd(), 'package.json');
const packageJson = JSON.parse(readFileSync(packageJsonUrl));

const content = `
// this is an autogenerated file, see scripts/version-update.js
export const VERSION = '${packageJson.version}';
`;

const fileUrl = resolve(process.cwd(), 'src', 'version.ts');
writeFileSync(fileUrl, content);
18 changes: 1 addition & 17 deletions packages/otel-web/src/version.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,2 @@
/*
Copyright 2023 Splunk Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// this is an autogenerated file, see scripts/version-update.js
export const VERSION = '0.16.2-20';
export const VERSION = '0.16.2-next.1';
2 changes: 2 additions & 0 deletions packages/session-recorder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
"version": "0.16.2-next.0",
"description": "HyperDX distribution OpenTelemetry-based session recording",
"scripts": {
"prebuild": "npm run postversion",
"build": "npm-run-all -s compile:*",
"compile": "npm-run-all -s compile:*",
"compile:browser": "rollup -c",
"compile:tsc": "tsc --build tsconfig.cjs.json tsconfig.esm.json",
"otlp:compile": "npm-run-all otlp:compile:pbjs otlp:compile:pbts",
"otlp:compile:pbjs": "pbjs -t static-module -w es6 --no-comments -o src/LogsProto.js --force-number opentelemetry-proto/opentelemetry/proto/common/v1/common.proto opentelemetry-proto/opentelemetry/proto/resource/v1/resource.proto opentelemetry-proto/opentelemetry/proto/logs/v1/logs.proto",
"otlp:compile:pbts": "pbjs -t static-module --force-number opentelemetry-proto/opentelemetry/proto/common/v1/common.proto opentelemetry-proto/opentelemetry/proto/resource/v1/resource.proto opentelemetry-proto/opentelemetry/proto/logs/v1/logs.proto | pbts -o src/LogsProto.d.ts -",
"postversion": "node ./scripts/version-update.mjs",
"protoc": "protoc --plugin=../../node_modules/.bin/protoc-gen-ts_proto --ts_proto_opt=useOptionals=all --ts_proto_opt= --ts_proto_out=./src opentelemetry-proto/opentelemetry/proto/logs/v1/logs.proto --proto_path=./opentelemetry-proto --ts_proto_opt=forceLong=number --ts_proto_opt=esModuleInterop=true",
"test": "jest"
},
Expand Down
14 changes: 14 additions & 0 deletions packages/session-recorder/scripts/version-update.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { readFileSync, writeFileSync } from 'fs';
import { resolve } from 'path';

// This script is ran when the root package is updated (which happens before child packages)
const packageJsonUrl = resolve(process.cwd(), 'package.json');
const packageJson = JSON.parse(readFileSync(packageJsonUrl));

const content = `
// this is an autogenerated file, see scripts/version-update.js
export const VERSION = '${packageJson.version}';
`;

const fileUrl = resolve(process.cwd(), 'src', 'version.ts');
writeFileSync(fileUrl, content);
18 changes: 1 addition & 17 deletions packages/session-recorder/src/version.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,2 @@
/*
Copyright 2023 Splunk Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// this is an autogenerated file, see scripts/version-update.js
export const VERSION = '0.16.2-20';
export const VERSION = '0.16.2-next.0';

0 comments on commit 398e858

Please sign in to comment.