Offroaders123 / NBTify

A library to read and write NBT files on the web!
http://npm.im/nbtify
MIT License
42 stars 5 forks source link

GitHub Pages Demo Site #10

Closed Offroaders123 closed 2 months ago

Offroaders123 commented 2 years ago

Now that the library needs a build step, I may have to make a separate example page that's different from the test pages. At least now I can reference the latest builds from npm! That's a great bonus that will really help out! Not sure if anyone's reading this, but does anyone know if you can associate TypeScript types for a CDN URL? I think I almost got it working by using declare module on the URL, and referencing the exports from an npm install of the library itself. Seems like a nice solution, but maybe there's a simpler one I don't know about yet.

Offroaders123 commented 2 months ago

I don't think this specifically is quite as much of a goal now, since there are usable demos out there now, like Dovetail and img2mcstructure for example. If anything, I'd want to point to those, and to write more documentation examples, rather than a demo specific to this repo.

In regards to the part about getting type-checking for the CDN import of NBTify, yes this is what it looks like to get it working:

// nbtify.d.ts

declare module "https://cdn.jsdelivr.net/npm/nbtify@2.0.0/+esm" {
  export * from "nbtify";
}

So it does involve you in needing to install it with npm, specifically with type-checking in mind. I was looking into automatic type detection, but I wasn't able to get it working, or at least I couldn't figure out how to get it working.