Skip to content

Fix backend.ai-client package metadata for publishable distribution #7196

@yomybaby

Description

@yomybaby

Context

packages/backend.ai-client/package.json (introduced in #6614 / FR-2529) has gaps that make it unsafe to publish or consume from other packages.

Current state

  • tsup builds ESM only (format: ['esm']) but package.json has both "main": "./dist/index.js" (ambiguous) and an "exports" map without a require branch. CJS consumers will silently get the ESM file.
  • No "publishConfig" block — first publish would default to whatever registry is configured locally, with whatever access setting is default.
  • "repository.url" points to a tree path, not a git URL — npm metadata pages can render this oddly.
  • "files": ["dist"] is fine but should also include README.md and LICENSE once those land (FR-2788).

Scope

Pick (a) ESM-only route (preferred — keeps the build simple, matches "type": "module"):

  • Remove "main" field
  • Set "exports" to:
{
  ".": {
    "types": "./dist/index.d.ts",
    "import": "./dist/index.js"
  }
}
  • Add "engines": { "node": ">=18" }
  • Add "sideEffects": false (already present — confirm)
  • Add "publishConfig": { "access": "public" } (or restricted, decide with maintainer)
  • Fix "repository" to:
{
  "type": "git",
  "url": "git+https://github.com/lablup/backend.ai-webui.git",
  "directory": "packages/backend.ai-client"
}
  • Add "homepage", "bugs.url" already present.

Verification

  • pnpm --filter backend.ai-client run build succeeds
  • pnpm --filter backend.ai-client pack --dry-run lists dist/, package.json, README.md, LICENSE (latter two land in FR-2788, so a stale state is acceptable but should be noted)
  • A throwaway import { Client } from 'backend.ai-client' resolves in both Node and Vite/esbuild
  • bash scripts/verify.sh passes
  • pnpm install from repo root still resolves the workspace link

Out of scope

  • ESLint config (separate issue)
  • CI workflow (separate issue)

JIRA Issue: FR-2789

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions