@sp-days-framework/create-sp-days 1.0.4 → 1.1.0-beta1

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.
Files changed (74) hide show
  1. package/README.md +14 -0
  2. package/bin/index.js +2 -0
  3. package/docs/advanced-config.mdx +387 -0
  4. package/docs/changelog.mdx +106 -0
  5. package/docs/index.mdx +205 -0
  6. package/docs/install.mdx +199 -0
  7. package/docs/sidebar-sections.mdx +268 -0
  8. package/docs/sp-days-plugin-color-light.svg +53 -0
  9. package/lib/.tsbuildinfo +1 -0
  10. package/lib/.tsbuildinfo-build +1 -0
  11. package/lib/index.d.ts +1 -0
  12. package/lib/index.js +36 -7
  13. package/package.json +31 -7
  14. package/publish-package-docs.js +12 -0
  15. package/templates/addon-resources/resources/api-reference.mdx +132 -0
  16. package/templates/addon-resources/resources/best-practice.mdx +407 -0
  17. package/templates/addon-resources/resources/cheat-sheet.mdx +120 -0
  18. package/templates/addon-resources/resources/cli-reference.mdx +280 -0
  19. package/templates/addon-resources/resources/configuration-guide.mdx +211 -0
  20. package/templates/addon-resources/resources/environment-setup.mdx +317 -0
  21. package/templates/addon-resources/resources/faq.mdx +146 -0
  22. package/templates/addon-resources/resources/glossary.mdx +78 -0
  23. package/templates/addon-resources/resources/index.mdx +67 -16
  24. package/templates/addon-resources/resources/quick-start.mdx +193 -0
  25. package/templates/addon-resources/resources/troubleshooting.mdx +263 -0
  26. package/templates/addon-resources/resources/useful-links.mdx +61 -0
  27. package/templates/page-course/README.md +62 -0
  28. package/templates/page-course/docusaurus.config.ts +59 -11
  29. package/templates/page-course/package.json +12 -2
  30. package/templates/page-course/sidebarSections.js +118 -0
  31. package/tsconfig.base.client.json +10 -0
  32. package/tsconfig.base.json +71 -0
  33. package/tsconfig.build.json +9 -0
  34. package/sp-days-framework-create-sp-days-1.0.3.tgz +0 -0
  35. package/templates/addon-resources/resources/interactive-tasks/creating-tasks.mdx +0 -254
  36. package/templates/addon-resources/resources/interactive-tasks/examples/_category_.yml +0 -3
  37. package/templates/addon-resources/resources/interactive-tasks/examples/advanced-usage.mdx +0 -304
  38. package/templates/addon-resources/resources/interactive-tasks/examples/basic-usage.mdx +0 -128
  39. package/templates/addon-resources/resources/interactive-tasks/index.mdx +0 -93
  40. package/templates/addon-resources/resources/interactive-tasks/setup/advanced-configuration.mdx +0 -273
  41. package/templates/addon-resources/resources/interactive-tasks/setup/index.mdx +0 -120
  42. package/templates/addon-resources/resources/interactive-tasks/task-progression.mdx +0 -140
  43. package/templates/addon-resources/resources/slidev-integration/index.mdx +0 -106
  44. package/templates/addon-resources/resources/slidev-integration/setup/advanced-configuration.mdx +0 -144
  45. package/templates/addon-resources/resources/slidev-integration/setup/index.mdx +0 -200
  46. package/templates/addon-resources/resources/sykehuspartner-theme/index.mdx +0 -105
  47. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/_category_.yml +0 -2
  48. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/_category_.yml +0 -2
  49. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/center.mdx +0 -33
  50. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/default.mdx +0 -59
  51. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/full.mdx +0 -49
  52. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/_category_.yml +0 -2
  53. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/image-left.mdx +0 -37
  54. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/image-right.mdx +0 -37
  55. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/image.mdx +0 -56
  56. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/_category_.yml +0 -2
  57. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/three-cols-header.mdx +0 -49
  58. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/three-cols.mdx +0 -47
  59. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/two-cols-header.mdx +0 -43
  60. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/two-cols.mdx +0 -38
  61. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/_category_.yml +0 -2
  62. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/cover.mdx +0 -43
  63. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/end.mdx +0 -33
  64. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/intro.mdx +0 -49
  65. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/section.mdx +0 -41
  66. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/_category_.yml +0 -2
  67. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/about-me.mdx +0 -92
  68. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/fact.mdx +0 -47
  69. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/quote.mdx +0 -27
  70. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/statement.mdx +0 -28
  71. package/templates/addon-resources/resources/sykehuspartner-theme/setup/advanced-configuration.mdx +0 -79
  72. package/templates/addon-resources/resources/sykehuspartner-theme/setup/index.mdx +0 -104
  73. package/templates/addon-resources/resources/sykehuspartner-theme/syntax-and-icons.mdx +0 -89
  74. package/templates/addon-slidev/package.json +0 -54
