根据自己的工作经验总结的,帮助大家入职后快速搭建开发环境,快速上手公司项目
先问清楚接手项目需要的node和npm版本,npm内部源地址等
-
下载NVM node版本管理工具。方便切换不同的node版本。
NVM安装教程
建议直接安装nvm 方便后期多项目切换node版本 -
下载node默认安装
- 根据公司需求设置npm源
配置npm服务器以下载依赖 npm config set registry +链接(淘宝链接:https://registry.npmmirror.com)
配置好后试用npm config get registry命令查看是否配置正确
删除当前源 会自动切换为官方源npm config rm registry
- 根据公司需求设置npm源
-
- global变量配置:git config --global user.name “xxx” git config --global user.email “xxx@xxx.com”
- global变量查看: git config --global user.name git config --global user.email
git remote -v
查看当前绑定的git仓库地址- git remote remove <name/origin> 删除当前绑定的git仓库地址
- git remote add origin … 新增绑定的git仓库地址
git remote set-url origin <giturl>
git remote add origin <giturl
>设置代码提交的目标仓库- 开通gitlab仓库权限后设置ssh密钥:是为了节省输入用户名密码的过程,同时保证传输安全
ssh-keygen -t rsa -C "youremail@example.com"
三次回车 复制里面的SSH密匙 登录GitLab,cat ~/.ssh/id_rsa.pub
密钥粘贴到GitLab中,添加ssh,如何添加具体流程:教程
-
修改host文件
若访问慢:修改host文件(用绕过dns解析,在本地直接绑定host) 在本地host文件中添加映射:路径是在 C:\Windows\System32\drivers\etc
Host作用文件理解 -
翻译软件:
- 设置->取词划词 -> 划词设置 展示方式 双击ctrl展示
- 设置截屏翻译。都很好用。
-
snipaste 前端设计稿取色 动态截图等。很好用强烈推介。
-
chrome浏览器,开发必备
-
Envato market 是一个代码交易网站,有各种模板供你选择。设计很棒可以参考
-
下载编辑器:
-
谷歌插件推介
沉浸式翻译 查外网文档很好用 比全屏翻译和谷歌页面翻译好用多了哈哈
Iconify IntelliSense - Iconify 图标插件
windicss IntelliSense - windicss 提示插件
I18n-ally - i18n 插件
Vetur - vue 开发必备 (也可以选择 Volar)
ESLint - 脚本代码检查
Prettier - 代码格式化
Stylelint - css 格式化
DotENV - .env 文件 高亮
Codeium - AI编码 自动生成注释 一件编码等 完全免费极力推介!
JavaScript and TypeScript Nightly - Vscode编辑器的TS语言支持 解决各种配置以外的报错问题
- Vscode代码片段,一键生成任何常用代码,又好用又帅!
案例:
配置好后输出html
再按tab即可瞬间输出body内部的代码片段
{
// Place your 全局 snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
"Print to console": {
"prefix": "html",
"body": [
"<!DOCTYPE html>",
"<html lang=\"en\">",
"<head>",
" <meta charset=\"UTF-8\">",
" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">",
" <title>Document</title>",
"</head>",
"<body>",
"",
"</body>",
"</html>",
],
"description": "Log output to console"
}
}
拉项目:
建文件夹 命令行该目录下(右键powershell/VSCode打开文件夹)
git init git clone (SSH地址)
code .用VSdode打开
npm init 生成 package.json
npm install 更新安装包
提交代码:
git add .
git commit -m""
git pull origin 分支名
git push origin 分支名
git branch
git checkout 分支名
git checkout -b
git merge 分支名
git branch -r 列出所有远程分支
git fetch --all 同步远程仓库的所有分支到本地
git remote -v 查看当前远端地址
执行完 commit 之后,想撤回 commit 不撤销git add .: git reset --soft HEAD^
HEAD^ 意思是上一个版本,也可以写成 HEAD~1
如果进行了 2 次 commit,都想撤回,可以使用 HEAD~2
创建新项目
1.git init
2.git commit -m “first commit”
3.git remote add origin https://github.com/BeatingWorldline/First.git
或git remote add origin git@github.com:BeatingWorldline/First.git
4.git push -u origin master
# github
151.101.72.133 assets-cdn.github.com
151.101.229.194 github.global.ssl.fastly.net