diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml new file mode 100644 index 0000000..11376a3 --- /dev/null +++ b/.forgejo/workflows/release.yml @@ -0,0 +1,25 @@ +name: Release + +on: + workflow_dispatch: + +jobs: + release: + name: Release + runs-on: docker + container: + image: ghcr.io/catthehacker/ubuntu:act-22.04 + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Install Rokit + uses: https://github.com/CompeyDev/setup-rokit@v0.1.2 + with: + token: ${{ secrets.githubtoken }} + + - name: Authorize + run: pesde auth login --token "${{ secrets.pesde_auth_token }}" + + - name: Publish + run: pesde publish -y diff --git a/.forgejo/workflows/sync.yml b/.forgejo/workflows/sync.yml new file mode 100644 index 0000000..02766ee --- /dev/null +++ b/.forgejo/workflows/sync.yml @@ -0,0 +1,42 @@ +name: Sync + +on: + workflow_dispatch: + schedule: + - cron: "10 0 * * *" # Runs at 00:10 UTC every day + +jobs: + release: + name: Release + runs-on: docker + container: + image: ghcr.io/catthehacker/ubuntu:act-22.04 + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Install Rokit + uses: https://github.com/CompeyDev/setup-rokit@v0.1.2 + with: + token: ${{ secrets.githubtoken }} + + - name: Pull Newest Jecs + run: lune run pull.luau + + - name: Read Jecs Version + id: read_jecs_version + run: | + version=$(lune run read_version | tr '\n' ' ') + echo "JECS_VERSION=$version" >> $GITHUB_OUTPUT + + - name: Create Pull Request + uses: https://github.com/peter-evans/create-pull-request@v7 + with: + title: Sync to upstream Jecs ${{ steps.read_jecs_version.outputs.JECS_VERSION }} + body: | + Sync to upstream Jecs ${{ steps.read_jecs_version.outputs.JECS_VERSION }} + - This pull request is **auto-generated** + branch: auto/update-jecs + commit-message: Sync to upstream Jecs ${{ steps.read_jecs_version.outputs.JECS_VERSION }} + base: main + token: ${{ secrets.privileged_forgejo_token }} diff --git a/pull.luau b/.lune/pull.luau similarity index 60% rename from pull.luau rename to .lune/pull.luau index c4dd703..b049c07 100644 --- a/pull.luau +++ b/.lune/pull.luau @@ -1,113 +1,216 @@ ---!strict -local task = require("@lune/task") -local process = require("@lune/process") -local fs = require("@lune/fs") -local net = require("@lune/net") -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, - }, -} - -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 = 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.") - ---local manifest_contents = fs.readFile("wally.toml") or error("Couldn't read manifest.") -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}`) -end -local manifest_contents = pull_manifest_res.body -local manifest: wally_manifest = serde.decode("toml", manifest_contents) or error("Couldn't decode manifest.") -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, - }, -} - -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", - }, -}) - -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) -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 }) -end - -local function download_list(list: { { path: string, output: string } }) - local n = #list - print(`🟧 Downloading {n} files...`) - - for idx = 1, n do - local file = list[idx] - - 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" }, -}) - -print("🟧 Writing pesde manifest...") -local pesde_manifest = - `name = "marked/jecs_pesde"\ndescription = "A minimal copy of jecs intended for adding as a Luau git dependency on pesde projects"\nversion = "{jecs_version}"\nrepository = "https://git.devmarked.win/marked/jecs-pesde"\n\nincludes = ["init.luau", "pesde.toml", "README.md", "LICENSE", ".luaurc"]\n\n[target]\nenvironment = "luau"\nlib = "init.luau"\n\n[indices]\ndefault = "https://github.com/daimond113/pesde-index"` - -fs.writeFile("pesde.toml", pesde_manifest) -print("✅ Wrote pesde manifest.") - -print("-- ✅ Finished pulling latest release.") +--!strict +local process = require("@lune/process") +local fs = require("@lune/fs") +local net = require("@lune/net") +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, + }, +} + +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, + }?, +} + +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 = 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.") + +--local manifest_contents = fs.readFile("wally.toml") or error("Couldn't read manifest.") +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}`) +end +local manifest_contents = pull_manifest_res.body +local manifest: wally_manifest = serde.decode("toml", manifest_contents) or error("Couldn't decode manifest.") +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, + }, +} + +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", + }, +}) + +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) +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 }) +end + +local function download_list(list: { { path: string, output: string } }) + local n = #list + print(`🟧 Downloading {n} files...`) + + for idx = 1, n do + local file = list[idx] + + 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" }, +}) + +print(`🟧 Modifying README.md to include repo info...`) +local readme_contents = fs.readFile("README.md") +local new_readme_contents = [[ +An unofficial pesde package for [jecs](https://github.com/ukendio/jecs). + + +]] .. readme_contents +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 = "MIT", + includes = { + "init.luau", + "pesde.toml", + "README.md", + "LICENSE", + ".luaurc", + }, + + target = { + environment = "luau", + lib = "init.luau", + }, + + indices = { + default = "https://github.com/daimond113/pesde-index", + }, +} + +print("🟧 Writing pesde manifest...") +local serialized_manifest = serde.encode("toml", pesde_manifest, true) +fs.writeFile("pesde.toml", serialized_manifest) +print("✅ Wrote pesde manifest.") + +print("-- ✅ Finished pulling latest release.") diff --git a/.lune/read_version.luau b/.lune/read_version.luau new file mode 100644 index 0000000..ee4ef9a --- /dev/null +++ b/.lune/read_version.luau @@ -0,0 +1,80 @@ +--!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) diff --git a/.zed/settings.json b/.zed/settings.json new file mode 100644 index 0000000..b4dba1e --- /dev/null +++ b/.zed/settings.json @@ -0,0 +1,53 @@ +{ + "lsp": { + "luau-lsp": { + "settings": { + "luau-lsp": { + "completion": { + "imports": { + "enabled": true, + "separateGroupsWithLine": true, + "suggestServices": true, + "suggestRequires": false + } + }, + "require": { + "mode": "relativeToFile", + "directoryAliases": { + "@lune/": "~/.lune/.typedefs/0.8.9/" + } + }, + "inlayHints": { + "parameterNames": "all" + } + }, + "ext": { + "roblox": { + "enabled": false, + "security_level": "roblox_script" + }, + "fflags": { + "enable_by_default": false, + "sync": true + }, + "binary": { + "ignore_system_version": false + } + } + } + } + }, + "languages": { + "Luau": { + "formatter": { + "external": { + "command": "stylua", + "arguments": ["-"] + } + } + } + }, + "file_types": { + "Luau": ["lua"] + } +} diff --git a/README.md b/README.md index 539213b..0d86c4c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +An unofficial pesde package for [jecs](https://github.com/ukendio/jecs). + +
diff --git a/pesde.toml b/pesde.toml index a879951..bd6fdee 100644 --- a/pesde.toml +++ b/pesde.toml @@ -1,13 +1,20 @@ -name = "marked/jecs_pesde" -description = "A minimal copy of jecs intended for adding as a Luau git dependency on pesde projects" -version = "0.3.2" +authors = ["jecs authors"] +description = "A minimal copy of jecs published on the official pesde registry" +includes = [ + "init.luau", + "pesde.toml", + "README.md", + "LICENSE", + ".luaurc", +] +license = "MIT" +name = "mark_marks/jecs_pesde" repository = "https://git.devmarked.win/marked/jecs-pesde" +version = "0.3.2" -includes = ["init.luau", "pesde.toml", "README.md", "LICENSE", ".luaurc"] +[indices] +default = "https://github.com/daimond113/pesde-index" [target] environment = "luau" lib = "init.luau" - -[indices] -default = "https://github.com/daimond113/pesde-index" \ No newline at end of file