开发环境搭建

Front End

mac开发环境

安装 brew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

终端环境

  • iterm2

  • oh-my-zsh

    安装

    sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

    添加插件

    vim ~/.zshrc
    plugins=(
      git
      z
    )

node 环境搭建

  • 安装 nvm

    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
    # or
    wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
     
     
    # then
    # vim ~/.bash_profile or ~/.zshrc or ~/.profile or ~/.bashrc
    # insert
    export NVM_DIR="$HOME/.nvm"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
     
    # last
    source ~/.your_rcprofile

    使用方法

    # 本地node版本
    nvm ls
    # node所有版本
    nvm ls-remote
    # 安装最新node(稳定版,即偶数版)
    nvm install --lts
    # 安装指定版本node
    nvm install v8.9.4
    # 切换到指定版本/别名node
    nvm use v8.9.4
    # 给node版本起别名
    nvm alias default v8.9.4
  • 安装 node

    nvm install v8.9.4

  • npm 换源

    # npm 源
    npm config set registry https://registry.npm.taobao.org
    # sass 源
    npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/

git 配置

  • 安装

    brew install git
  • 配置 ssh-key

    git config --global user.name ''
    git config --global user.email ''
    
    ssh-keygen -t res -C 'email'
  • 配置 hosts

    cd ~/.ssh
    vim config
    
    # 写入
    Host github.com
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_rsa_github
    
    Host gitlab.com
    HostName gitlab.com
    User git
    IdentityFile ~/.ssh/id_rsa_gitlab
  • 注入密码(重启后失效) ssh-add -k ~/.ssh/id_rsa_gitlab

vscode 编辑器

  • 安装插件 Setting Sync
  • 设置 gist "sync.gist": "8162a18bd9632ab95c50704e92e1a57c"
  • 同步 Setting
  • 主要插件eslint vetur document this javascript code snippets project manager