[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-109236":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":14,"stars7d":14,"stars30d":14,"stars90d":14,"forks30d":14,"starsTrendScore":14,"compositeScore":15,"rankGlobal":9,"rankLanguage":9,"license":16,"archived":17,"fork":17,"defaultBranch":18,"hasWiki":19,"hasPages":17,"topics":20,"createdAt":9,"pushedAt":21,"updatedAt":22,"readmeContent":23,"aiSummary":24,"trendingCount":14,"starSnapshotCount":14,"syncStatus":25,"lastSyncTime":26,"discoverSource":27},109236,"emdash-updater","swissky\u002Femdash-updater","swissky","Update EmDash from the admin with one click, with undo",null,"TypeScript",61,1,64,0,40.9,"GNU General Public License v3.0",false,"main",true,[],"2026-11-02 14:37:16","2026-11-21 05:57:00","# EmDash Updater\n\nUpdate [EmDash](https:\u002F\u002Femdashcms.com) from the admin with one click. The plugin commits the new versions to your GitHub repository, waits until your hosting has deployed them, and lets you undo the update.\n\n[![Updating an EmDash site from 1.3.1 to 1.4.0 in the admin, then undoing it (sped up)](https:\u002F\u002Fraw.githubusercontent.com\u002Fswissky\u002Femdash-updater\u002Fmain\u002Fdocs\u002Fdemo.gif)](https:\u002F\u002Fgithub.com\u002Fswissky\u002Femdash-updater\u002Fblob\u002Fmain\u002Fdocs\u002Fdemo.mp4)\n\n[Watch the full video](https:\u002F\u002Fgithub.com\u002Fswissky\u002Femdash-updater\u002Fblob\u002Fmain\u002Fdocs\u002Fdemo.mp4)\n\n\n## What it does\n\n- Shows which EmDash packages are installed and which newer versions are out.\n- **Update now** writes the new versions to `package.json` (and your lockfile) on your live branch. Your hosting builds and deploys as usual; database migrations run on the first request.\n- Offers a database backup download before the update starts.\n- Watches the build your hosting reports to GitHub. If it fails, the plugin shows the failure and puts the previous versions back when you click **Discard**.\n- **Undo update** returns to the versions you had before, in one click.\n- On Cloudflare Workers with D1, every update can first run as a **test version** with a copy of your content. You open it, check it, and only then apply it to the live site.\n\n![The confirmation dialog with the backup download before updating](docs\u002Fupdate-confirm.jpg)\n\n![The Updates page after the update, with the undo button](docs\u002Fupdate-done.jpg)\n\n## Requirements\n\n- EmDash 1.3 or later, Node.js 22.13 or later.\n- The site's code lives in a **GitHub** repository.\n- Your hosting deploys automatically when that repository changes (Cloudflare Workers Builds, Render, Vercel, Netlify, Coolify, a GitHub Actions deploy, and similar).\n\n## Install\n\n```bash\nnpm install emdash-updater\n```\n\nAdd the integration and the plugin in `astro.config.mjs`:\n\n```js\nimport { defineConfig } from \"astro\u002Fconfig\";\nimport emdash from \"emdash\u002Fastro\";\nimport updater from \"emdash-updater\u002Fastro\";\nimport { updaterPlugin } from \"emdash-updater\";\n\nexport default defineConfig({\n\tintegrations: [\n\t\tupdater(),\n\t\temdash({\n\t\t\t\u002F\u002F your database, storage, ...\n\t\t\tplugins: [updaterPlugin()],\n\t\t}),\n\t],\n});\n```\n\nKeep `updater()` before `emdash()`. Commit, push, and let your hosting deploy.\n\n### Only let some people update\n\nBy default every Admin can run updates. On a client site where you look after updates yourself, list the people who may:\n\n```js\nplugins: [updaterPlugin({ allowedUsers: [\"you@agency.com\"] })],\n```\n\nOther Admins still see the installed and available versions, with a note that you manage updates. Every update action refuses them with a 403. Leave the plugin out of `astro.config.mjs` if the Updates page should not appear at all.\n\n### Cloudflare Workers: test versions\n\nTest versions need Cloudflare Workers Builds connected to your GitHub repository, with builds for non-production branches turned on. Point `main` in `wrangler.jsonc` at a worker file that re-exports the plugin's worker:\n\n```ts\n\u002F\u002F src\u002Fworker.ts\nexport { default, PluginBridge } from \"emdash-updater\u002Fworker\";\n```\n\nThe plugin turns test versions on when it finds a `wrangler.jsonc`. To update straight to the live site instead, use `updater({ previews: false })`.\n\n## Connect GitHub\n\n1. Open **Admin > Plugins > Updates** and click **Connect GitHub**.\n2. GitHub asks you to create a private GitHub App for your site. The app belongs to your account, not to anyone else. Its key is stored encrypted in the plugin settings.\n3. Install the app on the repository your site is built from, then pick that repository in the admin.\n\nThe app asks for these permissions:\n\n| Permission | Why |\n| --- | --- |\n| Contents: read and write | Commit the new versions and undo them |\n| Workflows: read and write | Add the workflow that updates your lockfile |\n| Checks, commit statuses, deployments: read | Read whether your hosting's build succeeded |\n\nIf you connected before the workflow permission existed, the Updates page shows an **Allow on GitHub** link. Accept the new permission there once.\n\n## Lockfiles\n\nWhen your repository has a `package-lock.json`, `pnpm-lock.yaml`, `yarn.lock` or `bun.lock`, the plugin does not touch your live branch right away. It pushes the update to the branch `emdash-update-lockfile`, where a small GitHub Actions workflow (`.github\u002Fworkflows\u002Femdash-updater-lockfile.yml`, added by the plugin) updates the lockfile. The plugin checks that the workflow changed only the lockfile, then moves your live branch forward to that commit. Your hosting builds once, with `package.json` and the lockfile in sync, so `npm ci` keeps working.\n\n## Undo and your database\n\n**Undo update** restores `package.json` and the lockfile to the previous versions. Database changes made by the newer version stay in place. EmDash migrations only add to the schema, and older versions keep working with a newer database. On Cloudflare with test versions, undo can also restore the D1 database to the moment before the update (D1 Time Travel, up to 7 days on the Free plan).\n\nUndo still works when `main` got more commits after the update, as long as they left `package.json` and the lockfile as the update wrote them.\n\nDownload the backup offered before each update if you want a copy you control.\n\n## Hosting\n\n| Hosting | Mode |\n| --- | --- |\n| Cloudflare Workers Builds with D1 | Test version first, then apply |\n| Render, Vercel, Netlify, Coolify | Straight to live |\n| Docker on your own server | Straight to live, when a GitHub push triggers your deploy (for example a GitHub Actions workflow that rebuilds the container) |\n\nThe plugin reads the build result from GitHub check runs, commit statuses or deployments. If your hosting reports none, the plugin shows the update as waiting and gives you the way back after 15 minutes.\n\n### Docker on your own server\n\nThe plugin never connects to your server. It commits to GitHub, and your deploy picks up the push. A small, safe setup:\n\n1. Run the site with Docker Compose and keep the database and the sessions on a volume:\n\n   ```yaml\n   # compose.yaml\n   services:\n     site:\n       build: .\n       restart: unless-stopped\n       env_file: .env\n       ports:\n         - \"127.0.0.1:4321:4321\"\n       volumes:\n         - data:\u002Fapp\u002Fdata\n   volumes:\n     data:\n   ```\n\n   ```js\n   \u002F\u002F astro.config.mjs\n   import { defineConfig, sessionDrivers } from \"astro\u002Fconfig\";\n\n   export default defineConfig({\n   \tsession: { driver: sessionDrivers.fsLite({ base: \".\u002Fdata\u002Fsessions\" }) },\n   \t\u002F\u002F ...\n   });\n   ```\n\n   Without a persistent session store, every rebuild of the container signs everyone out. The Updates page then sends you to the sign-in and back; the update status is kept. With several containers, use a shared store such as Redis instead.\n\n2. Put a deploy script on the server that pulls `main` and rebuilds:\n\n   ```sh\n   #!\u002Fbin\u002Fsh\n   # deploy\u002Fdeploy.sh\n   set -eu\n   cd \"$(dirname \"$0\")\u002F..\"\n   git fetch --quiet origin main\n   git reset --quiet --hard origin\u002Fmain\n   docker compose up -d --build --remove-orphans\n   ```\n\n3. Create an SSH key that can run only this script. Add its public key to `~\u002F.ssh\u002Fauthorized_keys` on the server:\n\n   ```\n   command=\"\u002Fpath\u002Fto\u002Fsite\u002Fdeploy\u002Fdeploy.sh\",no-pty,no-port-forwarding,no-agent-forwarding,no-X11-forwarding ssh-ed25519 AAAA... deploy\n   ```\n\n4. Add a workflow that runs the script on every push to `main`. Store the private key, `user@host` and the output of `ssh-keyscan \u003Chost>` as the secrets `DEPLOY_SSH_KEY`, `DEPLOY_HOST` and `DEPLOY_KNOWN_HOSTS`:\n\n   ```yaml\n   # .github\u002Fworkflows\u002Fdeploy.yml\n   name: Deploy\n   on:\n     push:\n       branches: [main]\n   concurrency: deploy\n   jobs:\n     deploy:\n       runs-on: ubuntu-latest\n       steps:\n         - env:\n             SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}\n             SSH_HOST: ${{ secrets.DEPLOY_HOST }}\n             SSH_KNOWN_HOSTS: ${{ secrets.DEPLOY_KNOWN_HOSTS }}\n           run: |\n             mkdir -p ~\u002F.ssh\n             echo \"$SSH_KEY\" > ~\u002F.ssh\u002Fid_ed25519\n             echo \"$SSH_KNOWN_HOSTS\" > ~\u002F.ssh\u002Fknown_hosts\n             chmod 600 ~\u002F.ssh\u002Fid_ed25519\n             ssh \"$SSH_HOST\" deploy\n   ```\n\nThe workflow run is reported to GitHub as a check, so the Updates page shows when the new version is live.\n\n## License\n\nGPL-3.0-or-later. See [LICENSE](LICENSE).\n","EmDash Updater 是一个为 EmDash CMS 提供一键式后台升级与回滚能力的插件。它支持在管理界面中查看已安装及可用的新版本，自动更新 package.json 和锁文件、触发 GitHub 驱动的托管平台（如 Cloudflare Workers、Vercel 等）构建部署，并在失败时自动还原；提供更新前数据库备份下载、实时构建状态监听，以及针对 Cloudflare Workers + D1 的可选预发布测试环境。适用于使用 GitHub 托管代码、依赖自动化 CI\u002FCD 部署的 EmDash 站点运维场景。",2,"2026-11-24 04:36:16","CREATED_QUERY"]