Skip to content

Commit

Permalink
修改迁移脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
yunnysunny committed Feb 3, 2024
1 parent 70c4f81 commit e397903
Show file tree
Hide file tree
Showing 5 changed files with 500 additions and 12 deletions.
22 changes: 22 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// eslint-disable-next-line no-undef
module.exports = {
extends: [
'eslint:recommended',
],
env: {
// Your environments (which contains several predefined global variables)
'node': true,
},
globals: {
// Your global variables (setting to false means it's not allowed to be reassigned)
//
// myGlobal: false
},
rules: {
// Customize your rules
'quotes': ['error', 'single', { 'avoidEscape': true }],
'semi': ['error', 'never'],
'no-console': ['error'],
'indent': ['error', 2],
}
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
"docs:dev": "vuepress dev text",
"dev": "npm run docs:dev",
"docs:build": "vuepress build text",
"build": "npm run docs:build",
"build": "cross-env NODE_OPTIONS=--openssl-legacy-provider npm run docs:build",
"preview": "cd output && anywhere 8888"
},
"repository": "[email protected]:yunnysunny/nodebook.git",
"author": "yunnysunny <[email protected]>",
"license": "MIT",
"devDependencies": {
"cross-env": "^7.0.3",
"eslint": "^8.56.0",
"markdown-it-disable-url-encode": "^1.0.1",
"vuepress": "^1.9.10",
"vuepress-plugin-autometa": "^0.1.13",
Expand Down
25 changes: 23 additions & 2 deletions text/.vuepress/enhanceApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,32 @@ export default ({
const hash = location.hash
const pages = siteData.pages
if (hash) {
let pathFromHash = hash
let hashFromHash = ''
if (hash.indexOf('?') !== -1) {
const hashData = hash.split('?')
pathFromHash = hashData[0]
const realHashData = hashData[1]

realHashData.split('&').forEach(item => {
const pair = item.split('=')
if (pair[0] === 'id') {
const id = pair[1]
const re = /_(\d+)\-(.*)/
const result = re.exec(id)
const index = result[1].split('').join('-')
hashFromHash = `#_${index}-${result[2]}`
}
})
}
for (let i = 0, len = pages.length; i < len; i++) {
const path = pages[i].regularPath
const name = path.slice(0, -'.html'.length)
if ('#' + name === hash) {
const url = siteData.base + path.substring(1)
if ('#' + name === pathFromHash) {
let url = siteData.base + path.substring(1)
if (hashFromHash) {
url += hashFromHash
}
console.log('navigate to ', url)
location.href = url
break
Expand Down
2 changes: 1 addition & 1 deletion text/a7_easy_monitor_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ flush privileges;
> 镜像项目地址为 [whyun-docker/node (github.com)](https://github.com/whyun-docker/node)
由于牵扯到的环境变量比较多,所以这里直接给出一个 .env 文件:
```env
```shell
CONSOLE_MYSQL_HOST=mysql 访问 ip 或者域名
CONSOLE_MYSQL_PORT=mysql 端口号
CONSOLE_MYSQL_USER=mysql 用户名
Expand Down
Loading

0 comments on commit e397903

Please sign in to comment.