scripts/.lune/lib/manifest.luau

73 lines
1.8 KiB
Text
Raw Normal View History

2024-12-08 17:42:05 +00:00
local fs = require("@lune/fs")
local serde = require("@lune/serde")
export type SPDXLicense =
"MIT"
| "Apache-2.0"
| "BSD-2-Clause"
| "BSD-3-Clause"
| "GPL-2.0"
| "GPL-3.0"
| "LGPL-2.1"
| "LGPL-3.0"
| "MPL-2.0"
| "ISC"
| "Unlicense"
| "WTFPL"
| "Zlib"
| "CC0-1.0"
| "CC-BY-4.0"
| "CC-BY-SA-4.0"
| "BSL-1.0"
| "EPL-2.0"
| "AGPL-3.0"
export type DependencySpecifier = ((
{ name: string, version: string, index: string? }
| { workspace: string, version: string }
| { repo: string, rev: string, path: string? }
) & {
target: string?,
}) | { wally: string, version: string, index: string? }
export type PackageTarget = {
environment: "roblox" | "roblox_server",
2024-12-08 17:42:05 +00:00
lib: string,
} | {
environment: "luau" | "lune",
lib: string,
bin: string,
2024-12-08 17:42:05 +00:00
scripts: { [string]: string },
}
2024-12-08 17:42:05 +00:00
export type PesdeManifest<T = {}> = {
name: string,
version: string,
description: string?,
license: SPDXLicense?,
authors: { string }?,
repository: string?,
private: boolean?,
includes: { string }?,
pesde_version: string?,
workspace_members: { string }?,
target: PackageTarget,
build_files: { string }?,
scripts: { [string]: string }?,
indices: { [string]: string },
wally_indices: { [string]: string }?,
overrides: { [string]: DependencySpecifier }?,
patches: { [string]: { [string]: string } }?,
place: { [string]: string }?,
dependencies: { [string]: DependencySpecifier }?,
peer_dependencies: { [string]: DependencySpecifier }?,
dev_dependencies: { [string]: DependencySpecifier }?,
} & T
return function<T>(path: string?, _phantom: T): PesdeManifest<T>
local manifestContents = fs.readFile(path or "pesde.toml")
local decoded = serde.decode("toml", manifestContents)
return decoded :: PesdeManifest<T>
end