Skip to content

Add npm publishing support with Node.js compatibility - #5

Merged
russwyte merged 1 commit into
mainfrom
graphql-api-rewrite
Oct 31, 2025
Merged

russwyte merged 1 commit into
mainfrom
graphql-api-rewrite

Conversation

@russwyte

Copy link
Copy Markdown
Owner

Summary

  • Configure package for npm publishing with compiled JavaScript output
  • Add build script to transpile TypeScript to Node.js-compatible JavaScript
  • Update package.json to point to dist/ output instead of TypeScript sources
  • Package now published at https://www.npmjs.com/package/@russwyte/slabby

Changes

Build Configuration

  • Added build script using Bun bundler targeting Node.js runtime
  • Configured prepublishOnly hook to run tests and build automatically
  • Build process converts Bun shebang to Node.js shebang for broader compatibility

Package Configuration

  • Changed main from index.ts to ./dist/index.js
  • Updated bin.slabby from ./index.ts to dist/index.js
  • Modified files array to include only dist/ folder (not source files)
  • Bumped version from 0.1.0 to 0.1.1

Benefits

  • Package can now be installed globally via npm install -g @russwyte/slabby
  • Works with Node.js while maintaining Bun-first development workflow
  • Automated build process ensures published package is always up-to-date

Test plan

  • Build script successfully compiles TypeScript to JavaScript
  • Tests pass before publishing (prepublishOnly hook)
  • Package published successfully to npm registry
  • Global installation works: npm install -g @russwyte/slabby
  • Installed binary is executable and has correct shebang

Update package configuration to support publishing as a Node.js-compatible npm package:

- Add build script using Bun bundler to transpile TypeScript to JavaScript targeting Node.js
- Configure bin entry to point to compiled output (dist/index.js) instead of TypeScript source
- Change main entry point from TypeScript (index.ts) to compiled JavaScript (dist/index.js)
- Update files array to include only dist folder, README, and LICENSE in published package
- Add prepublishOnly hook to run tests and build before publishing
- Modify build script to replace Bun shebang with Node.js shebang for broader compatibility
- Bump version to 0.1.1

This enables installation via npm while maintaining Bun-first development workflow.
The package is now published and available at: https://www.npmjs.com/package/@russwyte/slabby
@russwyte
russwyte merged commit 4574de6 into main Oct 31, 2025
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