From e5c8e335c195783fb604dd0c3ea2f5e41874e0b2 Mon Sep 17 00:00:00 2001 From: Bryce Mecum Date: Mon, 18 May 2026 11:10:12 -0700 Subject: [PATCH 01/13] create npm packages --- packages/npm/.gitignore | 2 + .../packages/dbc-darwin-arm64/bin/.gitkeep | 0 .../packages/dbc-darwin-arm64/package.json | 29 ++ .../npm/packages/dbc-darwin-x64/bin/.gitkeep | 0 .../npm/packages/dbc-darwin-x64/package.json | 29 ++ .../npm/packages/dbc-linux-arm64/bin/.gitkeep | 0 .../npm/packages/dbc-linux-arm64/package.json | 29 ++ .../npm/packages/dbc-linux-x64/bin/.gitkeep | 0 .../npm/packages/dbc-linux-x64/package.json | 29 ++ .../npm/packages/dbc-win32-x64/bin/.gitkeep | 0 .../npm/packages/dbc-win32-x64/package.json | 29 ++ packages/npm/platforms.js | 57 ++++ packages/npm/scripts/create_packages.js | 290 ++++++++++++++++++ packages/npm/wrapper/bin/dbc.js | 44 +++ packages/npm/wrapper/package.json | 33 ++ 15 files changed, 571 insertions(+) create mode 100644 packages/npm/.gitignore create mode 100644 packages/npm/packages/dbc-darwin-arm64/bin/.gitkeep create mode 100644 packages/npm/packages/dbc-darwin-arm64/package.json create mode 100644 packages/npm/packages/dbc-darwin-x64/bin/.gitkeep create mode 100644 packages/npm/packages/dbc-darwin-x64/package.json create mode 100644 packages/npm/packages/dbc-linux-arm64/bin/.gitkeep create mode 100644 packages/npm/packages/dbc-linux-arm64/package.json create mode 100644 packages/npm/packages/dbc-linux-x64/bin/.gitkeep create mode 100644 packages/npm/packages/dbc-linux-x64/package.json create mode 100644 packages/npm/packages/dbc-win32-x64/bin/.gitkeep create mode 100644 packages/npm/packages/dbc-win32-x64/package.json create mode 100644 packages/npm/platforms.js create mode 100755 packages/npm/scripts/create_packages.js create mode 100755 packages/npm/wrapper/bin/dbc.js create mode 100644 packages/npm/wrapper/package.json diff --git a/packages/npm/.gitignore b/packages/npm/.gitignore new file mode 100644 index 00000000..eb31e58e --- /dev/null +++ b/packages/npm/.gitignore @@ -0,0 +1,2 @@ +node_modules/ +packages/*/bin/dbc* diff --git a/packages/npm/packages/dbc-darwin-arm64/bin/.gitkeep b/packages/npm/packages/dbc-darwin-arm64/bin/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/packages/npm/packages/dbc-darwin-arm64/package.json b/packages/npm/packages/dbc-darwin-arm64/package.json new file mode 100644 index 00000000..0e0f1a22 --- /dev/null +++ b/packages/npm/packages/dbc-darwin-arm64/package.json @@ -0,0 +1,29 @@ +{ + "name": "@columnar-tech/dbc-darwin-arm64", + "version": "0.3.0", + "description": "macOS arm64 binary for dbc, the CLI for installing ADBC drivers", + "keywords": [ + "adbc", + "arrow", + "database", + "drivers", + "dbc" + ], + "homepage": "https://columnar.tech/dbc", + "bugs": "https://github.com/columnar-tech/dbc/issues", + "repository": { + "type": "git", + "url": "https://github.com/columnar-tech/dbc.git", + "directory": "packages/npm/packages/dbc-darwin-arm64" + }, + "license": "Apache-2.0", + "os": [ + "darwin" + ], + "cpu": [ + "arm64" + ], + "files": [ + "bin/" + ] +} diff --git a/packages/npm/packages/dbc-darwin-x64/bin/.gitkeep b/packages/npm/packages/dbc-darwin-x64/bin/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/packages/npm/packages/dbc-darwin-x64/package.json b/packages/npm/packages/dbc-darwin-x64/package.json new file mode 100644 index 00000000..9086b6a9 --- /dev/null +++ b/packages/npm/packages/dbc-darwin-x64/package.json @@ -0,0 +1,29 @@ +{ + "name": "@columnar-tech/dbc-darwin-x64", + "version": "0.3.0", + "description": "macOS x64 binary for dbc, the CLI for installing ADBC drivers", + "keywords": [ + "adbc", + "arrow", + "database", + "drivers", + "dbc" + ], + "homepage": "https://columnar.tech/dbc", + "bugs": "https://github.com/columnar-tech/dbc/issues", + "repository": { + "type": "git", + "url": "https://github.com/columnar-tech/dbc.git", + "directory": "packages/npm/packages/dbc-darwin-x64" + }, + "license": "Apache-2.0", + "os": [ + "darwin" + ], + "cpu": [ + "x64" + ], + "files": [ + "bin/" + ] +} diff --git a/packages/npm/packages/dbc-linux-arm64/bin/.gitkeep b/packages/npm/packages/dbc-linux-arm64/bin/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/packages/npm/packages/dbc-linux-arm64/package.json b/packages/npm/packages/dbc-linux-arm64/package.json new file mode 100644 index 00000000..17b26a72 --- /dev/null +++ b/packages/npm/packages/dbc-linux-arm64/package.json @@ -0,0 +1,29 @@ +{ + "name": "@columnar-tech/dbc-linux-arm64", + "version": "0.3.0", + "description": "Linux arm64 binary for dbc, the CLI for installing ADBC drivers", + "keywords": [ + "adbc", + "arrow", + "database", + "drivers", + "dbc" + ], + "homepage": "https://columnar.tech/dbc", + "bugs": "https://github.com/columnar-tech/dbc/issues", + "repository": { + "type": "git", + "url": "https://github.com/columnar-tech/dbc.git", + "directory": "packages/npm/packages/dbc-linux-arm64" + }, + "license": "Apache-2.0", + "os": [ + "linux" + ], + "cpu": [ + "arm64" + ], + "files": [ + "bin/" + ] +} diff --git a/packages/npm/packages/dbc-linux-x64/bin/.gitkeep b/packages/npm/packages/dbc-linux-x64/bin/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/packages/npm/packages/dbc-linux-x64/package.json b/packages/npm/packages/dbc-linux-x64/package.json new file mode 100644 index 00000000..53b07e95 --- /dev/null +++ b/packages/npm/packages/dbc-linux-x64/package.json @@ -0,0 +1,29 @@ +{ + "name": "@columnar-tech/dbc-linux-x64", + "version": "0.3.0", + "description": "Linux x64 binary for dbc, the CLI for installing ADBC drivers", + "keywords": [ + "adbc", + "arrow", + "database", + "drivers", + "dbc" + ], + "homepage": "https://columnar.tech/dbc", + "bugs": "https://github.com/columnar-tech/dbc/issues", + "repository": { + "type": "git", + "url": "https://github.com/columnar-tech/dbc.git", + "directory": "packages/npm/packages/dbc-linux-x64" + }, + "license": "Apache-2.0", + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "files": [ + "bin/" + ] +} diff --git a/packages/npm/packages/dbc-win32-x64/bin/.gitkeep b/packages/npm/packages/dbc-win32-x64/bin/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/packages/npm/packages/dbc-win32-x64/package.json b/packages/npm/packages/dbc-win32-x64/package.json new file mode 100644 index 00000000..fa57098d --- /dev/null +++ b/packages/npm/packages/dbc-win32-x64/package.json @@ -0,0 +1,29 @@ +{ + "name": "@columnar-tech/dbc-win32-x64", + "version": "0.3.0", + "description": "Windows x64 binary for dbc, the CLI for installing ADBC drivers", + "keywords": [ + "adbc", + "arrow", + "database", + "drivers", + "dbc" + ], + "homepage": "https://columnar.tech/dbc", + "bugs": "https://github.com/columnar-tech/dbc/issues", + "repository": { + "type": "git", + "url": "https://github.com/columnar-tech/dbc.git", + "directory": "packages/npm/packages/dbc-win32-x64" + }, + "license": "Apache-2.0", + "os": [ + "win32" + ], + "cpu": [ + "x64" + ], + "files": [ + "bin/" + ] +} diff --git a/packages/npm/platforms.js b/packages/npm/platforms.js new file mode 100644 index 00000000..a2abf049 --- /dev/null +++ b/packages/npm/platforms.js @@ -0,0 +1,57 @@ +// Copyright 2026 Columnar Technologies 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. + +"use strict"; + +// Add a new entry here to support a new platform across both the +// build script (create_packages.js) and the wrapper shim (bin/dbc.js). +const PLATFORMS = [ + { + goosArch: "darwin-arm64", + npmPkg: "@columnar-tech/dbc-darwin-arm64", + binary: "dbc", + os: "darwin", + cpu: "arm64", + }, + { + goosArch: "darwin-amd64", + npmPkg: "@columnar-tech/dbc-darwin-x64", + binary: "dbc", + os: "darwin", + cpu: "x64", + }, + { + goosArch: "linux-arm64", + npmPkg: "@columnar-tech/dbc-linux-arm64", + binary: "dbc", + os: "linux", + cpu: "arm64", + }, + { + goosArch: "linux-amd64", + npmPkg: "@columnar-tech/dbc-linux-x64", + binary: "dbc", + os: "linux", + cpu: "x64", + }, + { + goosArch: "windows-amd64", + npmPkg: "@columnar-tech/dbc-win32-x64", + binary: "dbc.exe", + os: "win32", + cpu: "x64", + }, +]; + +module.exports = { PLATFORMS }; diff --git a/packages/npm/scripts/create_packages.js b/packages/npm/scripts/create_packages.js new file mode 100755 index 00000000..6b8d15d2 --- /dev/null +++ b/packages/npm/scripts/create_packages.js @@ -0,0 +1,290 @@ +#!/usr/bin/env node +// Copyright 2026 Columnar Technologies 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. + +// create_packages.js +// +// Populates the per-platform npm packages with the dbc binary extracted from +// a GoReleaser archive. Mirrors scripts/create_wheels.py in design. +// +// Requires: curl, tar, unzip (for .zip archives) +// +// Usage: +// +// # Create npm packages for all platforms in one go: +// node create_packages.js --version 0.3.0 +// +// # Create npm packages for a specific platform, including the wrapper: +// node create_packages.js --version 0.3.0 --platform darwin-arm64 + +"use strict"; + +const fs = require("fs"); +const os = require("os"); +const path = require("path"); +const { execFileSync } = require("child_process"); + +const GITHUB_ORG = "columnar-tech"; +const GITHUB_REPO = "dbc"; + +const { PLATFORMS } = require("../platforms.js"); + +function findPlatform(goosArch) { + return PLATFORMS.find((p) => p.goosArch === goosArch); +} + +// The platform packages live in packages/ where is the unscoped +// package name (e.g. "dbc-darwin-arm64", not "@columnar-tech/dbc-darwin-arm64") +function pkgDirFor(info) { + return path.join(PACKAGES_DIR, info.npmPkg.replace(/^@[^/]+\//, "")); +} + +const PACKAGES_DIR = path.resolve(__dirname, "..", "packages"); +const WRAPPER_DIR = path.resolve(__dirname, "..", "wrapper"); + +function curlGet(url) { + return execFileSync("curl", [ + "--silent", + "--show-error", + "--location", + "--fail", + url, + ]); +} + +function curlDownload(url, destPath) { + execFileSync( + "curl", + ["--silent", "--show-error", "--location", "--fail", "-o", destPath, url], + { + stdio: ["ignore", "pipe", "inherit"], + }, + ); +} + +function getGithubRelease(version) { + const tag = version.startsWith("v") ? version : `v${version}`; + const url = `https://api.github.com/repos/${GITHUB_ORG}/${GITHUB_REPO}/releases/tags/${tag}`; + console.log(`Fetching release info for ${tag}...`); + const body = curlGet(url); + return JSON.parse(body.toString()).assets.map((a) => ({ + name: a.name, + downloadUrl: a.browser_download_url, + digest: a.digest, + })); +} + +function extractBinary(archivePath, binaryName, destDir) { + if (archivePath.endsWith(".zip")) { + // -j: junk paths (strip directory components) + execFileSync( + "unzip", + ["-j", "-o", archivePath, `*${binaryName}`, "-d", destDir], + { + stdio: ["ignore", "pipe", "pipe"], + }, + ); + } else { + // GoReleaser archives are flat (no top-level directory wrapper) + execFileSync("tar", ["-xzf", archivePath, "-C", destDir], { + stdio: ["ignore", "pipe", "pipe"], + }); + } + + const extracted = path.join(destDir, binaryName); + if (!fs.existsSync(extracted)) { + throw new Error( + `Binary '${binaryName}' not found after extracting ${archivePath}`, + ); + } + return extracted; +} + +function setPackageVersion(pkgDir, version) { + const pkgJsonPath = path.join(pkgDir, "package.json"); + const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8")); + pkgJson.version = version; + fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2) + "\n"); +} + +function setWrapperVersion(version) { + const pkgJsonPath = path.join(WRAPPER_DIR, "package.json"); + const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8")); + pkgJson.version = version; + for (const dep of Object.keys(pkgJson.optionalDependencies)) { + pkgJson.optionalDependencies[dep] = version; + } + fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2) + "\n"); + console.log(`Updated wrapper package.json to version ${version}`); +} + +function populatePlatform(goosArch, archivePath, version) { + const info = findPlatform(goosArch); + if (!info) throw new Error(`Unknown platform: ${goosArch}`); + + const pkgDir = pkgDirFor(info); + const destPath = path.join(pkgDir, "bin", info.binary); + + const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "dbc-npm-")); + try { + console.log( + `Extracting ${info.binary} from ${path.basename(archivePath)}...`, + ); + const extracted = extractBinary(archivePath, info.binary, tmpDir); + fs.copyFileSync(extracted, destPath); + fs.chmodSync(destPath, 0o755); + console.log(` → ${destPath} (${fs.statSync(destPath).size} bytes)`); + } finally { + fs.rmSync(tmpDir, { recursive: true, force: true }); + } + + setPackageVersion(pkgDir, version); + console.log(` → set ${info.npmPkg} version to ${version}`); +} + +function parseArgs() { + const args = process.argv.slice(2); + const opts = { + version: null, + platform: null, + archive: null, + setVersionOnly: false, + }; + + for (let i = 0; i < args.length; i++) { + switch (args[i]) { + case "--version": + opts.version = args[++i]; + break; + case "--platform": + opts.platform = args[++i]; + break; + case "--archive": + opts.archive = args[++i]; + break; + case "--set-version-only": + opts.setVersionOnly = true; + break; + default: + console.error(`Unknown argument: ${args[i]}`); + process.exit(1); + } + } + + if (!opts.version) { + console.error("--version is required"); + process.exit(1); + } + + return opts; +} + +function main() { + const opts = parseArgs(); + const version = opts.version.replace(/^v/, ""); + + const created = []; + + if (opts.setVersionOnly) { + const platforms = opts.platform ? [opts.platform] : PLATFORMS.map((p) => p.goosArch); + for (const goosArch of platforms) { + const info = findPlatform(goosArch); + if (!info) { + console.error(`Unknown platform: ${goosArch}`); + process.exit(1); + } + const pkgDir = pkgDirFor(info); + setPackageVersion(pkgDir, version); + created.push(pkgDir); + } + setWrapperVersion(version); + created.push(WRAPPER_DIR); + } else if (opts.archive) { + if (!opts.platform) { + console.error("--platform is required when --archive is provided"); + process.exit(1); + } + populatePlatform(opts.platform, path.resolve(opts.archive), version); + setWrapperVersion(version); + created.push(pkgDirFor(findPlatform(opts.platform))); + created.push(WRAPPER_DIR); + } else { + // Download from GitHub releases + const assets = getGithubRelease(version); + const platforms = opts.platform ? [opts.platform] : PLATFORMS.map((p) => p.goosArch); + + for (const goosArch of platforms) { + const info = findPlatform(goosArch); + if (!info) { + console.error(`Unknown platform: ${goosArch}`); + process.exit(1); + } + + const [goos, goarch] = goosArch.split("-"); + const asset = assets.find( + (a) => + a.name.startsWith(`dbc-${goos}-${goarch}-`) && + (a.name.endsWith(".tar.gz") || a.name.endsWith(".zip")), + ); + + if (!asset) { + console.error( + `No archive asset found for ${goosArch} in release v${version}`, + ); + process.exit(1); + } + + const tmpArchive = path.join(os.tmpdir(), asset.name); + console.log(`Downloading ${asset.name}...`); + curlDownload(asset.downloadUrl, tmpArchive); + + if (asset.digest) { + const expected = asset.digest.split(":")[1]; + const actual = execFileSync("shasum", ["-a", "256", tmpArchive]) + .toString() + .split(" ")[0]; + if (actual !== expected) { + fs.unlinkSync(tmpArchive); + throw new Error( + `Hash mismatch for ${asset.name}: expected ${expected}, got ${actual}`, + ); + } + console.log(` ✓ checksum verified`); + } + + try { + populatePlatform(goosArch, tmpArchive, version); + } finally { + fs.unlinkSync(tmpArchive); + } + + created.push(pkgDirFor(info)); + } + + setWrapperVersion(version); + created.push(WRAPPER_DIR); + } + + console.log(`\nCreated ${created.length} package(s):`); + for (const p of created) { + console.log(` ${p}`); + } +} + +try { + main(); +} catch (err) { + console.error(err.message); + process.exit(1); +} diff --git a/packages/npm/wrapper/bin/dbc.js b/packages/npm/wrapper/bin/dbc.js new file mode 100755 index 00000000..e7c2ca4e --- /dev/null +++ b/packages/npm/wrapper/bin/dbc.js @@ -0,0 +1,44 @@ +#!/usr/bin/env node +// Copyright 2026 Columnar Technologies 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. + +"use strict"; + +const { execFileSync } = require("child_process"); +const { platform, arch } = process; +const { PLATFORMS } = require("../../platforms.js"); + +const entry = PLATFORMS.find((p) => p.os === platform && p.cpu === arch); + +if (!entry) { + console.error(`dbc: unsupported platform: ${platform}/${arch}`); + process.exit(1); +} + +let binPath; +try { + binPath = require.resolve(`${entry.npmPkg}/bin/${entry.binary}`); +} catch { + console.error( + `dbc: could not find the platform package ${entry.npmPkg}.\n` + + ` Try reinstalling: npm install -g @columnar-tech/dbc` + ); + process.exit(1); +} + +try { + execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" }); +} catch (err) { + process.exit(err.status ?? 1); +} diff --git a/packages/npm/wrapper/package.json b/packages/npm/wrapper/package.json new file mode 100644 index 00000000..aad469ba --- /dev/null +++ b/packages/npm/wrapper/package.json @@ -0,0 +1,33 @@ +{ + "name": "@columnar-tech/dbc", + "version": "0.3.0", + "description": "The CLI for installing and managing ADBC drivers", + "keywords": [ + "adbc", + "arrow", + "database", + "drivers", + "dbc" + ], + "homepage": "https://columnar.tech/dbc", + "bugs": "https://github.com/columnar-tech/dbc/issues", + "repository": { + "type": "git", + "url": "https://github.com/columnar-tech/dbc.git", + "directory": "packages/npm/wrapper" + }, + "license": "Apache-2.0", + "bin": { + "dbc": "bin/dbc.js" + }, + "files": [ + "bin/" + ], + "optionalDependencies": { + "@columnar-tech/dbc-darwin-arm64": "0.3.0", + "@columnar-tech/dbc-darwin-x64": "0.3.0", + "@columnar-tech/dbc-linux-arm64": "0.3.0", + "@columnar-tech/dbc-linux-x64": "0.3.0", + "@columnar-tech/dbc-win32-x64": "0.3.0" + } +} From 0c9288c0b9f91df36b3fec80b74eda087adaf74a Mon Sep 17 00:00:00 2001 From: Bryce Mecum Date: Mon, 18 May 2026 11:10:38 -0700 Subject: [PATCH 02/13] add npm publish step to release workflow --- .github/workflows/release.yml | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bc60be94..6753b9c8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -249,3 +249,47 @@ jobs: --value="${RELEASE_VERSION}" env: RELEASE_VERSION: ${{ fromJSON(steps.gorelease.outputs.metadata).version }} + + publish_npm: + runs-on: ubuntu-latest + environment: production + needs: production_deploy + if: github.event_name == 'push' + permissions: + contents: read + id-token: write # For npm provenance + steps: + - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 + with: + persist-credentials: false + + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + node-version: '24.x' + registry-url: 'https://registry.npmjs.org' + + - name: Publish to npm + run: | + VERSION="${{ github.ref_name }}" + VERSION="${VERSION#v}" # strip leading 'v' + + # Create packages for all platforms from the release we just published + node packages/npm/scripts/create_packages.js --version "$VERSION" + + # Handle pre-releases: Prereleases (e.g. 0.3.0-rc1) publish under + # 'next' so they don't become the default for 'npm install + # @columnar-tech/dbc' + if echo "$VERSION" | grep -q '-'; then + NPM_TAG="next" + else + NPM_TAG="latest" + fi + + # Make sure to upload the platform-specific packages before the + # wrapper since they're deps + for pkg in packages/npm/packages/*/; do + npm publish "$pkg" --provenance --access public --tag "$NPM_TAG" + done + npm publish packages/npm/wrapper --provenance --access public --tag "$NPM_TAG" + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From 49e827c1cf2f4cbdb46a3e582eb6cec461a0b45f Mon Sep 17 00:00:00 2001 From: Bryce Mecum Date: Mon, 18 May 2026 11:14:22 -0700 Subject: [PATCH 03/13] refactor create_packages.js to use gh --- packages/npm/scripts/create_packages.js | 95 ++++++++++--------------- 1 file changed, 37 insertions(+), 58 deletions(-) diff --git a/packages/npm/scripts/create_packages.js b/packages/npm/scripts/create_packages.js index 6b8d15d2..803d3931 100755 --- a/packages/npm/scripts/create_packages.js +++ b/packages/npm/scripts/create_packages.js @@ -18,7 +18,7 @@ // Populates the per-platform npm packages with the dbc binary extracted from // a GoReleaser archive. Mirrors scripts/create_wheels.py in design. // -// Requires: curl, tar, unzip (for .zip archives) +// Requires: gh, tar, unzip (for .zip archives) // // Usage: // @@ -35,8 +35,7 @@ const os = require("os"); const path = require("path"); const { execFileSync } = require("child_process"); -const GITHUB_ORG = "columnar-tech"; -const GITHUB_REPO = "dbc"; +const GITHUB_REPO = "columnar-tech/dbc"; const { PLATFORMS } = require("../platforms.js"); @@ -53,36 +52,29 @@ function pkgDirFor(info) { const PACKAGES_DIR = path.resolve(__dirname, "..", "packages"); const WRAPPER_DIR = path.resolve(__dirname, "..", "wrapper"); -function curlGet(url) { - return execFileSync("curl", [ - "--silent", - "--show-error", - "--location", - "--fail", - url, - ]); -} - -function curlDownload(url, destPath) { +// Download a release asset by name pattern into destDir, with checksum +// verification handled by gh itself. +function ghDownload(tag, pattern, destDir) { execFileSync( - "curl", - ["--silent", "--show-error", "--location", "--fail", "-o", destPath, url], - { - stdio: ["ignore", "pipe", "inherit"], - }, + "gh", ["release", "download", tag, + "--repo", GITHUB_REPO, + "--pattern", pattern, + "--dir", destDir, + "--clobber", + ], + { stdio: "inherit" }, ); } -function getGithubRelease(version) { - const tag = version.startsWith("v") ? version : `v${version}`; - const url = `https://api.github.com/repos/${GITHUB_ORG}/${GITHUB_REPO}/releases/tags/${tag}`; - console.log(`Fetching release info for ${tag}...`); - const body = curlGet(url); - return JSON.parse(body.toString()).assets.map((a) => ({ - name: a.name, - downloadUrl: a.browser_download_url, - digest: a.digest, - })); +// Return the asset names for a release tag. +function ghReleaseAssets(tag) { + const out = execFileSync( + "gh", ["release", "view", tag, + "--repo", GITHUB_REPO, + "--json", "assets", + ], + ); + return JSON.parse(out.toString()).assets.map((a) => a.name); } function extractBinary(archivePath, binaryName, destDir) { @@ -221,9 +213,12 @@ function main() { created.push(WRAPPER_DIR); } else { // Download from GitHub releases - const assets = getGithubRelease(version); + const tag = `v${version}`; const platforms = opts.platform ? [opts.platform] : PLATFORMS.map((p) => p.goosArch); + // Find the actual archive filename for each platform from the release + const assetNames = ghReleaseAssets(tag); + for (const goosArch of platforms) { const info = findPlatform(goosArch); if (!info) { @@ -232,41 +227,25 @@ function main() { } const [goos, goarch] = goosArch.split("-"); - const asset = assets.find( - (a) => - a.name.startsWith(`dbc-${goos}-${goarch}-`) && - (a.name.endsWith(".tar.gz") || a.name.endsWith(".zip")), + const assetName = assetNames.find( + (n) => + n.startsWith(`dbc-${goos}-${goarch}-`) && + (n.endsWith(".tar.gz") || n.endsWith(".zip")), ); - if (!asset) { - console.error( - `No archive asset found for ${goosArch} in release v${version}`, - ); + if (!assetName) { + console.error(`No archive asset found for ${goosArch} in release ${tag}`); process.exit(1); } - const tmpArchive = path.join(os.tmpdir(), asset.name); - console.log(`Downloading ${asset.name}...`); - curlDownload(asset.downloadUrl, tmpArchive); - - if (asset.digest) { - const expected = asset.digest.split(":")[1]; - const actual = execFileSync("shasum", ["-a", "256", tmpArchive]) - .toString() - .split(" ")[0]; - if (actual !== expected) { - fs.unlinkSync(tmpArchive); - throw new Error( - `Hash mismatch for ${asset.name}: expected ${expected}, got ${actual}`, - ); - } - console.log(` ✓ checksum verified`); - } - + const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "dbc-npm-dl-")); try { - populatePlatform(goosArch, tmpArchive, version); + // gh verifies checksums automatically against the release's checksums file + console.log(`Downloading ${assetName}...`); + ghDownload(tag, assetName, tmpDir); + populatePlatform(goosArch, path.join(tmpDir, assetName), version); } finally { - fs.unlinkSync(tmpArchive); + fs.rmSync(tmpDir, { recursive: true, force: true }); } created.push(pkgDirFor(info)); From b9a32ebaf8f98c1b8bb5943896a59a4c4d7dc09d Mon Sep 17 00:00:00 2001 From: Bryce Mecum Date: Mon, 18 May 2026 11:17:27 -0700 Subject: [PATCH 04/13] format --- packages/npm/scripts/create_packages.js | 44 ++++++++++++++++--------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/packages/npm/scripts/create_packages.js b/packages/npm/scripts/create_packages.js index 803d3931..f636906a 100755 --- a/packages/npm/scripts/create_packages.js +++ b/packages/npm/scripts/create_packages.js @@ -52,14 +52,19 @@ function pkgDirFor(info) { const PACKAGES_DIR = path.resolve(__dirname, "..", "packages"); const WRAPPER_DIR = path.resolve(__dirname, "..", "wrapper"); -// Download a release asset by name pattern into destDir, with checksum -// verification handled by gh itself. function ghDownload(tag, pattern, destDir) { execFileSync( - "gh", ["release", "download", tag, - "--repo", GITHUB_REPO, - "--pattern", pattern, - "--dir", destDir, + "gh", + [ + "release", + "download", + tag, + "--repo", + GITHUB_REPO, + "--pattern", + pattern, + "--dir", + destDir, "--clobber", ], { stdio: "inherit" }, @@ -68,12 +73,15 @@ function ghDownload(tag, pattern, destDir) { // Return the asset names for a release tag. function ghReleaseAssets(tag) { - const out = execFileSync( - "gh", ["release", "view", tag, - "--repo", GITHUB_REPO, - "--json", "assets", - ], - ); + const out = execFileSync("gh", [ + "release", + "view", + tag, + "--repo", + GITHUB_REPO, + "--json", + "assets", + ]); return JSON.parse(out.toString()).assets.map((a) => a.name); } @@ -189,7 +197,9 @@ function main() { const created = []; if (opts.setVersionOnly) { - const platforms = opts.platform ? [opts.platform] : PLATFORMS.map((p) => p.goosArch); + const platforms = opts.platform + ? [opts.platform] + : PLATFORMS.map((p) => p.goosArch); for (const goosArch of platforms) { const info = findPlatform(goosArch); if (!info) { @@ -214,7 +224,9 @@ function main() { } else { // Download from GitHub releases const tag = `v${version}`; - const platforms = opts.platform ? [opts.platform] : PLATFORMS.map((p) => p.goosArch); + const platforms = opts.platform + ? [opts.platform] + : PLATFORMS.map((p) => p.goosArch); // Find the actual archive filename for each platform from the release const assetNames = ghReleaseAssets(tag); @@ -234,7 +246,9 @@ function main() { ); if (!assetName) { - console.error(`No archive asset found for ${goosArch} in release ${tag}`); + console.error( + `No archive asset found for ${goosArch} in release ${tag}`, + ); process.exit(1); } From 3fa16ab47291d046cd33187efea485ab3c11eced Mon Sep 17 00:00:00 2001 From: Bryce Mecum Date: Mon, 18 May 2026 12:32:47 -0700 Subject: [PATCH 05/13] add README and LICENSE to packages --- packages/npm/.gitignore | 5 + packages/npm/packages/README.platform.md | 27 ++++++ .../packages/dbc-darwin-arm64/package.json | 4 +- .../npm/packages/dbc-darwin-x64/package.json | 4 +- .../npm/packages/dbc-linux-arm64/package.json | 4 +- .../npm/packages/dbc-linux-x64/package.json | 4 +- .../npm/packages/dbc-win32-x64/package.json | 4 +- packages/npm/scripts/create_packages.js | 19 +++- packages/npm/wrapper/README.md | 94 +++++++++++++++++++ packages/npm/wrapper/package.json | 4 +- 10 files changed, 161 insertions(+), 8 deletions(-) create mode 100644 packages/npm/packages/README.platform.md create mode 100644 packages/npm/wrapper/README.md diff --git a/packages/npm/.gitignore b/packages/npm/.gitignore index eb31e58e..d4e8637e 100644 --- a/packages/npm/.gitignore +++ b/packages/npm/.gitignore @@ -1,2 +1,7 @@ node_modules/ + +# Files populated by scripts/create_packages.js — not committed packages/*/bin/dbc* +packages/*/README.md +packages/*/LICENSE +wrapper/LICENSE diff --git a/packages/npm/packages/README.platform.md b/packages/npm/packages/README.platform.md new file mode 100644 index 00000000..de2a802a --- /dev/null +++ b/packages/npm/packages/README.platform.md @@ -0,0 +1,27 @@ + + +# @columnar-tech/dbc-PLATFORM_SUFFIX + +This package contains the `PLATFORM_SUFFIX` binary for [`@columnar-tech/dbc`](https://www.npmjs.com/package/@columnar-tech/dbc). + +**Do not install this package directly.** Install the wrapper instead: + +```sh +npm install -g @columnar-tech/dbc +``` + +This package is automatically selected by npm based on your operating system and CPU architecture. diff --git a/packages/npm/packages/dbc-darwin-arm64/package.json b/packages/npm/packages/dbc-darwin-arm64/package.json index 0e0f1a22..64357c69 100644 --- a/packages/npm/packages/dbc-darwin-arm64/package.json +++ b/packages/npm/packages/dbc-darwin-arm64/package.json @@ -24,6 +24,8 @@ "arm64" ], "files": [ - "bin/" + "bin/", + "README.md", + "LICENSE" ] } diff --git a/packages/npm/packages/dbc-darwin-x64/package.json b/packages/npm/packages/dbc-darwin-x64/package.json index 9086b6a9..48be2c69 100644 --- a/packages/npm/packages/dbc-darwin-x64/package.json +++ b/packages/npm/packages/dbc-darwin-x64/package.json @@ -24,6 +24,8 @@ "x64" ], "files": [ - "bin/" + "bin/", + "README.md", + "LICENSE" ] } diff --git a/packages/npm/packages/dbc-linux-arm64/package.json b/packages/npm/packages/dbc-linux-arm64/package.json index 17b26a72..533000da 100644 --- a/packages/npm/packages/dbc-linux-arm64/package.json +++ b/packages/npm/packages/dbc-linux-arm64/package.json @@ -24,6 +24,8 @@ "arm64" ], "files": [ - "bin/" + "bin/", + "README.md", + "LICENSE" ] } diff --git a/packages/npm/packages/dbc-linux-x64/package.json b/packages/npm/packages/dbc-linux-x64/package.json index 53b07e95..1f9d8db6 100644 --- a/packages/npm/packages/dbc-linux-x64/package.json +++ b/packages/npm/packages/dbc-linux-x64/package.json @@ -24,6 +24,8 @@ "x64" ], "files": [ - "bin/" + "bin/", + "README.md", + "LICENSE" ] } diff --git a/packages/npm/packages/dbc-win32-x64/package.json b/packages/npm/packages/dbc-win32-x64/package.json index fa57098d..726a0b28 100644 --- a/packages/npm/packages/dbc-win32-x64/package.json +++ b/packages/npm/packages/dbc-win32-x64/package.json @@ -24,6 +24,8 @@ "x64" ], "files": [ - "bin/" + "bin/", + "README.md", + "LICENSE" ] } diff --git a/packages/npm/scripts/create_packages.js b/packages/npm/scripts/create_packages.js index f636906a..2b04b6c4 100755 --- a/packages/npm/scripts/create_packages.js +++ b/packages/npm/scripts/create_packages.js @@ -49,8 +49,10 @@ function pkgDirFor(info) { return path.join(PACKAGES_DIR, info.npmPkg.replace(/^@[^/]+\//, "")); } -const PACKAGES_DIR = path.resolve(__dirname, "..", "packages"); -const WRAPPER_DIR = path.resolve(__dirname, "..", "wrapper"); +const PACKAGES_DIR = path.resolve(__dirname, "..", "packages"); +const WRAPPER_DIR = path.resolve(__dirname, "..", "wrapper"); +const REPO_ROOT = path.resolve(__dirname, "..", "..", ".."); +const PLATFORM_README_TEMPLATE = path.join(PACKAGES_DIR, "README.platform.md"); function ghDownload(tag, pattern, destDir) { execFileSync( @@ -126,9 +128,21 @@ function setWrapperVersion(version) { pkgJson.optionalDependencies[dep] = version; } fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2) + "\n"); + fs.copyFileSync(path.join(REPO_ROOT, "LICENSE"), path.join(WRAPPER_DIR, "LICENSE")); console.log(`Updated wrapper package.json to version ${version}`); } +function writePlatformDocs(info, pkgDir) { + // README: substitute PLATFORM placeholder with the unscoped package name + const unscoped = info.npmPkg.replace(/^@[^/]+\/dbc-/, ""); // e.g. "darwin-arm64" + const readme = fs.readFileSync(PLATFORM_README_TEMPLATE, "utf8") + .replaceAll("PLATFORM_SUFFIX", unscoped); + fs.writeFileSync(path.join(pkgDir, "README.md"), readme); + + // LICENSE: copy from the repo root + fs.copyFileSync(path.join(REPO_ROOT, "LICENSE"), path.join(pkgDir, "LICENSE")); +} + function populatePlatform(goosArch, archivePath, version) { const info = findPlatform(goosArch); if (!info) throw new Error(`Unknown platform: ${goosArch}`); @@ -149,6 +163,7 @@ function populatePlatform(goosArch, archivePath, version) { fs.rmSync(tmpDir, { recursive: true, force: true }); } + writePlatformDocs(info, pkgDir); setPackageVersion(pkgDir, version); console.log(` → set ${info.npmPkg} version to ${version}`); } diff --git a/packages/npm/wrapper/README.md b/packages/npm/wrapper/README.md new file mode 100644 index 00000000..cf9a9c0d --- /dev/null +++ b/packages/npm/wrapper/README.md @@ -0,0 +1,94 @@ + + +# dbc dbc Logo + +[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/columnar-tech/dbc/blob/main/LICENSE) +[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/columnar-tech/dbc)](https://github.com/columnar-tech/dbc/releases) +[![npm](https://img.shields.io/npm/v/@columnar-tech/dbc)](https://www.npmjs.com/package/@columnar-tech/dbc) + +**dbc is the command-line tool for installing and managing [ADBC](https://arrow.apache.org/adbc) drivers.** + +## Install + +```sh +npm install -g @columnar-tech/dbc +``` + +Or run without installing: + +```sh +npx @columnar-tech/dbc --help +``` + +## Usage + +Search for available drivers: + +```sh +dbc search +``` + +Install a driver: + +```sh +dbc install snowflake +``` + +Then use it with the [Node.js ADBC driver manager](https://arrow.apache.org/adbc/current/javascript/driver_manager.html): + +```sh +npm install @apache-arrow/adbc-driver-manager apache-arrow +``` + +```typescript +import { AdbcDatabase } from '@apache-arrow/adbc-driver-manager' + +const db = new AdbcDatabase({ + driver: 'snowflake', + databaseOptions: { + username: 'USER', + password: 'PASS', + 'adbc.snowflake.sql.auth_type': 'auth_snowflake', + 'adbc.snowflake.sql.account': 'ACCOUNT-IDENT', + }, +}) + +let conn +try { + conn = await db.connect() + const table = await conn.query('SELECT * FROM CUSTOMER LIMIT 5') + console.log(table.toString()) +} finally { + await conn?.close() + await db.close() +} +``` + +## Other installation methods + +dbc is also available via Homebrew, shell script, pip/uv, WinGet, and MSI installer. +See the [installation docs](https://docs.columnar.tech/dbc/getting_started/installation) for all options. + +## Documentation + +Full documentation at [docs.columnar.tech/dbc](https://docs.columnar.tech/dbc). + +## Links + +- [GitHub Repo](https://github.com/columnar-tech/dbc) +- [Issues](https://github.com/columnar-tech/dbc/issues) +- [Discussions](https://github.com/columnar-tech/dbc/discussions) diff --git a/packages/npm/wrapper/package.json b/packages/npm/wrapper/package.json index aad469ba..4b062bc1 100644 --- a/packages/npm/wrapper/package.json +++ b/packages/npm/wrapper/package.json @@ -21,7 +21,9 @@ "dbc": "bin/dbc.js" }, "files": [ - "bin/" + "bin/", + "README.md", + "LICENSE" ], "optionalDependencies": { "@columnar-tech/dbc-darwin-arm64": "0.3.0", From e9151e0bcc8b7ea5a81a39fb27c8820930b13ee3 Mon Sep 17 00:00:00 2001 From: Bryce Mecum Date: Mon, 18 May 2026 12:34:32 -0700 Subject: [PATCH 06/13] reset version field on all package.json files --- packages/npm/packages/dbc-darwin-arm64/package.json | 2 +- packages/npm/packages/dbc-darwin-x64/package.json | 2 +- packages/npm/packages/dbc-linux-arm64/package.json | 2 +- packages/npm/packages/dbc-linux-x64/package.json | 2 +- packages/npm/packages/dbc-win32-x64/package.json | 2 +- packages/npm/wrapper/package.json | 12 ++++++------ 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/npm/packages/dbc-darwin-arm64/package.json b/packages/npm/packages/dbc-darwin-arm64/package.json index 64357c69..286adb07 100644 --- a/packages/npm/packages/dbc-darwin-arm64/package.json +++ b/packages/npm/packages/dbc-darwin-arm64/package.json @@ -1,6 +1,6 @@ { "name": "@columnar-tech/dbc-darwin-arm64", - "version": "0.3.0", + "version": "0.0.0", "description": "macOS arm64 binary for dbc, the CLI for installing ADBC drivers", "keywords": [ "adbc", diff --git a/packages/npm/packages/dbc-darwin-x64/package.json b/packages/npm/packages/dbc-darwin-x64/package.json index 48be2c69..e5b29a06 100644 --- a/packages/npm/packages/dbc-darwin-x64/package.json +++ b/packages/npm/packages/dbc-darwin-x64/package.json @@ -1,6 +1,6 @@ { "name": "@columnar-tech/dbc-darwin-x64", - "version": "0.3.0", + "version": "0.0.0", "description": "macOS x64 binary for dbc, the CLI for installing ADBC drivers", "keywords": [ "adbc", diff --git a/packages/npm/packages/dbc-linux-arm64/package.json b/packages/npm/packages/dbc-linux-arm64/package.json index 533000da..c6c1b481 100644 --- a/packages/npm/packages/dbc-linux-arm64/package.json +++ b/packages/npm/packages/dbc-linux-arm64/package.json @@ -1,6 +1,6 @@ { "name": "@columnar-tech/dbc-linux-arm64", - "version": "0.3.0", + "version": "0.0.0", "description": "Linux arm64 binary for dbc, the CLI for installing ADBC drivers", "keywords": [ "adbc", diff --git a/packages/npm/packages/dbc-linux-x64/package.json b/packages/npm/packages/dbc-linux-x64/package.json index 1f9d8db6..8dd8bc64 100644 --- a/packages/npm/packages/dbc-linux-x64/package.json +++ b/packages/npm/packages/dbc-linux-x64/package.json @@ -1,6 +1,6 @@ { "name": "@columnar-tech/dbc-linux-x64", - "version": "0.3.0", + "version": "0.0.0", "description": "Linux x64 binary for dbc, the CLI for installing ADBC drivers", "keywords": [ "adbc", diff --git a/packages/npm/packages/dbc-win32-x64/package.json b/packages/npm/packages/dbc-win32-x64/package.json index 726a0b28..588b0e0e 100644 --- a/packages/npm/packages/dbc-win32-x64/package.json +++ b/packages/npm/packages/dbc-win32-x64/package.json @@ -1,6 +1,6 @@ { "name": "@columnar-tech/dbc-win32-x64", - "version": "0.3.0", + "version": "0.0.0", "description": "Windows x64 binary for dbc, the CLI for installing ADBC drivers", "keywords": [ "adbc", diff --git a/packages/npm/wrapper/package.json b/packages/npm/wrapper/package.json index 4b062bc1..11faa819 100644 --- a/packages/npm/wrapper/package.json +++ b/packages/npm/wrapper/package.json @@ -1,6 +1,6 @@ { "name": "@columnar-tech/dbc", - "version": "0.3.0", + "version": "0.0.0", "description": "The CLI for installing and managing ADBC drivers", "keywords": [ "adbc", @@ -26,10 +26,10 @@ "LICENSE" ], "optionalDependencies": { - "@columnar-tech/dbc-darwin-arm64": "0.3.0", - "@columnar-tech/dbc-darwin-x64": "0.3.0", - "@columnar-tech/dbc-linux-arm64": "0.3.0", - "@columnar-tech/dbc-linux-x64": "0.3.0", - "@columnar-tech/dbc-win32-x64": "0.3.0" + "@columnar-tech/dbc-darwin-arm64": "0.0.0", + "@columnar-tech/dbc-darwin-x64": "0.0.0", + "@columnar-tech/dbc-linux-arm64": "0.0.0", + "@columnar-tech/dbc-linux-x64": "0.0.0", + "@columnar-tech/dbc-win32-x64": "0.0.0" } } From 9ecaa55b42420dd221dabe5a2bca00a220f10369 Mon Sep 17 00:00:00 2001 From: Bryce Mecum Date: Mon, 18 May 2026 18:31:53 -0700 Subject: [PATCH 07/13] generate npm artifacts dynamically --- packages/npm/.gitignore | 4 +- ...{README.platform.md => README.template.md} | 0 .../packages/dbc-darwin-arm64/package.json | 31 ------ .../npm/packages/dbc-darwin-x64/package.json | 31 ------ .../npm/packages/dbc-linux-arm64/package.json | 31 ------ .../npm/packages/dbc-linux-x64/package.json | 31 ------ .../npm/packages/dbc-win32-x64/package.json | 31 ------ packages/npm/platforms.js | 5 + packages/npm/scripts/create_packages.js | 96 +++++++++++-------- packages/npm/wrapper/package.json | 35 ------- 10 files changed, 64 insertions(+), 231 deletions(-) rename packages/npm/packages/{README.platform.md => README.template.md} (100%) delete mode 100644 packages/npm/packages/dbc-darwin-arm64/package.json delete mode 100644 packages/npm/packages/dbc-darwin-x64/package.json delete mode 100644 packages/npm/packages/dbc-linux-arm64/package.json delete mode 100644 packages/npm/packages/dbc-linux-x64/package.json delete mode 100644 packages/npm/packages/dbc-win32-x64/package.json delete mode 100644 packages/npm/wrapper/package.json diff --git a/packages/npm/.gitignore b/packages/npm/.gitignore index d4e8637e..3a500e69 100644 --- a/packages/npm/.gitignore +++ b/packages/npm/.gitignore @@ -1,7 +1,9 @@ node_modules/ -# Files populated by scripts/create_packages.js — not committed +# Files generated by scripts/create_packages.js — not committed packages/*/bin/dbc* +packages/*/package.json packages/*/README.md packages/*/LICENSE +wrapper/package.json wrapper/LICENSE diff --git a/packages/npm/packages/README.platform.md b/packages/npm/packages/README.template.md similarity index 100% rename from packages/npm/packages/README.platform.md rename to packages/npm/packages/README.template.md diff --git a/packages/npm/packages/dbc-darwin-arm64/package.json b/packages/npm/packages/dbc-darwin-arm64/package.json deleted file mode 100644 index 286adb07..00000000 --- a/packages/npm/packages/dbc-darwin-arm64/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@columnar-tech/dbc-darwin-arm64", - "version": "0.0.0", - "description": "macOS arm64 binary for dbc, the CLI for installing ADBC drivers", - "keywords": [ - "adbc", - "arrow", - "database", - "drivers", - "dbc" - ], - "homepage": "https://columnar.tech/dbc", - "bugs": "https://github.com/columnar-tech/dbc/issues", - "repository": { - "type": "git", - "url": "https://github.com/columnar-tech/dbc.git", - "directory": "packages/npm/packages/dbc-darwin-arm64" - }, - "license": "Apache-2.0", - "os": [ - "darwin" - ], - "cpu": [ - "arm64" - ], - "files": [ - "bin/", - "README.md", - "LICENSE" - ] -} diff --git a/packages/npm/packages/dbc-darwin-x64/package.json b/packages/npm/packages/dbc-darwin-x64/package.json deleted file mode 100644 index e5b29a06..00000000 --- a/packages/npm/packages/dbc-darwin-x64/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@columnar-tech/dbc-darwin-x64", - "version": "0.0.0", - "description": "macOS x64 binary for dbc, the CLI for installing ADBC drivers", - "keywords": [ - "adbc", - "arrow", - "database", - "drivers", - "dbc" - ], - "homepage": "https://columnar.tech/dbc", - "bugs": "https://github.com/columnar-tech/dbc/issues", - "repository": { - "type": "git", - "url": "https://github.com/columnar-tech/dbc.git", - "directory": "packages/npm/packages/dbc-darwin-x64" - }, - "license": "Apache-2.0", - "os": [ - "darwin" - ], - "cpu": [ - "x64" - ], - "files": [ - "bin/", - "README.md", - "LICENSE" - ] -} diff --git a/packages/npm/packages/dbc-linux-arm64/package.json b/packages/npm/packages/dbc-linux-arm64/package.json deleted file mode 100644 index c6c1b481..00000000 --- a/packages/npm/packages/dbc-linux-arm64/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@columnar-tech/dbc-linux-arm64", - "version": "0.0.0", - "description": "Linux arm64 binary for dbc, the CLI for installing ADBC drivers", - "keywords": [ - "adbc", - "arrow", - "database", - "drivers", - "dbc" - ], - "homepage": "https://columnar.tech/dbc", - "bugs": "https://github.com/columnar-tech/dbc/issues", - "repository": { - "type": "git", - "url": "https://github.com/columnar-tech/dbc.git", - "directory": "packages/npm/packages/dbc-linux-arm64" - }, - "license": "Apache-2.0", - "os": [ - "linux" - ], - "cpu": [ - "arm64" - ], - "files": [ - "bin/", - "README.md", - "LICENSE" - ] -} diff --git a/packages/npm/packages/dbc-linux-x64/package.json b/packages/npm/packages/dbc-linux-x64/package.json deleted file mode 100644 index 8dd8bc64..00000000 --- a/packages/npm/packages/dbc-linux-x64/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@columnar-tech/dbc-linux-x64", - "version": "0.0.0", - "description": "Linux x64 binary for dbc, the CLI for installing ADBC drivers", - "keywords": [ - "adbc", - "arrow", - "database", - "drivers", - "dbc" - ], - "homepage": "https://columnar.tech/dbc", - "bugs": "https://github.com/columnar-tech/dbc/issues", - "repository": { - "type": "git", - "url": "https://github.com/columnar-tech/dbc.git", - "directory": "packages/npm/packages/dbc-linux-x64" - }, - "license": "Apache-2.0", - "os": [ - "linux" - ], - "cpu": [ - "x64" - ], - "files": [ - "bin/", - "README.md", - "LICENSE" - ] -} diff --git a/packages/npm/packages/dbc-win32-x64/package.json b/packages/npm/packages/dbc-win32-x64/package.json deleted file mode 100644 index 588b0e0e..00000000 --- a/packages/npm/packages/dbc-win32-x64/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@columnar-tech/dbc-win32-x64", - "version": "0.0.0", - "description": "Windows x64 binary for dbc, the CLI for installing ADBC drivers", - "keywords": [ - "adbc", - "arrow", - "database", - "drivers", - "dbc" - ], - "homepage": "https://columnar.tech/dbc", - "bugs": "https://github.com/columnar-tech/dbc/issues", - "repository": { - "type": "git", - "url": "https://github.com/columnar-tech/dbc.git", - "directory": "packages/npm/packages/dbc-win32-x64" - }, - "license": "Apache-2.0", - "os": [ - "win32" - ], - "cpu": [ - "x64" - ], - "files": [ - "bin/", - "README.md", - "LICENSE" - ] -} diff --git a/packages/npm/platforms.js b/packages/npm/platforms.js index a2abf049..16bbe031 100644 --- a/packages/npm/platforms.js +++ b/packages/npm/platforms.js @@ -20,6 +20,7 @@ const PLATFORMS = [ { goosArch: "darwin-arm64", npmPkg: "@columnar-tech/dbc-darwin-arm64", + description: "macOS arm64 binary for dbc, the CLI for installing ADBC drivers", binary: "dbc", os: "darwin", cpu: "arm64", @@ -27,6 +28,7 @@ const PLATFORMS = [ { goosArch: "darwin-amd64", npmPkg: "@columnar-tech/dbc-darwin-x64", + description: "macOS x64 binary for dbc, the CLI for installing ADBC drivers", binary: "dbc", os: "darwin", cpu: "x64", @@ -34,6 +36,7 @@ const PLATFORMS = [ { goosArch: "linux-arm64", npmPkg: "@columnar-tech/dbc-linux-arm64", + description: "Linux arm64 binary for dbc, the CLI for installing ADBC drivers", binary: "dbc", os: "linux", cpu: "arm64", @@ -41,6 +44,7 @@ const PLATFORMS = [ { goosArch: "linux-amd64", npmPkg: "@columnar-tech/dbc-linux-x64", + description: "Linux x64 binary for dbc, the CLI for installing ADBC drivers", binary: "dbc", os: "linux", cpu: "x64", @@ -48,6 +52,7 @@ const PLATFORMS = [ { goosArch: "windows-amd64", npmPkg: "@columnar-tech/dbc-win32-x64", + description: "Windows x64 binary for dbc, the CLI for installing ADBC drivers", binary: "dbc.exe", os: "win32", cpu: "x64", diff --git a/packages/npm/scripts/create_packages.js b/packages/npm/scripts/create_packages.js index 2b04b6c4..711cb7ff 100755 --- a/packages/npm/scripts/create_packages.js +++ b/packages/npm/scripts/create_packages.js @@ -52,7 +52,7 @@ function pkgDirFor(info) { const PACKAGES_DIR = path.resolve(__dirname, "..", "packages"); const WRAPPER_DIR = path.resolve(__dirname, "..", "wrapper"); const REPO_ROOT = path.resolve(__dirname, "..", "..", ".."); -const PLATFORM_README_TEMPLATE = path.join(PACKAGES_DIR, "README.platform.md"); +const PLATFORM_README_TEMPLATE = path.join(PACKAGES_DIR, "README.template.md"); function ghDownload(tag, pattern, destDir) { execFileSync( @@ -113,23 +113,59 @@ function extractBinary(archivePath, binaryName, destDir) { return extracted; } -function setPackageVersion(pkgDir, version) { - const pkgJsonPath = path.join(pkgDir, "package.json"); - const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8")); - pkgJson.version = version; - fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2) + "\n"); +const COMMON_FIELDS = { + keywords: ["adbc", "arrow", "database", "drivers", "dbc"], + homepage: "https://columnar.tech/dbc", + bugs: "https://github.com/columnar-tech/dbc/issues", + license: "Apache-2.0", +}; + +function writePlatformPackageJson(info, pkgDir, version) { + const unscoped = info.npmPkg.replace(/^@[^/]+\//, ""); // e.g. "dbc-darwin-arm64" + const pkgJson = { + name: info.npmPkg, + version, + description: info.description, + ...COMMON_FIELDS, + repository: { + type: "git", + url: "https://github.com/columnar-tech/dbc.git", + directory: `packages/npm/packages/${unscoped}`, + }, + os: [info.os], + cpu: [info.cpu], + files: ["bin/", "README.md", "LICENSE"], + }; + fs.writeFileSync( + path.join(pkgDir, "package.json"), + JSON.stringify(pkgJson, null, 2) + "\n", + ); } -function setWrapperVersion(version) { - const pkgJsonPath = path.join(WRAPPER_DIR, "package.json"); - const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8")); - pkgJson.version = version; - for (const dep of Object.keys(pkgJson.optionalDependencies)) { - pkgJson.optionalDependencies[dep] = version; - } - fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2) + "\n"); +function writeWrapperPackageJson(version) { + const optionalDependencies = Object.fromEntries( + PLATFORMS.map((p) => [p.npmPkg, version]), + ); + const pkgJson = { + name: "@columnar-tech/dbc", + version, + description: "The CLI for installing and managing ADBC drivers", + ...COMMON_FIELDS, + repository: { + type: "git", + url: "https://github.com/columnar-tech/dbc.git", + directory: "packages/npm/wrapper", + }, + bin: { dbc: "bin/dbc.js" }, + files: ["bin/", "README.md", "LICENSE"], + optionalDependencies, + }; + fs.writeFileSync( + path.join(WRAPPER_DIR, "package.json"), + JSON.stringify(pkgJson, null, 2) + "\n", + ); fs.copyFileSync(path.join(REPO_ROOT, "LICENSE"), path.join(WRAPPER_DIR, "LICENSE")); - console.log(`Updated wrapper package.json to version ${version}`); + console.log(`Wrote wrapper package.json at version ${version}`); } function writePlatformDocs(info, pkgDir) { @@ -164,8 +200,8 @@ function populatePlatform(goosArch, archivePath, version) { } writePlatformDocs(info, pkgDir); - setPackageVersion(pkgDir, version); - console.log(` → set ${info.npmPkg} version to ${version}`); + writePlatformPackageJson(info, pkgDir, version); + console.log(` → wrote ${info.npmPkg} package.json at version ${version}`); } function parseArgs() { @@ -174,7 +210,6 @@ function parseArgs() { version: null, platform: null, archive: null, - setVersionOnly: false, }; for (let i = 0; i < args.length; i++) { @@ -188,9 +223,6 @@ function parseArgs() { case "--archive": opts.archive = args[++i]; break; - case "--set-version-only": - opts.setVersionOnly = true; - break; default: console.error(`Unknown argument: ${args[i]}`); process.exit(1); @@ -211,29 +243,13 @@ function main() { const created = []; - if (opts.setVersionOnly) { - const platforms = opts.platform - ? [opts.platform] - : PLATFORMS.map((p) => p.goosArch); - for (const goosArch of platforms) { - const info = findPlatform(goosArch); - if (!info) { - console.error(`Unknown platform: ${goosArch}`); - process.exit(1); - } - const pkgDir = pkgDirFor(info); - setPackageVersion(pkgDir, version); - created.push(pkgDir); - } - setWrapperVersion(version); - created.push(WRAPPER_DIR); - } else if (opts.archive) { + if (opts.archive) { if (!opts.platform) { console.error("--platform is required when --archive is provided"); process.exit(1); } populatePlatform(opts.platform, path.resolve(opts.archive), version); - setWrapperVersion(version); + writeWrapperPackageJson(version); created.push(pkgDirFor(findPlatform(opts.platform))); created.push(WRAPPER_DIR); } else { @@ -280,7 +296,7 @@ function main() { created.push(pkgDirFor(info)); } - setWrapperVersion(version); + writeWrapperPackageJson(version); created.push(WRAPPER_DIR); } diff --git a/packages/npm/wrapper/package.json b/packages/npm/wrapper/package.json deleted file mode 100644 index 11faa819..00000000 --- a/packages/npm/wrapper/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "@columnar-tech/dbc", - "version": "0.0.0", - "description": "The CLI for installing and managing ADBC drivers", - "keywords": [ - "adbc", - "arrow", - "database", - "drivers", - "dbc" - ], - "homepage": "https://columnar.tech/dbc", - "bugs": "https://github.com/columnar-tech/dbc/issues", - "repository": { - "type": "git", - "url": "https://github.com/columnar-tech/dbc.git", - "directory": "packages/npm/wrapper" - }, - "license": "Apache-2.0", - "bin": { - "dbc": "bin/dbc.js" - }, - "files": [ - "bin/", - "README.md", - "LICENSE" - ], - "optionalDependencies": { - "@columnar-tech/dbc-darwin-arm64": "0.0.0", - "@columnar-tech/dbc-darwin-x64": "0.0.0", - "@columnar-tech/dbc-linux-arm64": "0.0.0", - "@columnar-tech/dbc-linux-x64": "0.0.0", - "@columnar-tech/dbc-win32-x64": "0.0.0" - } -} From 8d660cce86386c12612d8ec3ab41c5ec6fa4cbc2 Mon Sep 17 00:00:00 2001 From: Bryce Mecum Date: Mon, 18 May 2026 18:36:15 -0700 Subject: [PATCH 08/13] remove per-package bin dirs --- packages/npm/packages/dbc-darwin-arm64/bin/.gitkeep | 0 packages/npm/packages/dbc-darwin-x64/bin/.gitkeep | 0 packages/npm/packages/dbc-linux-arm64/bin/.gitkeep | 0 packages/npm/packages/dbc-linux-x64/bin/.gitkeep | 0 packages/npm/packages/dbc-win32-x64/bin/.gitkeep | 0 packages/npm/scripts/create_packages.js | 4 +++- 6 files changed, 3 insertions(+), 1 deletion(-) delete mode 100644 packages/npm/packages/dbc-darwin-arm64/bin/.gitkeep delete mode 100644 packages/npm/packages/dbc-darwin-x64/bin/.gitkeep delete mode 100644 packages/npm/packages/dbc-linux-arm64/bin/.gitkeep delete mode 100644 packages/npm/packages/dbc-linux-x64/bin/.gitkeep delete mode 100644 packages/npm/packages/dbc-win32-x64/bin/.gitkeep diff --git a/packages/npm/packages/dbc-darwin-arm64/bin/.gitkeep b/packages/npm/packages/dbc-darwin-arm64/bin/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/npm/packages/dbc-darwin-x64/bin/.gitkeep b/packages/npm/packages/dbc-darwin-x64/bin/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/npm/packages/dbc-linux-arm64/bin/.gitkeep b/packages/npm/packages/dbc-linux-arm64/bin/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/npm/packages/dbc-linux-x64/bin/.gitkeep b/packages/npm/packages/dbc-linux-x64/bin/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/npm/packages/dbc-win32-x64/bin/.gitkeep b/packages/npm/packages/dbc-win32-x64/bin/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/npm/scripts/create_packages.js b/packages/npm/scripts/create_packages.js index 711cb7ff..393141ff 100755 --- a/packages/npm/scripts/create_packages.js +++ b/packages/npm/scripts/create_packages.js @@ -184,7 +184,9 @@ function populatePlatform(goosArch, archivePath, version) { if (!info) throw new Error(`Unknown platform: ${goosArch}`); const pkgDir = pkgDirFor(info); - const destPath = path.join(pkgDir, "bin", info.binary); + const binDir = path.join(pkgDir, "bin"); + fs.mkdirSync(binDir, { recursive: true }); + const destPath = path.join(binDir, info.binary); const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "dbc-npm-")); try { From a66e3dade1bb73406859fe127e6d73f5dcc92b17 Mon Sep 17 00:00:00 2001 From: Bryce Mecum Date: Mon, 18 May 2026 18:37:37 -0700 Subject: [PATCH 09/13] format --- packages/npm/scripts/create_packages.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/npm/scripts/create_packages.js b/packages/npm/scripts/create_packages.js index 393141ff..dad802d7 100755 --- a/packages/npm/scripts/create_packages.js +++ b/packages/npm/scripts/create_packages.js @@ -49,9 +49,9 @@ function pkgDirFor(info) { return path.join(PACKAGES_DIR, info.npmPkg.replace(/^@[^/]+\//, "")); } -const PACKAGES_DIR = path.resolve(__dirname, "..", "packages"); -const WRAPPER_DIR = path.resolve(__dirname, "..", "wrapper"); -const REPO_ROOT = path.resolve(__dirname, "..", "..", ".."); +const PACKAGES_DIR = path.resolve(__dirname, "..", "packages"); +const WRAPPER_DIR = path.resolve(__dirname, "..", "wrapper"); +const REPO_ROOT = path.resolve(__dirname, "..", "..", ".."); const PLATFORM_README_TEMPLATE = path.join(PACKAGES_DIR, "README.template.md"); function ghDownload(tag, pattern, destDir) { @@ -164,19 +164,26 @@ function writeWrapperPackageJson(version) { path.join(WRAPPER_DIR, "package.json"), JSON.stringify(pkgJson, null, 2) + "\n", ); - fs.copyFileSync(path.join(REPO_ROOT, "LICENSE"), path.join(WRAPPER_DIR, "LICENSE")); + fs.copyFileSync( + path.join(REPO_ROOT, "LICENSE"), + path.join(WRAPPER_DIR, "LICENSE"), + ); console.log(`Wrote wrapper package.json at version ${version}`); } function writePlatformDocs(info, pkgDir) { // README: substitute PLATFORM placeholder with the unscoped package name const unscoped = info.npmPkg.replace(/^@[^/]+\/dbc-/, ""); // e.g. "darwin-arm64" - const readme = fs.readFileSync(PLATFORM_README_TEMPLATE, "utf8") + const readme = fs + .readFileSync(PLATFORM_README_TEMPLATE, "utf8") .replaceAll("PLATFORM_SUFFIX", unscoped); fs.writeFileSync(path.join(pkgDir, "README.md"), readme); // LICENSE: copy from the repo root - fs.copyFileSync(path.join(REPO_ROOT, "LICENSE"), path.join(pkgDir, "LICENSE")); + fs.copyFileSync( + path.join(REPO_ROOT, "LICENSE"), + path.join(pkgDir, "LICENSE"), + ); } function populatePlatform(goosArch, archivePath, version) { From 63bf7940e3299edfcf7ffdd44cc2d465bceb8c04 Mon Sep 17 00:00:00 2001 From: Bryce Mecum Date: Mon, 18 May 2026 18:37:41 -0700 Subject: [PATCH 10/13] format --- packages/npm/wrapper/bin/dbc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/npm/wrapper/bin/dbc.js b/packages/npm/wrapper/bin/dbc.js index e7c2ca4e..02126fed 100755 --- a/packages/npm/wrapper/bin/dbc.js +++ b/packages/npm/wrapper/bin/dbc.js @@ -32,7 +32,7 @@ try { } catch { console.error( `dbc: could not find the platform package ${entry.npmPkg}.\n` + - ` Try reinstalling: npm install -g @columnar-tech/dbc` + ` Try reinstalling: npm install -g @columnar-tech/dbc`, ); process.exit(1); } From 821ff84c6cde8bc55e03deedb9c2e7b9ac3df75c Mon Sep 17 00:00:00 2001 From: Bryce Mecum Date: Mon, 18 May 2026 18:37:52 -0700 Subject: [PATCH 11/13] improve unsupported platform message --- packages/npm/wrapper/bin/dbc.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/npm/wrapper/bin/dbc.js b/packages/npm/wrapper/bin/dbc.js index 02126fed..474197b4 100755 --- a/packages/npm/wrapper/bin/dbc.js +++ b/packages/npm/wrapper/bin/dbc.js @@ -22,7 +22,9 @@ const { PLATFORMS } = require("../../platforms.js"); const entry = PLATFORMS.find((p) => p.os === platform && p.cpu === arch); if (!entry) { - console.error(`dbc: unsupported platform: ${platform}/${arch}`); + console.error( + `dbc: unsupported platform: ${platform}/${arch}. Please file an issue at https://github.com/columnar-tech/dbc/issues`, + ); process.exit(1); } From bcec6d5fde0a770b54810dc1c9b45b545ceb42da Mon Sep 17 00:00:00 2001 From: Bryce Mecum Date: Tue, 19 May 2026 09:40:48 -0700 Subject: [PATCH 12/13] create npm packages in snapshot job too --- .github/workflows/release.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6753b9c8..f12d2bb6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -94,6 +94,24 @@ jobs: GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + node-version: '24.x' + + - name: Create npm packages + run: | + VERSION="${{ fromJSON(steps.gorelease-snapshot.outputs.metadata).version }}" + for platform in darwin-amd64 darwin-arm64 linux-amd64 linux-arm64; do + node packages/npm/scripts/create_packages.js \ + --version "$VERSION" \ + --platform "$platform" \ + --archive "dist/dbc-${platform}-${VERSION}.tar.gz" + done + node packages/npm/scripts/create_packages.js \ + --version "$VERSION" \ + --platform windows-amd64 \ + --archive "dist/dbc-windows-amd64-${VERSION}.zip" + - name: Upload Snapshot Artifacts uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: @@ -107,6 +125,8 @@ jobs: dist/*.rpm dist/msi/**/*.msi dist/python/* + packages/npm/packages/*/ + packages/npm/wrapper/ production_deploy: runs-on: ubuntu-latest From 4a5809cd8fd56fae79107194a2f7908423c78ad8 Mon Sep 17 00:00:00 2001 From: Bryce Mecum Date: Wed, 20 May 2026 08:45:34 -0700 Subject: [PATCH 13/13] try to install npm packages in snapshot job --- .github/workflows/release.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f12d2bb6..37ca5b19 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -98,7 +98,7 @@ jobs: with: node-version: '24.x' - - name: Create npm packages + - name: Create and verify npm packages run: | VERSION="${{ fromJSON(steps.gorelease-snapshot.outputs.metadata).version }}" for platform in darwin-amd64 darwin-arm64 linux-amd64 linux-arm64; do @@ -112,6 +112,12 @@ jobs: --platform windows-amd64 \ --archive "dist/dbc-windows-amd64-${VERSION}.zip" + # Verify we can install + cd packages/npm/wrapper + npm install ../packages/dbc-linux-x64 + npm install + node bin/dbc.js --version + - name: Upload Snapshot Artifacts uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: