@d-zero/scaffold 5.0.0-beta.4 → 5.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/__assets/_libs/component/c-nav-breadcrumb.pug +17 -39
- package/__assets/_libs/component/c-title-page.pug +1 -1
- package/__assets/_libs/data/breadcrumbs.js +77 -0
- package/__assets/_libs/data/titlelist.js +16 -0
- package/__assets/_libs/layouts/home.pug +0 -1
- package/__assets/_libs/layouts/sub.pug +0 -1
- package/__assets/_libs/mixin/meta.pug +25 -21
- package/__assets/htdocs/__tmpl/000_home.json +2 -1
- package/__assets/htdocs/__tmpl/100_sub.json +2 -1
- package/__assets/htdocs/__tmpl/200_blog_index.json +1 -0
- package/__assets/htdocs/__tmpl/210_blog_index.json +1 -0
- package/__assets/htdocs/__tmpl/300_form_input.json +2 -1
- package/__assets/htdocs/__tmpl/301_form_confirm.json +2 -1
- package/__assets/htdocs/__tmpl/302_form_complete.json +2 -1
- package/__assets/htdocs/sample/index.html +1 -0
- package/__assets/htdocs/sub-folder.test/index.pug +1 -3
- package/package.json +21 -15
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,34 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [5.0.0-beta.6](https://github.com/d-zero-dev/frontend-env/compare/v5.0.0-beta.5...v5.0.0-beta.6) (2025-10-03)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **scaffold:** filter empty strings in breadcrumb depth calculation ([02d5ffc](https://github.com/d-zero-dev/frontend-env/commit/02d5ffc7935b055d22fbb9dbf0cf2ee7767fc60a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [5.0.0-beta.5](https://github.com/d-zero-dev/frontend-env/compare/v5.0.0-beta.4...v5.0.0-beta.5) (2025-09-17)
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
- **scaffold:** add dotenv ([f9e09fb](https://github.com/d-zero-dev/frontend-env/commit/f9e09fbc1e32f99dd0529b5fba40cc8c205471cb))
|
|
22
|
+
- **scaffold:** remove unnecessary async keyword from breadcrumbs function ([2e1e11f](https://github.com/d-zero-dev/frontend-env/commit/2e1e11f29face454705de7b359ab1bc598c549cf))
|
|
23
|
+
- **scaffold:** use rel="icon" for favicon ([af6c9e8](https://github.com/d-zero-dev/frontend-env/commit/af6c9e83c2bd2b454bf54745de0b8275063450d5))
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
- **scaffold:** add dynamic breadcrumb generation ([4816002](https://github.com/d-zero-dev/frontend-env/commit/4816002823cb0698cac60858db26bffe081ab8e0))
|
|
28
|
+
- **scaffold:** add dynamic title generation using breadcrumbs ([39fd107](https://github.com/d-zero-dev/frontend-env/commit/39fd1076cd7d722bb97942751bc6f65826f93c1a))
|
|
29
|
+
- **scaffold:** update c-title-page component ([77d8bbe](https://github.com/d-zero-dev/frontend-env/commit/77d8bbe534392b1ae2bd82ea0e0da02287f32ff0))
|
|
30
|
+
- **scaffold:** update layout and template files ([6f95978](https://github.com/d-zero-dev/frontend-env/commit/6f9597865bf66e9d8f336a4e5e9db0462953116b))
|
|
31
|
+
- **scaffold:** update meta mixin, sample page and package config ([f97f141](https://github.com/d-zero-dev/frontend-env/commit/f97f1416ddd2053cdfab38823fe66adfdf3ef5f9))
|
|
32
|
+
- **scaffold:** update template data with Japanese titles ([7c60679](https://github.com/d-zero-dev/frontend-env/commit/7c606797db4a94b527de69b3ec79980fed275f61))
|
|
33
|
+
|
|
6
34
|
# [5.0.0-beta.4](https://github.com/d-zero-dev/frontend-env/compare/v5.0.0-beta.3...v5.0.0-beta.4) (2025-08-14)
|
|
7
35
|
|
|
8
36
|
### Bug Fixes
|
|
@@ -1,42 +1,20 @@
|
|
|
1
1
|
.c-nav-breadcrumb
|
|
2
2
|
ol(itemscope itemtype="https://schema.org/BreadcrumbList")
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
data-breadcrumb="home")
|
|
8
|
-
a(
|
|
9
|
-
href="/"
|
|
3
|
+
- const HOME_TITLE = "Home";
|
|
4
|
+
- const linkList = breadcrumbs(page, collections);
|
|
5
|
+
each link, index in linkList
|
|
6
|
+
li.c-nav-breadcrumb__item(
|
|
10
7
|
itemscope
|
|
11
|
-
itemprop="
|
|
12
|
-
itemtype="https://schema.org/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
itemprop="item"
|
|
25
|
-
itemtype="https://schema.org/WebPage"
|
|
26
|
-
itemid="/first/")
|
|
27
|
-
span(itemprop="name") Parent
|
|
28
|
-
meta(itemprop="position" content="2")
|
|
29
|
-
span.c-nav-breadcrumb__separetor
|
|
30
|
-
li.c-nav-breadcrumb__item(
|
|
31
|
-
itemscope
|
|
32
|
-
itemprop="itemListElement"
|
|
33
|
-
itemtype="https://schema.org/ListItem"
|
|
34
|
-
data-breadcrumb="current")
|
|
35
|
-
a(
|
|
36
|
-
href="/first/about"
|
|
37
|
-
itemscope
|
|
38
|
-
itemprop="item"
|
|
39
|
-
itemtype="https://schema.org/WebPage"
|
|
40
|
-
itemid="/first/about")
|
|
41
|
-
span(itemprop="name") Current
|
|
42
|
-
meta(itemprop="position" content="3")
|
|
8
|
+
itemprop="itemListElement"
|
|
9
|
+
itemtype="https://schema.org/ListItem"
|
|
10
|
+
data-breadcrumb=link.href === "/" ? "home" : undefined)
|
|
11
|
+
a(
|
|
12
|
+
href=link.href
|
|
13
|
+
itemscope
|
|
14
|
+
itemprop="item"
|
|
15
|
+
itemtype="https://schema.org/WebPage"
|
|
16
|
+
itemid=link.href)
|
|
17
|
+
span(itemprop="name")= link.href === "/" ? HOME_TITLE || link.title : link.title
|
|
18
|
+
meta(itemprop="position" content=index + 1)
|
|
19
|
+
if index < linkList.length - 1
|
|
20
|
+
span.c-nav-breadcrumb__separetor
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
.c-title-page
|
|
2
|
-
h1
|
|
2
|
+
h1= title
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
|
|
3
|
+
import { JSDOM } from 'jsdom';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export default function () {
|
|
9
|
+
return (page, collections) => {
|
|
10
|
+
const breadcrumbs = collections.all
|
|
11
|
+
.filter((item) => isAncestor(page, item.filePathStem))
|
|
12
|
+
.map((item) => ({
|
|
13
|
+
title: getTitle(item),
|
|
14
|
+
href: item.page.url,
|
|
15
|
+
depth: item.page.url.split('/').filter(Boolean).length,
|
|
16
|
+
}))
|
|
17
|
+
.sort((a, b) => a.depth - b.depth);
|
|
18
|
+
return breadcrumbs;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param page
|
|
25
|
+
* @param filePathStem
|
|
26
|
+
*/
|
|
27
|
+
function isAncestor(page, filePathStem) {
|
|
28
|
+
const dirname = path.dirname(filePathStem);
|
|
29
|
+
const name = path.basename(filePathStem);
|
|
30
|
+
const included = page.filePathStem.startsWith(dirname);
|
|
31
|
+
const isIndex = name === 'index';
|
|
32
|
+
const isSelf = page.filePathStem === filePathStem;
|
|
33
|
+
return (included && isIndex) || isSelf;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const titleCache = new Map();
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
* @param item
|
|
41
|
+
*/
|
|
42
|
+
function getTitle(item) {
|
|
43
|
+
const filePathStem = item.filePathStem;
|
|
44
|
+
if (titleCache.has(filePathStem)) {
|
|
45
|
+
return titleCache.get(filePathStem);
|
|
46
|
+
}
|
|
47
|
+
const title =
|
|
48
|
+
item.data.title?.trim() ||
|
|
49
|
+
getTitleFromDOM(getContent(item)) ||
|
|
50
|
+
item.page.fileSlug?.trim();
|
|
51
|
+
titleCache.set(filePathStem, title);
|
|
52
|
+
return title;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
57
|
+
* @param item
|
|
58
|
+
*/
|
|
59
|
+
function getTitleFromDOM(item) {
|
|
60
|
+
const content = getContent(item);
|
|
61
|
+
const dom = new JSDOM(content);
|
|
62
|
+
const title = dom.window.document.title.trim();
|
|
63
|
+
return title;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* @param item
|
|
69
|
+
*/
|
|
70
|
+
function getContent(item) {
|
|
71
|
+
try {
|
|
72
|
+
// UsingCircularTemplateContentReferenceError may potentially occur
|
|
73
|
+
return item.templateContent;
|
|
74
|
+
} catch {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import breadcrumbs from './breadcrumbs.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export default async function () {
|
|
7
|
+
return (page, collections, pkg, separator = ' | ') => {
|
|
8
|
+
const breadcrumbLinkList = breadcrumbs()(page, collections);
|
|
9
|
+
const titleList = breadcrumbLinkList
|
|
10
|
+
.filter((item) => item.href !== '/')
|
|
11
|
+
.toReversed()
|
|
12
|
+
.map((item) => item.title);
|
|
13
|
+
titleList.push(pkg.production?.siteName || '__サイト名__');
|
|
14
|
+
return titleList.join(separator);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
meta(property="og:
|
|
9
|
-
|
|
10
|
-
meta(property="og:description" content="
|
|
11
|
-
|
|
12
|
-
meta(property="og:
|
|
13
|
-
meta(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
meta(name="twitter:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
meta(charset="UTF-8")
|
|
2
|
+
meta(name="viewport" content="width=device-width")
|
|
3
|
+
title= titlelist(page, collections, pkg, " | ")
|
|
4
|
+
meta(name="format-detection" content="telephone=no")
|
|
5
|
+
meta(name="description" content=description || "")
|
|
6
|
+
meta(property="og:type" content=ogType || "website")
|
|
7
|
+
if pkg.production.siteName
|
|
8
|
+
meta(property="og:site_name" content=pkg.production.siteName || "__サイト名__")
|
|
9
|
+
if ogDescription || description
|
|
10
|
+
meta(property="og:description" content=ogDescription || description || "")
|
|
11
|
+
if pkg.production.host
|
|
12
|
+
meta(property="og:url" content=pkg.production.host + page.url)
|
|
13
|
+
meta(property="og:image" content=pkg.production.host + (ogImage || "/img/ogp.png"))
|
|
14
|
+
meta(name="twitter:card" content=ogCard || "summary_large_image")
|
|
15
|
+
meta(name="twitter:url" content=pkg.production.host + page.url)
|
|
16
|
+
if pkg.production.siteName
|
|
17
|
+
meta(name="twitter:title" content=pkg.production.siteName || "__サイト名__")
|
|
18
|
+
if ogDescription || description
|
|
19
|
+
meta(name="twitter:description" content=ogDescription || description || "")
|
|
20
|
+
if pkg.production.host
|
|
21
|
+
meta(name="twitter:image" content=pkg.production.host + (ogImage || "/img/ogp.png"))
|
|
22
|
+
link(rel="icon" href="/favicon.png")
|
|
23
|
+
link(rel="apple-touch-icon" href="/img/apple-touch-icon.png")
|
|
24
|
+
link(href="/css/style.css" rel="stylesheet")
|
|
25
|
+
script(src="/js/script.js" type="module")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d-zero/scaffold",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.6",
|
|
4
4
|
"description": "Frontend scaffold files of D-ZERO Co., Ltd.",
|
|
5
5
|
"repository": "https://github.com/d-zero-dev/frontend-env.git",
|
|
6
6
|
"author": "D-ZERO Co., Ltd.",
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
},
|
|
11
11
|
"type": "module",
|
|
12
12
|
"main": "package.json",
|
|
13
|
+
"production": {
|
|
14
|
+
"host": "https://example.com",
|
|
15
|
+
"siteName": "__サイト名__"
|
|
16
|
+
},
|
|
13
17
|
"scripts": {
|
|
14
18
|
"build": "yarn lint && npx @d-zero/builder",
|
|
15
19
|
"build:only": "npx @d-zero/builder",
|
|
@@ -39,30 +43,32 @@
|
|
|
39
43
|
"last 2 ios_saf version"
|
|
40
44
|
],
|
|
41
45
|
"devDependencies": {
|
|
42
|
-
"@burger-editor/local": "4.0.0-alpha.
|
|
43
|
-
"@d-zero/builder": "5.0.0-beta.
|
|
44
|
-
"@d-zero/linters": "5.0.0-alpha.
|
|
45
|
-
"@d-zero/postcss-config": "5.0.0-beta.
|
|
46
|
+
"@burger-editor/local": "4.0.0-alpha.25",
|
|
47
|
+
"@d-zero/builder": "5.0.0-beta.6",
|
|
48
|
+
"@d-zero/linters": "5.0.0-alpha.71",
|
|
49
|
+
"@d-zero/postcss-config": "5.0.0-beta.6",
|
|
46
50
|
"@d-zero/tsconfig": "0.5.0",
|
|
47
|
-
"@types/node": "
|
|
48
|
-
"cross-env": "10.
|
|
51
|
+
"@types/node": "24.6.2",
|
|
52
|
+
"cross-env": "10.1.0",
|
|
53
|
+
"dotenv": "17.2.3",
|
|
49
54
|
"husky": "9.1.7",
|
|
55
|
+
"jsdom": "27.0.0",
|
|
50
56
|
"npm-run-all2": "8.0.4",
|
|
51
|
-
"typescript": "5.9.
|
|
57
|
+
"typescript": "5.9.3",
|
|
52
58
|
"vitest": "3.2.4"
|
|
53
59
|
},
|
|
54
60
|
"dependencies": {
|
|
55
|
-
"@burger-editor/css": "4.0.0-alpha.
|
|
56
|
-
"@d-zero/custom-components": "5.0.0-beta.
|
|
61
|
+
"@burger-editor/css": "4.0.0-alpha.25",
|
|
62
|
+
"@d-zero/custom-components": "5.0.0-beta.6",
|
|
57
63
|
"dialog-toggle-events-polyfill": "1.1.4",
|
|
58
|
-
"invokers-polyfill": "0.5.
|
|
64
|
+
"invokers-polyfill": "0.5.7",
|
|
59
65
|
"kiso.css": "1.2.2",
|
|
60
66
|
"tslib": "2.8.1"
|
|
61
67
|
},
|
|
62
|
-
"packageManager": "yarn@4.
|
|
68
|
+
"packageManager": "yarn@4.10.3",
|
|
63
69
|
"volta": {
|
|
64
|
-
"node": "24.
|
|
65
|
-
"yarn": "4.
|
|
70
|
+
"node": "24.9.0",
|
|
71
|
+
"yarn": "4.10.3"
|
|
66
72
|
},
|
|
67
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "28d039bdddd1572ad0f2050cb775d5d8b6b497cd"
|
|
68
74
|
}
|