chore: Make jecs a dependency, bump jecs to v0.3.0
+ Make jecs a wally dependency instead of a file in lib. This wasn't done earlier due to wally packages not being able to be used outside of Roblox without dynamically requiring them. Now, a script is used to download the latest source of jecsfrom Github associated with the version in the manifest. + Bump jecs-utils to v0.1.3 and release
This commit is contained in:
parent
ae3042a1ab
commit
cab13e4213
23 changed files with 117 additions and 1916 deletions
|
@ -1,7 +1,8 @@
|
|||
--!strict
|
||||
local spawn = require("util/spawn")
|
||||
|
||||
spawn.start("lune run install-packages")
|
||||
spawn.start("rojo sourcemap dev.project.json -o sourcemap.json")
|
||||
spawn.start(
|
||||
"luau-lsp analyze --base-luaurc=.luaurc --sourcemap=sourcemap.json --settings=luau_lsp_settings.json --no-strict-dm-types --ignore Packages/**/*.lua --ignore Packages/**/*.luau --ignore lib/jecs.luau lib/"
|
||||
"luau-lsp analyze --base-luaurc=.luaurc --sourcemap=sourcemap.json --settings=luau_lsp_settings.json --no-strict-dm-types --ignore Packages/**/*.lua --ignore Packages/**/*.luau --ignore Packages/*.lua --ignore Packages/*.luau lib/"
|
||||
)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
--!strict
|
||||
local spawn = require("util/spawn")
|
||||
|
||||
spawn.start("lune run install-packages")
|
||||
spawn.start("rojo sourcemap dev.project.json -o sourcemap.json")
|
||||
spawn.start("darklua process --config .darklua.json lib/ dist/", { env = { ROBLOX_DEV = "false" } })
|
||||
spawn.start("rojo build default.project.json -o build.rbxm")
|
||||
|
|
|
@ -4,4 +4,5 @@ local spawn = require("util/spawn")
|
|||
spawn.start("lune run analyze")
|
||||
spawn.start("stylua lib/")
|
||||
spawn.start("selene lib/")
|
||||
spawn.start("lune run download-jecs")
|
||||
spawn.start("luau test/tests.luau")
|
||||
|
|
|
@ -4,11 +4,17 @@ local stdio = require("@lune/stdio")
|
|||
local task = require("@lune/task")
|
||||
|
||||
local spawn = require("util/spawn")
|
||||
local watch = require("util/watch")
|
||||
|
||||
task.spawn(watch, "wally.toml", function()
|
||||
spawn.spawn("lune run install-packages")
|
||||
end, false)
|
||||
spawn.start("lune run install-packages")
|
||||
|
||||
spawn.spawn("rojo sourcemap dev.project.json -o sourcemap.json --watch")
|
||||
spawn.spawn("darklua process --config .darklua.json --watch lib/ dist/", { env = { ROBLOX_DEV = "true" } })
|
||||
|
||||
task.wait(1)
|
||||
task.wait(2.5)
|
||||
|
||||
while true do
|
||||
local start_commit = stdio.prompt("confirm", "Start commit? -- `y` to start a commit, `n` to exit the script")
|
||||
|
|
|
@ -2,4 +2,5 @@
|
|||
local spawn = require("util/spawn")
|
||||
|
||||
spawn.start("rojo sourcemap dev.project.json -o sourcemap.json")
|
||||
spawn.start("lune run install-packages")
|
||||
spawn.start("darklua process --config .darklua.json lib/ dist/", { env = { ROBLOX_DEV = "false" } })
|
||||
|
|
67
.lune/download-jecs.luau
Normal file
67
.lune/download-jecs.luau
Normal file
|
@ -0,0 +1,67 @@
|
|||
--!strict
|
||||
local fs = require("@lune/fs")
|
||||
local net = require("@lune/net")
|
||||
local process = require("@lune/process")
|
||||
local serde = require("@lune/serde")
|
||||
local spawn = require("util/spawn")
|
||||
|
||||
type wally_manifest = {
|
||||
package: {
|
||||
name: string,
|
||||
version: string,
|
||||
registry: string,
|
||||
realm: string,
|
||||
license: string?,
|
||||
exclude: { string }?,
|
||||
include: { string }?,
|
||||
},
|
||||
dependencies: {
|
||||
[string]: string,
|
||||
},
|
||||
}
|
||||
|
||||
local github_token: string = process.args[1]
|
||||
|
||||
if not github_token then
|
||||
local env_exists = fs.metadata(".env").exists
|
||||
if not env_exists then
|
||||
error("Usage: lune run download-jecs [GITHUB_PAT]\nAlternatively, put the PAT in an .env file under GITHUB_PAT")
|
||||
end
|
||||
|
||||
local env = serde.decode("toml", fs.readFile(".env"))
|
||||
local pat = env.GITHUB_PAT or error("Couldn't read GITHUB_PAT from .env")
|
||||
github_token = pat
|
||||
end
|
||||
|
||||
local manifest_contents = fs.readFile("wally.toml") or error("Couldn't read manifest.")
|
||||
local manifest: wally_manifest = serde.decode("toml", manifest_contents) or error("Couldn't decode manifest.")
|
||||
local jecs_version = string.match(manifest.dependencies.jecs, "%d.%d.%d") or error("Couldn't find jecs version.")
|
||||
|
||||
type gh_api_tag = {
|
||||
ref: string,
|
||||
node_id: string,
|
||||
url: string,
|
||||
object: {
|
||||
sha: string,
|
||||
type: string,
|
||||
url: string,
|
||||
},
|
||||
}
|
||||
|
||||
local response = net.request({
|
||||
url = `https://api.github.com/repos/ukendio/jecs/git/refs/tags/v{jecs_version}`,
|
||||
method = "GET",
|
||||
headers = {
|
||||
Accept = "application/vnd.github+json",
|
||||
Authorization = `Bearer {github_token}`,
|
||||
["X-GitHub-Api-Version"] = "2022-11-28",
|
||||
},
|
||||
})
|
||||
|
||||
if not response.ok then
|
||||
error(`Github api response not ok:\n{response.statusCode} @ {response.statusMessage}\n{response.body}`)
|
||||
end
|
||||
|
||||
local gh_api_tag: gh_api_tag = serde.decode("json", response.body)
|
||||
|
||||
spawn.start(`curl https://raw.githubusercontent.com/ukendio/jecs/{gh_api_tag.object.sha}/src/init.luau -o jecs.luau`)
|
|
@ -2,18 +2,20 @@
|
|||
local fs = require("@lune/fs")
|
||||
local task = require("@lune/task")
|
||||
|
||||
local function watch(path: string, on_change: (path: string, contents: string) -> ())
|
||||
local function watch(path: string, on_change: (path: string, contents: string) -> (), run_initially: boolean?)
|
||||
local initial_metadata = fs.metadata(path)
|
||||
if not initial_metadata.exists then
|
||||
return
|
||||
end
|
||||
|
||||
local initial_contents = fs.readFile(path)
|
||||
if run_initially then
|
||||
local initial_contents = fs.readFile(path)
|
||||
|
||||
local initial_success, why = pcall(on_change :: any, path, initial_contents) -- :: any because otherwise it shits itself and the type doesn't give (boolean, string)??
|
||||
if not initial_success then
|
||||
warn(`There was an error while trying to start the watcher thread:\n{why}`)
|
||||
return
|
||||
local initial_success, why = pcall(on_change :: any, path, initial_contents) -- :: any because otherwise it shits itself and the type doesn't give (boolean, string)??
|
||||
if not initial_success then
|
||||
warn(`There was an error while trying to start the watcher thread:\n{why}`)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local last_modification = initial_metadata.modifiedAt
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue