Skip to content

Commit

Permalink
first deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
joey998 committed May 20, 2024
1 parent 39f1f4c commit e192fe2
Show file tree
Hide file tree
Showing 36 changed files with 543 additions and 160 deletions.
50 changes: 0 additions & 50 deletions .vitepress/config copy1.mts

This file was deleted.

7 changes: 3 additions & 4 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { defineConfig } from 'vitepress';
import { getNavAndSideBarInfo } from '../refreshConfig.data'
import { writeFileSync } from 'fs';
import { getNavAndSideBarInfo } from '../src/refreshConfig.data';

let configInfo = getNavAndSideBarInfo();
writeFileSync("./.out.json", JSON.stringify(configInfo))

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "joey998的博客",
description: "github,个人博客",
srcDir: './src',
base: '/my-site/',
base: '/blog/',

themeConfig: {
// https://vitepress.dev/reference/default-theme-config
Expand Down
18 changes: 0 additions & 18 deletions src/backend/cccc.vue

This file was deleted.

13 changes: 0 additions & 13 deletions src/backend/ddd copy.md

This file was deleted.

14 changes: 1 addition & 13 deletions src/backend/index.md
Original file line number Diff line number Diff line change
@@ -1,13 +1 @@
## 问题back

1. 描述
```js
console.log(12); // dfas
```

<CustomComponent />

<script setup>
import CustomComponent from './cccc.vue'
let c = 12;
</script>
后端问题
33 changes: 33 additions & 0 deletions src/backend/linux/git-ssh连接.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title:git的ssh连接方式
---

1. 在服务端使用`git init --bare bareDirectory`,或者新建一个`bareDirectory`,然后`cd`进去输入`git init --bare`
**note**:这里面需要使用到`--bare`参数,否则当在客户端提交时,客户端会报错
```
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To 121.42.12.48:/home/git/project/testDirectory/
```
**上面也提到了可以通过在服务端`git config receive.denyCurrentBranch ignore`来解决,但是不推荐**

2. 服务端克隆仓库
```
git clone [email protected]:/home/git/bareDirectory
git clone ssh://[email protected]:2222/home/git/bareDirectory
# ssh链接方式为
1, 用户名@IP地址:文件夹绝对路径 (此种方法默认是22端口,:后面的为绝对路径)
2, ssh://用户名@IP地址:端口号+绝对路径
```
32 changes: 32 additions & 0 deletions src/backend/linux/git-免密推送.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: git免密推送
---

接上文 [linux建立git服务器](https://blog.csdn.net/qq_34111969/article/details/107835545)
下面做一下免密推送

全部是客户端操作
1. 查看公私钥,如果存在,一般在`~/.ssh`目录下面(id_rsa,id_rsa_pub),若不存在,创建之
```bash
ssh-keygen
```
2. 上传公钥到服务器
```bash
ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]
```
**说明:**
上面命令其实就是写到服务器的gitpros用户主目录下的`.ssh/authorized_keys`,多个用户可以自动追加到该文件下面,不会覆盖原来用户的公钥

3. 测试免密登录
```bash
ssh [email protected]
```
***
**A&Q:**
1. ***免密未成功?***
一般是服务端的`.ssh`,`.ssh/authorized_keys` 权限有问题
去服务端使用gitpros账户输入
```bash
chmod 755 ~/.ssh
chmod 644 ~/.ssh/authorized_keys
```
43 changes: 43 additions & 0 deletions src/backend/linux/git-搭建一个git服务器.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
title: 搭建一个git服务器
---
1. 首先使用root登录,假设当前服务器ip为123.12.123.12
2. 新建一个gitpros用户,用来管理所有的代码仓
```bash
useradd -d /home/gitpros -m gitpros
```
**说明**:
*username* : linux创建用户命令
*-d [directory]* : 指定用户主目录,这一步最好加上,会自动添加用户配置文件,如`.bashrc`等文件
*-m* : 若上面指定的文件夹不存在,则自动创建
*gitpros* : 要创建的用户名

```
passwd gitpros
```
**说明**:下面会让设置gitpros的密码,假设为gitpros

3. 切换到刚创建的gitpros用户(接下来不需要root用户),进入其主目录,创建一个文件夹projects来放所有项目
```bash
su gitpros
cd /home/gitpros 或者直接 cd ~
mkdir projects
cd projects
```
4. 新建一个git服务端代码仓,服务端代码仓一般只用来远程操作,不需要存放实际代码,所以一般会加上`--bare`参数,文件夹结尾一般为.git。
```bash
git init --bare firstDir.git
```
**至此服务端工作已经做完了,下面都是客户端所做工作**
***

5. 使用git从一台客户端克隆远程仓库
```bash
git clone [email protected]:/home/gitpros/firstDir.git
```
期间会让输入密码, 密码为服务端gitpros密码:gitpros

后面就是基本的add, commit,pull,push的操作了

***tips:***
- 你可能还需要[git免密推送](https://blog.csdn.net/qq_34111969/article/details/107843003)
5 changes: 5 additions & 0 deletions src/backend/linux/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# linux

## something

context
12 changes: 12 additions & 0 deletions src/backend/linux/linux终端打印文本颜色.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: 终端打印文本的颜色
---

### 设置打印文本的颜色以及背景色,用来提示错误或者警告;
只需要在打印的字符串中添加"\033[**m",\*\*代表颜色数字。
```bash
console.log('\033[34m\033[47mno files to show! \n\033[47mfds\n')
```
具体看下面链接
[颜色参考链接(wiki需翻墙)]([https://zh.wikipedia.org/wiki/ANSI%E8%BD%AC%E4%B9%89%E5%BA%8F%E5%88%97#%E9%80%89%E6%8B%A9%E5%9B%BE%E5%BD%A2%E5%86%8D%E7%8E%B0%EF%BC%88SGR%EF%BC%89%E5%8F%82%E6%95%B0](https://zh.wikipedia.org/wiki/ANSI%E8%BD%AC%E4%B9%89%E5%BA%8F%E5%88%97#%E9%80%89%E6%8B%A9%E5%9B%BE%E5%BD%A2%E5%86%8D%E7%8E%B0%EF%BC%88SGR%EF%BC%89%E5%8F%82%E6%95%B0))
[https://zh.wikipedia.org/wiki/ANSI%E8%BD%AC%E4%B9%89%E5%BA%8F%E5%88%97#%E9%80%89%E6%8B%A9%E5%9B%BE%E5%BD%A2%E5%86%8D%E7%8E%B0%EF%BC%88SGR%EF%BC%89%E5%8F%82%E6%95%B0](https://zh.wikipedia.org/wiki/ANSI%E8%BD%AC%E4%B9%89%E5%BA%8F%E5%88%97#%E9%80%89%E6%8B%A9%E5%9B%BE%E5%BD%A2%E5%86%8D%E7%8E%B0%EF%BC%88SGR%EF%BC%89%E5%8F%82%E6%95%B0)
9 changes: 9 additions & 0 deletions src/backend/linux/windows10免密登录.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: windows10免密登录
---
按下`win + r`调出运行程序,
输入`netplwiz`
取消勾选“要使用本计算机,用户必须输入用户名和密码的设置项”选项,
点击应用,
输入默认登录用户以及密码。
over,over,over。
80 changes: 80 additions & 0 deletions src/backend/node/eslint使用说明.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
title: eslint使用说明
---

## Eslint配置

主要是eslint有自己自带的规则,想要禁止或者开启可以在rules里面设置;

同时可以增加插件,npm install之后要放配置在plugin属性里面,

增加了插件之后插件会有一些别人写好的规则组,选择一个或者几个写在extends里面,用来开启某一个插件的某些规则。

自定义某插件的某一条规则,需要在rules里面设置,设置方式为“插件名称/规则”,例如下面的import插件的“no-unresolved”规则,写成”import/no-unresolved”。

Setting里面写的是共享配置,
按照我的理解是vue插件如果也有一条规则叫做“no-unresolved”,本来要在rules里面写两个(“import/no-unresolved”,”vue/no-unresolved”)的。现在在settings里面只需要写”no-unresolved”一个就行了。(以上的settings只是理解,还未验证)(好像是自定义规则而时候才用到,相当于自定义规则可以访问的全局变量,未验证)

.eslintrc.* 多层级配置文件,会取父子的并集,重复的规则,已离文件最近的为准

.eslintignore 类似.gitignore,比它更加严格,使用参数--ignore-path 可以指定ignore文件,如eslint --ignore-path .gitignore file.js

```js
module.exports = {
  env: {
    browser: true, //使用browser的规则
    node: true, //使用node的默认规则
es6: true, //使用es6规则
  },
"globals": {
"Promise": "off", //不能使用某变量,比如上面开启了es6,加了这个就不能使用Promise变量了
//比如有时候在window定义了一个变量globalA, globalB, 在模块直接访问他们会报错,只能使用window.globalA, window.globalB
"globalA": "readonly", //只读不可写, 定义了之后可以直接在模块里面使用let a = globalA
"globalB": "writable", //可读可写, 定义了之后可以直接在模块里面使用let b = globalB; globalB = 12
},
  parser: "vue-eslint-parser", //指定默认的分析器,一般不指定
  parserOptions: {
    sourceType: "module",
  },
  plugins: [
    "vue", //全局rules使用vue/rule 改写
    "import", //全局rules使用import/rule 改写
  ],
  extends: [
//通过npm install eslint-plugin-*,插件名称可以省略 eslint-plugin- 前缀;可以开启多个
//下面所有extend的规则会和下面的全局rules求并集,冲突的属性会以全局rules为准
    "airbnb-base",
    "plugin:vue/recommended",
    "eslint:recommended",
  ],
  rules: {
//全局rules
//"off" 或 0 - 关闭规则
//"warn" 或 1 - 开启规则,使用警告级别的错误:warn (不会导致程序退出)
//"error" 或 2 - 开启规则,使用错误级别的错误:error (当被触发的时候,程序会退出)
    quotes: ["error""double"],
    "import/no-unresolved": [1, { commonjs: true, amd: true }],
    "import/extensions": [1"always", { js: "never", vue: "never" }], 
    "import/no-extraneous-dependencies": [2, { devDependencies: true }],
  },
"overrides": [
//匹配files属性的文件,会使用下面的子域rules,而不会使用上面的全局rules
{
"files": ["*-test.js","*.spec.js"],
"rules": {//子域rules
"no-unused-expressions": "off"
}
}
]
  // 下面是共享配置
  settings: {
//自定义规则使用才用到
"sharedData": "Hello",
    "import/resolver": {
      alias: {
        "@": "src/",
      },
    },
  },
};
```
7 changes: 7 additions & 0 deletions src/backend/node/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: 涉及内容
---

1. webpack使用说明

2. eslint使用说明
15 changes: 15 additions & 0 deletions src/backend/node/webpack-browserlist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: webpack-browserlist
---

## 问题定位
最终定位到的是我在package.json里面写了browserslist
## 解决方法:
删除browserslist,或者在webpack.config.js里面添加
```js
module.exports = {
target: process.env.NODE_ENV = "production" ? "browserslist" : "web"
}
```
这是webpack5的bug
[参考链接:browserslist 导致 webpack-dev-server 的自动刷新失效](https://segmentfault.com/q/1010000038165280)
14 changes: 14 additions & 0 deletions src/backend/node/webpack-wds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: webpack-dev-server热更新失效
---

最终定位到的是我在package.json里面写了browserslist
### 解决方法:
删除browserslist,或者在webpack.config.js里面添加
```js
module.exports = {
target: process.env.NODE_ENV = "production" ? "browserslist" : "web"
}
```
这是webpack5的bug
[参考链接:browserslist 导致 webpack-dev-server 的自动刷新失效](https://segmentfault.com/q/1010000038165280)
Loading

0 comments on commit e192fe2

Please sign in to comment.