@sp-days-framework/create-sp-days 1.0.0

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 (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +318 -0
  3. package/bin/index.js +86 -0
  4. package/lib/index.d.ts +20 -0
  5. package/lib/index.js +454 -0
  6. package/package.json +41 -0
  7. package/sp-days-framework-create-sp-days-1.0.0.tgz +0 -0
  8. package/templates/addon-resources/resources/frontpage-collection/components/Columns.mdx +191 -0
  9. package/templates/addon-resources/resources/frontpage-collection/components/ContentBlock.mdx +126 -0
  10. package/templates/addon-resources/resources/frontpage-collection/components/CourseFeature.mdx +147 -0
  11. package/templates/addon-resources/resources/frontpage-collection/components/FancyHeader.mdx +76 -0
  12. package/templates/addon-resources/resources/frontpage-collection/components/GetStarted.mdx +222 -0
  13. package/templates/addon-resources/resources/frontpage-collection/components/HeroBanner.mdx +205 -0
  14. package/templates/addon-resources/resources/frontpage-collection/components/IconContainer.mdx +249 -0
  15. package/templates/addon-resources/resources/frontpage-collection/components/Iconify.mdx +228 -0
  16. package/templates/addon-resources/resources/frontpage-collection/components/_category_.yml +2 -0
  17. package/templates/addon-resources/resources/frontpage-collection/index.mdx +85 -0
  18. package/templates/addon-resources/resources/frontpage-collection/setup/index.mdx +185 -0
  19. package/templates/addon-resources/resources/index.mdx +35 -0
  20. package/templates/addon-resources/resources/interactive-tasks/creating-tasks.mdx +292 -0
  21. package/templates/addon-resources/resources/interactive-tasks/examples/_category_.yml +3 -0
  22. package/templates/addon-resources/resources/interactive-tasks/examples/advanced-usage.mdx +304 -0
  23. package/templates/addon-resources/resources/interactive-tasks/examples/basic-usage.mdx +128 -0
  24. package/templates/addon-resources/resources/interactive-tasks/index.mdx +93 -0
  25. package/templates/addon-resources/resources/interactive-tasks/setup/advanced-configuration.mdx +150 -0
  26. package/templates/addon-resources/resources/interactive-tasks/setup/index.mdx +174 -0
  27. package/templates/addon-resources/resources/interactive-tasks/task-progression.mdx +140 -0
  28. package/templates/addon-resources/resources/slidev-integration/index.mdx +106 -0
  29. package/templates/addon-resources/resources/slidev-integration/setup/advanced-configuration.mdx +144 -0
  30. package/templates/addon-resources/resources/slidev-integration/setup/index.mdx +200 -0
  31. package/templates/addon-resources/resources/sykehuspartner-theme/index.mdx +105 -0
  32. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/_category_.yml +2 -0
  33. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/_category_.yml +2 -0
  34. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/center.mdx +33 -0
  35. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/default.mdx +59 -0
  36. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/full.mdx +49 -0
  37. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/_category_.yml +2 -0
  38. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/image-left.mdx +37 -0
  39. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/image-right.mdx +37 -0
  40. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/image.mdx +56 -0
  41. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/_category_.yml +2 -0
  42. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/three-cols-header.mdx +49 -0
  43. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/three-cols.mdx +47 -0
  44. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/two-cols-header.mdx +43 -0
  45. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/two-cols.mdx +38 -0
  46. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/_category_.yml +2 -0
  47. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/cover.mdx +43 -0
  48. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/end.mdx +33 -0
  49. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/intro.mdx +49 -0
  50. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/section.mdx +41 -0
  51. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/_category_.yml +2 -0
  52. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/about-me.mdx +92 -0
  53. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/fact.mdx +47 -0
  54. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/quote.mdx +27 -0
  55. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/statement.mdx +28 -0
  56. package/templates/addon-resources/resources/sykehuspartner-theme/setup/advanced-configuration.mdx +79 -0
  57. package/templates/addon-resources/resources/sykehuspartner-theme/setup/index.mdx +104 -0
  58. package/templates/addon-resources/resources/sykehuspartner-theme/syntax-and-icons.mdx +89 -0
  59. package/templates/addon-slidev/package.json +54 -0
  60. package/templates/addon-slidev/slidev/creating-your-first-slidev.md +301 -0
  61. package/templates/addon-slidev/slidev/slidev-theme-sykehuspartner.md +403 -0
  62. package/templates/page-course/README.md +152 -0
  63. package/templates/page-course/course/index.mdx +7 -0
  64. package/templates/page-course/course/placeholder-advanced-usage.mdx +304 -0
  65. package/templates/page-course/course/placeholder-basic-usage.mdx +128 -0
  66. package/templates/page-course/docusaurus.config.ts +171 -0
  67. package/templates/page-course/example-github-pages.yml +66 -0
  68. package/templates/page-course/gitignore +20 -0
  69. package/templates/page-course/package.json +51 -0
  70. package/templates/page-course/src/css/sp-days-theme.scss +297 -0
  71. package/templates/page-course/src/pages/index.mdx +165 -0
  72. package/templates/page-course/static/.nojekyll +0 -0
  73. package/templates/page-course/static/img/favicon-navbar/github.svg +3 -0
  74. package/templates/page-course/static/img/favicon-navbar/sorost-logo-dark.svg +24 -0
  75. package/templates/page-course/static/img/favicon-navbar/sorost-logo-light.svg +24 -0
  76. package/templates/page-course/static/img/footer/sykehuspartner-dark.svg +37 -0
  77. package/templates/page-course/static/img/footer/sykehuspartner-light.svg +37 -0
  78. package/templates/page-course/static/img/sidebar/docusaurus.svg +17 -0
  79. package/templates/page-course/static/img/sidebar/slidev.svg +22 -0
  80. package/templates/page-course/static/img/sp-days-logo-color-dark.svg +70 -0
  81. package/templates/page-course/static/img/sp-days-logo-color-light.svg +70 -0
  82. package/templates/page-course/static/img/sp-days-logo-filled-invert.svg +11 -0
  83. package/templates/page-course/static/img/sp-days-logo-filled.svg +11 -0
  84. package/templates/page-course/static/img/sp-days-logo-outline.svg +19 -0
  85. package/templates/page-course/static/img/sp-days-plugin-color-dark.svg +57 -0
  86. package/templates/page-course/static/img/sp-days-plugin-color-light.svg +53 -0
  87. package/templates/page-course/tsconfig.json +8 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Helse Sør-Øst
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,318 @@
1
+ # Create Sykehuspartner Days Template
2
+
3
+ Scaffolding tool for creating SP-Days course websites built on Docusaurus and Slidev.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ npx @sp-days-framework/create-sp-days example-directory
9
+ ```
10
+
11
+ This will create a new SP-Days course website with:
12
+
13
+ - Docusaurus-based course structure
14
+ - Interactive task system
15
+ - Frontpage components collection
16
+ - TypeScript configuration
17
+ - Pre-configured theme and styling
18
+
19
+ ## Features
20
+
21
+ ### Base Template (Always Included)
22
+
23
+ The base `page-course` template includes:
24
+
25
+ - **Docusaurus Core**: Latest Docusaurus 3.x with preset-classic
26
+ - **Interactive Tasks**: `@sp-days-framework/docusaurus-plugin-interactive-tasks` for hands-on learning
27
+ - **Frontpage Components**: `@sp-days-framework/docusaurus-frontpage-collection` for beautiful landing pages
28
+ - **Course Structure**: Pre-configured `/course` directory for content
29
+ - **TypeScript**: Full TypeScript support out of the box
30
+ - **SASS Support**: Custom styling with SASS/SCSS
31
+ - **Mermaid Diagrams**: Built-in diagram support
32
+
33
+ ### Optional Addons
34
+
35
+ #### Slidev Integration (`--addon-slidev`)
36
+
37
+ Adds presentation capabilities:
38
+
39
+ - `@sp-days-framework/docusaurus-plugin-slidev`: Seamless Slidev integration
40
+ - `@sp-days-framework/slidev-theme-sykehuspartner`: Custom Slidev theme
41
+ - Example presentations in `/slidev` directory
42
+ - `npm run slidev` command for presentation mode
43
+
44
+ #### Resources Page (`--addon-resources`)
45
+
46
+ Adds comprehensive documentation:
47
+
48
+ - Separate `/resources` documentation instance
49
+ - Component usage guides
50
+ - Setup and configuration examples
51
+ - Best practices documentation
52
+
53
+ ## Usage
54
+
55
+ ### Interactive Mode (Recommended)
56
+
57
+ Run without arguments for an interactive setup:
58
+
59
+ ```bash
60
+ npx @sp-days-framework/create-sp-days
61
+ ```
62
+
63
+ You'll be prompted for:
64
+
65
+ 1. Site name (directory name)
66
+ 2. Project name
67
+ 3. GitHub organization
68
+ 4. Repository name
69
+ 5. Site title
70
+ 6. Site tagline
71
+ 7. Slidev integration (yes/no)
72
+ 8. Resources page (yes/no)
73
+ 9. Package manager selection
74
+
75
+ ### CLI Mode
76
+
77
+ Provide all options via command line flags:
78
+
79
+ ```bash
80
+ npx @sp-days-framework/create-sp-days my-course \
81
+ --name "my-course" \
82
+ --org "my-organization" \
83
+ --repo "my-course-repo" \
84
+ --title "Advanced Docker Course" \
85
+ --tagline "Master containerization in 3 days" \
86
+ --addon-slidev \
87
+ --addon-resources \
88
+ --package-manager npm
89
+ ```
90
+
91
+ ## CLI Options
92
+
93
+ | Flag | Alias | Description | Default |
94
+ |------|-------|-------------|---------|
95
+ | `--name <name>` | `-n` | Project name | Directory name |
96
+ | `--org <organization>` | | GitHub organization | `helse-sorost` |
97
+ | `--repo <repository>` | | Repository name | Project name |
98
+ | `--title <title>` | | Site title | `SP Days Template` |
99
+ | `--tagline <tagline>` | | Site tagline | `Empowered by Docusaurus and Slidev` |
100
+ | `--addon-slidev` | | Add Slidev integration | `false` (CLI), prompted (interactive) |
101
+ | `--addon-resources` | | Add Resources page | `false` (CLI), prompted (interactive) |
102
+ | `--package-manager <pm>` | `-p` | Package manager (npm/yarn/pnpm/bun) | Auto-detected |
103
+ | `--skip-install` | `-s` | Skip dependency installation | `false` |
104
+ | `--help` | `-h` | Display help | - |
105
+ | `--version` | `-v` | Display version | - |
106
+
107
+ ## Examples
108
+
109
+ ### Minimal Setup
110
+
111
+ Create a basic course without addons:
112
+
113
+ ```bash
114
+ npx @sp-days-framework/create-sp-days my-course
115
+ ```
116
+
117
+ ### With All Features
118
+
119
+ Create a fully-featured course with presentations and resources:
120
+
121
+ ```bash
122
+ npx @sp-days-framework/create-sp-days docker-course \
123
+ --addon-slidev \
124
+ --addon-resources \
125
+ --title "Docker Fundamentals" \
126
+ --tagline "Learn containerization from scratch"
127
+ ```
128
+
129
+ ### Custom Organization
130
+
131
+ Set up for a specific GitHub organization:
132
+
133
+ ```bash
134
+ npx @sp-days-framework/create-sp-days kubernetes-101 \
135
+ --org "acme-corp" \
136
+ --repo "k8s-training" \
137
+ --title "Kubernetes 101" \
138
+ --addon-slidev
139
+ ```
140
+
141
+ ### Skip Installation
142
+
143
+ Create the structure without installing dependencies:
144
+
145
+ ```bash
146
+ npx @sp-days-framework/create-sp-days my-course --skip-install
147
+ cd my-course
148
+ npm install
149
+ ```
150
+
151
+ ## What Gets Created
152
+
153
+ ### Directory Structure
154
+
155
+ ```
156
+ my-course/
157
+ ├── course/ # Course content (MDX files)
158
+ │ └── index.mdx # Course overview
159
+ ├── src/
160
+ │ ├── css/
161
+ │ │ └── sp-days-theme.scss
162
+ │ └── pages/
163
+ │ └── index.mdx # Landing page
164
+ ├── static/
165
+ │ └── img/ # Logos and images
166
+ ├── docusaurus.config.ts # Main configuration
167
+ ├── package.json # Dependencies and scripts
168
+ ├── tsconfig.json # TypeScript config
169
+ └── README.md # Getting started guide
170
+ ```
171
+
172
+ With `--addon-slidev`:
173
+
174
+ ```
175
+ ├── slidev/ # Slidev presentations
176
+ │ ├── creating-your-first-slidev.md
177
+ │ └── slidev-theme-sykehuspartner.md
178
+ ```
179
+
180
+ With `--addon-resources`:
181
+
182
+ ```
183
+ ├── resources/ # Additional documentation
184
+ │ ├── frontpage-collection/
185
+ │ ├── interactive-tasks/
186
+ │ ├── slidev-integration/
187
+ │ └── sykehuspartner-theme/
188
+ ```
189
+
190
+ ### Template Processing
191
+
192
+ The tool automatically processes template variables:
193
+
194
+ ### Configuration Variables
195
+
196
+ Variables replaced in template files using simple string replacement:
197
+
198
+ ```typescript
199
+ // In docusaurus.config.ts
200
+ const organizationName = "<%= organizationName %>";
201
+ const projectName = "<%= projectName %>";
202
+ const gitRepositoryUrl = "<%= gitRepositoryUrl %>";
203
+ const title = "<%= title %>";
204
+ const tagline = "<%= tagline %>";
205
+ ```
206
+
207
+ These placeholders are replaced with actual values during installation.
208
+
209
+ ### Conditional Sections
210
+
211
+ Sections marked with `// CONDITIONAL: addon-name (START/END)` are automatically removed if the addon is not selected:
212
+
213
+ ```typescript
214
+ // CONDITIONAL: addon-slidev (START)
215
+ "@sp-days-framework/docusaurus-plugin-slidev",
216
+ // CONDITIONAL: addon-slidev (END)
217
+ ```
218
+
219
+ ## Available Commands
220
+
221
+ After creation, run these commands in your project:
222
+
223
+ ```bash
224
+ npm start # Start development server
225
+ npm run build # Build for production
226
+ npm run serve # Serve production build
227
+ npm run slidev # Launch Slidev (if addon installed)
228
+ npm run typecheck # Run TypeScript checks
229
+ ```
230
+
231
+ ## Requirements
232
+
233
+ - **Node.js**: >= 20.0
234
+ - **Package Manager**: npm, yarn, pnpm, or bun
235
+
236
+ ## Development
237
+
238
+ ### Building the Package
239
+
240
+ ```bash
241
+ # Clone the repository
242
+ git clone https://github.com/helse-sorost/sp-days-framework
243
+ cd sp-days-framework/create-sp-days
244
+
245
+ # Install dependencies
246
+ npm install
247
+
248
+ # Build
249
+ npm run build
250
+ ```
251
+
252
+ ### Testing Locally
253
+
254
+ There are several ways to test the package locally:
255
+
256
+ #### Option 1: Using npm link (Recommended for development)
257
+
258
+ ```bash
259
+ # From the create-sp-days directory
260
+ npm link
261
+
262
+ # Test in a different directory
263
+ cd /tmp
264
+ create-sp-days test-site
265
+
266
+ # Or using npx
267
+ npx create-sp-days test-site
268
+
269
+ # When done testing, unlink
270
+ cd /workspaces/sp-days-framework/create-sp-days
271
+ npm unlink -g
272
+ ```
273
+
274
+ #### Option 2: Install from tarball
275
+
276
+ ```bash
277
+ # Create the tarball
278
+ cd /workspaces/sp-days-framework/create-sp-days
279
+ npm pack
280
+
281
+ # Install globally from tarball
282
+ npm install -g ./sp-days-framework-create-sp-days-1.0.0.tgz
283
+
284
+ # Test it
285
+ cd /tmp
286
+ create-sp-days test-site
287
+
288
+ # Uninstall when done
289
+ npm uninstall -g @sp-days-framework/create-sp-days
290
+ ```
291
+
292
+ #### Option 3: Install locally in test directory
293
+
294
+ ```bash
295
+ # Create and navigate to test directory
296
+ mkdir -p /tmp/test-npm
297
+ cd /tmp/test-npm
298
+
299
+ # Install from tarball
300
+ npm install /workspaces/sp-days-framework/create-sp-days/sp-days-framework-create-sp-days-1.0.0.tgz
301
+
302
+ # Run it
303
+ npx @sp-days-framework/create-sp-days test-site
304
+ ```
305
+
306
+ ## Troubleshooting
307
+
308
+ ### "Exec format error" when using npx with tarball
309
+
310
+ You cannot execute a `.tgz` file directly with npx. Use one of the methods above instead:
311
+
312
+ - Install globally with `npm install -g ./package.tgz` then run the command
313
+ - Install locally with `npm install ./package.tgz` then use `npx @sp-days-framework/create-sp-days`
314
+ - Use `npm link` for development testing
315
+
316
+ ## License
317
+
318
+ MIT
package/bin/index.js ADDED
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Copyright (c) Sykehuspartner HF
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ // @ts-check
10
+
11
+ import path from "path";
12
+ import { createRequire } from "module";
13
+ import { logger } from "@docusaurus/logger";
14
+ import semver from "semver";
15
+ import { program } from "commander";
16
+
17
+ const packageJson = /** @type {import("../package.json")} */ (
18
+ createRequire(import.meta.url)("../package.json")
19
+ );
20
+ const requiredVersion = packageJson.engines.node;
21
+
22
+ if (!semver.satisfies(process.version, requiredVersion)) {
23
+ logger.error("Minimum Node.js version not met :(");
24
+ logger.info`You are using Node.js number=${process.version}, Requirement: Node.js number=${requiredVersion}.`;
25
+ process.exit(1);
26
+ }
27
+
28
+ program.version(packageJson.version);
29
+
30
+ program
31
+ .arguments("[siteName] [rootDir]")
32
+ .option("-n, --name <name>", "Project name (defaults to directory name)")
33
+ .option(
34
+ "--org <organization>",
35
+ "GitHub organization (defaults to helse-sorost)"
36
+ )
37
+ .option("--repo <repository>", "Repository name (defaults to project name)")
38
+ .option("--title <title>", "Site title (defaults to SP Days Template)")
39
+ .option(
40
+ "--tagline <tagline>",
41
+ "Site tagline (defaults to Empowered by Docusaurus and Slidev)"
42
+ )
43
+ .option("--addon-slidev", "Add Slidev integration addon")
44
+ .option("--addon-resources", "Add Resources page addon")
45
+ .option(
46
+ "-p, --package-manager <manager>",
47
+ "The package manager used to install dependencies. One of yarn, npm, pnpm, and bun."
48
+ )
49
+ .option(
50
+ "-s, --skip-install",
51
+ "Do not run package manager immediately after scaffolding"
52
+ )
53
+ .description("Initialize SP-Days course website.")
54
+ .action((siteName, rootDir, options) => {
55
+ // Extract only the CLI option VALUES, avoiding commander methods
56
+ const cliOptions = {
57
+ name: typeof options.name === "string" ? options.name : undefined,
58
+ org: typeof options.org === "string" ? options.org : undefined,
59
+ repo: typeof options.repo === "string" ? options.repo : undefined,
60
+ title: typeof options.title === "string" ? options.title : undefined,
61
+ tagline:
62
+ typeof options.tagline === "string" ? options.tagline : undefined,
63
+ addonSlidev: options.addonSlidev === true ? true : undefined,
64
+ addonResources: options.addonResources === true ? true : undefined,
65
+ packageManager:
66
+ typeof options.packageManager === "string"
67
+ ? options.packageManager
68
+ : undefined,
69
+ skipInstall: options.skipInstall === true ? true : undefined,
70
+ };
71
+
72
+ return import("../lib/index.js").then(({ default: init }) =>
73
+ init(path.resolve(rootDir ?? "."), siteName, cliOptions)
74
+ );
75
+ });
76
+
77
+ program.parse(process.argv);
78
+
79
+ if (!process.argv.slice(1).length) {
80
+ program.outputHelp();
81
+ }
82
+
83
+ process.on("unhandledRejection", (err) => {
84
+ logger.error(err);
85
+ process.exit(1);
86
+ });
package/lib/index.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ type CLIOptions = {
2
+ name?: string;
3
+ org?: string;
4
+ repo?: string;
5
+ title?: string;
6
+ tagline?: string;
7
+ addonSlidev?: boolean;
8
+ addonResources?: boolean;
9
+ packageManager?: PackageManager;
10
+ skipInstall?: boolean;
11
+ };
12
+ declare const lockfileNames: {
13
+ npm: string;
14
+ yarn: string;
15
+ pnpm: string;
16
+ bun: string;
17
+ };
18
+ type PackageManager = keyof typeof lockfileNames;
19
+ export default function init(rootDir: string, reqName?: string, cliOptions?: CLIOptions): Promise<void>;
20
+ export {};