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

zh-tpl

v2.1.1

Published

创建统一模块模板,支持模板有 umi js、umi ts、ts 函数组件、taro等

Downloads

7

Readme

tpl

创建统一功能模块模板,支持模板有 umi js、umi ts、ts 函数组件、taro等。

结构如下:

安装

npm i zh-tpl -g

使用

该 tpl cli 默认为 umi js 模板,使用如下:

$ tpl 模块名

例如:需要创建 home 模块,则运行如下命令

tpl home

运行结果:

为了规范,在创建模块的时候,同时支持传入头文件注释 author,命令行:

$ tpl 模块名 --author=小明

或者使用简写

$ tpl 模块名 -a=小明

umi ts 模板

该 tpl 也支持 umi ts 模板,使用如下命令行:

$ tpl 模块名 -a=xxx -t=ts

umi ts 函数组件模板

该 tpl 也支持 umi ts 函数组件模板,如果有 src/components 目录,则在该目录下创建,否则在执行的目录下创建组件;

组件名称默认会做首字母大写自动转化;

使用如下命令行:

$ tpl 组件名 -a=xxx -t=fc

taro 模板

该 tpl 也支持 taro 模板,使用如下命令行:

$ tpl 模块名 -a=xxx -t=taro

说明

  • 1.该模板是针对使用 umi 框架的项目,创建统一功能模块模板;

  • 2.安装完成之后,直接在项目的根目录 cmd 下运行命令(VSCode 直接打开终端运行命令);

  • 3.由于实际项目开发,模块一般都是在 src/pages 下创建,所以,默认创建的模块放在 src/pages 目录下;

  • 4.如果执行命令的目录下没有 src/pages ,则默认在执行的目录下创建模块;

  • 5.支持创建模块的时候,同时传入头文件注释 author,简写命令为:$ tpl 模块名 -a=xxx

  • 6.目前支持的模板有:umi js(默认)、umi ts、ts 函数组件、taro。