From d821ccecea52c7af61f662d07290f5dcd1f6a70f Mon Sep 17 00:00:00 2001 From: Peter Leonov Date: Fri, 19 Dec 2025 00:27:44 +0100 Subject: [PATCH 1/9] remove paths --- tsconfig.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index fb7d0de3..742d2e10 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -20,10 +20,7 @@ "outDir": "out", "lib": ["esnext", "dom"], "types": ["node", "jasmine"], - "baseUrl": "./", - "paths": { - "@clickhouse/client-common": ["packages/client-common/src/index.ts"] - } + "baseUrl": "./" }, "exclude": ["node_modules"], "include": ["./packages/**/src/**/*.ts"] From d61ab76f26df076d27053a69f136b7ceba416d81 Mon Sep 17 00:00:00 2001 From: Peter Leonov Date: Fri, 19 Dec 2025 00:25:12 +0100 Subject: [PATCH 2/9] don't self reference as a package (yet) --- packages/client-common/src/client.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/packages/client-common/src/client.ts b/packages/client-common/src/client.ts index ff0b7e48..ada60a6d 100644 --- a/packages/client-common/src/client.ts +++ b/packages/client-common/src/client.ts @@ -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' @@ -135,10 +131,8 @@ export interface InsertColumnsExcept { except: NonEmptyArray } -export interface InsertParams< - Stream = unknown, - T = unknown, -> extends BaseQueryParams { +export interface InsertParams + extends BaseQueryParams { /** Name of a table to insert into. */ table: string /** A dataset to insert. */ From 4abcd190c7f487848aa3b306d04be9d055e78970 Mon Sep 17 00:00:00 2001 From: Peter Leonov Date: Thu, 18 Dec 2025 23:38:25 +0100 Subject: [PATCH 3/9] set up the scripts --- .gitignore | 2 ++ packages/client-common/package.json | 6 +++++- packages/client-common/tsconfig.json | 7 +++++++ packages/client-node/package.json | 4 ++++ packages/client-node/tsconfig.json | 7 +++++++ packages/client-web/package.json | 4 ++++ packages/client-web/tsconfig.json | 7 +++++++ 7 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 packages/client-common/tsconfig.json create mode 100644 packages/client-node/tsconfig.json create mode 100644 packages/client-web/tsconfig.json diff --git a/.gitignore b/.gitignore index 3abad878..5be6cd53 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ out coverage coverage-web .nyc_output +packages/*/README.md +packages/*/LICENSE diff --git a/packages/client-common/package.json b/packages/client-common/package.json index 5c80024d..ca6bd8cf 100644 --- a/packages/client-common/package.json +++ b/packages/client-common/package.json @@ -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", @@ -19,6 +19,10 @@ "files": [ "dist" ], + "scripts": { + "prepack": "cp ../../README.md ../../LICENSE .", + "build": "rm -rf dist; tsc" + }, "dependencies": {}, "devDependencies": {} } diff --git a/packages/client-common/tsconfig.json b/packages/client-common/tsconfig.json new file mode 100644 index 00000000..08413718 --- /dev/null +++ b/packages/client-common/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.json", + "include": ["./src/**/*.ts"], + "compilerOptions": { + "outDir": "./dist" + } +} diff --git a/packages/client-node/package.json b/packages/client-node/package.json index 39d85229..a6b24fd3 100644 --- a/packages/client-node/package.json +++ b/packages/client-node/package.json @@ -22,6 +22,10 @@ "files": [ "dist" ], + "scripts": { + "prepack": "cp ../../README.md ../../LICENSE .", + "build": "rm -rf dist; tsc" + }, "dependencies": { "@clickhouse/client-common": "*" }, diff --git a/packages/client-node/tsconfig.json b/packages/client-node/tsconfig.json new file mode 100644 index 00000000..08413718 --- /dev/null +++ b/packages/client-node/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.json", + "include": ["./src/**/*.ts"], + "compilerOptions": { + "outDir": "./dist" + } +} diff --git a/packages/client-web/package.json b/packages/client-web/package.json index ab64403f..cd45e1b2 100644 --- a/packages/client-web/package.json +++ b/packages/client-web/package.json @@ -19,6 +19,10 @@ "files": [ "dist" ], + "scripts": { + "prepack": "cp ../../README.md ../../LICENSE .", + "build": "rm -rf dist; tsc" + }, "dependencies": { "@clickhouse/client-common": "*" } diff --git a/packages/client-web/tsconfig.json b/packages/client-web/tsconfig.json new file mode 100644 index 00000000..08413718 --- /dev/null +++ b/packages/client-web/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.json", + "include": ["./src/**/*.ts"], + "compilerOptions": { + "outDir": "./dist" + } +} From bbfc1a5c23083db61f8d61ef49406188eb57076e Mon Sep 17 00:00:00 2001 From: Peter Leonov Date: Fri, 19 Dec 2025 00:31:06 +0100 Subject: [PATCH 4/9] update docs draft --- CONTRIBUTING.md | 24 ++++++++++++------------ packages/client-node/package.json | 4 ++-- packages/client-web/package.json | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 70042869..ccffcdac 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -214,27 +214,27 @@ 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. 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: - ```bash -npx tsx .build/build_and_prepare.ts common && npm pack && npm publish +./update_versions.sh [new_version] ``` -Node.js client manual release: +Then build the packages in this order: ```bash -npx tsx .build/build_and_prepare.ts node && npm pack && npm publish +npm workspace @clickhouse/client-common run build +npm workspace @clickhouse/client-node run build +npm workspace @clickhouse/client-web run build ``` -Web client manual release: +If the above commands complete successfully, we're ready to publish. ```bash -npx tsx .build/build_and_prepare.ts web && npm pack && npm publish +npm workspace @clickhouse/client-common run pack +npm workspace @clickhouse/client-common run publish +npm workspace @clickhouse/client-node run pack +npm workspace @clickhouse/client-node run publish +npm workspace @clickhouse/client-web run pack +npm workspace @clickhouse/client-web run 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. diff --git a/packages/client-node/package.json b/packages/client-node/package.json index a6b24fd3..20b91ed8 100644 --- a/packages/client-node/package.json +++ b/packages/client-node/package.json @@ -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", @@ -27,7 +27,7 @@ "build": "rm -rf dist; tsc" }, "dependencies": { - "@clickhouse/client-common": "*" + "@clickhouse/client-common": "1.15.0" }, "devDependencies": { "simdjson": "^0.9.2" diff --git a/packages/client-web/package.json b/packages/client-web/package.json index cd45e1b2..470617d2 100644 --- a/packages/client-web/package.json +++ b/packages/client-web/package.json @@ -2,7 +2,7 @@ "name": "@clickhouse/client-web", "description": "Official JS client for ClickHouse DB - Web API implementation", "homepage": "https://clickhouse.com", - "version": "0.0.0", + "version": "1.15.0", "license": "Apache-2.0", "keywords": [ "clickhouse", @@ -24,6 +24,6 @@ "build": "rm -rf dist; tsc" }, "dependencies": { - "@clickhouse/client-common": "*" + "@clickhouse/client-common": "1.15.0" } } From 91fd7ccf2f28082b92715552ed78b000c11eb077 Mon Sep 17 00:00:00 2001 From: Peter Leonov Date: Fri, 19 Dec 2025 10:48:42 +0100 Subject: [PATCH 5/9] use workspaces global commands --- .build/build_and_prepare.ts | 63 ------------------------------------- .github/workflows/build.yml | 11 +++---- .scripts/build.sh | 5 --- CONTRIBUTING.md | 17 ++++------ package.json | 3 -- 5 files changed, 10 insertions(+), 89 deletions(-) delete mode 100644 .build/build_and_prepare.ts delete mode 100755 .scripts/build.sh diff --git a/.build/build_and_prepare.ts b/.build/build_and_prepare.ts deleted file mode 100644 index 3ceefbd2..00000000 --- a/.build/build_and_prepare.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { execSync } from 'child_process' -import fs, { readFileSync } from 'fs' -import * as process from 'process' - -void (async () => { - const [pkg] = process.argv.slice(2) - if (!pkg) { - console.error(`Expected package name as an argument`) - process.exit(1) - } - - let packageName = '' - if (pkg.endsWith('web')) { - packageName = 'client-web' - } else if (pkg.endsWith('node')) { - packageName = 'client-node' - } else if (pkg.endsWith('common')) { - packageName = 'client-common' - } else { - console.error(`Provided tag ${pkg} does not match any packages`) - process.exit(1) - } - - try { - fs.copyFileSync(`./packages/${packageName}/package.json`, './package.json') - - const packageJson: { - version: string - dependencies: Record - } = JSON.parse(readFileSync('./package.json').toString()) - - const version = ( - await import(`../packages/${packageName}/src/version` + '.ts') - ).default - console.log(`Current ${packageName} package version is: ${version}`) - packageJson.version = version - - if (packageJson.dependencies['@clickhouse/client-common']) { - const commonVersion = ( - await import('../packages/client-common/src/version' + '.ts') - ).default - console.log(`Updating client-common dependency to ${commonVersion}`) - packageJson['dependencies']['@clickhouse/client-common'] = commonVersion - } - - console.log('Updated package json:') - console.log(packageJson) - - console.log(`Building package ${packageName}...`) - execSync(`./.scripts/build.sh ${packageName}`, { cwd: process.cwd() }) - - fs.writeFileSync( - './package.json', - JSON.stringify(packageJson, null, 2) + '\n', - 'utf-8', - ) - } catch (err) { - console.error(err) - process.exit(1) - } - - process.exit(0) -})() diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9c74a468..eee4346a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: | diff --git a/.scripts/build.sh b/.scripts/build.sh deleted file mode 100755 index 84177d53..00000000 --- a/.scripts/build.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -rm -rf out dist -tsc -mkdir -p dist -mv out/$1/src/* dist/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ccffcdac..0eac33b4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -220,21 +220,16 @@ We prefer to keep versions the same across the packages, and release all at once ./update_versions.sh [new_version] ``` -Then build the packages in this order: +Then build the packages: ```bash -npm workspace @clickhouse/client-common run build -npm workspace @clickhouse/client-node run build -npm workspace @clickhouse/client-web run build + +npm --workspaces run build ``` -If the above commands complete successfully, we're ready to publish. +Now we're ready to publish. ```bash -npm workspace @clickhouse/client-common run pack -npm workspace @clickhouse/client-common run publish -npm workspace @clickhouse/client-node run pack -npm workspace @clickhouse/client-node run publish -npm workspace @clickhouse/client-web run pack -npm workspace @clickhouse/client-web run publish +npm --workspaces pack +npm --workspaces publish ``` diff --git a/package.json b/package.json index 09028067..7629e9d0 100644 --- a/package.json +++ b/package.json @@ -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 .", From ebdf9cb5db7321cd117a71ba7f3ea1a879cd659f Mon Sep 17 00:00:00 2001 From: Peter Leonov Date: Fri, 19 Dec 2025 13:30:46 +0100 Subject: [PATCH 6/9] finalize --- .scripts/update_version.sh | 21 +++++++++++++++++++++ CONTRIBUTING.md | 17 ++++++++++++++++- package.json | 2 +- 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100755 .scripts/update_version.sh diff --git a/.scripts/update_version.sh b/.scripts/update_version.sh new file mode 100755 index 00000000..5b613509 --- /dev/null +++ b/.scripts/update_version.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -euo pipefail + +version=${1:-} +if [ -z "$version" ]; then + echo "Usage: $0 " + 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" + fi +done + +npm --workspaces version "$version" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0eac33b4..f5e72c20 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -214,10 +214,16 @@ See [#177](https://github.com/ClickHouse/clickhouse-js/issues/177), as it should ## Release process +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. ```bash -./update_versions.sh [new_version] +./scripts/update_version.sh [new_version] ``` Then build the packages: @@ -233,3 +239,12 @@ Now we're ready to publish. npm --workspaces pack npm --workspaces publish ``` + +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] +``` diff --git a/package.json b/package.json index 7629e9d0..672caeee 100644 --- a/package.json +++ b/package.json @@ -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", "license": "Apache-2.0", "keywords": [ "clickhouse", From b4be7d2714b4e8eba948878f537e1b28056d36f2 Mon Sep 17 00:00:00 2001 From: Peter Leonov Date: Fri, 19 Dec 2025 16:24:24 +0100 Subject: [PATCH 7/9] npm i --- package-lock.json | 54 +++++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 35 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5807bb5d..1da70338 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "clickhouse-js", - "version": "0.0.0", + "version": "1.15.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "clickhouse-js", - "version": "0.0.0", + "version": "1.15.0", "license": "Apache-2.0", "workspaces": [ "./packages/*" @@ -17,7 +17,7 @@ "@istanbuljs/nyc-config-typescript": "^1.0.2", "@types/jasmine": "^5.1.8", "@types/jsonwebtoken": "^9.0.10", - "@types/node": "^24.2.1", + "@types/node": "24.2.1", "@types/sinon": "^21.0.0", "@types/split2": "^4.2.3", "@types/uuid": "^11.0.0", @@ -43,7 +43,7 @@ "lint-staged": "^16.1.5", "nyc": "^17.1.0", "parquet-wasm": "0.7.1", - "prettier": "3.6.2", + "prettier": "3.7.4", "sinon": "^21.0.0", "source-map-support": "^0.5.21", "split2": "^4.2.0", @@ -1786,13 +1786,13 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "24.10.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz", - "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==", + "version": "24.2.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.2.1.tgz", + "integrity": "sha512-DRh5K+ka5eJic8CjH7td8QpYEV6Zo10gfRkjHCO3weqZHWDtAaSTFtl4+VMqOJ4N5jcuhZ9/l+yy8rVgw7BQeQ==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~7.16.0" + "undici-types": "~7.10.0" } }, "node_modules/@types/sinon": { @@ -8373,22 +8373,6 @@ "node": ">=18" } }, - "node_modules/playwright/node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "peer": true, - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/pngjs": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-7.0.0.tgz", @@ -8449,9 +8433,9 @@ } }, "node_modules/prettier": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.6.2.tgz", - "integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==", + "version": "3.7.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.7.4.tgz", + "integrity": "sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA==", "dev": true, "license": "MIT", "bin": { @@ -10463,9 +10447,9 @@ } }, "node_modules/undici-types": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", - "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz", + "integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==", "dev": true, "license": "MIT" }, @@ -11383,16 +11367,16 @@ }, "packages/client-common": { "name": "@clickhouse/client-common", - "version": "0.0.0", + "version": "1.15.0", "license": "Apache-2.0", "devDependencies": {} }, "packages/client-node": { "name": "@clickhouse/client", - "version": "0.0.0", + "version": "1.15.0", "license": "Apache-2.0", "dependencies": { - "@clickhouse/client-common": "*" + "@clickhouse/client-common": "1.15.0" }, "devDependencies": { "simdjson": "^0.9.2" @@ -11403,10 +11387,10 @@ }, "packages/client-web": { "name": "@clickhouse/client-web", - "version": "0.0.0", + "version": "1.15.0", "license": "Apache-2.0", "dependencies": { - "@clickhouse/client-common": "*" + "@clickhouse/client-common": "1.15.0" } }, "vitest-poc": { From 08f3e5d0046b22fac1b025690f70b7558bc41d47 Mon Sep 17 00:00:00 2001 From: Peter Leonov Date: Fri, 19 Dec 2025 16:35:56 +0100 Subject: [PATCH 8/9] clean work dir --- CONTRIBUTING.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f5e72c20..f0a9753e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -222,14 +222,20 @@ Tools required: We prefer to keep versions the same across the packages, and release all at once, even if there were no changes in some. +Make sure that the working directory is clean: + +```bash +git clean -dfX +npm i +``` + ```bash -./scripts/update_version.sh [new_version] +.scripts/update_version.sh [new_version] ``` Then build the packages: ```bash - npm --workspaces run build ``` From 1e36e12c616c8342656a67168183498aa9c5a433 Mon Sep 17 00:00:00 2001 From: Peter Leonov Date: Fri, 19 Dec 2025 16:39:51 +0100 Subject: [PATCH 9/9] fix lint --- packages/client-common/src/client.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/client-common/src/client.ts b/packages/client-common/src/client.ts index ada60a6d..b9c47811 100644 --- a/packages/client-common/src/client.ts +++ b/packages/client-common/src/client.ts @@ -131,8 +131,10 @@ export interface InsertColumnsExcept { except: NonEmptyArray } -export interface InsertParams - extends BaseQueryParams { +export interface InsertParams< + Stream = unknown, + T = unknown, +> extends BaseQueryParams { /** Name of a table to insert into. */ table: string /** A dataset to insert. */