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

jd-minigame-ci

v0.2.6

Published

The jd-minigame-ci is a toolkit provided for developers of JD Mini Games. Developers can complete code upload and preview operations for JD Mini Games without the need to open the developer tools, simply by using this toolkit.

Downloads

124

Readme

京东小游戏 CI 工具

概述

jd-minigame-ci 是为京东小游戏开发者提供的工具包。开发者无需打开开发者工具,使用工具包即可完成小程序代码的上传、预览等操作。

上传秘钥

使用工具包之前,请访问“京东小程序控制台—设置—开发设置—小游戏代码上传秘钥”获取上传秘钥。

需要注意的是,获取上传密钥权限目前仅小游戏管理员可以获取。

alt 京东小程序秘钥生成

功能

  1. 上传代码,对应小程序开发者工具的上传功能
  2. 预览代码,对应小程序开发者工具的预览功能
  3. 支持“node 脚本”和“命令行”调用方式
  4. 跨平台,支持 Windows/Mac/Linux,可用于产品集成流水线部署

安装

npm install -g jd-minigame-ci

CLI版本获取

为确保使用最新功能和安全更新,如果检测到您的本地npm包版本落后于仓库中的最新版本,建议首先卸载本地包,随后安装最新版本。

通过以下命令可获取本地京东小游戏CLI工具版本:

jgc -v 
jgc -V

以上命令均可获取本地京东小游戏CLI工具版本。

也可以通过以下命令行:

jgc latest 

以上命令将拉取京东小游戏CLI工具在npm官方仓库最新版本,并与本地版本进行对比,提示版本对比信息。

命令行调用

创建小游戏配置文件

在游戏项目父目录或者其他目录(注意不要在当前待打包游戏的子目录)执行以下命令:

jgc config

配置成功后会在当前目录生成配置文件 jgc.config.js,配置示例如下:

module.exports = {
  "type": "game", // 包类型, 有三种类型可选:game(小游戏), plugin(插件)
  "appId": "133D26A41FB623****", // 游戏的appId 
  "requestToken": "1c0f081c18a248adbff9f****", // 游戏上传秘钥
  "entry": "./build/source", // 需要被打包的小游戏的路径 
  "version": "1.0.0", // 选填,版本号
  "description": "自测" // 选填,自定义备注 
}

预览功能

预览功能主要用于开发过程中,对小游戏进行真机预览及调试。

在生成 jgc.config.js 的同级目录执行以下命令:

jgc preview

执行完上述命令后,如果一切正常,会在Termina出现二维码,

alt 预览二维码

上传功能

上传功能用于开发者通过命令行快速将本地代码包上传至开发版本,并自动设置为体验版,返回体验版二维码。

在生成 jgc.config.js 的同级目录执行以下命令

jgc upload

alt 体验版二维码

客户端调试

在非线上小游戏,iOS/Android均支持打开调试模式,支持vConsole查看调试日志。

alt 开启调试

alt 调试

脚本调用

上传功能

const jgcCli = require('jd-minigame-ci')
jgcCli.upload({
  type: 'game', // 类型
  appId: '***', // 小游戏的appId
  requestToken: '', // 小游戏的上传秘钥
  entry: '',  // 需要被打包的小游戏(或者游戏插件)的路径
  version: '1.0.0', // 小游戏版本号
  description: 'fix:小游戏bug', // 小游戏版本描述
}).then(data => {
  console.log('data',data);
});

输入参数

| 参数名 | 类型 | 必填 | 说明 | |------------|-------|----|--------------| | appId | string | 是 | 小游戏的appId | | requestToken | string | 是 | 秘钥信息 | | entry | string | 是 | 项目路径 | | version | string | 否 | 自定义版本号 | | description | string | 否 | 自定义备注 |

返回值

| 属性 | 类型 | 说明 | |------------|-------|--------------| | url | string | openapp 协议二维码地址 | | expiredTime | string | 过期时间 |

预览功能

const jgcCli = require('jd-minigame-ci')
jgcCli.preview({
  type: 'game', // 类型
  appId: '***', // 小游戏的appId
  requestToken: '', // 小游戏的上传秘钥
  entry: '',  // 需要被打包的小游戏(或者游戏插件)的路径
}).then(data => {
  console.log('data',data);
});

输入参数

| 参数名 | 类型 | 必填 | 说明 | |------------|-------|----|--------------| | appId | string | 是 | 小游戏的appId | | requestToken | string | 是 | 秘钥信息 | | entry | string | 是 | 项目路径 |

返回值

| 属性 | 类型 | 说明 | |------------|-------|--------------| | url | string | openapp 协议二维码地址 | | expiredTime | string | 过期时间 |