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 🙏

© 2025 – Pkg Stats / Ryan Hefner

luowl-cli

v1.0.2

Published

测试用的脚手架

Downloads

5

Readme

代码解析

#!/usr/bin/env node   => 想要bin直接执行必须得指定环境(node)
const program = require('commander');
const packageJson = require('../package.json')
const { exec } = require('child_process');

// git仓库地址
const gitRepositoryPath = "http://124.70.134.70:8099/ruoyi-youya-nft/youya-ntf-h5.git"

// 创建文件夹
const createDir = (dir) => {
    return new Promise(resolve => {
        exec(`mkdir ${dir}`, {}, (error) => {
            resolve(process.cwd() + "\\"+dir)
            if (error) {
                console.error(`exec error: ${error}`);
            }
        })
    })
}

// 拉取代码
const gitClone = (cwd = process.cwd()) => {
    return new Promise(resolve => {
        exec(`git clone ${gitRepositoryPath}`, {
            cwd
        }, (error) => {
            if (error) {
                console.error(`exec error: ${error}`);
                return ;
            }
        })
    })
}

// options选项只有Boolean值
program.version(packageJson.version)
.name('lwl-cli')
.description('Split a string into substrings and display as an array')
.argument('<dir>','目录名')
.option("-d",'--dir',"目录名")
.action((dir) => {
    if(dir){
        createDir(dir).then((cwd) => {
            gitClone(cwd)
        })
    }else {
        gitClone()
    }
})

//解析用户传入的命令
program.parse(process.argv);

package.json解析

{
  //注意name属性一定要独一无二如果重复则会发布失败
  "name": "luowl-cli",
  "version": "1.0.1",
  "description": "测试用的脚手架",
  // 如果是node脚本则需要配置bin
  "bin": {
    // 前面的k就是执行(cli.js)文件的命令用户(npm i)安装之后直接使用(lwl-cli)就可以执行(bin/cli.js)文件
    "lwl-cli": "bin/cli.js"
  },
  // import 导入的默认文件
  "main": "index.js",
  // 仓库地址
  "repository": {
    "type": "git",
    "url": "https://gitee.com/lwllbt/lwl-cli.git"
  },
  // npm publish 需要发布的文件
  "files": [
    "bin"
  ],
}

npm 常用命令

  1. npm link --force (将当前项目在本地node_modules文件夹下面创建link)
  2. npm adduser (注册账户)
  3. npm whoami (查看当前登录的账户)
  4. npm login (登录)
  5. npm publish (发布项目)

npm 地址管理插件 nrm

  1. nrm ls (查看当前所有的地址)
  2. nrm use --name (切换地址)