mirror of
https://github.com/Anduin2017/HowToCook.git
synced 2025-01-30 13:32:56 +08:00
Merge pull request #525 from keidarcy/ci-readme-generator
添加自动生成README的CI
This commit is contained in:
commit
8241091500
1
.github/pull_request_template.md
vendored
1
.github/pull_request_template.md
vendored
@ -14,7 +14,6 @@
|
||||
- [ ] 菜谱包含`必备原料和工具`, `计算`, `操作`三部分内容。
|
||||
- [ ] 菜品的`原材料用量`是无歧义且准确的。对于可以自行发挥的量给出了建议的范围。
|
||||
- [ ] 菜品的`制作步骤`是无歧义,准确且完整的。对于每一个步骤的开始和结束都有明确的标准。
|
||||
- [ ] 我已更新 Readme 对本次修改的菜谱的引用链接。
|
||||
- [ ] 我没有破坏模板的一二级标题格式。
|
||||
- [ ] 我没有删除模板中必需的内容。
|
||||
- [ ] 我已删除干净所有的复制出来的模板的注释。
|
||||
|
130
.github/readme-generate.js
vendored
Normal file
130
.github/readme-generate.js
vendored
Normal file
@ -0,0 +1,130 @@
|
||||
const { readdir, writeFile, stat } = require('fs/promises');
|
||||
|
||||
const ignorePaths = ['.git', 'README.md', 'node_modules', 'CONTRIBUTING.md', '.github'];
|
||||
|
||||
const categories = {
|
||||
'home-cooking': {
|
||||
title: '家常菜',
|
||||
template: '',
|
||||
},
|
||||
breakfast: {
|
||||
title: '早餐',
|
||||
template: '',
|
||||
},
|
||||
staple: {
|
||||
title: '主食',
|
||||
template: '',
|
||||
},
|
||||
'semi-finished': {
|
||||
title: '半成品加工',
|
||||
template: '',
|
||||
},
|
||||
soup: {
|
||||
title: '汤与粥',
|
||||
template: '',
|
||||
},
|
||||
drink: {
|
||||
title: '饮料',
|
||||
template: '',
|
||||
},
|
||||
condiment: {
|
||||
title: '酱料和其它材料',
|
||||
template:'',
|
||||
},
|
||||
dessert: {
|
||||
title: '甜品',
|
||||
template: '',
|
||||
},
|
||||
};
|
||||
|
||||
let README_TEMPLATE = `# 程序员做饭指南
|
||||
|
||||
[![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/Anduin2017/HowToCook/Continuous%20Integration/master)](https://github.com/Anduin2017/HowToCook/actions/workflows/ci.yml)
|
||||
[![License](https://img.shields.io/github/license/Anduin2017/HowToCook)](./LICENSE)
|
||||
[![GitHub contributors](https://img.shields.io/github/contributors/Anduin2017/HowToCook)](https://github.com/Anduin2017/HowToCook/graphs/contributors)
|
||||
|
||||
最近在家隔离,出不了门。只能宅在家做饭了。作为程序员,我偶尔在网上找找菜谱和做法。但是这些菜谱往往写法千奇百怪,经常中间莫名出来一些材料。对于习惯了形式语言的程序员来说极其不友好。
|
||||
|
||||
所以,我计划自己搜寻菜谱和并结合实际做菜的经验,准备用更清晰精准的描述来整理常见菜的做法,以方便程序员在家做饭。
|
||||
|
||||
同样,我希望它是一个由社区驱动和维护的开源项目,使更多人能够一起做一个有趣的仓库。所以非常欢迎大家贡献它~
|
||||
|
||||
## 如何贡献
|
||||
|
||||
针对发现的问题,直接修改并提交 Pull request 即可。
|
||||
|
||||
在写新菜谱时,请复制并修改已有的菜谱模板: [示例菜](https://github.com/Anduin2017/HowToCook/blob/master/dishes/template/%E7%A4%BA%E4%BE%8B%E8%8F%9C/%E7%A4%BA%E4%BE%8B%E8%8F%9C.md?plain=1)。
|
||||
在提交 Pull Request 前更新一下 README.md 里的引用。
|
||||
|
||||
## 做菜之前
|
||||
|
||||
{{before}}
|
||||
## 菜谱
|
||||
{{main}}
|
||||
## 进阶知识学习
|
||||
|
||||
如果你已经做了许多上面的菜,对于厨艺已经入门,并且想学习更加高深的烹饪技巧,请继续阅读下面的内容:
|
||||
|
||||
{{after}}`;
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
let BEFORE = MAIN = AFTER = '';
|
||||
const markdownObj = await getAllMarkdown('.');
|
||||
for (const markdown of markdownObj) {
|
||||
if (markdown.path.includes('tips/advanced')) {
|
||||
AFTER += inlineTemplate(markdown.file, markdown.path, true);
|
||||
continue;
|
||||
}
|
||||
if (markdown.path.includes('tips')) {
|
||||
BEFORE += inlineTemplate(markdown.file, markdown.path, true);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const category of Object.keys(categories)) {
|
||||
if (markdown.path.includes(category)) {
|
||||
let currentCategoryStr = categories[category].template;
|
||||
currentCategoryStr += inlineTemplate(markdown.file, markdown.path);
|
||||
categories[category].template = currentCategoryStr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const category of Object.values(categories)) {
|
||||
MAIN += categoryTemplate(category.title, category.template);
|
||||
}
|
||||
|
||||
await writeFile('./README.md', README_TEMPLATE.replace('{{before}}', BEFORE)
|
||||
.replace('{{main}}', MAIN)
|
||||
.replace('{{after}}', AFTER));
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
async function getAllMarkdown(path) {
|
||||
const paths = [];
|
||||
const files = await readdir(path);
|
||||
for (const file of files) {
|
||||
const filePath = `${path}/${file}`;
|
||||
if (ignorePaths.includes(file)) continue;
|
||||
const fileStat = await stat(filePath);
|
||||
if (fileStat.isFile() && file.endsWith('.md')) {
|
||||
paths.push({ path, file });
|
||||
} else if (fileStat.isDirectory()) {
|
||||
const subFiles = await getAllMarkdown(filePath);
|
||||
paths.push(...subFiles);
|
||||
}
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
|
||||
function inlineTemplate(file, path) {
|
||||
return `* [${file.replace('.md', '')}](${path}/${file})\n`;
|
||||
}
|
||||
|
||||
function categoryTemplate(title, inlineStr) {
|
||||
return `\n### ${title}\n\n${inlineStr}`;
|
||||
}
|
||||
|
||||
main();
|
31
.github/workflows/readme-generate.yml
vendored
Normal file
31
.github/workflows/readme-generate.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
name: Readme Generate
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
- '*/*'
|
||||
- '**'
|
||||
- '!master'
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
- '*/*'
|
||||
- '**'
|
||||
- '!master'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
readme-gen:
|
||||
runs-on: ubuntu-latest
|
||||
# if: github.repository_owner == 'Anduin2017'
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: node ./.github/readme-generate.js
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: "[ci skip] Automatic generate readme"
|
||||
file_pattern: ":/*.md"
|
||||
commit_user_name: github-actions[bot]
|
||||
commit_user_email: github-actions[bot]@users.noreply.github.com
|
||||
commit_author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
|
192
README.md
192
README.md
@ -1,192 +0,0 @@
|
||||
# 程序员做饭指南
|
||||
|
||||
[![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/Anduin2017/HowToCook/Continuous%20Integration/master)](https://github.com/Anduin2017/HowToCook/actions/workflows/ci.yml)
|
||||
[![License](https://img.shields.io/github/license/Anduin2017/HowToCook)](./LICENSE)
|
||||
[![GitHub contributors](https://img.shields.io/github/contributors/Anduin2017/HowToCook)](https://github.com/Anduin2017/HowToCook/graphs/contributors)
|
||||
|
||||
最近在家隔离,出不了门。只能宅在家做饭了。作为程序员,我偶尔在网上找找菜谱和做法。但是这些菜谱往往写法千奇百怪,经常中间莫名出来一些材料。对于习惯了形式语言的程序员来说极其不友好。
|
||||
|
||||
所以,我计划自己搜寻菜谱和并结合实际做菜的经验,准备用更清晰精准的描述来整理常见菜的做法,以方便程序员在家做饭。
|
||||
|
||||
同样,我希望它是一个由社区驱动和维护的开源项目,使更多人能够一起做一个有趣的仓库。所以非常欢迎大家贡献它~
|
||||
|
||||
## 如何贡献
|
||||
|
||||
针对发现的问题,直接修改并提交 Pull request 即可。
|
||||
|
||||
在写新菜谱时,请复制并修改已有的菜谱模板: [示例菜](https://github.com/Anduin2017/HowToCook/blob/master/dishes/template/%E7%A4%BA%E4%BE%8B%E8%8F%9C/%E7%A4%BA%E4%BE%8B%E8%8F%9C.md?plain=1)。
|
||||
在提交 Pull Request 前更新一下 README.md 里的引用。
|
||||
|
||||
## 做菜之前
|
||||
|
||||
* [采购原料,准备厨房](./tips/厨房准备.md)
|
||||
* [学习炒与煎炸](./tips/learn/炒与煎.md)
|
||||
* [学习煮](./tips/learn/煮.md)
|
||||
* [学习蒸](./tips/learn/蒸.md)
|
||||
* [学习使用压力锅](./tips/learn/高压力锅.md)
|
||||
* [学习焯水](./tips/learn/焯水.md)
|
||||
* [学习腌(肉)](./tips/learn/学习腌.md)
|
||||
* [了解食品安全常识](./tips/learn/食品安全.md)
|
||||
* [如何选择吃什么?](./tips/如何选择现在吃什么.md)
|
||||
|
||||
## 菜谱
|
||||
|
||||
### 家常菜
|
||||
|
||||
#### 水产
|
||||
|
||||
* [糖醋鲤鱼](./dishes/home-cooking/糖醋鲤鱼/糖醋鲤鱼.md)
|
||||
* [清蒸生蚝](./dishes/home-cooking/清蒸生蚝.md)
|
||||
* [清蒸鲈鱼](./dishes/home-cooking/清蒸鲈鱼/清蒸鲈鱼.md)
|
||||
* [白灼虾](./dishes/home-cooking/白灼虾/白灼虾.md)
|
||||
* [咖喱炒蟹](./dishes/home-cooking/咖喱炒蟹.md)
|
||||
* [红烧鱼头](./dishes/home-cooking/红烧鱼头.md)
|
||||
* [红烧鲤鱼](./dishes/home-cooking/红烧鲤鱼.md)
|
||||
* [黄油煎虾](./dishes/home-cooking/黄油煎虾/黄油煎虾.md)
|
||||
* [烤鱼](./dishes/home-cooking/混合烤鱼/烤鱼.md)
|
||||
* [鳊鱼炖豆腐](./dishes/home-cooking/鳊鱼炖豆腐/鳊鱼炖豆腐.md)
|
||||
|
||||
#### 荤菜
|
||||
|
||||
* [水煮肉片](./dishes/home-cooking/水煮肉片.md)
|
||||
* [鱼香肉丝](./dishes/home-cooking/鱼香肉丝.md)
|
||||
* [回锅肉](./dishes/home-cooking/回锅肉.md)
|
||||
* [糖醋里脊](./dishes/home-cooking/糖醋里脊.md)
|
||||
* [西红柿牛腩](./dishes/home-cooking/西红柿牛腩/西红柿牛腩.md)
|
||||
* [宫保鸡丁](./dishes/home-cooking/宫保鸡丁/宫保鸡丁.md)
|
||||
* [麻辣香锅](./dishes/home-cooking/麻辣香锅.md)
|
||||
* [香干肉丝](./dishes/home-cooking/香干肉丝.md)
|
||||
* [香干芹菜炒肉](./dishes/home-cooking/香干芹菜炒肉/香干芹菜炒肉.md)
|
||||
* [尖椒炒牛肉](./dishes/home-cooking/尖椒炒牛肉.md)
|
||||
* [小炒肉](./dishes/home-cooking/小炒肉.md)
|
||||
* [可乐鸡翅](./dishes/home-cooking/可乐鸡翅.md)
|
||||
* [洋葱炒猪肉](./dishes/home-cooking/洋葱炒猪肉.md)
|
||||
* [酱牛肉](./dishes/home-cooking/酱牛肉/酱牛肉.md)
|
||||
* [血浆鸭](./dishes/home-cooking/血浆鸭/血浆鸭.md)
|
||||
* [黄瓜炒肉](./dishes/home-cooking/黄瓜炒肉.md)
|
||||
* [冷吃兔](./dishes/home-cooking/冷吃兔.md)
|
||||
* [香菇滑鸡](./dishes/home-cooking/香菇滑鸡/香菇滑鸡.md)
|
||||
* [西红柿土豆炖牛肉](./dishes/soup/西红柿土豆炖牛肉/西红柿土豆炖牛肉(腩).md)
|
||||
* [老式锅包肉](./dishes/home-cooking/老式锅包肉/老式锅包肉.md)
|
||||
* [小炒黄牛肉](./dishes/home-cooking/小炒黄牛肉/小炒黄牛肉.md)
|
||||
* [萝卜炖羊排](./dishes/home-cooking/萝卜炖羊排.md)
|
||||
* [红烧肉](./dishes/home-cooking/红烧肉/简易红烧肉.md)
|
||||
* [南派红烧肉](./dishes/home-cooking/红烧肉/南派红烧肉.md)
|
||||
* [鱼香茄子](./dishes/home-cooking/鱼香茄子/鱼香茄子.md)
|
||||
* [咕噜肉](./dishes/home-cooking/咕噜肉.md)
|
||||
* [孜然牛肉](./dishes/home-cooking/孜然牛肉.md)
|
||||
* [榄菜肉末四季豆](./dishes/home-cooking/榄菜肉末四季豆/榄菜肉末四季豆.md)
|
||||
* [水煮牛肉](./dishes/home-cooking/水煮牛肉/水煮牛肉.md)
|
||||
* [红烧猪蹄](./dishes/home-cooking/红烧猪蹄/红烧猪蹄.md)
|
||||
* [口水鸡](./dishes/home-cooking/口水鸡/口水鸡.md)
|
||||
|
||||
#### 素菜
|
||||
|
||||
* [西红柿炒鸡蛋](./dishes/home-cooking/西红柿炒鸡蛋.md)
|
||||
* [地三鲜](./dishes/home-cooking/地三鲜.md)
|
||||
* [葱煎豆腐](./dishes/home-cooking/葱煎豆腐.md)
|
||||
* [茄子炖土豆](./dishes/home-cooking/茄子炖土豆.md)
|
||||
* [辣椒炒肉](./dishes/home-cooking/辣椒炒肉.md)
|
||||
* [凉拌黄瓜](./dishes/home-cooking/凉拌黄瓜.md)
|
||||
* [酸辣土豆丝](./dishes/home-cooking/酸辣土豆丝.md)
|
||||
* [菠菜炒鸡蛋](./dishes/home-cooking/菠菜炒鸡蛋/菠菜炒鸡蛋.md)
|
||||
* [水油焖蔬菜](./dishes/home-cooking/水油焖蔬菜.md)
|
||||
* [白菜猪肉炖粉条](./dishes/home-cooking/白菜猪肉炖粉条.md)
|
||||
* [鸡蛋羹](./dishes/home-cooking/鸡蛋羹/鸡蛋羹.md)
|
||||
* [微波炉鸡蛋羹](./dishes/home-cooking/鸡蛋羹/微波炉鸡蛋羹.md)
|
||||
* [上汤娃娃菜](./dishes/home-cooking/上汤娃娃菜/上汤娃娃菜.md)
|
||||
* [炒青菜](./dishes/home-cooking/炒青菜.md)
|
||||
* [糖拌西红柿](./dishes/home-cooking/糖拌西红柿/糖拌西红柿.md)
|
||||
* [红烧茄子](./dishes/home-cooking/红烧茄子.md)
|
||||
* [凉粉](./dishes/home-cooking/凉粉/凉粉.md)
|
||||
* [鱼香茄子](./dishes/home-cooking/鱼香茄子/鱼香茄子.md)
|
||||
* [蒜苔炒肉末](./dishes/home-cooking/蒜苔炒肉末.md)
|
||||
|
||||
### 早餐
|
||||
|
||||
* [太阳蛋](./dishes/breakfast/太阳蛋.md)
|
||||
* [美式炒蛋](./dishes/breakfast/美式炒蛋.md)
|
||||
* [牛奶燕麦](./dishes/breakfast/牛奶燕麦.md)
|
||||
* [果酱吐司](./dishes/breakfast/吐司果酱.md)
|
||||
* [溏心蛋](./dishes/breakfast/溏心蛋.md)
|
||||
* [茶叶蛋](./dishes/breakfast/茶叶蛋.md)
|
||||
* [水煮玉米](./dishes/breakfast/水煮玉米.md)
|
||||
* [微波炉蛋糕](./dishes/breakfast/微波炉蛋糕.md)
|
||||
* [茶叶蛋](./dishes/breakfast/茶叶蛋.md)
|
||||
* [蒸花卷](./dishes/breakfast/蒸花卷.md)
|
||||
|
||||
|
||||
### 主食
|
||||
|
||||
* [米饭](./dishes/staple/米饭/米饭.md)
|
||||
* [蛋炒饭](./dishes/staple/蛋炒饭.md)
|
||||
* [日式咖喱饭](./dishes/staple/日式咖喱饭/日式咖喱饭.md)
|
||||
* [烙饼](./dishes/staple/烙饼/烙饼.md)
|
||||
* [炒方便面](./dishes/staple/炒方便面.md)
|
||||
* [老干妈拌面](./dishes/staple/老干妈拌面.md)
|
||||
* [醪糟小汤圆](./dishes/staple/醪糟小汤圆.md)
|
||||
* [炒河粉](./dishes/staple/炒河粉.md)
|
||||
* [炸酱面](./dishes/staple/炸酱面.md)
|
||||
* [手工水饺](./dishes/staple/手工水饺.md)
|
||||
* [麻油拌面](./dishes/staple/麻油拌面.md)
|
||||
* [披萨饼皮](./dishes/staple/pizza/披萨饼皮.md)
|
||||
* [热干面](./dishes/staple/热干面.md)
|
||||
* [炒馍](./dishes/staple/炒馍.md)
|
||||
* [煮泡面加蛋](./dishes/staple/煮泡面加蛋.md)
|
||||
* [老友猪肉粉](./dishes/staple/老友猪肉粉/老友猪肉粉.md)
|
||||
* [微波炉腊肠煲仔饭](./dishes/staple/微波炉腊肠煲仔饭/微波炉腊肠煲仔饭.md)
|
||||
* [麻辣减脂荞麦面](./dishes/staple/麻辣减脂荞麦面.md)
|
||||
|
||||
### 半成品加工
|
||||
|
||||
* [速冻汤圆](./dishes/semi-finished/速冻汤圆/速冻汤圆.md)
|
||||
* [懒人蛋挞](./dishes/semi-finished/懒人蛋挞/懒人蛋挞.md)
|
||||
* [速冻水饺](./dishes/semi-finished/速冻水饺.md)
|
||||
* [速冻馄饨](./dishes/semi-finished/速冻馄饨.md)
|
||||
* [凉皮](./dishes/semi-finished/凉皮.md)
|
||||
|
||||
### 汤与粥
|
||||
|
||||
* [米粥](./dishes/soup/米粥.md)
|
||||
* [皮蛋瘦肉粥](./dishes/soup/皮蛋瘦肉粥.md)
|
||||
* [西红柿鸡蛋汤](./dishes/soup/西红柿鸡蛋汤.md)
|
||||
* [金针菇汤](./dishes/soup/金针菇汤.md)
|
||||
* [罗宋汤](./dishes/soup/罗宋汤.md)
|
||||
* [昂刺鱼豆腐汤](./dishes/soup/昂刺鱼豆腐汤/昂刺鱼豆腐汤.md)
|
||||
* [紫菜蛋花汤](./dishes/soup/紫菜蛋花汤.md)
|
||||
* [菌菇炖乳鸽](./dishes/soup/菌菇炖乳鸽/菌菇炖乳鸽.md)
|
||||
* [小米粥](dishes/soup/小米粥.md)
|
||||
|
||||
### 饮料
|
||||
|
||||
* [酸梅汁(从半成品)](./dishes/drink/酸梅汁.md)
|
||||
* [酸梅汤(从原材料)](./dishes/drink/酸梅汤/酸梅汤.md)
|
||||
* [百香果橙子特调](./dishes/drink/百香果橙子特调/百香果橙子特调.md)
|
||||
* [耙耙柑茶](./dishes/drink/耙耙柑茶/耙耙柑茶.md)
|
||||
* [杨枝甘露](./dishes/drink/杨枝甘露.md)
|
||||
* [金菲士](./dishes/drink/金菲士/金菲士.md)
|
||||
* [金汤力](./dishes/drink/金汤力/金汤力.md)
|
||||
* [奶茶](./dishes/drink/奶茶.md)
|
||||
* [B52轰炸机](./dishes/drink/B52轰炸机.md)
|
||||
|
||||
### 酱料和其它材料
|
||||
|
||||
* [油泼辣子](./dishes/condiment/油泼辣子.md)
|
||||
* [蒜香酱油](./dishes/condiment/蒜香酱油.md)
|
||||
* [糖醋汁](./dishes/condiment/糖醋汁.md)
|
||||
* [油酥](./dishes/condiment/油酥.md)
|
||||
* [炒糖色](./dishes/condiment/糖色.md)
|
||||
* [蔗糖糖浆](./dishes/condiment/蔗糖糖浆/蔗糖糖浆.md)
|
||||
* [炸串酱料](./dishes/condiment/炸串酱料.md)
|
||||
|
||||
### 甜品
|
||||
|
||||
* [提拉米苏](./dishes/dessert/提拉米苏/提拉米苏.md)
|
||||
* [烤蛋挞](./dishes/dessert/烤蛋挞/烤蛋挞.md)
|
||||
|
||||
## 进阶知识学习
|
||||
|
||||
如果你已经做了许多上面的菜,对于厨艺已经入门,并且想学习更加高深的烹饪技巧,请继续阅读下面的内容:
|
||||
|
||||
* [辅料使用技巧](./tips/advanced/辅料技巧.md)
|
||||
* [油温判断技巧](./tips/advanced/油温判断技巧.md)
|
Loading…
x
Reference in New Issue
Block a user