Skip to content

fix(vscode): ship self-contained, OS-portable .vsix via npm#159

Merged
jung-thomas merged 1 commit into
mainfrom
fix/vscode-extension-standalone-vsix
Jul 11, 2026
Merged

fix(vscode): ship self-contained, OS-portable .vsix via npm#159
jung-thomas merged 1 commit into
mainfrom
fix/vscode-extension-standalone-vsix

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Summary

Fixes #158. The VS Code extension had three problems that made it effectively uninstallable for users:

  1. No .vsix shipped in the npm package — so hana-cli vscode install fell through to instructions that pointed at a Marketplace listing that doesn't exist and a from-source build that fails.
  2. Blank webviews when installed — the built .vsix loaded its Vue UI from ../app/vue/dist-vscode, a sibling path that only exists inside the repo, not in an installed extension.
  3. OS-specific native binarybetter-sqlite3 (a native .node module) was compiled into the bundle, so a .vsix built on one OS wouldn't load on another.

@ihenry's report was exactly this: Marketplace search returns nothing, and npm run bundle fails with dozens of Could not resolve "express" / "exceljs" / "@sap/cds" … errors — because the extension's bundle reaches into the root project's node_modules, which he hadn't installed.

Changes

Self-contained webview UI

  • htmlProvider.ts: new resolveWebviewDist() prefers a local webview-dist/ (shipped in the .vsix), falls back to ../app/vue/dist-vscode for F5 dev-launch.
  • esbuild.config.mjs: copies app/vue/dist-vscodevscode-extension/webview-dist during bundle.

OS-portable — no native binary

  • utils/database/index.js: default the sqlite CDS driver to Node's built-in node:sqlite (respects any explicit override). Matches the CAP 10 default; the Node >=22 baseline always ships it.
  • esbuild.config.mjs: mark better-sqlite3 external so no .node binary is bundled. (Kept sqlite3 external — the build proved it's a guarded optional require in @sap/cds.)

Ship the .vsix via npm

  • vscode-extension/.npmignore: allow the git-ignored *.vsix into the npm tarball while excluding all extension source.
  • .github/workflows/release-hana-cli.yml: build a fresh .vsix in the publish job (installs app/vue + vscode-extension deps that root npm ci doesn't). Also fixes a latent prepack: build:vue failure — that step was added after the last successful publish and would break the next release.

Docs

  • Document the root-install prerequisite for building from source (the exact #158 errors) and the offline bundled-.vsix install.

Verification

  • ✅ New .vsix contains the Vue UI (301 files; the old one had 8, no UI).
  • ✅ New .vsix contains zero .node native binaries.
  • ✅ End-to-end: CDS connects with driver:'node', SELECT 1 runs, and better-sqlite3 is never loaded (cap-js/node-sqlite.js is).
  • ✅ npm tarball ships exactly one .vsix + package.json from vscode-extension/, no source.
  • eslint clean; 14 tests/utils/database.Test.js tests pass.

Notes

  • node:sqlite emits an ExperimentalWarning on Node 22 (stabilizes in a later release) — expected and harmless for a dev tool, and it's the CAP 10 direction.
  • The extension is still not published to the VS Code Marketplace; this PR makes the bundled-.vsix install path the reliable one.

The packaged extension previously installed but rendered blank webviews and
carried a platform-specific native sqlite binary, and no .vsix shipped in the
npm package — so `hana-cli vscode install` could never find one (issue #158).

Webview UI (was loaded from a sibling path that only exists in the repo):
- htmlProvider resolves a local `webview-dist/` (shipped inside the .vsix),
  falling back to ../app/vue/dist-vscode for F5 dev-launch.
- esbuild copies app/vue/dist-vscode into vscode-extension/webview-dist during
  bundle, with a warning if assets are missing.

OS portability (was bundling better-sqlite3's native .node binary):
- Default the sqlite CDS driver to Node's built-in node:sqlite (respecting any
  explicit override); matches the CAP 10 default, Node >=22 baseline always
  ships it. Verified end-to-end: SELECT runs, better-sqlite3 never loads.
- Mark better-sqlite3 external in esbuild so no native binary is bundled. Keep
  sqlite3 external (it is a guarded optional require in @sap/cds).

Ship the .vsix via npm:
- Add vscode-extension/.npmignore so the git-ignored *.vsix is allowed into the
  npm tarball while all extension source is excluded.
- Build a fresh .vsix in the release workflow's publish job (installs app/vue +
  vscode-extension deps that root `npm ci` does not). This also fixes a latent
  prepack:build:vue failure that would break the next publish.

Docs: document the root-install prerequisite for building from source (the
exact esbuild "Could not resolve" errors from #158) and the offline install.
@jung-thomas
jung-thomas merged commit 7516df5 into main Jul 11, 2026
20 of 21 checks passed
@jung-thomas
jung-thomas deleted the fix/vscode-extension-standalone-vsix branch July 11, 2026 17:52
jung-thomas added a commit that referenced this pull request Jul 11, 2026
Version bump + changelog for the 4.202607.0 release. Done via PR because the
release workflow's workflow_dispatch path pushes the bump commit directly to
main, which the branch-protection rulesets reject (GH013). After this merges,
pushing the v4.202607.0 tag triggers the workflow's tag path (resolve-version
-> publish), which does not push to main and publishes cleanly.

Includes: self-contained OS-portable VS Code .vsix (#159), CAP 10 + cds-10
drivers (#160), TypeScript 7 for extension/mcp-server + consolidated deps
(#160, #162), Group B majors (#162), i18n key fixes (#163).

Co-authored-by: Thomas Jung <12159356+jung-thomas@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not able to find or install vscode extension

1 participant