@@ -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;
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "./tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "tsBuildInfoFile": "${configDir}/lib/.tsbuildinfo-client",
5
+ "noEmit": false,
6
+ "moduleResolution": "bundler",
7
+ "module": "esnext",
8
+ "target": "esnext"
9
+ }
10
+ }
@@ -0,0 +1,71 @@
1
+ {
2
+ "compilerOptions": {
3
+ "rootDir": "${configDir}/src",
4
+ "outDir": "${configDir}/lib",
5
+ "composite": true,
6
+ "incremental": true,
7
+ "tsBuildInfoFile": "${configDir}/lib/.tsbuildinfo",
8
+ "erasableSyntaxOnly": true,
9
+ /* Emit */
10
+ "target": "ES2020",
11
+ "lib": ["ESNext"],
12
+ "declaration": true,
13
+ // These two options will be selectively overridden in each project.
14
+ // Utility libraries will have source maps on, but plugins will not.
15
+ "declarationMap": false,
16
+ "sourceMap": false,
17
+ "jsx": "react-native",
18
+ "importHelpers": true,
19
+ "noEmitHelpers": true,
20
+ // Will be overridden in client projects
21
+ "module": "NodeNext",
22
+ // Avoid accidentally using this config to build
23
+ "noEmit": true,
24
+
25
+ /* Strict Type-Checking Options */
26
+ "allowUnreachableCode": false,
27
+ // Too hard to turn on
28
+ "exactOptionalPropertyTypes": false,
29
+ "noFallthroughCasesInSwitch": true,
30
+ "noImplicitOverride": true,
31
+ "noImplicitReturns": true,
32
+ // `process.env` is usually accessed as property
33
+ "noPropertyAccessFromIndexSignature": false,
34
+ "noUncheckedIndexedAccess": true,
35
+ /* strict family */
36
+ "strict": true,
37
+ "alwaysStrict": true,
38
+ "noImplicitAny": true,
39
+ "noImplicitThis": true,
40
+ "strictBindCallApply": true,
41
+ "strictFunctionTypes": true,
42
+ "strictNullChecks": true,
43
+ "strictPropertyInitialization": true,
44
+ "useUnknownInCatchVariables": true,
45
+ /* Handled by ESLint */
46
+ "noUnusedLocals": false,
47
+ "noUnusedParameters": false,
48
+ "importsNotUsedAsValues": "remove",
49
+
50
+ /* Module Resolution */
51
+ "moduleResolution": "NodeNext",
52
+ "resolveJsonModule": true,
53
+ "allowSyntheticDefaultImports": true,
54
+ "esModuleInterop": true,
55
+ "forceConsistentCasingInFileNames": true,
56
+ "isolatedModules": true,
57
+ "allowJs": true,
58
+ "skipLibCheck": true // @types/webpack and webpack/types.d.ts are not the same thing
59
+ },
60
+ "include": ["./**/*", "./**/.eslintrc.js"],
61
+ "exclude": [
62
+ "node_modules",
63
+ "coverage/**",
64
+ "**/lib/**/*",
65
+ "website/**",
66
+ "**/__mocks__/**/*",
67
+ "**/__fixtures__/**/*",
68
+ "examples/**",
69
+ "packages/create-docusaurus/templates/**"
70
+ ]
71
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "./tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "noEmit": false,
5
+ "tsBuildInfoFile": "lib/.tsbuildinfo-build"
6
+ },
7
+ "include": ["src"],
8
+ "exclude": ["templates/", "**/__tests__/**"]
9
+ }
@@ -1,254 +0,0 @@
1
- ---
2
- sidebar_position: 2
3
- ---
4
-
5
- import Tabs from "@theme/Tabs";
6
- import TabItem from "@theme/TabItem";
7
- import Mermaid from '@theme/Mermaid';
8
-
9
- # Task Component
10
-
11
- Learn how to create interactive tasks with various features including hints, solutions, and non-persistent examples.
12
-
13
- ## Syntax Reference
14
-
15
- | Element | Directive | Requirement | Notes |
16
- |---------|-----------|-------------|-------|
17
- | **Task Container** | `::::task[Task Name]` (4+ colons) | Required | Tasks are auto-numbered sequentially per page |
18
- | **Hint Section** | `:::hint` (3+ colons) | Optional | Max one per task; additional hints ignored with warning. Can appear anywhere inside task container |
19
- | **Solution Section** | `:::solution` (3+ colons) | Optional | Max one per task; additional solutions ignored with warning. Can appear anywhere inside task container |
20
- | **Task Example** | `::::task-example[Example Name]` (4+ colons) | Required | Same as regular tasks but non-persistent; uses "Example N" numbering |
21
-
22
- ## Basic Task
23
-
24
- A simple task without hints or solutions.
25
-
26
-
27
- ```md
28
- ::::task[Create a Component]
29
-
30
- Create a new React component in `src/components/MyComponent.tsx`.
31
-
32
- ::::
33
- ```
34
-
35
- ::::task-example[Create a Component]
36
-
37
- Create a new React component in `src/components/MyComponent.tsx`.
38
-
39
- ::::
40
-
41
-
42
- ---
43
-
44
- ## Task with Hint
45
-
46
- Add a hint to guide users through the task.
47
-
48
-
49
- ```mdx
50
- ::::task[Configure TypeScript]
51
-
52
- Set up TypeScript configuration for strict mode.
53
-
54
- :::hint
55
- Look for the `tsconfig.json` file in your project root.
56
- :::
57
-
58
- ::::
59
- ```
60
-
61
- ::::task-example[Configure TypeScript]
62
-
63
- Set up TypeScript configuration for strict mode.
64
-
65
- :::hint
66
- Look for the `tsconfig.json` file in your project root.
67
- :::
68
-
69
- ::::
70
-
71
- ---
72
-
73
- ## Task with Solution
74
-
75
- Provide a complete solution for the task.
76
-
77
-
78
- ```mdx
79
- ::::task[Create Package JSON]
80
-
81
- Initialize a new Node.js project with npm.
82
-
83
- :::solution
84
- Run `npm init -y` in your project directory.
85
- :::
86
-
87
- ::::
88
- ```
89
-
90
- ::::task-example[Create Package JSON]
91
-
92
- Initialize a new Node.js project with npm.
93
-
94
- :::solution
95
- Run `npm init -y` in your project directory.
96
- :::
97
-
98
- ::::
99
-
100
- ---
101
-
102
- ## Task with Hint and Solution
103
-
104
- Combine both hint and solution for comprehensive guidance.
105
-
106
- ````mdx
107
- ::::task[Add API Route]
108
-
109
- Create a new API endpoint for user authentication.
110
-
111
- :::hint
112
- API routes in Next.js go in the `app/api` directory.
113
- :::
114
-
115
- :::solution
116
- Create `app/api/auth/route.ts`:
117
-
118
- ```typescript
119
- export async function POST(request: Request) {
120
- const body = await request.json();
121
- // Authentication logic here
122
- return Response.json({ success: true });
123
- }
124
- ```
125
- :::
126
-
127
- ::::
128
- ````
129
-
130
- ::::task-example[Add API Route]
131
-
132
- Create a new API endpoint for user authentication.
133
-
134
- :::hint
135
- API routes in Next.js go in the `app/api` directory.
136
- :::
137
-
138
- :::solution
139
- Create `app/api/auth/route.ts`:
140
-
141
- ```typescript
142
- export async function POST(request: Request) {
143
- const body = await request.json();
144
- // Authentication logic here
145
- return Response.json({ success: true });
146
- }
147
- ```
148
- :::
149
-
150
- ::::
151
-
152
-
153
- ---
154
-
155
- ## Using Markdown Features
156
-
157
- Tasks fully support standard Docusaurus markdown features like the [admonitions feature](https://docusaurus.io/docs/markdown-features/admonitions).
158
-
159
-
160
- ````mdx
161
- ::::task[Setup Development Environment]
162
-
163
- Follow these steps to configure your workspace.
164
-
165
- :::note
166
- Make sure you have Node.js 18+ installed before proceeding.
167
- :::
168
-
169
- **Installation Steps:**
170
-
171
- 1. Install dependencies:
172
- ```bash
173
- npm install
174
- ```
175
-
176
- 2. Start the development server:
177
- ```bash
178
- npm run dev
179
- ```
180
-
181
- :::warning
182
- Do not commit your `.env` file to version control!
183
- :::
184
-
185
- :::hint
186
- Check the README.md for environment variable examples.
187
- :::
188
-
189
- ::::
190
- ````
191
-
192
- ::::task-example[Setup Development Environment]
193
-
194
- Follow these steps to configure your workspace.
195
-
196
- :::note
197
- Make sure you have Node.js 18+ installed before proceeding.
198
- :::
199
-
200
- **Installation Steps:**
201
-
202
- 1. Install dependencies:
203
- ```bash
204
- npm install
205
- ```
206
-
207
- 2. Start the development server:
208
- ```bash
209
- npm run dev
210
- ```
211
-
212
- :::warning
213
- Do not commit your `.env` file to version control!
214
- :::
215
-
216
- :::hint
217
- Check the README.md for environment variable examples.
218
- :::
219
-
220
- ::::
221
-
222
-
223
- ## Nesting
224
-
225
- The `::::task` directive supports nesting [admonitions](https://docusaurus.io/docs/markdown-features/admonitions) and other markdown features by using colon count to determine hierarchy. Each parent container must use **more colons** than its children to prevent premature closure.
226
-
227
- **Nesting rules:**
228
- - Task container: `::::task` (4+ colons)
229
- - Hint/Solution: `:::hint` or `:::solution` (3+ colons)
230
- - Nested admonition: `:::note`, `:::tip`, etc. (3+ colons)
231
- - For deeper nesting, add more colons to parent containers
232
-
233
- Each level needs more colons than its children to avoid premature closure.
234
-
235
- ### Nesting Example
236
-
237
- ```mdx
238
- ::::::task[Nested Example]
239
- (Layer 1)
240
-
241
- :::::hint
242
- (Layer 2)
243
-
244
- ::::note
245
- (Layer 3)
246
-
247
- :::warning
248
- (Layer 4)
249
- :::
250
-
251
- :::::
252
-
253
- ::::::
254
- ```
@@ -1,3 +0,0 @@
1
- label: 'Task Examples'
2
- customProps:
3
- sidebar_task_hide_progress: true