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

@zkty-team/x-engine-module-offline

v0.1.20

Published

此模块用于离线更新, 自动触发.

Downloads

49

Readme

此模块用于离线更新, 自动触发.

客户端更新流程

  • 启动

    • 请求服务器获取 microApp.json
      • 请求成功:
        • 循环:url,version = locateMicroAppByMicroappId
          • url != nil: 通过 appid 对比版本号
            • 本地版本低, 下载远程新版本,并解压到沙盒
            • 本地版本一样或更高, 返回
          • url 为 nil: 下载远程新版本,并解压到沙盒
      • 请求失败: 不做任何事
  • (url) locateMicroAppByMicroappId(&version)

    • 从沙盒找
      • 成功, 返回 index.html 位置与版本
      • 失败, 从工程找
        • 成功 返回 index.html 位置与版本
        • 失败 返回 (nil,-1)

微应用存储的位置

各平台表现不一, 假设可持久化存储位置为 X

{X}/microApps/{microAppId}.{version}/index.html

{X}/microApps/{microAppId}.{version}/icon.png

{X}/microApps/{microAppId}.{version}/...

microApps 做为一个统一的 microApp 入口.

- {X}
	- microApps
		-	com.zkty.xiaoqu.opendoor.1
				- index.html
				- icon.png
		- com.zkty.xiaoqu.opendoor.2
				- index.html
				- icon.png
		-	com.zkty.xiaoqu.shequ.1
				- index.html
				- icon.png

zip 包格式

- {microAppId}.{version}.zip
  - index.html
  - icon.png   // 128*128
  - ...

举例:

- com.zkty.xiaoqu.opendoor.1.zip
  - index.html
  - icon.png
	- ...

引擎应用配置

xengine_config.json:

{
  "appId": "com.zkty.xiaoqu",    // 建议直接设置为应用的 Bundle Identifier
  "appSecret": "8b387ca3ebdd412e9c97ef81ed352ee7",  //随机 md5 值.
  "offlineServerUrl": "https://3rd-public-file.oss-cn-beijing.aliyuncs.com"  //服务器地址,
  ...
}

app 微应用集合地址

请求地址:

GET: {offlineServerUrl}/microApps.json?key=md5(appSecret+appId)
key 由  md5 算出. 
key = md5(appSecret+appId)

返回: 有新版本

http status: 200

microApps.json:

{
  "code":0,
  "data":
        [
          {
            "microAppName":"开门",
            "microAppId":"com.zkty.xiaoqu.opendoor",
            "microAppVersion":2,
            "url":"http://www.dfsf/com.zkty.xiaoqu.opendoor.2.zip",
            "fallback":"http://www.dfsf/com.zkty.xiaoqu.opendoor.2/index.html"
          }
        ]
  }

microApps.json 应该持久化在手机应用本地. 用来对比.

如果不持久化到本地, 那就需要扫描本地 microApps 来对比是否需要更新版本.

微应用 zip 下载地址

GET: {url}?key=md5(appSecret+microAppId+version)&engine_build=1
http://www.dfsf/com.zkty.xiaoqu.opendoor.2.zip?key=md5(appSecret+microAppId+version)&engine_build=1