setup

作者: clickhouse

在全新檢出(或拉取影響 package.json 檔案的變更後)執行任何 npm run test:*、npm run lint、npm run typecheck 或 npm run build 腳本之前,請先使用此技能。

npx skills add https://github.com/clickhouse/clickhouse-js --skill setup

clickhouse-js Repository Setup

Use this skill before running any of the npm run test:*, npm run lint, npm run typecheck, or npm run build scripts in a fresh checkout (or after pulling changes that touch package.json files).

Prerequisites

  • Node.js 22 recommended (matches .nvmrc). The root package.json declares "engines": { "node": ">=20.19.0" }, and CI tests Node 20, 22, 24, and 26.
  • Docker with the Compose plugin (docker compose ...). Required only for integration tests and any example that talks to a real server.

1. Install dependencies

This is an npm workspaces repo (packages/*), with two additional independent example packages (examples/node, examples/web) that have their own package.json and are not part of the workspaces.

Install all three:

npm install
npm --prefix examples/node install
npm --prefix examples/web install

The root postinstall script patches node_modules/parquet-wasm/package.json; it runs automatically as part of npm install.

2. Build the workspace packages

The workspace packages (@clickhouse/client-common, @clickhouse/client, @clickhouse/client-web) must be built before some tests, examples, and typechecks can resolve their inter-package imports:

npm run build

This runs build in every workspace package.

3. Start ClickHouse (only for integration tests / examples)

Unit tests do not need a server. Integration tests (npm run test:*:integration*) and the example runners do.

From the repo root:

docker compose up -d

This starts both the single-node setup (clickhouse on 8123/9000, clickhouse_tls on 8443/9440) and the two-node cluster (clickhouse1, clickhouse2, plus the nginx round-robin entrypoint on 8127). All services use non-overlapping ports so a single up -d covers every integration test mode.

To override the server version, set CLICKHOUSE_VERSION when starting Compose; for example: CLICKHOUSE_VERSION=head docker compose up -d, CLICKHOUSE_VERSION=latest docker compose up -d, or CLICKHOUSE_VERSION=24.8 docker compose up -d to use an explicit version tag.

4. Verify

After the steps above you can run, for example:

  • npm run lint — lint every workspace package
  • npm run typecheck — typecheck every workspace package
  • npm run test:node:unit / npm run test:web:unit — unit tests, no server required
  • npm run test:node:integration / npm run test:web:integration — integration tests, server required
  • From examples/node or examples/web: npm run lint, npm run typecheck, npm run run-examples

See npm run from the repo root for the full list of test scripts.

來自 clickhouse 的更多技能

clickhouse-best-practices
clickhouse
我们要求翻译一段文本,目标语言是繁体中文。文本内容是关于ClickHouse最佳实践的规则,包括模式设计、查询优化和数据摄取策略。需要保留名称"clickhouse-best-practices"(但名称不在<text>内,所以不翻译)。注意不要添加额外内容,只翻译<text>内的文字。 翻译时注意专业术语:schema design -> 模式設計,query optimization -> 查詢優化,data ingestion strategy -> 數據攝取策略,primary key -> 主鍵,data type selection -> 數據類型選擇,immutable design decisions -> 不可變設計決策,JOIN -> JOIN(保留),insert batching -> 插入批次處理,mutation avoidance -> 避免突變,columnar storage -> 列式存儲,sparse index mechanics -> 稀疏索引機制,structured review procedures -> 結構化審查程序。 注意繁体中文用词:规则、组织、涵盖、关键、标记、提供等。 文本末尾有"for...",但原文是"for..."后面没有完整
official
clickhouse-js-node-coding
clickhouse
Write idiomatic application code with the ClickHouse Node.js client (`@clickhouse/client`). Use this skill whenever a user is *building* against the Node.js…
official
clickhousectl-cloud-deploy
clickhouse
當用戶想要將ClickHouse部署到雲端、上線生產環境、使用ClickHouse Cloud、託管受管理的ClickHouse服務,或從本地遷移時使用。
official
clickstack-otel-collector
clickhouse
當使用者想要將 OpenTelemetry collector 接入 ClickHouse Cloud 上的 Managed ClickStack 服務時使用,無論是透過部署新的本地 collector…
official
infra-clickhouse
clickhouse
使用clickhousectl CLI設定及管理ClickHouse——安裝並執行本機ClickHouse伺服器以利開發,同時建立受管理的ClickHouse Cloud…
official
infra-postgres
clickhouse
使用 clickhousectl CLI 設定並管理 Postgres — 執行本機 Docker 支援的 Postgres 以進行開發,並建立及操作受管理的 ClickHouse…
official
clickhouse-best-practices
clickhouse
審查 ClickHouse 結構、查詢或配置時必須使用。包含 31 條規則,在提供建議前必須檢查。務必閱讀…
official
setup
clickhouse
引導用戶設定與此插件捆綁的 ClickHouse MCP 伺服器連線。當用戶首次安裝插件或遇到問題時使用…
official