1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-07-07 04:14:26 +00:00
Commit Graph

15 Commits

Author SHA1 Message Date
Jonathan Coates
27dc8b5b2c
Pass follow_redirects flag to the CORS proxy
Currently redirects would be returned from the proxy, and then
immediately followed by XMLHTTPRequest. The proxy now follows requests
(when requested), so that should no longer happen.

We should probably switch over to fetch(...) here, to allow setting
follow_redirects to false, but that's a job for another day.

Haha, so many web emulator related commits of late. This'll die down
soon.
2023-10-08 20:12:47 +01:00
Jonathan Coates
6ec34b42e5
Small cleanup to our web build scripts
- Update to Rollup 4.x
 - Replace terser and postcss with swc and lightningcss. This is
   definitely more code for us to write (maybe I should turn them into
   proper plugins we can depend on), but both speedier and fewer
   dependencies.
 - Drop dependency on glob - we can get away with fs.readdir for what we
   needed it for.
2023-10-08 13:14:02 +01:00
Jonathan Coates
c0643fadca
Build a web-based emulator for the documentation site (#1597)
Historically we've used copy-cat to provide a web-based emulator for
running example code on our documentation site. However, copy-cat is
often out-of-date with CC:T, which means example snippets fail when you
try to run them!

This commit vendors in copy-cat (or rather an updated version of it)
into CC:T itself, allowing us to ensure the emulator is always in sync
with the mod.

While the ARCHITECTURE.md documentation goes into a little bit more
detail here, the general implementation is as follows

 - In project/src/main we implement the core of the emulator. This
   includes a basic reimplementation of some of CC's classes to work on
   the web (mostly the HTTP API and ComputerThread), and some additional
   code to expose the computers to Javascript.

 - This is all then compiled to Javascript using [TeaVM][1] (we actually
   use a [personal fork of it][2] as there's a couple of changes I've
   not upstreamed yet).

 - The Javascript side then pulls in the these compiled classes (and
   the CC ROM) and hooks them up to [cc-web-term][3] to display the
   actual computer.

 - As we're no longer pulling in copy-cat, we can simplify our bundling
   system a little - we now just compile to ESM modules directly.

[1]: https://github.com/konsoletyper/teavm
[2]: https://github.com/SquidDev/teavm/tree/squid-patches
[3]: https://github.com/squiddev-cc/cc-web-term
2023-10-03 09:19:19 +01:00
Jonathan Coates
663eecff0c Relocate our existing web code to subdirectories
- Move the frontend code into src/frontend
 - Move our custom element SSR system into src/htmlTransform.

This is mostly in prep for merging in copy-cat's core, as that's a whole
bunch of extra code.
2023-09-28 21:00:07 +01:00
Jonathan Coates
3188197447
Use Preact for static rendering of components
We already use preact for the copy-cat integration, so it makes sense to
use it during the static pass too. This allows us to drop a dependency
on react.
2023-09-20 22:09:58 +01:00
Jonathan Coates
6c8b391dab
Some web tooling changes
- Switch to tsx from ts-node, fixing issues on Node 20
 - Update rehype
2023-09-18 17:15:03 +01:00
Jonathan Coates
6ac09742fc
Fix errors from the typescript bump
Looks like ./gradlew docWebsite didn't rebuild here.
2023-08-31 20:49:53 +01:00
MineRobber___T
b9edd7c7f6
Add dark mode styling for recipes (#1558)
Exactly what it says on the tin.
2023-08-14 07:51:14 +01:00
Jonathan Coates
8a203e7454
Re-license several more files under MPL-2.0
- Several files where @MCJack123 is the exclusive contributor. He has
   signed over all contributions to "any OSI-approved license". Thank
   you!

 - Various the file handle classes: Looking at these again, I don't
   think they contain any of the original code.
2023-03-28 10:28:59 +01:00
Jonathan Coates
82947a6e67
A couple of CSS tweaks
- Fix the "Run" button scrolling horizontally on small screens.
 - Make the "X" in the computer popup square.
 - Make the computer popup more fun.
2023-03-24 21:02:32 +00:00
Jonathan Coates
895bc7721a
License CC:T according to the REUSE specification (#1351)
This adds SPDX license headers to all source code files, following the
REUSE[1] specification. This does not include any asset files (such as
generated JSON files, or textures). While REUSE does support doing so
with ".license" files, for now we define these licences using the
.reuse/dep5 file.

[1]: https://reuse.software/
2023-03-15 21:52:13 +00:00
Jonathan Coates
a74089d8ae
Bump dependency versions
Mostly in prep for 1.19.4.

 - Update to Loom 1.1.

   - Simplifies our handling of remapped configurations a little.
   - Removes the need for a fake fabric.mod.json in the API jar.

   For reasons I don't quite understand, this required us to bump the
   Fabric API version. Otherwise interfaces are not injected.

 - Update to Rollup 3.0.

 - Do NOT update NullAway: It now correctly checks @Nullable fields in
   inherited classes. This is good, but also a pain as Minecraft is a
   little over-eager in where it puts @Nullable.
2023-03-14 18:43:42 +00:00
Jonathan Coates
77624fc6fd
Update project paths in our utility build scripts 2022-11-10 09:12:28 +00:00
Jonathan Coates
f04acdc199
Split CC:T into common and forge projects
After several weeks of carefully arranging ribbons, we pull the string
and end up with, ... a bit of a messy bow. There were still some things
I'd missed.

 - Split the mod into a common (vanilla-only) project and Forge-specific
   project. This gives us room to add Fabric support later on.

 - Split the project into main/client source sets. This is not currently
   statically checked: we'll do that soon.

 - Rename block/item/tile entities to use suffixes rather than prefixes.
2022-11-10 08:54:09 +00:00
Jonathan Coates
d8e2161f15
Move website source/build logic to projects/web
Mostly useful as it moves some of our build logic out of the main
project, as that's already pretty noisy!
2022-11-06 13:37:07 +00:00