Anyone tried Zapatos with Deno?
This is a fantastic idea and excellent library. Any chance that it might work in Deno scripts?
Thanks. I've not really looked at Deno yet, but I'll leave this open for now in case anyone else wants to chime in.
Thanks @jawj if you're interested, Denoify is a tool that could make it easier to maintain this package for both NodeJS and Deno at the same time.
@jawj did you get a chance to check out Deno since we chatted? I've found that Pika is a great CDN to use to help auto-convert to Deno:
https://www.skypack.dev/view/zapatos
As you can see, Zapatos already has a high Package Score (86) and just needs one minor change in your package.json to potentially be fully compatible with Deno (see the "fix" button):

@jawj if you've had a moment to take a peek at Deno or SkyPack to fix the TypeScript Types warning (see above) we're ready to give this a try in our projects. Thanks!
We use the "exports" key in package.json to export the db and generate submodules separately, and as far as I can see there's not yet any way to explicitly map those to separate type declaration files (there's a suggestion to add a "types" key under each exported name, which looks sensible enough, but doesn't seem to have happened yet).
Happy to consider a PR if you can find a workaround.
Thanks for the hint @jawj - that's helpful. Deno does not use package.json and is "pure TypeScript" so I'll see if I can figure out a way around the exports key in package.json.
@shah any luck with this?
Thanks for checking in @jawj! Unfortunately because Zapatos is not natively ESM, I had to use Skypack.dev's packager but this is what is generated:
/*
* [Package Error] "[email protected]" could not be built.
*
* [1/5] Verifying package is valid…
* [2/5] Installing dependencies from npm…
* [3/5] Building package using esinstall…
* Running esinstall...
* No "exports" main resolved in zapatos/package.json
* No "exports" main resolved in /tmp/cdn/_eJ13sZAAmqsToAOlkfmZ/node_modules/zapatos/package.json
*
* How to fix:
* - If you believe this to be an error in Skypack, file an issue here: https://github.com/skypackjs/skypack-cdn/issues
* - If you believe this to be an issue in the package, share this URL with the package authors to help them debug & fix.
* - Use https://skypack.dev/ to find a web-friendly alternative to find another package.
*/
console.warn("[Package Error] \"[email protected]\" could not be built. \n[1/5] Verifying package is valid…\n[2/5] Installing dependencies from npm…\n[3/5] Building package using esinstall…\nRunning esinstall...\nNo \"exports\" main resolved in zapatos/package.json\nNo \"exports\" main resolved in /tmp/cdn/_eJ13sZAAmqsToAOlkfmZ/node_modules/zapatos/package.json");
throw new Error("[Package Error] \"[email protected]\" could not be built. ");
export default null;
This is my Deno test file:
import * as zg from "https://cdn.skypack.dev/zapatos/generate";
//import * as z from "https://cdn.skypack.dev/zapatos";
const zapCfg: zg.Config = {
db: { connectionString: "postgres://localhost/mydb" },
};
await zg.generate(zapCfg);
Hmm. Looks like this is still the issue I mentioned before, about types being found for named exports. There's continuing discussion on the TS issue.
Agreed, @jawj - I have been thinking of creating a Deno-native port of Zapatos for that reason. As long as there are no NodeJS-specific APIs being used, it should be straightforward to port.
The referenced TS issue got fixed if I'm not mistaken.
@tbo here's what I get when I try it in Deno 1.16 using SkyPack.dev:
❯ deno-run https://cdn.skypack.dev/zapatos
Download https://cdn.skypack.dev/zapatos
Download https://cdn.skypack.dev/-/[email protected]/dist=es2019,mode=raw/zapatos
error: Import 'https://cdn.skypack.dev/-/[email protected]/dist=es2019,mode=raw/zapatos' failed, not found.
at https://cdn.skypack.dev/zapatos:16:23
❯ deno-run https://cdn.skypack.dev/@pantas-net/zapatos
Download https://cdn.skypack.dev/@pantas-net/zapatos
Download https://cdn.skypack.dev/new/@pantas-net/[email protected]/dist=es2019
Download https://cdn.skypack.dev/-/@pantas-net/[email protected]/dist=es2019,mode=raw/@pantas-net/zapatos
error: Import 'https://cdn.skypack.dev/-/@pantas-net/[email protected]/dist=es2019,mode=raw/@pantas-net/zapatos' failed, not found.
Were you using it from another CDN/source?
@shah I didn't actually try it out. I just noticed that the TS issue mentioned in https://github.com/jawj/zapatos/issues/28#issuecomment-783564539 got closed. I thought I mention it, because @jawj added the "waiting for other project" due to that issue.