NPM 常用库集合

NPM

npm 中文文档

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# npm 中国镜像
npm config get registry
npm config set registry https://registry.npm.taobao.org

# 查看本机 npm 全局安装列表
npm list -g --depth 0

npm install -g jshint
npm uninstall -g jshint
npm update -g jshint

Yarn

yarn 中文文档

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
npm install -g yarn

# yarn 中国镜像
yarn config get registry
yarn config set registry https://registry.npm.taobao.org

yarn add ..
yarn add .. -D
yarn global add ..
yarn global list
yarn config list
yarn remove ..
yarn upgrade

常用命令

1
2
3
4
5
# 全局包列表
yarn global list

# 更新依赖包
yarn upgrade-interactive

修改 Yarn 全局缓存位置

1
2
3
4
yarn cache list
yarn cache dir
yarn cache clean
yarn config set cache-folder "D:\Link\Yarn\Cache"
1
2
3
4
npm config get cache
npm cache clean --force
npm config set cache "D:\Link\npm-cache"
npm cache verify

node_sass

全局配置

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
npm config set registry https://registry.npm.taobao.org
npm config set disturl https://npm.taobao.org/dist
npm config set electron_mirror https://npm.taobao.org/mirrors/electron/
npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/

yarn config set registry https://registry.npm.taobao.org -g
yarn config set disturl https://npm.taobao.org/dist -g
yarn config set electron_mirror https://npm.taobao.org/mirrors/electron/ -g
yarn config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ -g
yarn config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/ -g
yarn config set chromedriver_cdnurl https://cdn.npm.taobao.org/dist/chromedriver -g
yarn config set operadriver_cdnurl https://cdn.npm.taobao.org/dist/operadriver -g
yarn config set fse_binary_host_mirror https://npm.taobao.org/mirrors/fsevents -g

持久化文件路径在 C:\Users\用户名 文件夹$$ .npmrc.yarnrc 文件

.npmrc

1
2
3
4
5
registry=https://registry.npm.taobao.org/
disturl=https://npm.taobao.org/mirrors/node/
phantomjs_cdnurl=http://cnpmjs.org/downloads/
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/

mirror-config-china

1
yarn global add mirror-config-china

License for package Android SDK Build-Tools 28.0.2 not accepted

1
2
%USERPROFILE%\AppData\Local\Android\Sdk\tools\bin
sdkmanager --licenses

Live-Server

Node.js 服务器

1
2
3
4
5
6
yarn global add live-server
live-server
--port=NUMBER - select port to use, default: PORT env var or 8080
--host=ADDRESS - select host address to bind to, default: IP env var or 0.0.0.0 ("any address")
--no-browser - suppress automatic web browser launching
--browser=BROWSER - specify browser to use instead of system default

Hexo

静态博客生成器

1
2
3
4
5
6
7
yarn global add hexo-cli
yarn add hexo-neat --save
hexo init blog
hexo new "Hello Hexo"
hexo new page "about"
hexo server
hexo generate

hexo-next

1
2
cd your-hexo-site
git clone https://github.com/iissnan/hexo-theme-next themes/next

Docsify

官方文档

文档生成器

1
2
3
yarn global add docsify-cli
docsify init ..
docsify serve

dlf

node_modules 快速删除

1
2
3
yarn global add dlf
dlf file
dlf directory

rimraf

The UNIX command rm -rf for node

1
2
3
yarn global add rimraf
rimraf file
rimraf directory

Bower

静态库包管理器

1
2
3
4
5
6
7
yarn global add bower
bower -h
bower init
bower install jquery --save
bower info jquery
bower search bootstrap
bower uninstall jquery

Angular-CLI

中文文档

1
2
3
4
yarn global add @angular/cli
ng new my-app
cd my-app
ng serve --open

Ionic

官方文档

1
2
3
4
yarn global add ionic cordova
ionic start helloWorld blank
cd helloWorld
ionic serve

markmap-lib

markmap-lib, Visualize your Markdown as mindmaps with Markmap

README.md

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# My tools

## Search Engines

- [Google](https://www.google.com/)
- [Bing](https://www.bing.com/)

## Web

- HTML
- JavaScript
- CSS

---

- Python
- PHP
- Go
1
2
yarn global add markmap-lib
markmap README.md

prettier

1
2
3
prettier 格式化文件夹
npx prettier --check "./src/**/*.{vue,js,graphql}"
npx prettier --write "./src/**/*.{vue,js,graphql}"