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

zash-cli

v1.0.5

Published

A simple CLI for generating the pages

Downloads

8

Readme

zash-cli

A simple CLI for generating pages into your projects

Author:zwf193071

E-mail: [email protected]

date: 2020/07/29

Preface

这些页面都是相似的,为何要反复的拷贝来拷贝去?好不容易拷贝完,还得为新增的页面添加路由、左侧菜单和面包屑导航的功能,555...不甘心将时间浪费在这些细枝末节上,于是擦干眼泪,撸起袖子做了一套自动化生成页面的工具,希望能给后面的读者一些启示。

Feature

一款为公司内部vue项目特定的CLI工具,亦可基于此进行改造,现支持create <new-file-name>命令,可生成单页或带tab的多页面,自动注入新页面功能至路由、面包屑及菜单导航等组件内

Usage

全局安装zash-cli。npm install -g zash-cli

or

git clone https://github.com/zwf193071/zash-cli.git

cd zash-cli && npm install

npm link

打开terminal或 cmd ,输入zash or zash -h ,你将看到如下信息:

  Usage: zash [options] [command]

  Options:
    -h, --help              output usage information

  Commands:
    create <new-file-name>  create a new file powered by zash-cli

    Run zash <command> --help for detailed usage of given command.

在你想生成页面的项目内的根目录下,新建pageConf.js文件,代码如下所示:

/**
 * 自动生成文件的相关配置信息
 * @param parentFolderPath 父文件地址,相对于根路径
 * @param routerPath 路由文件地址
 * @param breadPath 面包屑导航地址
 * @param parentName 父菜单名字
 * @param leftMenuPath 左侧菜单文件路径
 * @param author 当前文件的创建者
 * @param title 文件标题,与增删改的提示信息相关
 * @param isDrawer 是否有抽屉,默认为true,表示增删改功能皆有
 * @param getUrl 列表请求接口地址
 * @param addUrl 新增接口地址
 * @param editUrl 编辑接口地址
 * @param deleteUrl 删除接口地址
 * @param childrenValues 子页面的模块名称
 * @param childrenNames 子页面的标题
 * @author zhuwenfang
 * @createtime 2020-07-28
 */
exports.conf = {
    parentFolderPath: 'src/views/Content/SFC',
    routerPath: 'src/router/routes.js',
    breadPath: 'src/components/BreadLink/config.js',
    parentName: '网络服务',
    leftMenuPath: 'src/views/Home/LeftMenu/LeftMenu.config.js',
    author: 'zhuwenfang',
    title: '测试一',
    isDrawer: true,
    getUrl: '',
    addUrl: '',
    editUrl: '',
    deleteUrl: '',
    // 下面针对是多页面的配置
    childrenValues: ['child1', 'child2', 'child3', 'child4'],
    childrenNames: ['子页面1', '子页面2', '子页面3', '子页面4']
};

Commands

create

这个命令会创建新页面组件Test.

$ zash create Test

image

在你想注入路由的文件内,写上// $h// $f,当执行命令成功后,会在该路由文件,根据该注释语句占位符,自动导入Test的路由

image image

左侧菜单和面包屑导航亦是根据上述原理自动注入生成

Thanks to

License

This repo is released under the MIT.