-
Notifications
You must be signed in to change notification settings - Fork 27
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
Separate the (Python) server from the frontend in the source tree #1952
Comments
OK, I think I am getting close to this. Everything is working nicely locally; you can test my js-split branch. To answer the remaining question about JS tracebacks, I've added two build modes - when Fontra is installed with FontraPak works with a small change to the fontoverview URL. I think I need to check that other projectmanager implementations also work. |
Oh... and the renaming of JavaScript imports is now scripted, so we can quickly recreate the "big-bang" commit whenever we decide to do it. |
Do you mean the "making all JS imports consistent as well as working in the new environment"? |
Right. Once the JS scripts are moved into their new |
Lovely. |
If I start the server in the
...and go to
I did |
I'll try it from a clean checkout but it feels like the |
|
|
Nope, I haven't done that bit yet. (I did it in the first PoC, I'll bring that change over.) |
Yeah, I'd forgotten a |
That works, great! |
The RCJK project manager isn't working, but it sounds like it isn't expected to be yet. I do see some login fields, but the CSS is missing so the layout is all garbled. I'll send you an email with a private server location so you can test. |
Thank you. I've just done a new (force) push and tests are working. |
I think I need to think a bit more deeply about how to make pluggable project managers like fontra-rcjk work. They need to ship their own HTML/JS assets, but we can't expect them to be bundled into the |
(Also struggling with this.) We can let go of the I do like the idea of having a Python package that we can use to target the bundler output, but it doesn't have to be |
Well, the issue is that we build a bunch of HTML/JS assets at Fontra install time, and then later a user does |
OK, I think I have something but I'm not entirely happy with it, so I'm just whiteboarding here. We have multiple classes of thing: Current modelViewsWhat is it? A HTML file and one or more JS files and other assets. ProjectmanagersBasically the same as views, but:
New modelViewsWhat is it? A HTML file and one or more JS files and other assets. And I can't punt on the "custom views" problem, because it's broadly equivalent to the "custom projectmanagers" problem and we need that to work for RCJK. So. Maybe we're in a world where
Yeah. I think that's basically where I had got to in my head anyway, but now I'm convinced. |
OK, I now think I have this working, including custom out-of-tree views (demonstration package) and RoboCJK projectmanager. |
I can't get this to work. I started with fresh checkouts of your fontra and fontra-rcjk forks, in their js-split branches. In fontra, with Node 23:
In fontra-rcjk:
|
|
Should have fixed those issues now. |
pip install in fontra-rcjk still fails.
|
Argh, failed to |
That works! Thanks. If I look into fontra-rcjk's package-lock.json files, I see entries like this: "node_modules/@fontra/core": {
"version": "0.0.1",
"resolved": "https://gitpkg.vercel.app/simoncozens/fontra/src-js/fontra-core?js-split",
"integrity": "sha512-z6MSlkveHndgmlxceVm8e5cDoc52aXyNA6PN1jBcOAURUMetgPp6W/cGXhbXFHlZ6rHn9r5cR3yb8cjMrKPf7A==",
"dependencies": {
"@fontra/core": "file:",
"bezier-js": "^6.1.4",
"fflate": "^0.8.2",
"lib-font": "^2.4.3",
"tsc": "^2.0.4"
}
}, Can you elaborate a bit on how this works and why it needs to refer to an external fontra-core? |
Currently fontra-rcjk does this:
assuming that it will be able to find those individual JS files in the server's deployment directory. This is no longer true in the new model, because (a) Post-change, fontra-cjk will do this:
That is, it will import these two functions from JS dependencies, and the code for these two functions will be bundled into the single JS file which makes up For that to happen, |
Understood, so these would ultimately point to our own repos via the gitpkg.vercel.com tool. Does this also imply that in the fontra-views-features demo, all needed bits of fontra/core will be bundled for that view, and not be shared with the builtin views? (Assuming fontra/core is at least shared among builtin views) |
It does, yes. Once I have a useful demo plugin we can see how much of |
Is it the same for builtin views, as in, are they each bundled individually? |
Yes and no; webpack can be configured to split out common code. I haven't played with the different ways to optimise this yet. |
I have now played with this, and we really can save whatever chunks we like - all the
Or we can configure it to do essentially what we have right now:
It's all tweakable. |
This is with @simoncozens: to clean up the Fontra source tree, and clearly separate the Python server source code from the front end code and assets, with the purpose of opening up more deployment options for Fontra, such as a serverless version.
Possible breakage that we must keep in mind
Steps:
start.js
files (Move JS code from HTML to start.js #1984)webpack.config.js
, package subdirectory structure, etc.) (JS package scaffolding #1985)bundle-rollup
tobuild
in package.json, make build hook similarly generically named (Make bundler actions generically named #1983)(To be edited...)
The text was updated successfully, but these errors were encountered: