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

kd-deliver-api-pro

v1.0.0-alpha.31

Published

KD-DELIVER-API-PRO

Downloads

50

Readme

KDPlus 项目基线脚手架

已集成KD-API主要核心代码,可直接使用此脚手架快速应用项目二开。

1:监听code

import { Core } form 'kd-api/lib'

const listen = (listenName: String,cb: Function) => {
    Core.customEventListener(listenName, callback: (val: object) => {
        if(val.code === 313) {
            cb?.(val)
        }
    });
}

说明

listen是给用户提供的可调用的方法。

此处仅为示例,请在实际开发中定义新的方法名。

| 属性 | 类型 | 是否必填 | 说明 | |---------|--------|------|--------| | listenName | String | Y | 监听code事件自定义方法。(用户不用多操心这个是做什么用的) | | cb | Function | Y | 用户处理回调函数参数的业务逻辑 |

customEventListener为监听code事件方法。

| 属性 | 类型 | 是否必填 | 说明 | |---------|--------|------|--------| | listenName | String | Y | 用户在调用listen方法传的,监听code事件自定义方法。 | | callback | String | Y | 处理满足条件的code,把结果通过用户的回调函数返回给用户。 |

2:移除监听

import { Core } form 'kd-api/lib'

const removeListen = (listenName: string) => {
    Core.removeCustomEventlistener(listenName);
}

说明

removeListen是给用户提供的可调用的方法。

| 属性 | 类型 | 是否必填 | 说明 | |---------|--------|------|--------| | listenName | String | Y | 为用户在进行添加监听事件方法时传的自定义方法名。 |

removeCustomEventlistener为移除监听code事件方法。

| 属性 | 类型 | 是否必填 | 说明 | |---------|--------|------|--------| | listenName | String | Y | 监听code事件自定义方法。 |

3:封装定开API

import { Core } form 'kd-api/lib'

const messageUnity = (params: String | Object | Array) => {
    return Core.sendEvent(packageName, action, JSON.stringify(params))
}

说明

messageUnity是给用户提供的可调用的方法。

此处仅为示例,请在实际开发中定义新的方法名。

| 属性 | 类型 | 是否必填 | 说明 | |---------|--------|------|--------| | params | String、Object、Array等 | Y | 需要传递的参数可为任一类型。(必须与unity接收的格式及字段一致。) |

sendEvent为调用unity方法。

| 属性 | 类型 | 是否必填 | 说明 | |---------|--------|------|--------| | packageName | String | Y | 包名。(unity提供) | | action | String | Y | 方法名。(unity提供) | | params | String | Y | 参数。(与unity接收的保持一致。) |

4:使用基线API

export * from 'kd-api/lib';

直接导出KD-API基线所有API供用户使用。 API具体使用方式见:产品基线文档

5:版本及分支管理

feature-姓名拼音缩写-项目名 分支

个人开发项目分支。所有API在个人项目分支上开发。

1:在项目API开发完成后代码合并到alpha分支,发布alpha版本;

2:在alpha分支如果出现bug,则回归到个人开发分支修复,重复步骤1。

alpha分支

内部测试分支。封装API之后用于开发人员及测试人员测试。

需求迭代开发过程中版本发布 npm 包。

在个人开发分支完成项目API封装后,代码合并到此分支,发布测试版本。

1:修改package.json中version字段。例:"version": "1.0.0-alpha.1"

2:发布命令。npm publish --tag alpha

main分支

发布正式npm包分支。

在项目API封装完成且测试通过后发布正式版本。

此分支只合并alpha分支测试通过的代码;

1:修改package.json中version字段。例:"version": "1.0.0"

2:发布命令。npm publish / yarn publish

注:为避免出现版本重复问题,执行npm publish命令,不必再次执行yarn publish命令,yarn会自动同步npm的版本

注意

  • 发布正式包,必须经过负责人、测试通过后才可发布;
  • 每次版本发布,新增或修改的必须有对应的文档说明;
  • 版本号必须为递增,不能跳跃。