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

local-updater

v1.0.8

Published

local updater, update your thinkjs source code

Downloads

8

Readme

localUpdater

  • update your local server code from internet server
  • 局域网代码自动下载升级外网代码源

what scene need use this plugin ? 什么场景使用该插件 ?

  • Local Server of SupperMarket, when the local code needs update from Internet Server。example ThinkJS Server
  • 超市类的局域网服务端程序,当需要升级局域网服务端代码的时候。比如ThinkJS服务端。

how to run localUpdater ? 怎么使用localUpdater?

  • npm i local-updater -save

example, your internet host server is updater.test.com , and your path of lastest.json on your server is /update/json/lastest.json, and the root path of your source code on your server is /update/v2/

  • server update json: lastest.json 你外网服务器升级配置文件lastest.json
  • if your source code on the other server, you can set the param dir with http://domain/dir/lastest.json
{
  "version":"1.0.2",
  "dir":"update/v2/",
  "file_list":[
	{"path":"test2.js","hash":"ad0234829205b9033196ba818f7a872b"},
	{"path":"src/test3.js","hash":""},
	{}
  ]
}
  • your local node server code: 你局域网node服务器代码:
//install and require localUpdater 安装并引入localUpdater
var localUpdater = require('localUpdater');
//create instance of localUpdater 实例化localUpdate
var updater = new localUpdater('http://updater.test.com/update/json/','1.0.0','./');
//listen update Avilable, if res==true, run function update() to download file 监听升级可用事件,若res为true则执行升级方法update()
updater.on('updateAvilable',function(res){
    if(res){
        updater.update();
    }
});
//listen update Error, when res.code>500 the file download error 监听升级错误信息,当res.code>500时为下载文件错误
updater.on('updateError',function(res){
    console.log(res);
});
//listen download file, res = {path:internet_file_path,hash:internet_file_hash,index:internet_file_list_index,counts:internet_file_counts}
//监听每个文件更新下载完成 res = {path:下载文件路径名,hash:下载文件hash值,index:下载文件列表索引,counts:下载文件列表总数}
updater.on('updateFile',function(res){
    console.log(res);
});
//listen download finish, need update your local version number,res = {ver:self.ver,newver:self.newver,file_list:self.file_list}
//监听下载更新完毕事件,这里应该更新本地服的版本号,res = {ver:更新前版本号,newver:更新后版本号,file_list:更新文件列表}
updater.on('updateFinish',function(res){
    console.log(res);
});
//run checkUpdate, auto update => run it ever 60 minutes 执行检查更新方法,建议每隔60分钟检查运行一次,达到自动更新目的
updater.checkUpdate();

how to make file list on internet server ? 外网服务端如何生成升级列表文件?

  • example, install localUpdater in your program directory and run makeList function(needs_make_dir,root_path)
  • 例如,安装localUpdater并引入后,运行如下代码即可,第二个参数为服务端代码根目录路径,第一个参数空字符串即可,若只需要更新部分文件夹代码,则第一个参数为生成列表的目录相对根目录路径
var localUpdater = require('localUpdater');
localUpdater.makeList('','src/v2/');
  • then there will be a file lastest.json