-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
189 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
--- | ||
title: hexo+butterfly主题+自动部署构建博客 | ||
date: 2022-03-12 22:13:45 | ||
tags: | ||
- hexo | ||
categories: | ||
- hexo | ||
--- | ||
|
||
# 使用hexo搭建博客 | ||
|
||
## 开始 | ||
|
||
```bash | ||
npm install hexo-cli -g | ||
hexo init blog | ||
cd blog | ||
npm install | ||
hexo server | ||
``` | ||
|
||
## 命令配置 | ||
|
||
```bash | ||
server: "hexo server --log" // 添加--log打印日志 | ||
``` | ||
|
||
|
||
|
||
## 插件 | ||
|
||
### 热更新 | ||
|
||
```bash | ||
npm install hexo-browsersync --save | ||
``` | ||
|
||
注意:更改_config.yml等配置文件需要重新运行; | ||
|
||
|
||
# butterfly主题配置 | ||
## 主题下载使用 | ||
|
||
butterfly [https://butterfly.js.org/posts/21cfbf15/#%E5%AE%89%E8%A3%9D] | ||
|
||
可以使用npm包,也可以克隆代码。这边选择克隆代码,好处是可以更自由地编辑,不过clone 下来目录下存在.git文件夹,需要进行删除:可参考这篇文章 https://blog.csdn.net/xiebaochun/article/details/114143346 | ||
### 第一步 | ||
|
||
```bash | ||
git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly | ||
``` | ||
|
||
会在themes文件夹下生成butterfly目录 | ||
|
||
### 第二步 | ||
|
||
修改_config.yaml里的theme | ||
|
||
```yaml | ||
theme: butterfly | ||
``` | ||
### 第三步 | ||
安装pug和stylus渲染器 | ||
```bash | ||
npm install hexo-renderer-pug hexo-renderer-stylus --save | ||
``` | ||
|
||
## 主题配置优化 | ||
|
||
|
||
# 部署 | ||
|
||
## 一键部署 | ||
```bash | ||
npm install hexo-deployer-git --save | ||
``` | ||
|
||
编辑_config.yaml | ||
|
||
```yaml | ||
url: https://duanlvxin.github.io | ||
|
||
deploy: | ||
type: git | ||
repo: https://github.com/duanlvxin/duanlvxin.github.io.git | ||
branch: master | ||
``` | ||
执行部署命令 | ||
```bash | ||
hexo clean && hexo deploy | ||
``` | ||
|
||
查看\<username\>.github.io | ||
|
||
## 使用github actions | ||
在.github的workflows文件下新建deploy.yml(文件名可以变,文件夹必须是workflows) | ||
|
||
源码在dev分支上,打包好的文件在master上; | ||
HEXO_DEPLOY_KEY是github上配置的 | ||
|
||
```yml | ||
name: Hexo Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-18.04 | ||
if: github.event.repository.owner.id == github.event.sender.id | ||
|
||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: dev | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: '16' | ||
|
||
- name: Setup Hexo | ||
run: | | ||
npm install hexo-cli -g | ||
npm install | ||
- name: Build | ||
run: | | ||
hexo clean | ||
hexo generate | ||
- name: Deploy | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: master | ||
folder: public | ||
ssh-key: ${{ secrets.HEXO_DEPLOY_KEY }} | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
title: typescript类型全解 | ||
date: 2022-04-17 16:57:55 | ||
tags: | ||
- typescript | ||
categories: | ||
- typescript | ||
cover: /svg/typescript.svg | ||
bg_size: auto | ||
--- | ||
|
||
## typescript类型 | ||
|
||
## 类型浅谈 | ||
|
||
### any | ||
开启了strict: true, 隐式any会报错(函数中未定义类型的参数);但是导入其他文件的时候不显示报错?(require('xxx.js')) | ||
|
||
### unknown | ||
|
||
### number | ||
|
||
### string | ||
|
||
### boolean | ||
|
||
### 数组 | ||
数组 | ||
元组 | ||
|
||
|
||
### undefined、null、nerver、void | ||
undefined: 变量未定义 | ||
null: 类型不存在 | ||
nerver:函数一直执行 | ||
void: 函数没有显示return | ||
|
||
## 类型别名 | ||
```ts | ||
type Age = number; | ||
``` |