forked from lxchapu/astro-gyoza
-
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
12 changed files
with
101 additions
and
115 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export default { | ||
extends: ['@commitlint/config-conventional'] | ||
extends: ['@commitlint/config-conventional'], | ||
} |
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 |
---|---|---|
|
@@ -58,4 +58,4 @@ | |
"simple-git-hooks": { | ||
"commit-msg": "pnpm exec commitlint --edit $1" | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,45 +1,45 @@ | ||
import { input } from "@inquirer/prompts"; | ||
import fs from "fs"; | ||
import path from "path"; | ||
import { isFileNameSafe } from "./utils.js"; | ||
import { input } from '@inquirer/prompts' | ||
import fs from 'fs' | ||
import path from 'path' | ||
import { isFileNameSafe } from './utils.js' | ||
|
||
function getFriendFullPath(fileName) { | ||
return path.join("./src/content/friends", `${fileName}.yaml`); | ||
return path.join('./src/content/friends', `${fileName}.yaml`) | ||
} | ||
|
||
const fileName = await input({ | ||
message: "请输入文件名称", | ||
message: '请输入文件名称', | ||
validate: (value) => { | ||
if (!isFileNameSafe(value)) { | ||
return "文件名只能包含字母、数字和连字符"; | ||
return '文件名只能包含字母、数字和连字符' | ||
} | ||
const fullPath = getFriendFullPath(value); | ||
const fullPath = getFriendFullPath(value) | ||
if (fs.existsSync(fullPath)) { | ||
return `${fullPath} 已存在`; | ||
return `${fullPath} 已存在` | ||
} | ||
return true; | ||
return true | ||
}, | ||
}); | ||
}) | ||
|
||
const title = await input({ | ||
message: "请输入标题", | ||
}); | ||
message: '请输入标题', | ||
}) | ||
const description = await input({ | ||
message: "请输入描述", | ||
}); | ||
message: '请输入描述', | ||
}) | ||
const link = await input({ | ||
message: "请输入地址", | ||
}); | ||
message: '请输入地址', | ||
}) | ||
const avatar = await input({ | ||
message: "请输入头像地址", | ||
}); | ||
message: '请输入头像地址', | ||
}) | ||
|
||
const content = `title: ${title} | ||
description: ${description} | ||
link: ${link} | ||
avatar: ${avatar} | ||
`; | ||
` | ||
|
||
const fullPath = getFriendFullPath(fileName); | ||
fs.writeFileSync(fullPath, content); | ||
console.log(`${fullPath} 创建成功`); | ||
const fullPath = getFriendFullPath(fileName) | ||
fs.writeFileSync(fullPath, content) | ||
console.log(`${fullPath} 创建成功`) |
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 |
---|---|---|
@@ -1,45 +1,45 @@ | ||
import { input } from "@inquirer/prompts"; | ||
import fs from "fs"; | ||
import path from "path"; | ||
import { isFileNameSafe } from "./utils.js"; | ||
import { input } from '@inquirer/prompts' | ||
import fs from 'fs' | ||
import path from 'path' | ||
import { isFileNameSafe } from './utils.js' | ||
|
||
function getProjectFullPath(fileName) { | ||
return path.join("./src/content/projects", `${fileName}.yaml`); | ||
return path.join('./src/content/projects', `${fileName}.yaml`) | ||
} | ||
|
||
const fileName = await input({ | ||
message: "请输入文件名称", | ||
message: '请输入文件名称', | ||
validate: (value) => { | ||
if (!isFileNameSafe(value)) { | ||
return "文件名只能包含字母、数字和连字符"; | ||
return '文件名只能包含字母、数字和连字符' | ||
} | ||
const fullPath = getProjectFullPath(value); | ||
const fullPath = getProjectFullPath(value) | ||
if (fs.existsSync(fullPath)) { | ||
return `${fullPath} 已存在`; | ||
return `${fullPath} 已存在` | ||
} | ||
return true; | ||
return true | ||
}, | ||
}); | ||
}) | ||
|
||
const title = await input({ | ||
message: "请输入项目名称", | ||
}); | ||
message: '请输入项目名称', | ||
}) | ||
const description = await input({ | ||
message: "请输入项目描述", | ||
}); | ||
message: '请输入项目描述', | ||
}) | ||
const link = await input({ | ||
message: "请输入项目地址", | ||
}); | ||
message: '请输入项目地址', | ||
}) | ||
const image = await input({ | ||
message: "请输入预览图片地址", | ||
}); | ||
message: '请输入预览图片地址', | ||
}) | ||
|
||
const content = `title: ${title} | ||
description: ${description} | ||
link: ${link} | ||
image: ${image} | ||
`; | ||
` | ||
|
||
const fullPath = getProjectFullPath(fileName); | ||
fs.writeFileSync(fullPath, content); | ||
console.log(`${fullPath} 创建成功`); | ||
const fullPath = getProjectFullPath(fileName) | ||
fs.writeFileSync(fullPath, content) | ||
console.log(`${fullPath} 创建成功`) |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export function isFileNameSafe(fileName) { | ||
return /^[a-z0-9]+(-[a-z0-9]+)*$/.test(fileName); | ||
return /^[a-z0-9]+(-[a-z0-9]+)*$/.test(fileName) | ||
} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
--- | ||
title: 项目 | ||
description: 这些是我创建或参与的项目,如果你感兴趣不妨去给个 Star。 | ||
--- | ||
--- |
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
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
Oops, something went wrong.