@sp-days-framework/create-sp-days 1.0.4 → 1.1.0-beta2
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/README.md +14 -0
- package/bin/index.js +2 -0
- package/docs/advanced-config.mdx +412 -0
- package/docs/changelog.mdx +129 -0
- package/docs/index.mdx +206 -0
- package/docs/install.mdx +199 -0
- package/docs/sidebar-sections.mdx +268 -0
- package/docs/sp-days-plugin-color-light.svg +53 -0
- package/lib/.tsbuildinfo +1 -0
- package/lib/.tsbuildinfo-build +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +36 -7
- package/package.json +31 -7
- package/publish-package-docs.js +12 -0
- package/templates/addon-resources/resources/api-reference.mdx +132 -0
- package/templates/addon-resources/resources/best-practice.mdx +407 -0
- package/templates/addon-resources/resources/cheat-sheet.mdx +120 -0
- package/templates/addon-resources/resources/cli-reference.mdx +280 -0
- package/templates/addon-resources/resources/configuration-guide.mdx +211 -0
- package/templates/addon-resources/resources/environment-setup.mdx +317 -0
- package/templates/addon-resources/resources/faq.mdx +146 -0
- package/templates/addon-resources/resources/glossary.mdx +78 -0
- package/templates/addon-resources/resources/index.mdx +67 -16
- package/templates/addon-resources/resources/quick-start.mdx +193 -0
- package/templates/addon-resources/resources/troubleshooting.mdx +263 -0
- package/templates/addon-resources/resources/useful-links.mdx +61 -0
- package/templates/page-course/README.md +87 -0
- package/templates/page-course/docusaurus.config.ts +103 -10
- package/templates/page-course/package.json +12 -2
- package/templates/page-course/sidebarSections.js +118 -0
- package/templates/page-course/src/css/sp-days-theme.scss +428 -211
- package/tsconfig.base.client.json +10 -0
- package/tsconfig.base.json +71 -0
- package/tsconfig.build.json +9 -0
- package/sp-days-framework-create-sp-days-1.0.3.tgz +0 -0
- package/templates/addon-resources/resources/interactive-tasks/creating-tasks.mdx +0 -254
- package/templates/addon-resources/resources/interactive-tasks/examples/_category_.yml +0 -3
- package/templates/addon-resources/resources/interactive-tasks/examples/advanced-usage.mdx +0 -304
- package/templates/addon-resources/resources/interactive-tasks/examples/basic-usage.mdx +0 -128
- package/templates/addon-resources/resources/interactive-tasks/index.mdx +0 -93
- package/templates/addon-resources/resources/interactive-tasks/setup/advanced-configuration.mdx +0 -273
- package/templates/addon-resources/resources/interactive-tasks/setup/index.mdx +0 -120
- package/templates/addon-resources/resources/interactive-tasks/task-progression.mdx +0 -140
- package/templates/addon-resources/resources/slidev-integration/index.mdx +0 -106
- package/templates/addon-resources/resources/slidev-integration/setup/advanced-configuration.mdx +0 -144
- package/templates/addon-resources/resources/slidev-integration/setup/index.mdx +0 -200
- package/templates/addon-resources/resources/sykehuspartner-theme/index.mdx +0 -105
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/_category_.yml +0 -2
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/_category_.yml +0 -2
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/center.mdx +0 -33
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/default.mdx +0 -59
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/full.mdx +0 -49
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/_category_.yml +0 -2
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/image-left.mdx +0 -37
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/image-right.mdx +0 -37
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/image.mdx +0 -56
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/_category_.yml +0 -2
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/three-cols-header.mdx +0 -49
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/three-cols.mdx +0 -47
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/two-cols-header.mdx +0 -43
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/two-cols.mdx +0 -38
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/_category_.yml +0 -2
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/cover.mdx +0 -43
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/end.mdx +0 -33
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/intro.mdx +0 -49
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/section.mdx +0 -41
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/_category_.yml +0 -2
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/about-me.mdx +0 -92
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/fact.mdx +0 -47
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/quote.mdx +0 -27
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/statement.mdx +0 -28
- package/templates/addon-resources/resources/sykehuspartner-theme/setup/advanced-configuration.mdx +0 -79
- package/templates/addon-resources/resources/sykehuspartner-theme/setup/index.mdx +0 -104
- package/templates/addon-resources/resources/sykehuspartner-theme/syntax-and-icons.mdx +0 -89
- package/templates/addon-slidev/package.json +0 -54
|
@@ -41,6 +41,11 @@ const config: Config = {
|
|
|
41
41
|
id: "course",
|
|
42
42
|
path: "course",
|
|
43
43
|
routeBasePath: "course",
|
|
44
|
+
sidebarItemsGenerator: require("./sidebarSections"),
|
|
45
|
+
remarkPlugins: [
|
|
46
|
+
require("@sp-days-framework/docusaurus-plugin-terminal-codeblock")
|
|
47
|
+
.remarkTerminalDirective,
|
|
48
|
+
],
|
|
44
49
|
beforeDefaultRemarkPlugins: [
|
|
45
50
|
require("@sp-days-framework/docusaurus-plugin-interactive-tasks")
|
|
46
51
|
.remarkTaskDirective,
|
|
@@ -60,6 +65,61 @@ const config: Config = {
|
|
|
60
65
|
// Adds the Interactive Tasks plugin to enable task directives
|
|
61
66
|
"@sp-days-framework/docusaurus-plugin-interactive-tasks",
|
|
62
67
|
|
|
68
|
+
// Adds the Terminal Codeblock plugin to enable terminal output rendering
|
|
69
|
+
"@sp-days-framework/docusaurus-plugin-terminal-codeblock",
|
|
70
|
+
|
|
71
|
+
// CONDITIONAL: package-docs (START)
|
|
72
|
+
// Create SP Days Documentation
|
|
73
|
+
[
|
|
74
|
+
"@docusaurus/plugin-content-docs",
|
|
75
|
+
{
|
|
76
|
+
sidebarItemsGenerator: require("./sidebarSections"),
|
|
77
|
+
...require("@sp-days-framework/create-sp-days/publish-package-docs"),
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
// Frontpage Collection Documentation
|
|
81
|
+
[
|
|
82
|
+
"@docusaurus/plugin-content-docs",
|
|
83
|
+
{
|
|
84
|
+
sidebarItemsGenerator: require("./sidebarSections"),
|
|
85
|
+
...require("@sp-days-framework/docusaurus-frontpage-collection/publish-package-docs"),
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
// Interactive Tasks Plugin Documentation
|
|
89
|
+
[
|
|
90
|
+
"@docusaurus/plugin-content-docs",
|
|
91
|
+
{
|
|
92
|
+
sidebarItemsGenerator: require("./sidebarSections"),
|
|
93
|
+
...require("@sp-days-framework/docusaurus-plugin-interactive-tasks/publish-package-docs"),
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
// Slidev Plugin Documentation
|
|
97
|
+
[
|
|
98
|
+
"@docusaurus/plugin-content-docs",
|
|
99
|
+
{
|
|
100
|
+
sidebarItemsGenerator: require("./sidebarSections"),
|
|
101
|
+
...require("@sp-days-framework/docusaurus-plugin-slidev/publish-package-docs"),
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
// Terminal Codeblock Plugin Documentation
|
|
105
|
+
[
|
|
106
|
+
"@docusaurus/plugin-content-docs",
|
|
107
|
+
{
|
|
108
|
+
sidebarItemsGenerator: require("./sidebarSections"),
|
|
109
|
+
|
|
110
|
+
...require("@sp-days-framework/docusaurus-plugin-terminal-codeblock/publish-package-docs"),
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
// Sykehuspartner Slidev Theme Documentation
|
|
114
|
+
[
|
|
115
|
+
"@docusaurus/plugin-content-docs",
|
|
116
|
+
{
|
|
117
|
+
sidebarItemsGenerator: require("./sidebarSections"),
|
|
118
|
+
...require("@sp-days-framework/slidev-theme-sykehuspartner/publish-package-docs"),
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
// CONDITIONAL: package-docs (END)
|
|
122
|
+
|
|
63
123
|
// CONDITIONAL: addon-slidev (START)
|
|
64
124
|
// Adds the Slidev plugin to enable slide presentations and static directories for Slidev assets
|
|
65
125
|
"@sp-days-framework/docusaurus-plugin-slidev",
|
|
@@ -73,16 +133,10 @@ const config: Config = {
|
|
|
73
133
|
id: "resources",
|
|
74
134
|
path: "resources",
|
|
75
135
|
routeBasePath: "resources",
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
{
|
|
81
|
-
// TOC configuration for resources docs instance
|
|
82
|
-
tocEnabled: true,
|
|
83
|
-
tocHeadingLevel: 3, // Use h2 for TOC entries (can be 2-6)
|
|
84
|
-
},
|
|
85
|
-
],
|
|
136
|
+
sidebarItemsGenerator: require("./sidebarSections"),
|
|
137
|
+
remarkPlugins: [
|
|
138
|
+
require("@sp-days-framework/docusaurus-plugin-terminal-codeblock")
|
|
139
|
+
.remarkTerminalDirective,
|
|
86
140
|
],
|
|
87
141
|
},
|
|
88
142
|
],
|
|
@@ -120,6 +174,45 @@ const config: Config = {
|
|
|
120
174
|
// CONDITIONAL: addon-slidev (START)
|
|
121
175
|
{ to: "/slidev", label: "Slides" },
|
|
122
176
|
// CONDITIONAL: addon-slidev (END)
|
|
177
|
+
// CONDITIONAL: package-docs (START)
|
|
178
|
+
{
|
|
179
|
+
type: "dropdown",
|
|
180
|
+
label: "Plugin Docs",
|
|
181
|
+
position: "left",
|
|
182
|
+
items: [
|
|
183
|
+
{
|
|
184
|
+
to: "/package-docs/create-sp-days",
|
|
185
|
+
label: "Create SP Days",
|
|
186
|
+
className: "title-logo-navbar-sp-days-plugin",
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
to: "/package-docs/frontpage-collection",
|
|
190
|
+
label: "Frontpage Collection",
|
|
191
|
+
className: "title-logo-navbar-docusaurus",
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
to: "/package-docs/interactive-tasks",
|
|
195
|
+
label: "Interactive Tasks",
|
|
196
|
+
className: "title-logo-navbar-docusaurus",
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
to: "/package-docs/slidev-integration",
|
|
200
|
+
label: "Slidev Integration",
|
|
201
|
+
className: "title-logo-navbar-docusaurus",
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
to: "/package-docs/terminal-codeblock",
|
|
205
|
+
label: "Terminal Codeblock",
|
|
206
|
+
className: "title-logo-navbar-docusaurus",
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
to: "/package-docs/sykehuspartner-theme",
|
|
210
|
+
label: "Sykehuspartner Theme",
|
|
211
|
+
className: "title-logo-navbar-slidev",
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
},
|
|
215
|
+
// CONDITIONAL: package-docs (END)
|
|
123
216
|
{
|
|
124
217
|
href: gitRepositoryUrl,
|
|
125
218
|
position: "right",
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
"serve": "docusaurus serve",
|
|
13
13
|
"write-translations": "docusaurus write-translations",
|
|
14
14
|
"write-heading-ids": "docusaurus write-heading-ids",
|
|
15
|
+
// CONDITIONAL: addon-slidev (START)
|
|
16
|
+
"slidev": "slidev",
|
|
17
|
+
// CONDITIONAL: addon-slidev (END)
|
|
15
18
|
"typecheck": "tsc"
|
|
16
19
|
},
|
|
17
20
|
"dependencies": {
|
|
@@ -19,8 +22,15 @@
|
|
|
19
22
|
"@docusaurus/preset-classic": "^3.9.2",
|
|
20
23
|
"@docusaurus/theme-mermaid": "^3.9.2",
|
|
21
24
|
"@mdx-js/react": "^3.0.0",
|
|
22
|
-
"@sp-days-framework/docusaurus-frontpage-collection": "^1.0
|
|
23
|
-
"@sp-days-framework/docusaurus-plugin-interactive-tasks": "^1.0
|
|
25
|
+
"@sp-days-framework/docusaurus-frontpage-collection": "^1.1.0-beta1",
|
|
26
|
+
"@sp-days-framework/docusaurus-plugin-interactive-tasks": "^1.1.0-beta1",
|
|
27
|
+
// CONDITIONAL: addon-slidev (START)
|
|
28
|
+
"@sp-days-framework/docusaurus-plugin-slidev": "^1.1.0-beta1",
|
|
29
|
+
"@sp-days-framework/slidev-theme-sykehuspartner": "^1.1.0-beta1",
|
|
30
|
+
// CONDITIONAL: addon-slidev (END)
|
|
31
|
+
// CONDITIONAL: package-docs (START)
|
|
32
|
+
"@sp-days-framework/create-sp-days": "^1.1.0-beta1",
|
|
33
|
+
// CONDITIONAL: package-docs (END)
|
|
24
34
|
"clsx": "^2.0.0",
|
|
25
35
|
"docusaurus-plugin-sass": "^0.2.6",
|
|
26
36
|
"prism-react-renderer": "^2.3.0",
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom sidebar generator that dynamically groups pages and categories based on sidebar_custom_props.section
|
|
3
|
+
*
|
|
4
|
+
* Usage in document frontmatter:
|
|
5
|
+
* ---
|
|
6
|
+
* sidebar_label: "API Reference"
|
|
7
|
+
* sidebar_custom_props:
|
|
8
|
+
* section: "Templates"
|
|
9
|
+
* section_position: 2
|
|
10
|
+
* ---
|
|
11
|
+
*
|
|
12
|
+
* Usage in _category_.yml:
|
|
13
|
+
* label: "Content"
|
|
14
|
+
* customProps:
|
|
15
|
+
* section: "Layouts"
|
|
16
|
+
* section_position: 3
|
|
17
|
+
*
|
|
18
|
+
* Pages and categories with the same section value will be grouped together under a separator with that name.
|
|
19
|
+
* Items without a section will appear at the top in their natural order.
|
|
20
|
+
* Sections are ordered by section_position (optional). Sections without position are sorted alphabetically after positioned sections.
|
|
21
|
+
*
|
|
22
|
+
* @param {Object} params - Sidebar generation parameters
|
|
23
|
+
* @returns {Promise<Array>} Modified sidebar items with section separators
|
|
24
|
+
*/
|
|
25
|
+
async function dynamicSectionSidebarGenerator({
|
|
26
|
+
defaultSidebarItemsGenerator,
|
|
27
|
+
...args
|
|
28
|
+
}) {
|
|
29
|
+
const sidebarItems = await defaultSidebarItemsGenerator(args);
|
|
30
|
+
|
|
31
|
+
// Group items by section
|
|
32
|
+
const unsectioned = [];
|
|
33
|
+
const sections = new Map(); // Map<sectionName, {items: [], positions: Set}>
|
|
34
|
+
|
|
35
|
+
sidebarItems.forEach((item) => {
|
|
36
|
+
if (item.type === "doc") {
|
|
37
|
+
const doc = args.docs.find((d) => d.id === item.id);
|
|
38
|
+
const section = doc?.frontMatter?.sidebar_custom_props?.section;
|
|
39
|
+
const sectionPosition =
|
|
40
|
+
doc?.frontMatter?.sidebar_custom_props?.section_position;
|
|
41
|
+
|
|
42
|
+
if (section) {
|
|
43
|
+
if (!sections.has(section)) {
|
|
44
|
+
sections.set(section, { items: [], positions: new Set() });
|
|
45
|
+
}
|
|
46
|
+
sections.get(section).items.push(item);
|
|
47
|
+
if (sectionPosition !== undefined) {
|
|
48
|
+
sections.get(section).positions.add(sectionPosition);
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
unsectioned.push(item);
|
|
52
|
+
}
|
|
53
|
+
} else if (item.type === "category") {
|
|
54
|
+
// Handle categories (e.g., from _category_.yml files)
|
|
55
|
+
const section = item.customProps?.section;
|
|
56
|
+
const sectionPosition = item.customProps?.section_position;
|
|
57
|
+
|
|
58
|
+
if (section) {
|
|
59
|
+
if (!sections.has(section)) {
|
|
60
|
+
sections.set(section, { items: [], positions: new Set() });
|
|
61
|
+
}
|
|
62
|
+
sections.get(section).items.push(item);
|
|
63
|
+
if (sectionPosition !== undefined) {
|
|
64
|
+
sections.get(section).positions.add(sectionPosition);
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
unsectioned.push(item);
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
// Links, HTML items, etc. stay at top
|
|
71
|
+
unsectioned.push(item);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// Validate section_position values
|
|
76
|
+
sections.forEach((data, sectionName) => {
|
|
77
|
+
if (data.positions.size > 1) {
|
|
78
|
+
const positionValues = Array.from(data.positions).join(", ");
|
|
79
|
+
throw new Error(
|
|
80
|
+
`Section "${sectionName}" has conflicting section_position values: ${positionValues}. ` +
|
|
81
|
+
`All pages in a section must use the same section_position value.`,
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// Sort sections by position, then alphabetically
|
|
87
|
+
const sortedSections = Array.from(sections.entries()).sort(
|
|
88
|
+
([nameA, dataA], [nameB, dataB]) => {
|
|
89
|
+
const posA =
|
|
90
|
+
dataA.positions.size > 0 ? Array.from(dataA.positions)[0] : Infinity;
|
|
91
|
+
const posB =
|
|
92
|
+
dataB.positions.size > 0 ? Array.from(dataB.positions)[0] : Infinity;
|
|
93
|
+
|
|
94
|
+
if (posA !== posB) {
|
|
95
|
+
return posA - posB;
|
|
96
|
+
}
|
|
97
|
+
// If positions are equal (both Infinity or same number), sort alphabetically
|
|
98
|
+
return nameA.localeCompare(nameB);
|
|
99
|
+
},
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
// Build final sidebar with separators
|
|
103
|
+
const result = [...unsectioned];
|
|
104
|
+
|
|
105
|
+
sortedSections.forEach(([sectionName, data]) => {
|
|
106
|
+
result.push({
|
|
107
|
+
type: "html",
|
|
108
|
+
value: `<div style=" margin: 0.5rem; padding: 0.25rem 0; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; display: flex; align-items: center; gap: 0.5rem;"><span style=" flex: 1; border-top: 1px solid var(--ifm-color-emphasis-300); " ></span> <span style=" text-transform: uppercase; color: var(--ifm-color-emphasis-600);
|
|
109
|
+
white-space: nowrap;">${sectionName}</span><span style="flex: 1; border-top: 1px solid var(--ifm-color-emphasis-300);"></span></div>`,
|
|
110
|
+
className: `sidebar-section-${sectionName.toLowerCase().replace(/\s+/g, "-")}`,
|
|
111
|
+
});
|
|
112
|
+
result.push(...data.items);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
module.exports = dynamicSectionSidebarGenerator;
|