Skip to content

Commit e397903

Browse files
committed
修改迁移脚本
1 parent 70c4f81 commit e397903

File tree

5 files changed

+500
-12
lines changed

5 files changed

+500
-12
lines changed

.eslintrc.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// eslint-disable-next-line no-undef
2+
module.exports = {
3+
extends: [
4+
'eslint:recommended',
5+
],
6+
env: {
7+
// Your environments (which contains several predefined global variables)
8+
'node': true,
9+
},
10+
globals: {
11+
// Your global variables (setting to false means it's not allowed to be reassigned)
12+
//
13+
// myGlobal: false
14+
},
15+
rules: {
16+
// Customize your rules
17+
'quotes': ['error', 'single', { 'avoidEscape': true }],
18+
'semi': ['error', 'never'],
19+
'no-console': ['error'],
20+
'indent': ['error', 2],
21+
}
22+
}

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
"docs:dev": "vuepress dev text",
77
"dev": "npm run docs:dev",
88
"docs:build": "vuepress build text",
9-
"build": "npm run docs:build",
9+
"build": "cross-env NODE_OPTIONS=--openssl-legacy-provider npm run docs:build",
1010
"preview": "cd output && anywhere 8888"
1111
},
1212
"repository": "[email protected]:yunnysunny/nodebook.git",
1313
"author": "yunnysunny <[email protected]>",
1414
"license": "MIT",
1515
"devDependencies": {
16+
"cross-env": "^7.0.3",
17+
"eslint": "^8.56.0",
1618
"markdown-it-disable-url-encode": "^1.0.1",
1719
"vuepress": "^1.9.10",
1820
"vuepress-plugin-autometa": "^0.1.13",

text/.vuepress/enhanceApp.js

+23-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,32 @@ export default ({
1212
const hash = location.hash
1313
const pages = siteData.pages
1414
if (hash) {
15+
let pathFromHash = hash
16+
let hashFromHash = ''
17+
if (hash.indexOf('?') !== -1) {
18+
const hashData = hash.split('?')
19+
pathFromHash = hashData[0]
20+
const realHashData = hashData[1]
21+
22+
realHashData.split('&').forEach(item => {
23+
const pair = item.split('=')
24+
if (pair[0] === 'id') {
25+
const id = pair[1]
26+
const re = /_(\d+)\-(.*)/
27+
const result = re.exec(id)
28+
const index = result[1].split('').join('-')
29+
hashFromHash = `#_${index}-${result[2]}`
30+
}
31+
})
32+
}
1533
for (let i = 0, len = pages.length; i < len; i++) {
1634
const path = pages[i].regularPath
1735
const name = path.slice(0, -'.html'.length)
18-
if ('#' + name === hash) {
19-
const url = siteData.base + path.substring(1)
36+
if ('#' + name === pathFromHash) {
37+
let url = siteData.base + path.substring(1)
38+
if (hashFromHash) {
39+
url += hashFromHash
40+
}
2041
console.log('navigate to ', url)
2142
location.href = url
2243
break

text/a7_easy_monitor_setup.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ flush privileges;
4444
> 镜像项目地址为 [whyun-docker/node (github.com)](https://github.com/whyun-docker/node)
4545
4646
由于牵扯到的环境变量比较多,所以这里直接给出一个 .env 文件:
47-
```env
47+
```shell
4848
CONSOLE_MYSQL_HOST=mysql 访问 ip 或者域名
4949
CONSOLE_MYSQL_PORT=mysql 端口号
5050
CONSOLE_MYSQL_USER=mysql 用户名

0 commit comments

Comments
 (0)