How to create a self-updating Node.js application?

后端 未结 4 1326
孤独总比滥情好
孤独总比滥情好 2021-02-13 13:29

I\'d like to create an application with Node.js that periodically checks for updates and installs them if there are any.

The basic components are clear to me:

4条回答
  •  花落未央
    2021-02-13 13:46

    A web server would be unnecessary. Git is a prefect solution for hosting public and private code & includes version control. For private repositories you can make use of the personal access tokens.

    I have created a module for automatically updating node.js applications from git repositories. It compares the local package.json with the one from your repo, then automatically clones the repo and install dependencies. You can configure your app to check for updates on application start, end, or schedule routine checks.

    Auto Git Update - https://github.com/chegele/AutoGitUpdate

    import AutoGitUpdate from 'auto-git-update';
    
    const config = {
        repository: 'https://github.com/chegele/BackupPurger'
        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();
    

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题