-
Notifications
You must be signed in to change notification settings - Fork 1
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
Use require
wherever possible
#27
base: master
Are you sure you want to change the base?
Conversation
cc @danports |
@danports should we rename |
''You're a module now, Jimmy!''
94ec800
to
75efbe8
Compare
75efbe8
to
f5c978c
Compare
I agree that |
Also, what are your thoughts about automatic linting? I can also setup some CI to do linting in a separate PR. |
Re: linting, my feeling is that it depends on how strict it is. Certainly a CI pipeline that checks for syntax errors at a bare minimum would be better than what we have now (nothing). |
I've got a working CI setup that uses Selene, a configurable linter. In its default configuration, it checks for all sorts of things, and can check even more if you configure it to do so. It also has support for knowing about custom globals (ex. ComputerCraft APIs). To top it all off, it's written in Rust. |
Sounds good. I have pushed broken code to git before, though fortunately I've caught it by other means (e.g. canary deployments) before I had to fix hundreds of broken computers! 😅 Anything to prevent that would be helpful. |
Also trimmed some ending whitespace.
Also trim some trailing whitespace.
We can squash the |
Also removed trailing whitespace and deleted the `require` for an unused library.
By default, package.path doesn't search for /modules. This changes that.
Alright, all of the APIs have been converted to modules. |
@danports for the |
I've just written a script that does the heavy lifting of loading (We'd need to migrate a single script in prism-rails to use this, but otherwise it wouldn't break anything.) |
Only thing that appears to be left is the |
This uses https://github.com/tomodachi94/cc-require, a fork of https://github.com/oddstr13/cc-require. Startupmgr is a script that executes everything in '/startup.d', and is useful for executing multiple scripts on boot.
3a091b1
to
a8b2920
Compare
I am wondering whether it would be better to handle the Also, yes, I'll do some testing on my server on this branch once it's ready. |
OK, I could see how you could do this without adding a line to the top of the files by moving all of the existing |
I agree that it should, and cc-require is intended to be used as a resource pack that modifies ROM (but it works in non-ROM too). My modification to cc-require detects that if To summarize, I think it should remain in the library but a ROM patch should be available. |
Yeah, having both library and ROM options makes a lot of sense. So the idea is that |
Yep, pretty much. Originally, I was going to add the |
This is needed to retain compatibility with unpublished scripts that use os.loadAPI().
@danports I've finished the |
Thanks! I'll take a look this weekend and see if I can test both this and the |
Looking at this now...I think I need to figure out a solution for the
What are your thoughts? I'm leaning towards 1️⃣ because I'm not sure it really makes sense to take a dependency on |
@@ -0,0 +1,3 @@ | |||
package.path = package.path .. ";/modules/?;/modules/?.lua;/modules/?/init.lua" | |||
local dns = require("dns") | |||
|
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 seems like the rest of this file's contents are missing? Ditto for every other package converted to a module - it seems like only the new modules have any actual code.
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.
-.- Not sure what happened here. I'll try to fix this tomorrow.
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'll work on fix later today.
@@ -0,0 +1,3 @@ | |||
{ | |||
description = "Execute all scripts in the /startup.d folder" |
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'm wondering whether we should merge startupmgr
with autostartup
. Thoughts?
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.
Maybe. What are their differences?
In regards to Amber, I think we should do #1. |
This PR is in a highly unfinished state. I don't recommend merging it until it's ready.
Checklist:
.lua
extensionos.loadAPI
that transparentlyrequire
s modules whenos.loadAPI()
is calledrequire
added on every bootrequire
to work:package.path = package.path .. ";/modules/?;/modules/?.lua;/modules/?/init.lua"
Closes #21
Modules: