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

npm-package-privatify

v1.1.4

Published

一个将私有源npm包处理为离线包的自动化工具

Downloads

7

Readme

npm-package-privatify

说明

一个将私有源npm包处理为离线包的自动化工具

使用

安装

npm install -g npm-package-privatify

1、privatify package <package-name> [scope]

将所声明的npm包package处理为离线包,并查找离线包package子包依赖是否包含scope下的子包,如包含也处理为离线包

scope匹配规则:https://www.npmjs.com/package/minimatch

参数:

<package-name>:npm包名

// 将packageName处理为私包
privatify package packageName

执行成功后,有两处变化:

(1)本工程package.json

// 修改前
...
"dependencies|| devDependencies": {
    "packageName": "^0.3.29",
},
// 修改后
...
"dependencies|| devDependencies": {
    "packageName": "file:private/packageName-${version}.tar.gz",
},

(2)路径private下新增文件packageName-${version}.tar.gz

[scope]:查找包是否存在scope下的依赖,有则会处理子包私有包

privatify package @scope1/packageName @scope1

执行成功后,除了跟上述一样有两处变化,如果子包有依赖scope下的私有包,还有两处变化:

(3)private/@scope1/packageName下的package.json文件

// 修改前
...
"dependencies|| devDependencies": {
    "@scope1/subPackageName": "^0.3.29",
},
// 修改后
...
"dependencies|| devDependencies": {
    "@scope1/subPackageName": "file:../../private/@scope1/packageName-${version}.tar.gz",
},

(4) 路径private/@scope1下新增文件subPackageName-${version}.tar.gz

提供快捷操作,将所声明作用域下的私有包统一处理为离线包,查找包是否存在scope下的依赖,有则会处理子包私有包

参数:

<scope>:要查找的作用域

scope匹配规则:https://www.npmjs.com/package/minimatch

// 将在@scope1下的私有包处理为私包
privatify scope @scope1

3、privatify create <registry-name>

创建一个npm私服仓库

参数:

<registry-name>:私服仓库名称

--context <context>:上下文路径

实现流程

example

常见问题

Q: 多个子包依赖包中依赖同一个私有包,但是版本不一样?

A: 本工具区分了版本,自动处理了此问题