excaliburjs / Excalibur

🎮 Your friendly TypeScript 2D game engine for the web 🗡️
https://excaliburjs.com
BSD 2-Clause "Simplified" License
1.83k stars 191 forks source link

JSR? Include src in npm package #2296

Open Cretezy opened 2 years ago

Cretezy commented 2 years ago

Context

Sometimes while digging through code, it's useful to see the original implementation of a method.

Proposal

Include src in the published npm package, allowing "Go to implementation" in editor. Example change: https://github.com/excaliburjs/Excalibur/commit/ce8ec03410b90b56b963139a9ceabd2b7cf377a4

eonarheim commented 2 years ago

I agree this would be very useful!

One way this could work in the current state would be to use Excalibur as a git submodule and import the main entry point (something like import * as ex from ./lib/excalibur/src/engine). Although git submodules are notoriously tricky and full of sharp corners.

I found an interesting concept mentioned online called a "source package", which would be a separate package that would contain the raw source files and allow users to opt-in to source files https://stackoverflow.com/a/57534667, CRA has a proposal

@kamranayub @jedeen What do you think about exploring and potentially publishing a "source package"? Or does it make sense to include all the source in the main package?

github-actions[bot] commented 2 years ago

This issue hasn't had any recent activity lately and is being marked as stale automatically.

eonarheim commented 1 month ago

I'm thinking about use the new package registry https://jsr.io/ to do this, it'll host the TypeScript source code for your package as long as your package is esm