{"id":18654677,"url":"https://github.com/juampi92/auto-updater","last_synced_at":"2025-08-21T12:30:35.560Z","repository":{"id":15002515,"uuid":"17727979","full_name":"juampi92/auto-updater","owner":"juampi92","description":"Node.js auto-update plugin","archived":false,"fork":false,"pushed_at":"2018-06-26T21:02:43.000Z","size":45,"stargazers_count":76,"open_issues_count":6,"forks_count":32,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-03-14T14:45:27.479Z","etag":null,"topics":["javascript","npm-package","updater"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juampi92.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}},"created_at":"2014-03-13T22:18:29.000Z","updated_at":"2023-12-11T12:14:13.000Z","dependencies_parsed_at":"2022-09-07T13:50:50.963Z","dependency_job_id":null,"html_url":"https://github.com/juampi92/auto-updater","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juampi92%2Fauto-updater","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juampi92%2Fauto-updater/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juampi92%2Fauto-updater/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juampi92%2Fauto-updater/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juampi92","download_url":"https://codeload.github.com/juampi92/auto-updater/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230511479,"owners_count":18237657,"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":["javascript","npm-package","updater"],"created_at":"2024-11-07T07:16:11.659Z","updated_at":"2024-12-19T23:14:41.161Z","avatar_url":"https://github.com/juampi92.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Auto-Updater\n[![Build Status](https://travis-ci.org/juampi92/auto-updater.svg)](https://travis-ci.org/juampi92/auto-updater)[![Dependencies](https://david-dm.org/juampi92/auto-updater.svg)](https://david-dm.org/juampi92/auto-updater)\n\n[Node.js](http://nodejs.org/) auto-update plugin.\n\nCompares local package.json with repository package.json and if versions don't match, it downloads the latest zip and extracts it.\n\n# Installation\n\t\nWith [npm](http://npmjs.org) do:\n\n    $ npm install auto-updater\n\n# What does it do?\n\n * Compares local version with remote version.\n * If versions don't match, it downloads the repository.\n * It extracts the repository, overwriting the modified files.\n * Compares local dependencies with remote dependencies and tells if they don't match.\n\n# Events\n\n * `git-clone` The user has a git clone. Recommend use the \"git pull\" command\n * `check.up-to-date ( v )` versions match\n * `check.out-dated ( v_old , v)` versions dont match\n * `update.downloaded` Update downloaded in the machine\n * `update.not-installed` Update was already in the dir, so it wasnt installed\n * `update.extracted` The update has been extracted correctly.\n * `download.start ( name )` The download of \"name of the update\" has started\n * `download.progress ( name , % )` The download has been updated. New percentage\n * `download.end ( name )` The download has ended\n * `download.error ( err )` Something happened to the download\n * `end` Called when all is over ( along with 'check-up-to-date' if there are no updates, or with 'extracted' if it was installed )\n\n# Public Methods:\n\n * `use ( config )`\n * `on ( event, callback )` Sets the events (use like [EventEmitter](https://nodejs.org/api/events.html#toc))\n * `fire ( command )` Fires a command\n\n## Config\n * `pathToJson: ''` from repo main folder to package.json (only subfolders. Can't go backwards)\n * `autoupdate: false` if true, all stages run one after the other. Else, you need to force the stages with the force methods\n * `checkgit: true` Checks if the .git folder exists, so its a dev and doesnt download the project.\n * `jsonhost: 'raw.githubusercontent.com'` URL of raw remote package.json\n * `contenthost: 'codeload.github.com'` URL of full remote zip\n * `progressDebounce: 0` Debounces the 'download.progress' event (0 = disabled)\n * `devmode: false` Developer Mode. Enhances error messages using console.log\n\n## Commands\n * `check` Compares the two versions. Triggers: 'git-clone', 'check.up-to-date', 'check.out-dated'\n * `download-update` Downloads the update. Triggers: 'update.downloaded', 'update.not-installed','download.*'\n * `extract` Extracts (or installs) the update reeplacing old files (it doesnt delete untracked files). Triggers: 'update.extracted'\n * `diff-dependencies` Returns an array of dependencies (only the names) that dont match. Returns an empty array if there's no difference. Requires the 'check' command first.\n\nWarning: do not run this methods in other order.\n\n# Package.json configuration\n\t\n\t\"version\":\"0.0.1\",\n\t\"auto-updater\":{\n\t\t\"repo\":\"/github-user/github-repo\",\n\t\t\"branch\":\"master\"\n\t}\n\nThat segment must be added to the project (local). It is critical that the package.json of the app you are using has a version field (so it can be compared with the remote package.json stored on github), and the auto-updater field, so it knows where to get the remote data.\n\n# Example\n```javascript\n    var AutoUpdater = require('auto-updater');\n\n    var autoupdater = new AutoUpdater({\n     pathToJson: '',\n     autoupdate: false,\n     checkgit: true,\n     jsonhost: 'raw.githubusercontent.com',\n     contenthost: 'codeload.github.com',\n     progressDebounce: 0,\n     devmode: false\n    });\n\n    // State the events\n    autoupdater.on('git-clone', function() {\n      console.log(\"You have a clone of the repository. Use 'git pull' to be up-to-date\");\n    });\n    autoupdater.on('check.up-to-date', function(v) {\n      console.info(\"You have the latest version: \" + v);\n    });\n    autoupdater.on('check.out-dated', function(v_old, v) {\n      console.warn(\"Your version is outdated. \" + v_old + \" of \" + v);\n      autoupdater.fire('download-update'); // If autoupdate: false, you'll have to do this manually.\n      // Maybe ask if the'd like to download the update.\n    });\n    autoupdater.on('update.downloaded', function() {\n      console.log(\"Update downloaded and ready for install\");\n      autoupdater.fire('extract'); // If autoupdate: false, you'll have to do this manually.\n    });\n    autoupdater.on('update.not-installed', function() {\n      console.log(\"The Update was already in your folder! It's read for install\");\n      autoupdater.fire('extract'); // If autoupdate: false, you'll have to do this manually.\n    });\n    autoupdater.on('update.extracted', function() {\n      console.log(\"Update extracted successfully!\");\n      console.warn(\"RESTART THE APP!\");\n    });\n    autoupdater.on('download.start', function(name) {\n      console.log(\"Starting downloading: \" + name);\n    });\n    autoupdater.on('download.progress', function(name, perc) {\n      process.stdout.write(\"Downloading \" + perc + \"% \\033[0G\");\n    });\n    autoupdater.on('download.end', function(name) {\n      console.log(\"Downloaded \" + name);\n    });\n    autoupdater.on('download.error', function(err) {\n      console.error(\"Error when downloading: \" + err);\n    });\n    autoupdater.on('end', function() {\n      console.log(\"The app is ready to function\");\n    });\n    autoupdater.on('error', function(name, e) {\n      console.error(name, e);\n    });\n\n    // Start checking\n    autoupdater.fire('check');\n```\n\n# Dependencies\n * [Adm-zip](https://github.com/cthackers/adm-zip)\n * [underscore](https://www.npmjs.com/package/underscore)\n * [node-promise](https://www.npmjs.com/package/node-promise)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuampi92%2Fauto-updater","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuampi92%2Fauto-updater","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuampi92%2Fauto-updater/lists"}