refactor: SRE 学习路径抽成独立板块「学习路线」,与知识库同级
- knowledge/sre-learning-path/ -> 学习路线/sre-learning-path/(git mv,404 个文件保留改名历史) - 导航页新增模块 learning-path(num 03,project 顺延 04),知识库回到 4 份资料 - check-portal.js / add-back-links.js 支持模块目录独立于 id(m.dir || m.id), 路由仍为 #/learning-path/sre-learning-path,URL 保持 ASCII - portal.js 快捷键提示按模块数生成、复制板块目录用真实目录名 - docker / linux / nginx 的外链、build-nav.js 生成器与自检白名单改指 ../../学习路线/sre-learning-path/ - 399 个站点页面与全部知识站点的返回入口由 tools/add-back-links.js 重算 (标签改为「学习路径 › SRE 从零到成熟学习路径」) - .sre-s23 生成脚手架与根 README、index.html 同步到新路径与新板块数 自检:check-portal / add-back-links --check 全绿; 学习路线站点 399 页与 docker、linux、nginx 的 check-pages 全部通过。
This commit is contained in:
@@ -10,7 +10,8 @@
|
||||
* 检查项:
|
||||
* 1. 模块 / 资料 id 唯一,path、dir 在仓库内(不允许绝对路径或 .. 逃逸)
|
||||
* 2. 每个 path 指向的文件存在,且是 .html;每个 dir 指向的目录存在
|
||||
* 3. path / dir 位于该模块自己的顶层目录下(如 knowledge/… 属于 knowledge 模块)
|
||||
* 3. path / dir 位于该模块自己的顶层目录下
|
||||
* (模块目录默认等于模块 id;id 需要英文 URL 时可以另写 `dir: '学习路线'` 指定)
|
||||
* 4. 统计条目数与未登记资料(interview/ 这类空目录允许为空)
|
||||
* 退出码:0 全部通过,1 有问题。
|
||||
* ==========================================================================*/
|
||||
@@ -84,6 +85,10 @@ for (const m of DATA.modules) {
|
||||
}
|
||||
if (!Array.isArray(m.entries)) { fail(`${where}:entries 必须是数组`); continue; }
|
||||
|
||||
// 模块的磁盘目录:默认与 id 同名,id 是英文时可以用 dir 指向中文目录
|
||||
const modDir = (m.dir || m.id || '').replace(/\/+$/, '');
|
||||
if (m.dir && !inside(m.dir, 'dir', where)) continue;
|
||||
|
||||
if (m.temp) {
|
||||
if (inside(m.temp.path, 'temp.path', where) && !exists(m.temp.path, 'file')) {
|
||||
fail(`${where}:临时页 ${m.temp.path} 不存在`);
|
||||
@@ -107,8 +112,8 @@ for (const m of DATA.modules) {
|
||||
if (inside(e.path, 'path', w)) {
|
||||
if (!exists(e.path, 'file')) fail(`${w}:path ${e.path} 不存在`);
|
||||
else if (!/\.html?$/i.test(e.path)) warn(`${w}:path ${e.path} 不是 .html,点开会是下载或源码`);
|
||||
if (m.id && !e.path.startsWith(m.id + '/')) {
|
||||
fail(`${w}:path ${e.path} 不在 ${m.id}/ 目录下`);
|
||||
if (modDir && !e.path.startsWith(modDir + '/')) {
|
||||
fail(`${w}:path ${e.path} 不在 ${modDir}/ 目录下`);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -125,8 +130,8 @@ for (const m of DATA.modules) {
|
||||
total += n;
|
||||
rows.push([m.id, m.name, n, m.statusText || m.status || '']);
|
||||
|
||||
// 模块自己的目录应当存在(interview / knowledge / project)
|
||||
if (m.id && !exists(m.id, 'dir')) fail(`${where}:目录 ${m.id}/ 不存在`);
|
||||
// 模块自己的目录应当存在(interview / knowledge / 学习路线 / project)
|
||||
if (modDir && !exists(modDir, 'dir')) fail(`${where}:目录 ${modDir}/ 不存在`);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ 输出 */
|
||||
|
||||
Reference in New Issue
Block a user