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

@tars/nodetools-cli

v0.0.12

Published

tools cli for tars-nodejs

Downloads

81

Readme

Tars Nodejs 脚手架及自动化发布工具

此工具提供Tars Nodejs 脚手架、自动打包发布的功能。
通过此工具,可以通过简单的3~4个步骤来开发、发布一个tars服务。

1. 安装

npm install -g @tars/nodetools-cli

2. 使用

创建服务

参考tars的Hello World文档创建一个tars服务。
注意选择正确的协议类型, tars rpc服务选择tars协议, http服务选择非tars协议

初始化

nodetools init
根据需要设置选项,其中application、server、obj,必须和创建服务的步骤中一致。

  • 语言支持:javascript、typescript
  • 协议支持:http、tars
  • Http框架支持:koa、express、Nodejs原生http模块

开发

在初始化项目生成的目录下,http协议服务可以直接npm run dev 启动服务,开发业务逻辑;

tars协议服务首先需要编写协议文件、转换为js/ts代码,按代码中提示配置好相应的imp对象,再npm run dev启动服务。

打包发布

此工具提供tars nodejs服务自动打包发布的功能,根据提示输入tars平台地址、tars用户中心中创建的token,即可自动打包、发布服务。其中token可根据实际情况选择保存或者不保存到package.json中,非敏感项目或者环境可选择保存。

http协议服务,项目初始化完毕后可直接运行 npm run upload 将服务发布至Tars平台,浏览器中访问 /hello 路径即可看到测试输出。

tars协议服务,需要先转换tars协议文件,实现业务逻辑后运行 npm run upload 发布至Tars平台。

非本工具脚手架创建的项目,可在根目录下运行 nodetools upload 来自动打包发布,也可以自行编辑package.json中的script来使用此工具。

通过命令行使用

可以通过传入 --cmd来从命令行读取参数
初始化 nodetools init --cmd ...,参数列表:

-V, --version                output the version number
  --cmd                        get options from command line
  --language [language]        project language, can be JavaScript/TypeScript (default: "JavaScript")
  --protocol [protocol]        project protocol, can be http/tars (default: "http")
  --application [application]  application name (default: "")
  --server [server]            server name (default: "")
  --obj [obj]                  obj name (default: "")
  --httpapp [httpapp]          http app, can be koa/express/native http (default: "koa")
  --tarsfile [tarsfile]        tars protocol file name, eg: (default: "Hello.tars")
  -h, --help                   display help for command

发布 nodetools upload --cmd ...,参数列表:

-V, --version                output the version number
  --cmd                        get options from command line
  --tarsurl [tarsurl]          tars url (default: "")
  --token [token]              tars token (default: "")
  --application [application]  application name (default: "")
  --server [server]            server name (default: "")
  --obj [obj]                  obj name (default: "")
  -h, --help                   display help for command

参数要求与通过终端输入时一致。