mirror of
https://github.com/pesde-pkg/tooling.git
synced 2024-12-12 07:10:36 +00:00
refactor: restructure repo
* Restructures monorepo packages * Updated pesde manifests with scope and other metadata * Consolidated all interactive install logic into __call metamethod for one liner bin re-exports * Renamed binlib->toolchainlib * Introduced first real world package - stylua (!!)
This commit is contained in:
parent
50f665bb08
commit
94706f8a9d
26 changed files with 102 additions and 92 deletions
1
bins/stylua/init.luau
Normal file
1
bins/stylua/init.luau
Normal file
|
@ -0,0 +1 @@
|
||||||
|
require("./lune_packages/core")("JohnnyMorganz/stylua", _G.PESDE_ROOT)
|
|
@ -1,10 +1,9 @@
|
||||||
name = "compeydev/lune"
|
name = "pesde/stylua"
|
||||||
version = "0.8.9"
|
version = "2.0.1"
|
||||||
target = "lune"
|
target = "lune"
|
||||||
|
|
||||||
[graph."0x5eal/semver"."0.1.1 luau"]
|
[graph."0x5eal/semver"."0.1.1 luau"]
|
||||||
direct = ["semver", { name = "0x5eal/semver", version = "^0.1.1", target = "luau" }, "standard"]
|
resolved_ty = "peer"
|
||||||
resolved_ty = "standard"
|
|
||||||
|
|
||||||
[graph."0x5eal/semver"."0.1.1 luau".target]
|
[graph."0x5eal/semver"."0.1.1 luau".target]
|
||||||
environment = "luau"
|
environment = "luau"
|
||||||
|
@ -29,36 +28,6 @@ result = [{ name = "lukadev_0/result", version = "^1.2.0", index = "https://gith
|
||||||
environment = "luau"
|
environment = "luau"
|
||||||
lib = "lib/init.luau"
|
lib = "lib/init.luau"
|
||||||
|
|
||||||
[graph."compeydev/binlib"."0.1.0 lune"]
|
|
||||||
direct = ["core", { workspace = "compeydev/binlib", version = "^" }, "standard"]
|
|
||||||
resolved_ty = "standard"
|
|
||||||
|
|
||||||
[graph."compeydev/binlib"."0.1.0 lune".target]
|
|
||||||
environment = "lune"
|
|
||||||
lib = "src/init.luau"
|
|
||||||
|
|
||||||
[graph."compeydev/binlib"."0.1.0 lune".dependencies]
|
|
||||||
"0x5eal/semver" = ["0.1.1 luau", "semver"]
|
|
||||||
"jiwonz/dirs" = ["0.1.2 lune", "dirs"]
|
|
||||||
"jiwonz/pathfs" = ["0.1.0 lune", "pathfs"]
|
|
||||||
"lukadev_0/option" = ["1.2.0 lune", "option"]
|
|
||||||
"lukadev_0/result" = ["1.2.0 lune", "result"]
|
|
||||||
|
|
||||||
[graph."compeydev/binlib"."0.1.0 lune".pkg_ref]
|
|
||||||
ref_ty = "workspace"
|
|
||||||
path = "core"
|
|
||||||
|
|
||||||
[graph."compeydev/binlib"."0.1.0 lune".pkg_ref.dependencies]
|
|
||||||
dirs = [{ name = "jiwonz/dirs", version = "^0.1.1", index = "https://github.com/daimond113/pesde-index" }, "standard"]
|
|
||||||
option = [{ name = "lukadev_0/option", version = "^1.2.0", index = "https://github.com/daimond113/pesde-index" }, "peer"]
|
|
||||||
pathfs = [{ name = "jiwonz/pathfs", version = "^0.1.0", index = "https://github.com/daimond113/pesde-index" }, "standard"]
|
|
||||||
result = [{ name = "lukadev_0/result", version = "^1.2.0", index = "https://github.com/daimond113/pesde-index" }, "peer"]
|
|
||||||
semver = [{ name = "0x5eal/semver", version = "^0.1.1", index = "https://github.com/daimond113/pesde-index", target = "luau" }, "standard"]
|
|
||||||
|
|
||||||
[graph."compeydev/binlib"."0.1.0 lune".pkg_ref.target]
|
|
||||||
environment = "lune"
|
|
||||||
lib = "src/init.luau"
|
|
||||||
|
|
||||||
[graph."jiwonz/dirs"."0.1.2 lune"]
|
[graph."jiwonz/dirs"."0.1.2 lune"]
|
||||||
resolved_ty = "standard"
|
resolved_ty = "standard"
|
||||||
|
|
||||||
|
@ -168,3 +137,33 @@ index_url = "https://github.com/daimond113/pesde-index"
|
||||||
[graph."lukadev_0/result"."1.2.0 luau".pkg_ref.target]
|
[graph."lukadev_0/result"."1.2.0 luau".pkg_ref.target]
|
||||||
environment = "luau"
|
environment = "luau"
|
||||||
lib = "lib/init.luau"
|
lib = "lib/init.luau"
|
||||||
|
|
||||||
|
[graph."pesde/toolchainlib"."0.1.0 lune"]
|
||||||
|
direct = ["core", { workspace = "pesde/toolchainlib", version = "^" }, "standard"]
|
||||||
|
resolved_ty = "standard"
|
||||||
|
|
||||||
|
[graph."pesde/toolchainlib"."0.1.0 lune".target]
|
||||||
|
environment = "lune"
|
||||||
|
lib = "src/init.luau"
|
||||||
|
|
||||||
|
[graph."pesde/toolchainlib"."0.1.0 lune".dependencies]
|
||||||
|
"0x5eal/semver" = ["0.1.1 luau", "semver"]
|
||||||
|
"jiwonz/dirs" = ["0.1.2 lune", "dirs"]
|
||||||
|
"jiwonz/pathfs" = ["0.1.0 lune", "pathfs"]
|
||||||
|
"lukadev_0/option" = ["1.2.0 lune", "option"]
|
||||||
|
"lukadev_0/result" = ["1.2.0 lune", "result"]
|
||||||
|
|
||||||
|
[graph."pesde/toolchainlib"."0.1.0 lune".pkg_ref]
|
||||||
|
ref_ty = "workspace"
|
||||||
|
path = "toolchainlib"
|
||||||
|
|
||||||
|
[graph."pesde/toolchainlib"."0.1.0 lune".pkg_ref.dependencies]
|
||||||
|
dirs = [{ name = "jiwonz/dirs", version = "^0.1.1", index = "https://github.com/daimond113/pesde-index" }, "standard"]
|
||||||
|
option = [{ name = "lukadev_0/option", version = "^1.2.0", index = "https://github.com/daimond113/pesde-index" }, "peer"]
|
||||||
|
pathfs = [{ name = "jiwonz/pathfs", version = "^0.1.0", index = "https://github.com/daimond113/pesde-index" }, "standard"]
|
||||||
|
result = [{ name = "lukadev_0/result", version = "^1.2.0", index = "https://github.com/daimond113/pesde-index" }, "peer"]
|
||||||
|
semver = [{ name = "0x5eal/semver", version = "^0.1.1", index = "https://github.com/daimond113/pesde-index", target = "luau" }, "peer"]
|
||||||
|
|
||||||
|
[graph."pesde/toolchainlib"."0.1.0 lune".pkg_ref.target]
|
||||||
|
environment = "lune"
|
||||||
|
lib = "src/init.luau"
|
|
@ -1,11 +1,11 @@
|
||||||
name = "compeydev/lune"
|
name = "pesde/stylua"
|
||||||
version = "0.8.9"
|
version = "2.0.1"
|
||||||
description = "A standalone Luau runtime"
|
description = "A standalone Luau runtime"
|
||||||
authors = [
|
authors = [
|
||||||
"CompeyDev <hi@devcomp.xyz>",
|
"CompeyDev <hi@devcomp.xyz>",
|
||||||
"Filip Tibell <filip.tibell@gmail.com>",
|
"Johnny Morganz <johnnymorganz@outlook.com>",
|
||||||
]
|
]
|
||||||
repository = "https://github.com/CompeyDev/pesde-tooling/blob/main/lune"
|
repository = "https://github.com/pesde-dev/tooling"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
[target]
|
[target]
|
||||||
|
@ -15,8 +15,7 @@ bin = "init.luau"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
result = { name = "lukadev_0/result", version = "^1.2.0" }
|
result = { name = "lukadev_0/result", version = "^1.2.0" }
|
||||||
option = { name = "lukadev_0/option", version = "^1.2.0" }
|
option = { name = "lukadev_0/option", version = "^1.2.0" }
|
||||||
semver = { name = "0x5eal/semver", version = "^0.1.1", target = "luau" }
|
core = { workspace = "pesde/toolchainlib", version = "^" }
|
||||||
core = { workspace = "compeydev/binlib", version = "^" }
|
|
||||||
|
|
||||||
[indices]
|
[indices]
|
||||||
default = "https://github.com/daimond113/pesde-index"
|
default = "https://github.com/daimond113/pesde-index"
|
|
@ -1,37 +0,0 @@
|
||||||
local stdio = require("@lune/stdio")
|
|
||||||
local process = require("@lune/process")
|
|
||||||
local fs = require("@lune/fs")
|
|
||||||
local serde = require("@lune/serde")
|
|
||||||
|
|
||||||
local core = require("./lune_packages/core")
|
|
||||||
local Semver = require("./luau_packages/semver")
|
|
||||||
local Option = require("./lune_packages/option")
|
|
||||||
type Option<T> = Option.Option<T>
|
|
||||||
|
|
||||||
-- Use _G.PESDE_ROOT to get the install directory, then decode the
|
|
||||||
-- pesde manifest to get the version of the tool dynamically
|
|
||||||
local PLATFORM_SEP = if process.platform == "windows" then "\\" else "/"
|
|
||||||
local ERROR_PREFIX = `{stdio.color("red")}{stdio.style("bold")}error{stdio.color("reset")}:`
|
|
||||||
|
|
||||||
local manifestContents = fs.readFile(`{_G.PESDE_ROOT}{PLATFORM_SEP}pesde.toml`)
|
|
||||||
|
|
||||||
-- TODO: Create a pesde manifest type in binlib, and use that here
|
|
||||||
local ok, manifest = pcall(serde.decode, "toml", manifestContents)
|
|
||||||
if not ok then
|
|
||||||
stdio.ewrite(`{ERROR_PREFIX} Failed to decode bundled manifest. This is probably a bug.\n\n{manifest}`)
|
|
||||||
process.exit(1)
|
|
||||||
end
|
|
||||||
|
|
||||||
local ok, err = pcall(
|
|
||||||
core.installTool,
|
|
||||||
{
|
|
||||||
alias = Option.None,
|
|
||||||
repo = "lune-org/lune",
|
|
||||||
version = Option.Some(Semver.parse(manifest.version):unwrap()) :: Option<Semver.SemverImpl>,
|
|
||||||
} :: core.ToolId
|
|
||||||
)
|
|
||||||
|
|
||||||
if not ok then
|
|
||||||
stdio.ewrite(`{ERROR_PREFIX} Failed to install {manifest.name}@{manifest.version}`)
|
|
||||||
stdio.ewrite(` - {err}`)
|
|
||||||
end
|
|
10
pesde.lock
10
pesde.lock
|
@ -1,9 +1,9 @@
|
||||||
name = "compeydev/pesde_bins"
|
name = "pesde/tooling"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
target = "lune"
|
target = "lune"
|
||||||
|
|
||||||
[workspace."compeydev/binlib"]
|
[workspace."pesde/stylua"]
|
||||||
lune = "core"
|
lune = "bins/stylua"
|
||||||
|
|
||||||
[workspace."compeydev/lune"]
|
[workspace."pesde/toolchainlib"]
|
||||||
lune = "lune"
|
lune = "toolchainlib"
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
name = "compeydev/pesde_bins"
|
name = "pesde/tooling"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
private = true
|
private = true
|
||||||
|
|
||||||
workspace_members = ["lune", "core"]
|
workspace_members = ["toolchainlib", "bins/*"]
|
||||||
|
|
||||||
[target]
|
[target]
|
||||||
environment = "lune"
|
environment = "lune"
|
||||||
|
|
||||||
[indices]
|
[indices]
|
||||||
default = "https://github.com/daimond113/pesde-index"
|
default = "https://github.com/daimond113/pesde-index"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
name = "compeydev/binlib"
|
name = "pesde/toolchainlib"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
target = "lune"
|
target = "lune"
|
||||||
|
|
||||||
[graph."0x5eal/semver"."0.1.1 luau"]
|
[graph."0x5eal/semver"."0.1.1 luau"]
|
||||||
direct = ["semver", { name = "0x5eal/semver", version = "^0.1.1", target = "luau" }, "standard"]
|
direct = ["semver", { name = "0x5eal/semver", version = "^0.1.1", target = "luau" }, "peer"]
|
||||||
resolved_ty = "standard"
|
resolved_ty = "standard"
|
||||||
|
|
||||||
[graph."0x5eal/semver"."0.1.1 luau".target]
|
[graph."0x5eal/semver"."0.1.1 luau".target]
|
|
@ -1,4 +1,4 @@
|
||||||
name = "compeydev/binlib"
|
name = "pesde/toolchainlib"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
includes = ["src/", "pesde.toml", "LICENSE", "README.md"]
|
includes = ["src/", "pesde.toml", "LICENSE", "README.md"]
|
||||||
|
|
||||||
|
@ -9,11 +9,11 @@ lib = "src/init.luau"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
pathfs = { name = "jiwonz/pathfs", version = "^0.1.0" }
|
pathfs = { name = "jiwonz/pathfs", version = "^0.1.0" }
|
||||||
dirs = { name = "jiwonz/dirs", version = "^0.1.1" }
|
dirs = { name = "jiwonz/dirs", version = "^0.1.1" }
|
||||||
semver = { name = "0x5eal/semver", version = "^0.1.1", target = "luau" }
|
|
||||||
|
|
||||||
[peer_dependencies]
|
[peer_dependencies]
|
||||||
result = { name = "lukadev_0/result", version = "^1.2.0" }
|
result = { name = "lukadev_0/result", version = "^1.2.0" }
|
||||||
option = { name = "lukadev_0/option", version = "^1.2.0" }
|
option = { name = "lukadev_0/option", version = "^1.2.0" }
|
||||||
|
semver = { name = "0x5eal/semver", version = "^0.1.1", target = "luau" }
|
||||||
|
|
||||||
[indices]
|
[indices]
|
||||||
default = "https://github.com/daimond113/pesde-index"
|
default = "https://github.com/daimond113/pesde-index"
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
local net = require("@lune/net")
|
local net = require("@lune/net")
|
||||||
local process = require("@lune/process")
|
local process = require("@lune/process")
|
||||||
|
local stdio = require("@lune/stdio")
|
||||||
|
local serde = require("@lune/serde")
|
||||||
|
|
||||||
local Semver = require("../luau_packages/semver")
|
local Semver = require("../luau_packages/semver")
|
||||||
local pathfs = require("../lune_packages/pathfs")
|
local pathfs = require("../lune_packages/pathfs")
|
||||||
|
@ -254,10 +256,58 @@ function installTool(tool: ToolId)
|
||||||
toolInstallPath:toString()
|
toolInstallPath:toString()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
chmod(linkPath, 0b111101101)
|
chmod(linkPath, 0b111101101)
|
||||||
|
runTool(toolinstallPath)
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return setmetatable({
|
||||||
runTool = runTool,
|
runTool = runTool,
|
||||||
installTool = installTool,
|
installTool = installTool,
|
||||||
}
|
}, {
|
||||||
|
__call = function(lib, tool: string, pesdeRoot: string?)
|
||||||
|
-- TODO: Progress bar maybe? :D
|
||||||
|
|
||||||
|
local ERROR_PREFIX = `{stdio.color("red")}{stdio.style("bold")}error{stdio.color("reset")}:`
|
||||||
|
|
||||||
|
local repo, version = string.match(tool, "([^@]+)@?(.*)")
|
||||||
|
if repo == nil then
|
||||||
|
stdio.ewrite(`{ERROR_PREFIX} Invalid tool provided\n`)
|
||||||
|
process.exit(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function manifestVersion(): string
|
||||||
|
if pesdeRoot == nil then
|
||||||
|
stdio.ewrite(`{ERROR_PREFIX} Failed to discover pesde package root\n`)
|
||||||
|
process.exit(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Use _G.PESDE_ROOT to get the install directory, then decode the
|
||||||
|
-- pesde manifest to get the version of the tool dynamically
|
||||||
|
local manifestContents = pathfs.readFile(pathfs.Path.from(pesdeRoot):join("pesde.toml"))
|
||||||
|
-- TODO: Create a pesde manifest type in toolchainlib, and use that here
|
||||||
|
local ok, manifest = pcall(serde.decode, "toml", manifestContents)
|
||||||
|
if not ok then
|
||||||
|
stdio.ewrite(`{ERROR_PREFIX} Failed to decode bundled manifest. This is probably a bug.\n\n{manifest}`)
|
||||||
|
process.exit(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
return manifest.version
|
||||||
|
end
|
||||||
|
|
||||||
|
local ok, err = pcall(
|
||||||
|
lib.installTool,
|
||||||
|
{
|
||||||
|
-- TODO: Use alias within pesde.toml in linker script
|
||||||
|
alias = Option.None,
|
||||||
|
repo = repo,
|
||||||
|
version = Option.Some(Semver.parse(if version ~= "" then version else manifestVersion()):unwrap()) :: Option<Semver.SemverImpl>,
|
||||||
|
} :: core.ToolId
|
||||||
|
)
|
||||||
|
|
||||||
|
if not ok then
|
||||||
|
stdio.ewrite(`{ERROR_PREFIX} Failed to install {tool}\n`)
|
||||||
|
stdio.ewrite(` - {err}\n`)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
Loading…
Reference in a new issue