{"id":20980877,"url":"https://github.com/cap-go/cordova-updater","last_synced_at":"2025-05-14T15:30:51.584Z","repository":{"id":57685555,"uuid":"473414039","full_name":"Cap-go/cordova-updater","owner":"Cap-go","description":null,"archived":false,"fork":false,"pushed_at":"2023-12-15T11:46:42.000Z","size":22,"stargazers_count":4,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-14T00:50:14.258Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cap-go.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"Cap-go","patreon":null,"open_collective":"capgo","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2022-03-24T01:19:38.000Z","updated_at":"2023-12-12T00:26:12.000Z","dependencies_parsed_at":"2023-12-25T23:44:32.748Z","dependency_job_id":null,"html_url":"https://github.com/Cap-go/cordova-updater","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"a38c904e5c67bb6a91497b95f473ddbee6941e9e"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcordova-updater","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcordova-updater/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcordova-updater/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcordova-updater/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cap-go","download_url":"https://codeload.github.com/Cap-go/cordova-updater/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225300645,"owners_count":17452634,"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":[],"created_at":"2024-11-19T05:31:02.474Z","updated_at":"2024-11-19T05:31:04.522Z","avatar_url":"https://github.com/Cap-go.png","language":"Java","funding_links":["https://github.com/sponsors/Cap-go","https://opencollective.com/capgo"],"categories":[],"sub_categories":[],"readme":"# cordova-updater\n\nUpdate cordova app withtout store review.\n\nWIP =\u003e This module is not ready yet.\n\nOnly the documentation is ready. Not the code.\n\nYou have 3 ways possible :\n- use [capgo.app](https://capgo.app) a full featured auto update system in 5 min Setup, to manage version, update, revert and see stats.\n- use your own server update with auto update system\n- use manual methods to zip, upload, download, from JS to do it when you want.\n\n\n## Community\nJoin the [discord](https://discord.gg/VnYRvBfgA6) to get help.\n\n## Documentation\nI maintain a more user friendly [documentation](https://doc.capgo.app).\n\n## install plugin\n\n```bash\ncordova plugin add cordova-plugin-cocoapod-support\ncordova plugin add cordova-updater\n```\n\n### Auto update setup\nCreate account in [capgo.app](https://capgo.app) and get your [API key](https://capgo.app/app/apikeys)\n- Download the CLI `npm i -g capgo`\n- Add app from CLI `capgo add -a API_KEY`\n- Upload app `capgo upload -a API_KEY`\n- Upload app `capgo set -a API_KEY -s public`\n- Edit your `capacitor.config.json` like below, set `autoUpdateUrl` with the url printed in the previous step.\n\n```json\n// capacitor.config.json\n{\n\t\"appId\": \"**.***.**\",\n\t\"appName\": \"Name\",\n\t\"plugins\": {\n\t\t\"CapacitorUpdater\": {\n\t\t\t\"autoUpdateUrl\": \"https://capgo.app/api/latest?appid=**.****.***\u0026channel=dev\"\n\t\t}\n\t}\n}\n```\n- Add to your main code\n```javascript\n  import { CordovaUpdater } from 'cordova-updater'\n  CordovaUpdater.notifyAppReady()\n  // To let auto update know you app boot well.\n```\n\n- Do `npm run build \u0026\u0026 npx cordova prepare` to copy the build to cordova.\n- Run the app and see app auto update after each backgrounding.\n- If update fail it will roolback to previous version.\n\nSee more there in the [Auto update](\nhttps://doc.capgo.app/Auto-update-2cf9edda70484d7fa57111ab9c435d08) documentation.\n\n\n### Manual setup\n\nZip your builded app code and upload it somewhere.\n\nAdd in your main code \n\n```javascript\n  import { CordovaUpdater } from 'cordova-updater'\n\n\n  let version = \"\"\n  document.addEventListener(\"pause\", async () =\u003e {\n    await CapacitorUpdater.set(version)\n    console.log(\"Version set\")\n  }), false);\n  document.addEventListener(\"resume\", async () =\u003e {\n      version = await CapacitorUpdater.download({\n        url: 'https://github.com/Forgr-ee/Mimesis/releases/download/0.0.1/dist.zip',\n      })\n  }), false);\n\n  // or do it when click on button\n  const updateNow = async () =\u003e {\n    const version = await CapacitorUpdater.download({\n      url: 'https://github.com/Forgr-ee/Mimesis/releases/download/0.0.1/dist.zip',\n    })\n    // show the splashscreen to let the update happen\n    SplashScreen.show()\n    await CapacitorUpdater.set(version)\n    SplashScreen.hide() // in case the set fail, otherwise the new app will have to hide it\n  }\n```\n\n*Be extra carufull for your update* if you send a broken update, the app will crash until the user reinstalls it.\n\n\nYou can list the version and manage it with the command below.\n\n## Packaging `dist.zip`\n\nWhatever you choose to name the file you download from your release/update server URL, the zip file should contain the full contents of your production Capacitor build output folder, usually `{project directory}/dist/` or `{project directory}/www/`. This is where `index.html` will be located, and it should also contain all bundled JavaScript, CSS, and web resources necessary for your app to run.\n\nDo not password encrypt this file, or it will fail to unpack.\n\n## API\n\n\u003cdocgen-index\u003e\n\n* [`download(...)`](#download)\n* [`set(...)`](#set)\n* [`delete(...)`](#delete)\n* [`list()`](#list)\n* [`reset(...)`](#reset)\n* [`current()`](#current)\n* [`reload()`](#reload)\n* [`versionName()`](#versionname)\n* [`notifyAppReady()`](#notifyappready)\n* [`delayUpdate()`](#delayupdate)\n* [`cancelDelay()`](#canceldelay)\n\n\u003c/docgen-index\u003e\n\n\u003cdocgen-api\u003e\n\u003c!--Update the source file JSDoc comments and rerun docgen to update the docs below--\u003e\n\n### download(...)\n\n```typescript\ndownload(options: { url: string; }) =\u003e Promise\u003c{ version: string; }\u003e\n```\n\nDownload a new version from the provided URL, it should be a zip file, with files inside or with a unique folder inside with all your files\n\n| Param         | Type                          |\n| ------------- | ----------------------------- |\n| **`options`** | \u003ccode\u003e{ url: string; }\u003c/code\u003e |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ version: string; }\u0026gt;\u003c/code\u003e\n\n--------------------\n\n\n### set(...)\n\n```typescript\nset(options: { version: string; versionName?: string; }) =\u003e Promise\u003cvoid\u003e\n```\n\nSet version as current version, set will return an error if there are is no index.html file inside the version folder. `versionName` is optional and it's a custom value that will be saved for you\n\n| Param         | Type                                                    |\n| ------------- | ------------------------------------------------------- |\n| **`options`** | \u003ccode\u003e{ version: string; versionName?: string; }\u003c/code\u003e |\n\n--------------------\n\n\n### delete(...)\n\n```typescript\ndelete(options: { version: string; }) =\u003e Promise\u003cvoid\u003e\n```\n\nDelete version in storage\n\n| Param         | Type                              |\n| ------------- | --------------------------------- |\n| **`options`** | \u003ccode\u003e{ version: string; }\u003c/code\u003e |\n\n--------------------\n\n\n### list()\n\n```typescript\nlist() =\u003e Promise\u003c{ versions: string[]; }\u003e\n```\n\nGet all available versions\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ versions: string[]; }\u0026gt;\u003c/code\u003e\n\n--------------------\n\n\n### reset(...)\n\n```typescript\nreset(options: { toAutoUpdate?: boolean; }) =\u003e Promise\u003cvoid\u003e\n```\n\nSet the `builtin` version (the one sent to Apple store / Google play store ) as current version\n\n| Param         | Type                                     |\n| ------------- | ---------------------------------------- |\n| **`options`** | \u003ccode\u003e{ toAutoUpdate?: boolean; }\u003c/code\u003e |\n\n--------------------\n\n\n### current()\n\n```typescript\ncurrent() =\u003e Promise\u003c{ current: string; }\u003e\n```\n\nGet the current version, if none are set it returns `builtin`\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ current: string; }\u0026gt;\u003c/code\u003e\n\n--------------------\n\n\n### reload()\n\n```typescript\nreload() =\u003e Promise\u003cvoid\u003e\n```\n\nReload the view\n\n--------------------\n\n\n### versionName()\n\n```typescript\nversionName() =\u003e Promise\u003c{ versionName: string; }\u003e\n```\n\nGet the version name, if it was set during the set phase\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ versionName: string; }\u0026gt;\u003c/code\u003e\n\n--------------------\n\n\n### notifyAppReady()\n\n```typescript\nnotifyAppReady() =\u003e Promise\u003cvoid\u003e\n```\n\nNotify native plugin that the update is working, only in auto-update\n\n--------------------\n\n\n### delayUpdate()\n\n```typescript\ndelayUpdate() =\u003e Promise\u003cvoid\u003e\n```\n\nSkip updates in the next time the app goes into the background, only in auto-update\n\n--------------------\n\n\n### cancelDelay()\n\n```typescript\ncancelDelay() =\u003e Promise\u003cvoid\u003e\n```\n\nallow update in the next time the app goes into the background, only in auto-update\n\n--------------------\n\n\u003c/docgen-api\u003e\n\n### Listen to download events\n\n```javascript\n  import { CapacitorUpdater } from 'capacitor-updater';\n\nCapacitorUpdater.addListener('download', (info: any) =\u003e {\n  console.log('download was fired', info.percent);\n});\n```\n\nOn iOS, Apple don't allow you to show a message when the app is updated, so you can't show a progress bar.\n\n### Inspiration\n\n- [capacitor-updater](https://github.dev/Capgo/capacitor-updater)\n- [cordova-plugin-ionic](https://github.dev/ionic-team/cordova-plugin-ionic)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcap-go%2Fcordova-updater","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcap-go%2Fcordova-updater","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcap-go%2Fcordova-updater/lists"}