Skip to content

fix(packaging): make npm package publishable - #36

Open
gmenher wants to merge 1 commit into
Gkrumbach07:mainfrom
gmenher:fix/npm-package-publishable
Open

fix(packaging): make npm package publishable#36
gmenher wants to merge 1 commit into
Gkrumbach07:mainfrom
gmenher:fix/npm-package-publishable

Conversation

@gmenher

@gmenher gmenher commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Ref: #30

Summary

Fixes the packaging issues that block the automated publish pipeline (#11).

Changes

  1. Root . export — Add entry so bare import from 'openshell-dashboard' resolves correctly under modern bundlers.
  2. Fix types field — Point at dist/pages/index.d.ts to match main/module (was dist/types/index.d.ts, causing type/runtime mismatch for consumers).
  3. Remove duplicate peerDeps from dependencies — 9 packages (react, react-dom, react-router-dom, @patternfly/*, @tanstack/react-query) were in both peerDependencies and dependencies. Consumers got a second copy of React in their tree, breaking context hooks.
  4. Add build:lib to CI — Catches packaging breakage before merge.
  5. Add exports resolution verification — After build:lib, CI does npm pack + installs in a temp dir + require.resolve on all export entries. Catches broken exports maps.

NOT included (deliberate)

"type": "module" is not added. The tsconfig emits extensionless relative imports (ESNext with moduleResolution: node). Node ESM requires explicit .js extensions, so type: module would break Node-direct usage. Since the sole consumer is a bundler (webpack/rspack in odh-dashboard), this is unnecessary and would be harmful.

Testing

Verified locally:

cd frontend && npm run build:lib   # ✅ compiles clean
npm pack --pack-destination /tmp
mkdir /tmp/verify-pkg && cd /tmp/verify-pkg
npm init -y
npm install --legacy-peer-deps /tmp/openshell-dashboard-0.1.0.tgz
node -e "
  require.resolve('openshell-dashboard');
  require.resolve('openshell-dashboard/pages');
  require.resolve('openshell-dashboard/components');
  require.resolve('openshell-dashboard/api');
  require.resolve('openshell-dashboard/types');
  require.resolve('openshell-dashboard/slots');
  console.log('All exports resolve correctly');
"
# Output: All exports resolve correctly

Also verified go build ./... and go test ./... pass (backend unchanged).

Address the packaging issues blocking the automated publish pipeline (Gkrumbach07#11):

- Add root '.' entry to exports map so bare 'import from openshell-dashboard'
  resolves correctly under modern bundlers.
- Fix types field: point at dist/pages/index.d.ts to match main/module
  (was dist/types/index.d.ts, causing type/runtime mismatch for consumers).
- Remove 9 peerDependencies duplicated in dependencies (react, react-dom,
  react-router-dom, @patternfly/*, @tanstack/react-query). Consumers were
  getting a second copy of React in their tree, breaking context hooks.
- Add build:lib step to CI so publishability cannot silently break.
- Add exports resolution verification step (npm pack + require.resolve).

Note: 'type: module' deliberately NOT added. The tsconfig emits extensionless
relative imports (ESNext with node moduleResolution). Node ESM requires explicit
extensions, so type:module would break Node-direct usage. Since the sole consumer
is a bundler (webpack/rspack in odh-dashboard), this is unnecessary.

Closes Gkrumbach07#30
@gmenher
gmenher requested a review from Gkrumbach07 as a code owner August 12, 2026 16:50
@danreed-rh
danreed-rh self-requested a review August 12, 2026 17:32
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.

1 participant