Skip to content

Commit

Permalink
fix: 迁移到服务器
Browse files Browse the repository at this point in the history
  • Loading branch information
tigerzh committed Jan 31, 2023
1 parent ebbc13c commit 095a3f4
Show file tree
Hide file tree
Showing 11 changed files with 138 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import dayjs from 'dayjs'
process.env.VITE_APP_BUILD_TIME = dayjs().format('YYYY-MM-DD HH:mm:ss')

export default defineConfig({
base: '/document/',
lang: 'zh-CN',
title: '🏠',
description: '笔记本 📚',
Expand All @@ -29,7 +30,7 @@ export default defineConfig({
algolia: {
indexName: 'article',
appId: 'MDH54K1FJG',
apiKey: '2651a6fb85dcb86beafa3e76ba3dcf99',
apiKey: '2651a6fb85dcb86beafa3e76ba3dcf99'
},
// carbonAds: {
// code: 'CEBDT27Y',
Expand Down
9 changes: 5 additions & 4 deletions .vitepress/theme/components/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import pkg from '../../../package.json'
// import NewsLetter from './NewsLetter.vue'
// import SponsorsGroup from './SponsorsGroup.vue'
// import Sence from './Sence.vue'
const { isDark } = useData()
const { isDark, localePath } = useData()
const title = useTitle()
const url =
Expand All @@ -27,6 +27,7 @@ const fetchepic = () => {
fetchepic()
}, 5000)
}
const base = ref()
const print = (key: string, value: string) =>
console.log(
`%c ${key} %c ${value} %c `,
Expand Down Expand Up @@ -57,7 +58,7 @@ onUnmounted(() => {
My
<span class="accent">Life</span>
<br />Getting Better
{{ isDark ? '🌙' : '☀️' }}
{{ isDark? '🌙': '☀️' }}
</h1>
<transition enter-active-class="animate__animated animate__lightSpeedInLeft"
leave-active-class="animate__animated animate__lightSpeedOutRight">
Expand All @@ -67,13 +68,13 @@ onUnmounted(() => {
</transition>

<p class="actions">
<a class="get-started" href="/cryptocurrency/money.html">
<a class="get-started" :href="`${localePath}cryptocurrency/money.html`">
立即探索
<svg class="icon" xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24">
<path d="M13.025 1l-2.847 2.828 6.176 6.176h-16.354v3.992h16.354l-6.176 6.176 2.847 2.828 10.975-11z" />
</svg>
</a>
<a class="setup" href="/note/工程化指南.html">开始阅读 📒</a>
<a class="setup" :href="`${localePath}note/前端工程化.html`">开始阅读 📒</a>
</p>
</section>

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* 解决地址错误的问题 ([3830821](https://github.com/AliMales/NoteBook/commit/3830821833e835022ff2481f321c2565017c01ba))
* 解决地址错误的问题 ([36fd70b](https://github.com/AliMales/NoteBook/commit/36fd70b79cc5dd446dc650362d1cda6eb68afed2))
* 解决生产changelog重复问题 ([5aaea13](https://github.com/AliMales/NoteBook/commit/5aaea13f19ec1e7ad44e15547c03894f6f306484))
* 修复无法搜索的问题 ([ebbc13c](https://github.com/AliMales/NoteBook/commit/ebbc13cc8e4a92106cd029f74da7e12e731ea6e1))
* fix build error ([711a3d0](https://github.com/AliMales/NoteBook/commit/711a3d06fb992b719db7140aa139c72dbecf7f15))


Expand Down
74 changes: 74 additions & 0 deletions bin/deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/usr/bin/env node
/**
* node 部署前端脚本
*/
// pnpm i -D child_process@1.0.2 ora@5.4.0 inquirer@8.0.0
// # From 1.0.0 -> 1.0.1
// npm version patch

// # From 1.0.1 -> 1.1.0
// npm version minor

// # From 1.1.0 -> 2.0.0
// npm version major
// 此脚本仅适用个人
// import { exec } from "child_process";
// import ora from "ora";
// import inquirer from "inquirer";
// import _package from "../package.json"
// import envs from "./env.json"
// import dayjs from "dayjs";
// 此脚本仅适用个人
const { exec } = require('child_process')
const ora = require("ora");
const inquirer = require("inquirer");
const _package = require("../package.json");
// const { outputDir } = require("../vue.config");
const envs = require("./env.json");
// 当前版本
const version = _package.version;
// 项目目录
const dirPath = `${process.cwd()}/.vitepress/dist`;
// 版本目录
const versionPath = `${dirPath}-${version}`;
const dayjs = require("dayjs");

inquirer
.prompt({
type: "rawlist",
name: "commit",
message: "请选择部署环境:",
default: "stage",
choices: envs.map((it) => `${it.name}: ${it.website}`),
})
.then(async (answers) => {
const [name] = answers.commit.split(":");
const index = envs.findIndex((it) => it.name === name);


if (index > -1) {
const it = envs[index];
console.log(`pnpm build;
cp -r ${dirPath} ${versionPath};
scp -r ${dirPath} ${it.sshNmae}:${it.targetPath};
scp -r ${versionPath} ${it.sshNmae}:${it.targetPath};
rm -rf ${versionPath};
`)
const spinner = ora({
text: `${answers.commit}:部署中...`,
}).start();
exec(
`pnpm build;
cp -r ${dirPath} ${versionPath};
scp -r ${dirPath} ${it.sshNmae}:${it.targetPath};
scp -r ${versionPath} ${it.sshNmae}:${it.targetPath};
rm -rf ${versionPath};
`,
function (err) {
if (err) throw err;
spinner.succeed("部署完成");
spinner.succeed(dayjs().format("YYYY-MM-DD HH:mm:ss"));
}
);
}
});
9 changes: 9 additions & 0 deletions bin/env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"name": "document",
"targetPath": "/home/app/document",
"website": "https://tigerzh.com/document",
"sshNmae": "zorg",
"mpmModel": "build"
}
]
16 changes: 16 additions & 0 deletions crawler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os
import json
# print(os.path.abspath(os.getcwd(), './.vitepress//dist/hashmap.json'))
with open('./.vitepress/dist/hashmap.json') as f:
url_obj = json.load(f)
keys = url_obj.keys()

# def get_urls(url):
# return url.replace('_', '/').replace('md', 'html')
# map(get_urls, keys)

for [i, key] in enumerate(keys):
print(key)
key = key.replace('_', '/').replace('md', 'html')
# keys[i] = keys[i].replace('_', '/').replace('md', 'html')
print(keys)
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{
"name": "z-doc",
"private": true,
"version": "1.0.0",
"version": "1.0.2",
"engines": {
"node": ">=14.0.0"
},
"scripts": {
"dev": "vitepress",
"build": "vitepress build && npm run cz",
"build": "vitepress build",
"serve": "vitepress serve",
"cz": "git add . && git cz && git push && npm run changelog && npm run crawler",
"preinstall": "npx only-allow pnpm",
"changelog": "rm -rf CHANGELOG.md && conventional-changelog -p angular -i CHANGELOG.md -s",
"crawler": "node crawler.ts"
"crawler": "node crawler.ts",
"deploy": "npm --no-git-tag-version version patch && node ./bin/deploy"
},
"dependencies": {
"@vue/repl": "^1.3.2",
Expand Down
7 changes: 7 additions & 0 deletions src/log/个人项目(Z ORG).md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ZORG



## 背景

web2的所有网络都是租赁关系,属于我们自己的只有操作方法和管道数据。数据和流量对我们,利用网上的,以最小的代价创建自己互联网组织打造极具个人平台
Expand All @@ -13,6 +15,11 @@ web2的所有网络都是租赁关系,属于我们自己的只有操作方法
```

### 账号信息

ip: 8.219.194.86
密码:Zorg123.



## 修改速记
Expand Down
2 changes: 0 additions & 2 deletions src/log/超级比较.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


## 超级比较


Expand Down
19 changes: 19 additions & 0 deletions src/log/跨境电商.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,25 @@ https://buy.cloud.tencent.com/domain?from=console



## 1.5.50 (2023-01-04)

### Features

* 基金数量占比图
* 基金规模占比图
* 基金规模占比图
* 基金数量与规模气泡图
* 基金数量变化时序图
* 基金规模变化时序图
* 业绩指标纵向对比图
* 业绩指标横向对比图
* 基金公司业绩指标排名
* 公募基金重仓股变迁表
* 债券基金券种配置
* 修复bug ([9706a24](https://git.51keti.cn/zhouyong/xichou-admin/commits/9706a247f6a7f847d2a1d73573b3be4bb2aea76a))
* 修复bug ([799f86c](https://git.51keti.cn/zhouyong/xichou-admin/commits/799f86c7d3897c396b1447de929744a42548c5fe))
* 修复bug ([b6b9ad9](https://git.51keti.cn/zhouyong/xichou-admin/commits/b6b9ad9def0d94f80cabde270a7dd08447ef657f))

## 2022-07-05

- 新增人员
Expand Down
2 changes: 1 addition & 1 deletion src/note/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ find . -path "*/migrations/*.py" -not -name "__init__.py" -delete
find . -path "*/migrations/*.pyc" -delete
#重新生成 makemigrations
python manage.py makemigrations
python manage.py migrate

# 当已有数据添加字段时
python manage.py migrate --fake

Expand Down

0 comments on commit 095a3f4

Please sign in to comment.