fix: Make the pull script work with jecs 0.5.x, chore: Pull latest
This commit is contained in:
parent
c799215642
commit
4b17cad7d4
8 changed files with 1123 additions and 436 deletions
254
.lune/pull.luau
254
.lune/pull.luau
|
@ -1,109 +1,109 @@
|
|||
--!strict
|
||||
local process = require("@lune/process")
|
||||
local fs = require("@lune/fs")
|
||||
local net = require("@lune/net")
|
||||
local process = require("@lune/process")
|
||||
local serde = require("@lune/serde")
|
||||
|
||||
print("-- 🟧 Starting pull of latest release...")
|
||||
|
||||
type wally_manifest = {
|
||||
package: {
|
||||
name: string,
|
||||
version: string,
|
||||
registry: string,
|
||||
realm: string,
|
||||
license: string?,
|
||||
exclude: { string }?,
|
||||
include: { string }?,
|
||||
},
|
||||
dependencies: {
|
||||
[string]: string,
|
||||
},
|
||||
package: {
|
||||
name: string,
|
||||
version: string,
|
||||
registry: string,
|
||||
realm: string,
|
||||
license: string?,
|
||||
exclude: { string }?,
|
||||
include: { string }?,
|
||||
},
|
||||
dependencies: {
|
||||
[string]: string,
|
||||
},
|
||||
}
|
||||
|
||||
type environment = "luau" | "lune" | "roblox" | "roblox_server"
|
||||
type pesde_dependency = {
|
||||
name: string,
|
||||
version: string,
|
||||
index: string?,
|
||||
target: environment?,
|
||||
name: string,
|
||||
version: string,
|
||||
index: string?,
|
||||
target: environment?,
|
||||
} | {
|
||||
wally: string,
|
||||
version: string,
|
||||
index: string?,
|
||||
wally: string,
|
||||
version: string,
|
||||
index: string?,
|
||||
} | {
|
||||
repo: string,
|
||||
rev: string,
|
||||
path: string?,
|
||||
repo: string,
|
||||
rev: string,
|
||||
path: string?,
|
||||
}
|
||||
|
||||
type pesde_manifest = {
|
||||
name: string,
|
||||
version: string,
|
||||
description: string?,
|
||||
license: string?,
|
||||
authors: { string }?,
|
||||
repository: string?,
|
||||
private: boolean?,
|
||||
includes: { string }?,
|
||||
pesde_version: string?,
|
||||
workspace_members: { string }?,
|
||||
name: string,
|
||||
version: string,
|
||||
description: string?,
|
||||
license: string?,
|
||||
authors: { string }?,
|
||||
repository: string?,
|
||||
private: boolean?,
|
||||
includes: { string }?,
|
||||
pesde_version: string?,
|
||||
workspace_members: { string }?,
|
||||
|
||||
target: {
|
||||
environment: environment,
|
||||
lib: string,
|
||||
bin: string?,
|
||||
build_files: { string }?,
|
||||
},
|
||||
target: {
|
||||
environment: environment,
|
||||
lib: string,
|
||||
bin: string?,
|
||||
build_files: { string }?,
|
||||
},
|
||||
|
||||
scripts: {
|
||||
roblox_sync_config_generator: string?,
|
||||
sourcemap_generator: string?,
|
||||
scripts: {
|
||||
roblox_sync_config_generator: string?,
|
||||
sourcemap_generator: string?,
|
||||
|
||||
[string]: string,
|
||||
}?,
|
||||
[string]: string,
|
||||
}?,
|
||||
|
||||
indices: {
|
||||
default: string,
|
||||
indices: {
|
||||
default: string,
|
||||
|
||||
[string]: string,
|
||||
},
|
||||
wally_indices: {
|
||||
default: string,
|
||||
[string]: string,
|
||||
},
|
||||
wally_indices: {
|
||||
default: string,
|
||||
|
||||
[string]: string,
|
||||
}?,
|
||||
[string]: string,
|
||||
}?,
|
||||
|
||||
overrides: {
|
||||
[string]: pesde_dependency,
|
||||
}?,
|
||||
patches: {
|
||||
[string]: { [string]: string },
|
||||
}?,
|
||||
overrides: {
|
||||
[string]: pesde_dependency,
|
||||
}?,
|
||||
patches: {
|
||||
[string]: { [string]: string },
|
||||
}?,
|
||||
|
||||
dependencies: {
|
||||
[string]: pesde_dependency,
|
||||
}?,
|
||||
peer_dependencies: {
|
||||
[string]: pesde_dependency,
|
||||
}?,
|
||||
dev_dependencies: {
|
||||
[string]: pesde_dependency,
|
||||
}?,
|
||||
dependencies: {
|
||||
[string]: pesde_dependency,
|
||||
}?,
|
||||
peer_dependencies: {
|
||||
[string]: pesde_dependency,
|
||||
}?,
|
||||
dev_dependencies: {
|
||||
[string]: pesde_dependency,
|
||||
}?,
|
||||
}
|
||||
|
||||
print("🟧 Fetching github token...")
|
||||
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_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
|
||||
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
|
||||
print("✅ Got github token.")
|
||||
|
||||
|
@ -111,7 +111,7 @@ print("✅ Got github token.")
|
|||
print("🟧 Fetching latest jecs wally manifest...")
|
||||
local pull_manifest_res = net.request("https://raw.githubusercontent.com/Ukendio/jecs/refs/heads/main/wally.toml")
|
||||
if not pull_manifest_res.ok then
|
||||
error(`❌ Couldn't download jecs manifest: {pull_manifest_res.statusCode} {pull_manifest_res.statusMessage}`)
|
||||
error(`❌ Couldn't download jecs manifest: {pull_manifest_res.statusCode} {pull_manifest_res.statusMessage}`)
|
||||
end
|
||||
local manifest_contents = pull_manifest_res.body
|
||||
local manifest: wally_manifest = serde.decode("toml", manifest_contents) or error("Couldn't decode manifest.")
|
||||
|
@ -119,29 +119,29 @@ local jecs_version = manifest.package.version
|
|||
print(`✅ Got latest manifest. Version: {jecs_version}`)
|
||||
|
||||
type gh_api_tag = {
|
||||
ref: string,
|
||||
node_id: string,
|
||||
url: string,
|
||||
object: {
|
||||
sha: string,
|
||||
type: string,
|
||||
url: string,
|
||||
},
|
||||
ref: string,
|
||||
node_id: string,
|
||||
url: string,
|
||||
object: {
|
||||
sha: string,
|
||||
type: string,
|
||||
url: string,
|
||||
},
|
||||
}
|
||||
|
||||
print("🟧 Getting tag associated with version in manifest...")
|
||||
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",
|
||||
},
|
||||
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}`)
|
||||
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)
|
||||
|
@ -149,28 +149,33 @@ print(`✅ Got associated tag: {gh_api_tag.object.sha}`)
|
|||
|
||||
local URL = `https://raw.githubusercontent.com/Ukendio/jecs/{gh_api_tag.object.sha}/`
|
||||
local function download(path: string, output: string)
|
||||
process.spawn("curl", { URL .. path, "-o", output })
|
||||
process.spawn("curl", { URL .. path, "-o", output })
|
||||
end
|
||||
|
||||
local function download_list(list: { { path: string, output: string } })
|
||||
local n = #list
|
||||
print(`🟧 Downloading {n} files...`)
|
||||
local n = #list
|
||||
print(`🟧 Downloading {n} files...`)
|
||||
|
||||
for idx = 1, n do
|
||||
local file = list[idx]
|
||||
for idx = 1, n do
|
||||
local file = list[idx]
|
||||
|
||||
print(`Downloading file {idx}/{n} - {file.path} -> {file.output}...`)
|
||||
download(file.path, file.output)
|
||||
end
|
||||
if file.output == "$" then
|
||||
file.output = file.path
|
||||
end
|
||||
|
||||
print(`✅ Downloaded {n} files.`)
|
||||
print(`Downloading file {idx}/{n} - {file.path} -> {file.output}...`)
|
||||
download(file.path, file.output)
|
||||
end
|
||||
|
||||
print(`✅ Downloaded {n} files.`)
|
||||
end
|
||||
|
||||
download_list({
|
||||
{ path = "src/init.luau", output = "init.luau" },
|
||||
{ path = ".luaurc", output = ".luaurc" },
|
||||
{ path = "LICENSE", output = "LICENSE" },
|
||||
{ path = "README.md", output = "README.md" },
|
||||
{ path = "jecs.luau", output = "init.luau" },
|
||||
{ path = ".luaurc", output = "$" },
|
||||
{ path = "LICENSE", output = "$" },
|
||||
{ path = "README.md", output = "$" },
|
||||
{ path = "CHANGELOG.md", output = "$" },
|
||||
})
|
||||
|
||||
print(`🟧 Modifying README.md to include repo info...`)
|
||||
|
@ -184,28 +189,29 @@ fs.writeFile("README.md", new_readme_contents)
|
|||
print(`✅ Modified README.md.`)
|
||||
|
||||
local pesde_manifest: pesde_manifest = {
|
||||
name = "mark_marks/jecs_pesde",
|
||||
description = "A minimal copy of jecs published on the official pesde registry",
|
||||
version = jecs_version,
|
||||
authors = { "jecs authors" },
|
||||
repository = "https://git.devmarked.win/marked/jecs-pesde",
|
||||
license = manifest.package.license,
|
||||
includes = {
|
||||
"init.luau",
|
||||
"pesde.toml",
|
||||
"README.md",
|
||||
"LICENSE",
|
||||
".luaurc",
|
||||
},
|
||||
name = "mark_marks/jecs_pesde",
|
||||
description = "A minimal copy of jecs published on the official pesde registry",
|
||||
version = jecs_version,
|
||||
authors = { "jecs authors" },
|
||||
repository = "https://git.devmarked.win/marked/jecs-pesde",
|
||||
license = manifest.package.license,
|
||||
includes = {
|
||||
"init.luau",
|
||||
"pesde.toml",
|
||||
"README.md",
|
||||
"CHANGELOG.md",
|
||||
"LICENSE",
|
||||
".luaurc",
|
||||
},
|
||||
|
||||
target = {
|
||||
environment = "luau",
|
||||
lib = "init.luau",
|
||||
},
|
||||
target = {
|
||||
environment = "luau",
|
||||
lib = "init.luau",
|
||||
},
|
||||
|
||||
indices = {
|
||||
default = "https://github.com/daimond113/pesde-index",
|
||||
},
|
||||
indices = {
|
||||
default = "https://github.com/pesde-pkg/index",
|
||||
},
|
||||
}
|
||||
|
||||
print("🟧 Writing pesde manifest...")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue