mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-11-17 23:34:51 +00:00
c0643fadca
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
119 lines
3.7 KiB
Common Lisp
119 lines
3.7 KiB
Common Lisp
; -*- mode: Lisp;-*-
|
|
|
|
; SPDX-FileCopyrightText: 2021 The CC: Tweaked Developers
|
|
;
|
|
; SPDX-License-Identifier: LicenseRef-CCPL
|
|
|
|
(sources
|
|
/doc/
|
|
/projects/forge/build/docs/luaJavadoc/
|
|
/projects/core/src/main/resources/data/computercraft/lua/bios.lua
|
|
/projects/core/src/main/resources/data/computercraft/lua/rom/
|
|
/projects/core/src/test/resources/test-rom
|
|
/projects/web/src/frontend/mount)
|
|
|
|
(doc
|
|
; Also defined in projects/web/build.gradle.kts
|
|
(destination /projects/web/build/illuaminate)
|
|
(index doc/index.md)
|
|
|
|
(site
|
|
(title "CC: Tweaked")
|
|
(logo projects/common/src/main/resources/pack.png)
|
|
(url https://tweaked.cc/)
|
|
(source-link https://github.com/cc-tweaked/CC-Tweaked/blob/${commit}/${path}#L${line})
|
|
|
|
(styles /projects/web/build/rollup/index.css)
|
|
(scripts /projects/web/build/rollup/index.js)
|
|
(head doc/head.html))
|
|
|
|
(module-kinds
|
|
(peripheral Peripherals)
|
|
(generic_peripheral "Generic Peripherals")
|
|
(event Events)
|
|
(guide Guides)
|
|
(reference Reference))
|
|
|
|
(library-path
|
|
/doc/stub/
|
|
/projects/forge/build/docs/luaJavadoc/
|
|
|
|
/projects/core/src/main/resources/data/computercraft/lua/rom/apis/
|
|
/projects/core/src/main/resources/data/computercraft/lua/rom/apis/command/
|
|
/projects/core/src/main/resources/data/computercraft/lua/rom/apis/turtle/
|
|
|
|
/projects/core/src/main/resources/data/computercraft/lua/rom/modules/main/
|
|
/projects/core/src/main/resources/data/computercraft/lua/rom/modules/command/
|
|
/projects/core/src/main/resources/data/computercraft/lua/rom/modules/turtle/))
|
|
|
|
(at /
|
|
(linters
|
|
syntax:string-index
|
|
doc:docusaurus-admonition
|
|
doc:ldoc-reference
|
|
|
|
;; It'd be nice to avoid this, but right now there's a lot of instances of
|
|
;; it.
|
|
-var:set-loop
|
|
|
|
;; It's useful to name arguments for documentation, so we allow this. It'd
|
|
;; be good to find a compromise in the future, but this works for now.
|
|
-var:unused-arg)
|
|
|
|
(lint
|
|
(bracket-spaces
|
|
(call no-space)
|
|
(function-args no-space)
|
|
(parens no-space)
|
|
(table space)
|
|
(index no-space))
|
|
|
|
(allow-clarifying-parens true)
|
|
|
|
;; colours imports from colors, and we don't handle that right now.
|
|
;; keys is entirely dynamic, so we skip it.
|
|
(dynamic-modules colours keys _G)
|
|
|
|
(globals
|
|
:max
|
|
_CC_DEFAULT_SETTINGS
|
|
_CC_DISABLE_LUA51_FEATURES
|
|
_HOST
|
|
;; Ideally we'd pick these up from bios.lua, but illuaminate currently
|
|
;; isn't smart enough.
|
|
sleep write printError read rs)))
|
|
|
|
;; We disable the unused global linter in bios.lua, APIs and our documentation
|
|
;; stubs docs. In the future hopefully we'll get illuaminate to handle this.
|
|
(at
|
|
(/doc/stub/
|
|
/projects/core/src/main/resources/data/computercraft/lua/bios.lua
|
|
/projects/core/src/main/resources/data/computercraft/lua/rom/apis/
|
|
/projects/forge/build/docs/luaJavadoc/)
|
|
(linters -var:unused-global)
|
|
(lint (allow-toplevel-global true)))
|
|
|
|
;; Suppress warnings for currently undocumented modules.
|
|
(at
|
|
(; Lua APIs
|
|
/projects/core/src/main/resources/data/computercraft/lua/rom/apis/window.lua)
|
|
|
|
(linters -doc:undocumented -doc:undocumented-arg -doc:undocumented-return))
|
|
|
|
;; Suppress warnings for various APIs using its own deprecated members.
|
|
(at
|
|
(/projects/core/src/main/resources/data/computercraft/lua/bios.lua
|
|
/projects/core/src/main/resources/data/computercraft/lua/rom/apis/turtle/turtle.lua)
|
|
(linters -var:deprecated))
|
|
|
|
(at /projects/core/src/test/resources/test-rom
|
|
; We should still be able to test deprecated members.
|
|
(linters -var:deprecated)
|
|
|
|
(lint
|
|
(globals
|
|
:max sleep write
|
|
cct_test describe expect howlci fail it pending stub before_each)))
|
|
|
|
(at /projects/web/src/frontend/mount/expr_template.lua (lint (globals :max __expr__)))
|