jecs-pesde/.lune/read_version.luau

80 lines
1.4 KiB
Text

--!strict
local fs = require("@lune/fs")
local serde = require("@lune/serde")
type environment = "luau" | "lune" | "roblox" | "roblox_server"
type pesde_dependency = {
name: string,
version: string,
index: string?,
target: environment?,
} | {
wally: string,
version: string,
index: 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 }?,
target: {
environment: environment,
lib: string,
bin: string?,
build_files: { string }?,
},
scripts: {
roblox_sync_config_generator: string?,
sourcemap_generator: string?,
[string]: string,
}?,
indices: {
default: string,
[string]: string,
},
wally_indices: {
default: 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,
}?,
}
local manifest_contents = fs.readFile("pesde.toml")
local manifest: pesde_manifest = serde.decode("toml", manifest_contents) or error("Couldn't decode manifest.")
local jecs_version = manifest.version
print(jecs_version)