Skip to content
Open
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
63 changes: 0 additions & 63 deletions .build/build_and_prepare.ts

This file was deleted.

11 changes: 4 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,13 @@ jobs:
run: |
npm install -g typescript

- name: Build Common package
- name: Build packages
run: |
npx tsx .build/build_and_prepare.ts common && npm pack
npm --workspaces run build

- name: Build Node.js package
- name: Pack packages
run: |
npx tsx .build/build_and_prepare.ts node && npm pack
- name: Build Web package
run: |
npx tsx .build/build_and_prepare.ts web && npm pack
npm --workspaces pack

- name: Rename artifacts
run: |
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ out
coverage
coverage-web
.nyc_output
packages/*/README.md
packages/*/LICENSE
5 changes: 0 additions & 5 deletions .scripts/build.sh

This file was deleted.

21 changes: 21 additions & 0 deletions .scripts/update_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -euo pipefail

version=${1:-}
if [ -z "$version" ]; then
echo "Usage: $0 <version>"
exit 1
fi

echo "Setting the version to: $version"

for package in packages/client-node packages/client-web; do
if [ -f "$package/package.json" ]; then
echo "Updating client-common version in $package/package.json"
json=$(cat "$package/package.json")
echo "$json" | jq --arg version "$version" '.dependencies["@clickhouse/client-common"] = $version' > "$package/package.json"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not a js script to avoid jq requirement

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point. I'm surely ok with switching back to a JS script if there is a preference on your side.

My reason is that in automation scripts the unix-way (i.e. using existing CLI tools) is the way to go. Also, jq is sort of a living standard these days (together with yq). This holds true, of course, until the complexity overgrows bash as a language in general.

Let me know if you'd like to switch and keep the pure JS approach here, I'll then make a follow-up PR.

fi
done

npm --workspaces version "$version"
36 changes: 26 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,27 +214,43 @@ See [#177](https://github.com/ClickHouse/clickhouse-js/issues/177), as it should

## Release process

Don't forget to change the package version in `packages/**/src/version.ts` before the release.
Tools required:

- Node.js >= `20.x`
- NPM >= `11.x`
- jq (https://stedolan.github.io/jq/)

We prefer to keep versions the same across the packages, and release all at once, even if there were no changes in some.

Common package manual release:
Make sure that the working directory is clean:

```bash
npx tsx .build/build_and_prepare.ts common && npm pack && npm publish
git clean -dfX
npm i
```

Node.js client manual release:
```bash
.scripts/update_version.sh [new_version]
```

Then build the packages:

```bash
npx tsx .build/build_and_prepare.ts node && npm pack && npm publish
npm --workspaces run build
```

Web client manual release:
Now we're ready to publish.

```bash
npx tsx .build/build_and_prepare.ts web && npm pack && npm publish
npm --workspaces pack
npm --workspaces publish
```

For simplicity, `build_and_prepare.ts` just overrides the root `package.json`,
which allows to use `npm pack` and `npm publish` as usual despite having multiple workspaces.
Don't commit the generated `package.json` after the manual release.
After that you can commit the changes, create a new Git tag and push it to the repository:

```bash
git add .
git commit -m "chore: bump version to [new_version]"
git tag v[new_version]
git push origin v[new_version]
```
54 changes: 19 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "clickhouse-js",
"description": "Official JS client for ClickHouse DB",
"homepage": "https://clickhouse.com",
"version": "0.0.0",
"version": "1.15.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it need to be manually updated?

Copy link
Collaborator Author

@peter-leonov-ch peter-leonov-ch Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simply put, yes, which does not differ from the current approach.

The update is done by the script above (.scripts/update_version.sh). The current approach that is in main relies on changing 3 JS files and moving package.json around, while the new approach in this PR relies on updating two JSON files and leaving the rest to the npm CLI.

Potentially, with a more streamlined deploy pipeline we'd stick to only using npm without relying on jq and manually patching the dependency version. This IMO should come naturally when and if we're going with automating the deployment as @slvrtrn suggested as a north star here.

"license": "Apache-2.0",
"keywords": [
"clickhouse",
Expand All @@ -19,9 +19,6 @@
},
"scripts": {
"build:node:all": "rm -rf out; tsc --project tsconfig.all.json",
"build:common:package": ".scripts/build.sh client-common",
"build:node:package": ".scripts/build.sh client-node",
"build:web:package": ".scripts/build.sh client-web",
"build:web:minjs": "webpack --config webpack.release.js",
"typecheck": "tsc --project tsconfig.all.json --noEmit",
"lint": "eslint .",
Expand Down
6 changes: 5 additions & 1 deletion packages/client-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@clickhouse/client-common",
"description": "Official JS client for ClickHouse DB - common types",
"homepage": "https://clickhouse.com",
"version": "0.0.0",
"version": "1.15.0",
"license": "Apache-2.0",
"keywords": [
"clickhouse",
Expand All @@ -19,6 +19,10 @@
"files": [
"dist"
],
"scripts": {
"prepack": "cp ../../README.md ../../LICENSE .",
"build": "rm -rf dist; tsc"
},
"dependencies": {},
"devDependencies": {}
}
8 changes: 2 additions & 6 deletions packages/client-common/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@ import type {
MakeResultSet,
WithClickHouseSummary,
WithResponseHeaders,
} from '@clickhouse/client-common'
import {
type DataFormat,
defaultJSONHandling,
DefaultLogger,
} from '@clickhouse/client-common'
} from './index'
import { type DataFormat, defaultJSONHandling, DefaultLogger } from './index'
import type { InsertValues, NonEmptyArray } from './clickhouse_types'
import type { ImplementationDetails, ValuesEncoder } from './config'
import { getConnectionParams, prepareConfigWithURL } from './config'
Expand Down
7 changes: 7 additions & 0 deletions packages/client-common/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.json",
"include": ["./src/**/*.ts"],
"compilerOptions": {
"outDir": "./dist"
}
}
8 changes: 6 additions & 2 deletions packages/client-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@clickhouse/client",
"description": "Official JS client for ClickHouse DB - Node.js implementation",
"homepage": "https://clickhouse.com",
"version": "0.0.0",
"version": "1.15.0",
"license": "Apache-2.0",
"keywords": [
"clickhouse",
Expand All @@ -22,8 +22,12 @@
"files": [
"dist"
],
"scripts": {
"prepack": "cp ../../README.md ../../LICENSE .",
"build": "rm -rf dist; tsc"
},
"dependencies": {
"@clickhouse/client-common": "*"
"@clickhouse/client-common": "1.15.0"
},
"devDependencies": {
"simdjson": "^0.9.2"
Expand Down
7 changes: 7 additions & 0 deletions packages/client-node/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.json",
"include": ["./src/**/*.ts"],
"compilerOptions": {
"outDir": "./dist"
}
}
Loading
Loading