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

lyh-cli-test-3

v1.0.0

Published

1. package.json 中配置 bin 2. www文件首行`#! /usr/bin/env node`作用 > 告诉系统可以在PATH目录中查找node,使用node环境执行后续代码 3. 开发环境下 执行`npm link` > 在全局环境下,生成一个符号链接文件,该文件的名字就是package.json文件中指定的模块名 > `npm unlink` 可以重置之前的操作 4. 使用管理员权限打开cmd,然后再执行 `mine-cli`

Downloads

4

Readme

可执行文件

  1. package.json 中配置 bin
  2. www文件首行#! /usr/bin/env node作用

    告诉系统可以在PATH目录中查找node,使用node环境执行后续代码

  3. 开发环境下 执行npm link

    在全局环境下,生成一个符号链接文件,该文件的名字就是package.json文件中指定的模块名 npm unlink 可以重置之前的操作

  4. 使用管理员权限打开cmd,然后再执行 mine-cli

核心依赖作用

  1. commander

    解析用户传递的参数。按照不同的调用方式执行不同的逻辑 eg: mine-cli --helpmine-cli create projectName

  2. ora

    在一些异步请求时间较长的时候显示一个loading效果

  3. inquirer (交互式命令行插件)

    提供错误回调 询问操作者问题 获取并解析用户输入 检测用户回答是否合法 管理多层级的提示

  4. download-git-repo

    下载git仓库文件

  5. ncp

    拷贝文件

  6. metalsmith consolidate ejs

    用于模板渲染

mine-cli create 主要逻辑

  1. 调用接口获取 linyuhang945 用户下仓库列表,然后让用户选择一个仓库
  2. 调用接口获取 选中仓库 下tags列表,然后让用户选择一个tag
  3. 把对应的文件下载到本机缓存
  4. 简单情况直接拷贝下载的文件到当前执行命令的目录
  5. 复杂情况需要先做模板渲染,再把渲染后的模板文件拷贝到当前执行命令的目录

把mine-cli发布到npm上

  1. 重置npm源 npm config set registry https://registry.npmjs.org/

    npm config set registry https://registry.npm.taobao.org npm config get registry

  2. 执行 npm addUser 然后输入用户名密码
  3. 执行 npm publish 发布
  4. 执行 npm unpublish --force 删除之前的发布

使用当前cli

  1. 安装 npm i lyh-cli-test -g
  2. lyh-cli-test create xxx