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

create-bff-service-cli

v1.0.5

Published

快速搭建一个基于 egg 的,规范的 bff-service

Downloads

16

Readme

create-bff-service-cli

介绍

快速搭建一个基于 egg框架 的 bff-service cli工具。

  • 服务模版多种语言可选模 typescript/javascript (建议选择 typescript,目前只添加了typescript 模版)
  • 模版内容支持根据交互动态配置,具体可配置内容请看下文参数说明
  • 服务模版编码规范已完善,已添加 eslintprettiertsconfig 配置等,并且支持自动保存校验,.vscodesettings.json 已配置 。
  • 提供了基本项目结构 routercontrollerserviceconfig 配置等,可直接测试template中提供的基础接口。

快速开始

使用前的准备工作

  1. 安装 node.js

    node.js安装可以官网下载安装,https://nodejs.org/

    也可以使用 nvs安装,方便切换版本,https://github.com/jasongin/nvs

  2. 安装 yarn

    > npm install -g yarn
  3. 安装 nrm nrm 作用是修改 npm 的镜像源 安装 nrm

    > npm install -g nrm

    设置 npm 源为私服地址:

    > nrm add me http://*.*.*.*:78900
    > nrm use me
  4. 建议 IDE vscode

  5. vscode必装插件 ESLint

    Prettier - Code formatter

    通过这两个插件,配合项目中的规则配置文件,可以使团队中的代码格式化规则一致

安装 create-bff-service-cli

> npm install -g create-bff-service-cli

安装之后就可以使用 cli 命令: create-bff-service

cli 执行命令说明

在命令行执行命令

create-bff-service init

然后会出现交互提示,按照交互提示输入各项参数。

参数项说明
  1. 服务名称 serviceName: 服务的英文名称,例如: xxx-bff-service
  2. 作者 author: 作者的英文名称,例如:xiaoming
  3. 服务端口号 port: 找运维申请的服务端口号,例如:7001
  4. 版本号 version: 服务的版本号,例如:0.0.1
  5. 介绍 description: 服务的介绍 例如:某业务线的 BFF 服务
  6. 模版 template: 选择模版 例如:选择 typescript 模版
  7. 项目版本管理 git: 选择是否 git 初始化项目 例如: yes git 初始化项目
  8. 项目依赖安装 install: 选择是否安装依赖 例如: yes install 所有依赖
使用调试模式启动 cli 创建的 bff-service
> yarn debug
模版接口测试

接口访问测试:调用 demo/demo1 路由,获取服务返回数据。

curl http://127.0.0.1:7890/demo/demo1

// 返回结果
{"status":200,"data":{"r":"hello word"}}    
模版代码保存自动格式化配置

该功能正常使用前提需要安装前文提到的 vscode 插件