{"id":17689896,"url":"https://github.com/cdaein/vite-plugin-ssam-git","last_synced_at":"2026-02-12T23:33:00.140Z","repository":{"id":65908292,"uuid":"601897189","full_name":"cdaein/vite-plugin-ssam-git","owner":"cdaein","description":"Create a Git commit and use the commit hash from frontend","archived":false,"fork":false,"pushed_at":"2026-01-26T07:49:18.000Z","size":272,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-26T21:55:17.916Z","etag":null,"topics":["git","ssam","vite","vite-plugin"],"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/cdaein.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-02-15T03:50:20.000Z","updated_at":"2026-01-26T07:49:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"1f7682c3-d0d8-4dc8-8c6a-a729a67cb301","html_url":"https://github.com/cdaein/vite-plugin-ssam-git","commit_stats":{"total_commits":22,"total_committers":1,"mean_commits":22.0,"dds":0.0,"last_synced_commit":"9e0bd1ec59b76072638d09eaee485ad8264f378c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cdaein/vite-plugin-ssam-git","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdaein%2Fvite-plugin-ssam-git","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdaein%2Fvite-plugin-ssam-git/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdaein%2Fvite-plugin-ssam-git/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdaein%2Fvite-plugin-ssam-git/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cdaein","download_url":"https://codeload.github.com/cdaein/vite-plugin-ssam-git/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdaein%2Fvite-plugin-ssam-git/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29386220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T22:07:52.078Z","status":"ssl_error","status_checked_at":"2026-02-12T22:07:49.026Z","response_time":55,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["git","ssam","vite","vite-plugin"],"created_at":"2024-10-24T11:49:14.133Z","updated_at":"2026-02-12T23:33:00.123Z","avatar_url":"https://github.com/cdaein.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vite-plugin-ssam-git\n\nThe purpose of `vite-plugin-ssam-git` is to help [Ssam](https://github.com/cdaein/ssam) canvas wrapper and helper create a code and image snapshot at the same time when working on creative coding sketches. Having both snapshots makes it easy to archive and retrieve the work from a particular moment. It may also be used more generally by leveraging the server-client communication.\n\n\u003e ⚠️ This module is early in its development. Expect breaking changes to come.\n\n## Install\n\n```sh\nnpm i -D vite-plugin-ssam-git\n```\n\n## How it works\n\nWhen the plugin is run, it first checks whether `git` is available on the machine and then checks for whether the project directory is already a git repo or not. If it's not, it will run `git init` to create a new one.\n\nWhen `ssam:git` message is sent to the plugin from a client, the plugin commits to the Git and sends back `ssam:git-success` message to the client with the commit hash. Ssam then uses this info to export an image with the hash. The plugin sends `ssam:log` message when git commit is successful, and it sends `ssam:warn` for errors.\n\n## How to use\n\n\u003e If you're using Ssam with `npm create ssam`, this plugin is already set up for you. No need to do anything below.\n\nIn your code:\n\n```js\n// attach it to a keyboard listener or button, etc.\nif (import.meta.hot) {\n  import.meta.hot.send(\"ssam:git\", {\n    // you can include extra data\n    id: 1234,\n  });\n}\n\nif (import.meta.hot) {\n  import.meta.hot.on(\"ssam:git-success\", (data) =\u003e {\n    // do something with the git commit hash\n    saveFile(`${data.hash}.png`);\n    // you get back extra data you sent earlier\n    console.log(data.id);\n  });\n\n  import.meta.hot.on(\"ssam:log\", (data) =\u003e {\n    console.log(data.msg);\n  });\n\n  import.meta.hot.on(\"ssam:warn\", (data) =\u003e {\n    console.warn(data.msg);\n  });\n}\n```\n\n## Minimum Example\n\nIf you want to use this plugin in your own setup, here is a bare minimum example:\n\nIn `vite.config.js`:\n\n```js\nimport { defineConfig } from \"vite\";\nimport { ssamGit } from \"vite-plugin-ssam-git\";\n\nexport default defineConfig({\n  plugins: [ssamGit()],\n  // ..\n});\n```\n\nIn your module code:\n\n```js\nconst canvas = document.createElement(\"canvas\");\ncanvas.width = canvas.height = 200;\ndocument.body.appendChild(canvas);\nconst ctx = canvas.getContext(\"2d\");\n\nctx.fillStyle = `gray`;\nctx.fillRect(0, 0, 200, 200);\n\nwindow.addEventListener(\"keydown\", (ev) =\u003e {\n  if (ev.key === \"k\") {\n    if (import.meta.hot) {\n      import.meta.hot.send(\"ssam:git\");\n    }\n  }\n});\n\nif (import.meta.hot) {\n  import.meta.hot.on(\"ssam:git-success\", (data) =\u003e\n    // do something with hash\n    console.log(`commit hash:${data.hash}`)\n    // if you have some function to save a canvas...\n    saveCanvas(canvas, { filename: `${data.hash}.png` })\n  );\n  import.meta.hot.on(\"ssam:log\", (data) =\u003e console.log(data.msg));\n  import.meta.hot.on(\"ssam:warn\", (data) =\u003e console.warn(data.msg));\n}\n\nexport {};\n```\n\n## Default Options\n\n```js\nssamGit({\n  // console logging in browser\n  log: true,\n});\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdaein%2Fvite-plugin-ssam-git","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdaein%2Fvite-plugin-ssam-git","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdaein%2Fvite-plugin-ssam-git/lists"}