npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gh-autoupdater

v1.1.0

Published

Compare local package.json and remote package.json and if versions don't match, copy remote files

Downloads

2

Readme

AutoUpdater

Compare local package.json and remote package.json and if versions don't match, copy remote files

Installation

npm install gh-autoupdater

How it works?

  • Compare local version with remote version
  • If versions don't match, download the repository
  • Copy files to local
  • Compare local dependencies with remote dependencies
  • If dependencies don't match, install the remote dependencies

Config

  • repo: 'http://github.com/user/repo' - The url to the root of a git repository to update from.
  • branch: 'main' - The branch to update from.
  • temp: './temp-update' - The local dir to save temporary information for the update.
  • ignore: ['.git',...] - An array of files for not copiyng when updating.
  • testing: false - If true, copy update inside ./testing folder.
  • dev: false - If true, ignore the update.
  • token: 123456... - If you are using a private repository you should use a personal access token for downloading it

This values are the default values

Events

  • out-dated(localVersion, remoteVersion) - Local version is out-dated
  • up-to-date(version) - Versions match
  • download.start(repo) - Download started from the repository
  • download.end - Files downloaded
  • update.start - Copying files from "tepm folder"
  • modules.start - Installing dependencies
  • modules.end(modules) - Dependencies installed
  • end - All is over

Example

const AutoUpdate = require('gh-autoupdater');

const update = new AutoUpdate({
  repo: 'https://github.com/user/repo',
  branch: 'main',
  temp: './temp-update',
  testing: false,
});

// Initialize update
update.autoUpdate();

// Events
update.on('out-dated', (local, remote) => {
  console.log('Out-dated: Local-' + local + ' Remote-' + remote);
});
update.on('up-to-date', (local) => {
  console.log('Up to date: local-' + local);
});
update.on('modules.start', () => {
  console.log('Updating dependencies...');
});
update.on('modules.end', (modules) => {
  console.log('Dependencies updated: ');
  console.log(modules);
});
update.on('download.start', (repo) => {
  console.log('Downloading files from: ' + repo);
});
update.on('download.end', () => {
  console.log('Files downloaded');
});
update.on('update.start', () => {
  console.log('Copying files...');
});
update.on('end', () => {
  console.log('Application updated');
});