如何制作一个自更新的节点包? [英] How to make a self-updating node package?

查看:45
本文介绍了如何制作一个自更新的节点包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个 node_module bookiza 它本质上是一个命令行工具,人们使用 --global 标志安装然后使用它在线创作和出版书籍.我们正在(大部分)关注 semver,但我认为将来会如此严格.

We have a node_module bookiza which is essentially a command line tool that people install with --global flag and then use it to create and publish books online. We are following semver for it (mostly) but I envisage it will be done so strictly in the future.

有没有办法让这个模块成为一个自我更新的模块?以便我们所有的客户(作者)始终使用相同版本的 bookiza(除非他们禁用自动更新).基本上,每 15 天或在发布新版本时运行 npm update [-g] bookiza.

Is there a way to make this module a self-updating one? So that all our clients (writers) are on the same version of bookiza at all the times (unless they disable autoupdate). Essentially, run npm update [-g] bookiza every 15 days or when a new release is outed.

我应该如何实施这个?

推荐答案

对于那些正在寻找相同事物的人,我创建了一个模块,用于从 git 存储库自动更新 node.js 应用程序.它将本地 package.json 与您的 repo 中的 package.json 进行比较,然后自动克隆 repo 并安装依赖项.

For those who are looking for the same thing, 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.

自动 Git 更新 - https://github.com/chegele/AutoGitUpdate

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();

这篇关于如何制作一个自更新的节点包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