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

live-mp-tools

v1.3.4-alpha2

Published

AppId: 主干环境:wx0c3417205d9852a9 测试环境:wxb58a41ffda339bf5 正式环境:wx13a74d0d3ab0942e

Downloads

51

Readme

live-mp-tools

暴露的接口

AppId: 主干环境:wx0c3417205d9852a9 测试环境:wxb58a41ffda339bf5 正式环境:wx13a74d0d3ab0942e

暴露的环境名字段:ENV_NAME(环境)、LIVE_BASE_URL(请求域名)

ENV:inside. 主干环境 test. 测试环境 '' 正式环境

业务请求域名 https://applet-server.${ENV}xiaoeknow.com

live 对应鹅直播主干业务

player 对应h5直播间业务

需要在开发者工具手动缓存一个 storeId (店铺ID),若不设定默认店铺ID appmzd7lhrj6214。

  • @description 网络请求发送
  • @param {String} method 网络请求类型 get/post
  • @param {String} url 网络请求地址
  • @param {Object} params 请求传参
  • @param {Boolean} [isNeedBiz=true] 是否需要在传参外层用 bizData 变量包裹。例如:传参为{a: 1},用bizData包裹后为{bizData: {a: 1}}
  • @param {Object} [config={}] 网络请求 header 扩展 (非必传)
  • @param {host} [host=''] host 自定义扩展(非必传)
// 请求示例
const http = require('live-mp-tools')

const url = "_alive/v2/base_info"
const param = {
  resource_id: 'l_617a430c60b219052d7eb94a',
  type: 12,
  app_id: 'appyhdtiy2a1818'
}
const isNeedBiz = false
const config = {} // header 扩展 (可不传) 
const host = 'captcha.xiaoeknow.com' (可不传) // 直接传现网业务域名,包内已作环境判断
const res = await http.player.get(url, param, isNeedBiz, config, host)

更新版本

1.2.6 更新内容:limitKoToken 限制接口请求标识,处理直播间 baseInfo 接口极限异常情况,标识后续接口不调取直接 return。

1.2.3 & 1.2.4 更新内容:utils 新增资源压缩加速方法。

1.2.2 更新内容:playerHttp 精准正则匹配条件添加请求头信息。

1.2.1 更新内容:对获取kotoken登录接口作处理,防止接口出错阻塞。

1.2.0 更新内容:1.将请求封装改成类的形式。 2.暴露请求域名。

1.1.9 更新内容:封装的请求接口增加重新登录次数限制(5次)。

1.1.8 更新内容:增加埋点封装。

开发

  1. 安装依赖:
npm install
  1. 执行命令:npm run dev 默认会在包根目录下生成 miniprogram_dev 目录,src 中的源代码会被构建并生成到 miniprogram_dev/components 目录下。如果需要监听文件变化动态构建,则可以执行命令:npm run watch

目录结构

以下为推荐使用的目录结构,如果有必要开发者也可以自行做一些调整:

|--miniprogram_dev // 开发环境构建目录
|--miniprogram_dist // 生产环境构建目录
|--src // 源码
|   |--components // 通用自定义组件
|   |--images // 图片资源
|   |
|   |--xxx.js/xxx.wxml/xxx.json/xxx.wxss // 暴露的 js 模块/自定义组件入口文件
|
|--test // 测试用例
|--tools // 构建相关代码
|   |--demo // demo 小程序目录,开发环境下会被拷贝生成到 miniprogram_dev 目录中
|   |--config.js // 构建相关配置文件
|
|--gulpfile.js

PS:对外暴露的 js 模块/自定义组件请放在 src 目录下,不宜放置在过深的目录。另外新增的暴露模块需要在 tools/config.js 的 entry 字段中补充,不然不会进行构建。

其他命令

  • 上传npm包:
npm run build

npm login

npm publish
  • 清空 miniprogram_dist 目录:
npm run clean
  • 清空 miniprogam_dev 目录:
npm run clean-dev