{"id":24397753,"url":"https://github.com/42lm/zig-package-manager-example","last_synced_at":"2025-10-24T21:14:22.884Z","repository":{"id":273091201,"uuid":"918677974","full_name":"42LM/zig-package-manager-example","owner":"42LM","description":"Zig ⚡️ - Package Manager Example","archived":false,"fork":false,"pushed_at":"2025-02-03T23:47:49.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-04T00:18:54.753Z","etag":null,"topics":["build-zig","dependecy","package-manager","zig","zig-fetch","zig-zon","ziglang","zon"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/42LM.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-18T15:16:07.000Z","updated_at":"2025-02-03T23:47:52.000Z","dependencies_parsed_at":"2025-01-18T16:35:25.340Z","dependency_job_id":"83d522d3-e3c1-4deb-b47a-59bfbc6df521","html_url":"https://github.com/42LM/zig-package-manager-example","commit_stats":null,"previous_names":["42lm/zig-package-manager-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/42LM%2Fzig-package-manager-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/42LM%2Fzig-package-manager-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/42LM%2Fzig-package-manager-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/42LM%2Fzig-package-manager-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/42LM","download_url":"https://codeload.github.com/42LM/zig-package-manager-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243346869,"owners_count":20276100,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build-zig","dependecy","package-manager","zig","zig-fetch","zig-zon","ziglang","zon"],"created_at":"2025-01-19T22:40:00.866Z","updated_at":"2025-10-24T21:14:22.864Z","avatar_url":"https://github.com/42LM.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![ubuntu-latest](https://github.com/42LM/zig-package-manager-example/actions/workflows/ubuntu-latest.yml/badge.svg)](https://github.com/42LM/zig-package-manager-example/actions/workflows/ubuntu-latest.yml) [![macos-latest](https://github.com/42LM/zig-package-manager-example/actions/workflows/macos-latest.yml/badge.svg)](https://github.com/42LM/zig-package-manager-example/actions/workflows/macos-latest.yml) [![windows-latest](https://github.com/42LM/zig-package-manager-example/actions/workflows/windows-latest.yml/badge.svg)](https://github.com/42LM/zig-package-manager-example/actions/workflows/windows-latest.yml)\n\n[![v0.14.0](https://github.com/42LM/zig-package-manager-example/actions/workflows/v0.14.0.yml/badge.svg)](https://github.com/42LM/zig-package-manager-example/actions/workflows/v0.14.0.yml) [![v0.15.0](https://github.com/42LM/zig-package-manager-example/actions/workflows/v0.15.0.yml/badge.svg)](https://github.com/42LM/zig-package-manager-example/actions/workflows/v0.15.0.yml)\n\n# zig-package-manager-example\nThis is a small and simple example/demonstration of the zig package manager aka `zig.zon`.\n\nIt provides an example on how to provide a zig ligrary and how to use it in a different project.\n\n\u003e [!IMPORTANT]\n\u003e 🛟 Does **not work** on **zig versions below `\u003c v0.14.0`**!  \n\n\u003e [!TIP]\n\u003e If you are looking for minimal setup of a zig library please check out the [minimal](https://github.com/42LM/zig-package-manager-example/tree/minimal) branch.\n\n## Using it\nCreate a new zig project:\n```sh\nmkdir zig-package-manager-example\ncd zig-package-manager-example\nzig init\n```\n\nIn your zig project folder (where `build.zig` is located), run:\n\n```sh\nzig fetch --save \"git+https://github.com/42LM/zig-package-manager-example\"\n```\n\n\u003e [!TIP]\n\u003e You can also fetch the lib/repo via tag/release. Check out the [v0.0.0 release](https://github.com/42LM/zig-package-manager-example/releases/tag/v0.0.0).\n\nThen, in your `build.zig`'s `build` function, add the following before\n`b.installArtifact(exe)`:\n\n```zig\n    const hello = b.dependency(\"hello\", .{\n        .target = target,\n        .optimize = optimize,\n    });\n    exe.root_module.addImport(\"hello\", hello.module(\"hello\"));\n```\n\nIn your projects `main.zig` file import the hello module:\n```zig\nconst std = @import(\"std\");\nconst hello = @import(\"hello\");\n\npub fn main() !void {\n    std.debug.print(\"{s}\\n\", .{hello.world()});\n}\n```\n\nRun the project:\n```sh\nzig build run\n```\n\n\u003e Does not do much, only prints out `no operations`\n\nRun the tests:\n```sh\nzig build test\n```\n\n\u003e Run the tests of the lib\n\n## Troubleshoot\n\u003e [!WARNING]\n\u003e Handle with care: Delete the cache of zig:\n\u003e ```\n\u003e rm -rf ~/.cache/zig\n\u003e ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F42lm%2Fzig-package-manager-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F42lm%2Fzig-package-manager-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F42lm%2Fzig-package-manager-example/lists"}