Skip to content

Add npm packaging #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

lalalune
Copy link
Contributor

@lalalune lalalune commented Jun 5, 2025

This PR adds npm packaging and publishing for hyperfy, at least for the Node client. Includes limited Typescript support. Requires some more testing, but pushing the draft for feedback

tcm390 and others added 13 commits May 13, 2025 17:38
I've set up the project for NPM packaging of the Node.js client.

Key changes include:
- Updates `src/node-client/index.js` to export System, Node, and World.
- Modifies `scripts/build-node-client.mjs` to:
  - Output to `dist/npm/`.
  - Copy PhysX assets to `dist/npm/vendor/`.
  - Generate a `package.json` for the NPM package in `dist/npm/`.
  - Generate a fallback `index.d.ts` in `dist/npm/` (automated generation via dts-bundle-generator failed when I checked it).
- Adds `typescript` and `dts-bundle-generator` as devDependencies.
- Updates the main `package.json` with a `publish:node` script and adds `dist/npm/` to the `files` array.
- Adds a GitHub Actions workflow (`.github/workflows/npm-publish.yml`) to automate publishing to NPM on new GitHub releases.
- Updates `README.md` with installation and publishing instructions.

Note: Further work is required to address:
- A runtime error "navigator is not defined" when using the client in Node.js.
- Issues with the accuracy and completeness of the generated `index.d.ts` TypeScript definitions.

This commit includes all preparatory work up to the point of encountering these critical issues when I checked it.
@lalalune lalalune marked this pull request as ready for review June 19, 2025 07:08
Export required modules for plugin-hyperfy
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.

2 participants