{"id":16886104,"url":"https://github.com/vdustr/g2d","last_synced_at":"2025-04-11T12:37:00.897Z","repository":{"id":62422362,"uuid":"415233651","full_name":"VdustR/g2d","owner":"VdustR","description":"Transform .gitignore into .dockerignore","archived":false,"fork":false,"pushed_at":"2022-02-25T11:35:00.000Z","size":35,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T08:51:22.439Z","etag":null,"topics":["container","deno","docker","dockerignore","git","gitignore","linux","macos","podman","windows"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/VdustR.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-09T07:16:43.000Z","updated_at":"2023-07-12T16:41:24.000Z","dependencies_parsed_at":"2022-11-01T17:33:11.721Z","dependency_job_id":null,"html_url":"https://github.com/VdustR/g2d","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VdustR%2Fg2d","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VdustR%2Fg2d/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VdustR%2Fg2d/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VdustR%2Fg2d/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VdustR","download_url":"https://codeload.github.com/VdustR/g2d/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248402403,"owners_count":21097329,"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":["container","deno","docker","dockerignore","git","gitignore","linux","macos","podman","windows"],"created_at":"2024-10-13T16:38:18.916Z","updated_at":"2025-04-11T12:37:00.806Z","avatar_url":"https://github.com/VdustR.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# g2d\n\n[![Test](https://github.com/VdustR/g2d/actions/workflows/test.yml/badge.svg)](https://github.com/VdustR/g2d/actions/workflows/test.yml)\n[![Release](https://github.com/VdustR/g2d/actions/workflows/build.yml/badge.svg)](https://github.com/VdustR/g2d/actions/workflows/build.yml)\n[![ghcr](https://github.com/VdustR/g2d/actions/workflows/ghcr.yml/badge.svg)](https://github.com/VdustR/g2d/actions/workflows/ghcr.yml)\n\nTransform `.gitignore` into `.dockerignore`.\n\n| `.gitignore` | `.dockerignore` |\n| ------------ | --------------- |\n| `!/`         | `!`             |\n| `!`          | `!**/`          |\n| `/`          | -               |\n| -            | `**/`           |\n\n## Download\n\nCheck [releases](https://github.com/VdustR/g2d/releases).\n\n## Usage\n\n`g2d` will detect the nearest `.gitignore` by default.\n\n```sh\n# stdout\ng2d\n\n# specific file\ng2d foo/.gitignore\n\n# export to ./.dockerignore\ng2d -o .\n\n# if foo is a directory\n# .dockerignore would be exported to foo/.dockerignore\ng2d -o foo\ncat foo/.gitignore\n\n# if foo is a file\n# .dockerignore would be exported to foo\ng2d -o foo\ncat foo\n\n# from stdin to stdout\ncat .gitignore | g2d \u003e .dockerignore\n\n# more\ng2d -h\n```\n\n## Install with Deno\n\n```sh\n# install from remote\ndeno install \\\n  --unstable \\\n  --allow-read \\\n  --allow-write \\\n  -n g2d \\\n  https://deno.land/x/g2d/bin.ts\n\n# install from local repo\ngit clone git@github.com:VdustR/g2d.git\ndeno install \\\n  --unstable \\\n  --allow-read \\\n  --allow-write \\\n  -n g2d \\\n  bin.ts\n\n# uninstall\nrm $(which g2d)\n```\n\n## Deno Library\n\n```ts\nimport g2b from \"https://deno.land/x/g2d/mod.ts\";\n\nconst gitignore = Deno.readTextFileSync(\".gitignore\");\nconst dockerignore = g2b(gitignore);\nDeno.writeTextFileSync(\".dockerignore\", dockerignore);\n```\n\n## Container\n\nCheck [g2d container](https://github.com/VdustR/g2d/pkgs/container/g2d).\n\n```bash\npodman run --rm -it -v $(pwd):/repo g2d g2d /repo/.gitignore -o /repo\n```\n\n## Dev\n\n```sh\ndeno run --unstable --allow-read --allow-write bin.ts\n```\n\n## Test\n\n```sh\n./scripts/test.sh\n```\n\n## Tested Dev Env\n\n```\ndeno 1.19.1 (release, x86_64-unknown-linux-gnu)\nv8 9.9.115.7\ntypescript 4.5.2\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvdustr%2Fg2d","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvdustr%2Fg2d","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvdustr%2Fg2d/lists"}