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

@pos-360/auto-git-update

v1.1.3

Published

Update node app from git repo.

Downloads

35

Readme

Auto Git Update

a node.js module used for automatically updating projects from a git repository.

Notes

  • This module comes in two flavors. ECMAScript & Commonjs.
  • The default install will be an ECMAScript module which requires use of an import statement.
  • Optionally, install the commonjs module to make use of the more popular require statement.
  • This module uses simple-logger (https://github.com/chegele/Logger).
  • To update from private repositories a personal access token needs to be provided.
  • During updates a backup of the old version is taken and stored in the configured tempLocation.
  • The remote package.json is compared to the local package.json to determine if a different version is available.

Config Options

  • repository String - The url to the root of a git repository to update from.
  • tempLocation String - The local dir to save temporary information for Auto Git Update.
  • fromReleases Boolean - [optional] Updated based off of latest published GitHub release instead of branch package.json.
  • branch String - [optional] The branch to update from. Defaults to master.
  • token String - [optional] A personal access token used for accessions private repositories.
  • ignoreFiles Array[String] - [optional] An array of files to not install when updating. Useful for config files.
  • executeOnComplete String - [optional] A command to execute after an update completes. Good for restarting the app.
  • exitOnComplete Boolean - [optional] Use process exit to stop the app after a successful update.
  • logConfig Object - [optional] An object with the logging configuration, see https://github.com/chegele/Logger

Functions

  • autoUpdate() - Updates if local package.json version is different than remote.
  • compareVersions() - Compares package.json versions without updating.
    • Returns an object with the properties upToDate, currentVersion, & remoteVersion.
  • forceUpdate() - Updates without comparing package versions.
  • setLogConfig(logConfig) - Updates logging configuration. https://github.com/chegele/Logger

ECMAScript Example (default)

npm i auto-git-update
import AutoGitUpdate from 'auto-git-update';

const config = {
    repository: 'https://github.com/chegele/BackupPurger',
    fromReleases: true,
    tempLocation: 'C:/Users/scheg/Desktop/tmp/',
    ignoreFiles: ['util/config.js'],
    executeOnComplete: 'C:/Users/scheg/Desktop/worksapce/AutoGitUpdate/startTest.bat',
    exitOnComplete: true
}

const updater = new AutoGitUpdate(config);

updater.autoUpdate();

CommonJS Example

npm i auto-git-update@commonjs
const AutoGitUpdate = require('auto-git-update');

const config = {
    repository: 'https://github.com/chegele/BackupPurger',
    fromReleases: true,
    tempLocation: 'C:/Users/scheg/Desktop/tmp/',
    ignoreFiles: ['util/config.js'],
    executeOnComplete: 'C:/Users/scheg/Desktop/worksapce/AutoGitUpdate/startTest.bat',
    exitOnComplete: true
}

const updater = new AutoGitUpdate(config);

updater.autoUpdate();