-
Notifications
You must be signed in to change notification settings - Fork 107
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
[FEAT] New web bundle #318
Conversation
Co-authored-by: Wojciech Pawlik <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Can we retain the README section about the CDN? We don't shut it down.
- Should the Netlify CDN config be changed to redirect to https://bundle.deno.dev?
Codecov ReportBase: 36.93% // Head: 36.93% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## main #318 +/- ##
=======================================
Coverage 36.93% 36.93%
=======================================
Files 17 17
Lines 4364 4364
Branches 157 157
=======================================
Hits 1612 1612
Misses 2750 2750
Partials 2 2 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Constantly rebuilding every release is a pain. Let's just not upload new versions to CDN. |
|
I'd remove the CDN entirely and just let |
CDN is pointless now. It has the same code as |
And yet there's no good reason to break people's setups, is there? It is a one-time action to set it up and it will require zero maintenance. |
Sure, feel free to set up a redirect. Documenting it would just cause unnecessary confusion tho. |
set -eu | ||
|
||
# Cloudflare Workers don't support top-level await | ||
sed -i~ 's/^if (isDeno)/if (false)/' ../src/platform.deno.ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this, mostly because regex on source is very ugly and hard to maintain. The whole point is to have one clean file per platform. If we want to support different platforms that require different platform-specific code, we should create a new file and cp
our way through.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we rewrite to prevent top level awaits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we provide a new file platform.web.ts
, we can write it w/o TLA, yes.
cp ../LICENSE bundle/ | ||
cp ../README.md bundle/ | ||
shopt -s globstar | ||
rm bundle/**/*.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to explicitly copy over the files we need, rather than copying over everything and then deleting some specific parts of it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would, but glob patterns are very sketchy and I couldn't get cp to reproduce the existing folder structure but ignore js files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rsync
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't used it before.
I'll look into it
Co-authored-by: KnorpelSenf <[email protected]>
I want to look into this in my holidays |
rm bundle/**/*.js | ||
|
||
echo "Bundling source" | ||
deno bundle ../src/mod.ts bundle/out/mod.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
… then there is https://deno.land/[email protected]/tools/bundler#bundling-for-the-web:
The output of deno bundle is intended for consumption in Deno and not for use in a web browser or other runtimes. That said, depending on the input it may work in other environments.
If you wish to bundle for the web, we recommend other solutions such as esbuild.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Esbuild wasn't smart enough to omit if (false)
when I last tired it. Unlike SWC used by deno bundle
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (false)
is a big hack that should be avoided anyway. Do you remember how we went from bash scripts to d2n? I'd like to make a similar move here, and end up using good tools rather than writing custom scripts.
bb290f9
to
d05dbc0
Compare
New bundling script generates
bundling/bundle
folder which can benpm publish
ed creating@grammyjs/web
.The
package.json
for the new package is automatically generated from the currentpackage.json
to avoid version mismatches.Tested with vite, but not with CF workers.
Co-authored-by: Wojciech Pawlik [email protected]