grammyjs / conversations

Conversational interfaces for grammY.
https://grammy.dev/plugins/conversations
MIT License
48 stars 17 forks source link

Web bundle concept #82

Closed PonomareVlad closed 12 months ago

PonomareVlad commented 1 year ago

Is this the right direction, or need something different ? 🌚

codecov[bot] commented 1 year ago

Codecov Report

Patch and project coverage have no change.

Comparison is base (3124f1f) 95.83% compared to head (723482e) 95.83%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #82 +/- ## ======================================= Coverage 95.83% 95.83% ======================================= Files 4 4 Lines 840 840 Branches 124 124 ======================================= Hits 805 805 Misses 33 33 Partials 2 2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

wojpawlik commented 1 year ago

You can already use deno2node API to write a shared build script. I'm happy to help :)

TypeScript expects tsconfig.json to be a local file, and it uses it to resolve source files.

KnorpelSenf commented 1 year ago

We want to share the config between projects, and resolve files via script args

wojpawlik commented 1 year ago

The API doesn't even require tsconfig.json:

const ctx = new Context({ compilerOptions });
ctx.project.addSourceFilesAtPaths(...);

and then https://github.com/fromdeno/deno2node/blob/1461bd6e634ee3953545c4ce7823c4b024dc0793/src/cli.ts#L37-L46.

wojpawlik commented 1 year ago

I don't know how to prevent bundling entire grammY in.

Isn't the Node build of conversations web compatible already?

PonomareVlad commented 1 year ago

Isn't the Node build of conversations web compatible already?

No, because oson depends on @deno/shim-deno package that imports node-specific fs apis

wojpawlik commented 1 year ago

https://github.com/KnorpelSenf/oson/blob/0fe5862fbb67181b902c5f2b1d50979079f0a369/build.ts#L22 can be removed @KnorpelSenf (https://github.com/KnorpelSenf/oson/issues/7)

PonomareVlad commented 1 year ago

@wojpawlik https://t.me/grammyjs/149613

KnorpelSenf commented 12 months ago

We are going to:

  1. Create a Deno script that uses d2n and can build everything (npm package and web build)
  2. Unify the build and CI setup across the entire organisation with that script
  3. Pass in everything as arguments, so that the build output no longer depends on config files in the respective repo

I don't really know yet when this will happen, but once it does, it will supersede this.

PonomareVlad commented 12 months ago

If someone is looking for a way to solve the problem of running the conversations plugin in the Vercel Edge environment, it is:

{
  "dependencies": {
    "@grammyjs/conversations": "^1.1.2"
  },
  "overrides": {
    "o-son": "npm:@ponomarevlad/o-son@1.0.1-web.1"
  }
}

Full example