Skip to content

Commit

Permalink
✨ feat: 新建snpm库
Browse files Browse the repository at this point in the history
  • Loading branch information
jiaoxiaoyuan committed Sep 2, 2024
1 parent 97dace8 commit ff1e5be
Show file tree
Hide file tree
Showing 7 changed files with 500 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.DS_Store
node_modules
/dist
/umap

package-lock.json

/tests/e2e/videos/
/tests/e2e/screenshots/

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*

package-lock.json

build/env.js
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry = https://registry.npmjs.org/
79 changes: 79 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@

# 这是一个切换镜像源的库

安装建议加上-g

npm i @front-base/snpm -g
##### snpm ls 查看目前源

* npm------- https://registry.npmjs.org/

yarn------ https://registry.yarnpkg.com/

tencent--- https://mirrors.cloud.tencent.com/npm/

cnpm------ https://r.cnpmjs.org/

taobao---- https://registry.npmmirror.com/

npmMirror- https://skimdb.npmjs.com/registry/

##### snpm use 切换源

选择你要切换的源

##### snpm current 查看当前源

当前源: npm

##### snpm add 添加源

1.输入添加的名称
2.输入源地址

##### snpm ping 测试源

? 请选择镜像 cnpm
响应时长: 1635ms

##### snpm delete 删除自定义源

add添加的源都可以删除


##### snpm rename 重命名

自定义添加的源都可以进行重新命名

##### snpm edit 编辑自定义镜像地址

# 用法 Usage

Usage: snpm [options] [command]

Options:

-V, --version output the version number

-h, --help display help for command


Commands:
ls 查看镜像

use 请选择镜像

current 查看当前源

ping 测试镜像地址速度

add 自定义镜像

delete 删除自定义的源

rename 重命名

edit 编辑自定义镜像地址

help [command] display help for command

37 changes: 37 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "@front-base/snpm",
"version": "0.0.1",
"description": "npm 镜像管理工具",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"postinstall": "node -e \"try{require('./postinstall')}catch(e){}\""
},
"keywords": [
"nrm",
"npm",
"cnpm",
"yarn"
],
"bin": {
"snpm": "./src/index.js"
},
"publicConfig": {
"registry": "https://registry.npmjs.org/"
},
"repository": {
"type": "git",
"url": "https://gitee.com/NativeBase/func-package/tree/master/packages/snpm"
},
"bugs": {
"url": "https://gitee.com/NativeBase/func-package/issues"
},
"author": "JiaoXiaoYuan",
"license": "ISC",
"dependencies": {
"chalk": "^4.0.0",
"commander": "^10.0.0",
"inquirer": "^8.0.0",
"node-http-ping": "^0.3.1"
}
}
26 changes: 26 additions & 0 deletions postinstall.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
console.log(`
_____ _____ _____
/\ \ /\ \ /\ \
/::\____\ /::\____\ /::\ \
/::::| | /::::| | /::::\ \
/:::::| | /:::::| | /::::::\ \
/::::::| | /::::::| | /:::/\:::\ \
/:::/|::| | /:::/|::| | /:::/__\:::\ \
/:::/ |::| | /:::/ |::| | /::::\ \:::\ \
/:::/ |::|___|______ /:::/ |::|___|______ /::::::\ \:::\ \
/:::/ |::::::::\ \ /:::/ |::::::::\ \ /:::/\:::\ \:::\____\
/:::/ |:::::::::\____\/:::/ |:::::::::\____\/:::/ \:::\ \:::| |
\::/ / ~~~~~/:::/ /\::/ / ~~~~~/:::/ /\::/ \:::\ /:::|____|
\/____/ /:::/ / \/____/ /:::/ / \/_____/\:::\/:::/ /
/:::/ / /:::/ / \::::::/ /
/:::/ / /:::/ / \::::/ /
/:::/ / /:::/ / \::/____/
/:::/ / /:::/ / ~~
/:::/ / /:::/ /
/:::/ / /:::/ /
\::/ / \::/ /
\/____/ \/____/
`)
console.log('安装完之后使用snpm命令')
32 changes: 32 additions & 0 deletions registries.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"npm": {
"home": "https://www.npmjs.org",
"registry": "https://registry.npmjs.org/",
"ping": "https://registry.npmjs.org"
},
"yarn": {
"home": "https://yarnpkg.com",
"registry": "https://registry.yarnpkg.com/",
"ping": "https://registry.yarnpkg.com"
},
"tencent": {
"home": "https://mirrors.cloud.tencent.com/npm/",
"registry": "https://mirrors.cloud.tencent.com/npm/",
"ping": "https://mirrors.cloud.tencent.com/npm"
},
"cnpm": {
"home": "https://cnpmjs.org",
"registry": "https://r.cnpmjs.org/",
"ping": "https://r.cnpmjs.org"
},
"taobao": {
"home": "https://npmmirror.com",
"registry": "https://registry.npmmirror.com/",
"ping": "https://registry.npmmirror.com"
},
"npmMirror": {
"home": "https://skimdb.npmjs.com/",
"registry": "https://skimdb.npmjs.com/registry/",
"ping": "https://skimdb.npmjs.com/registry"
}
}
Loading

0 comments on commit ff1e5be

Please sign in to comment.