Skip to content

Commit e8b0bfb

Browse files
committed
restore the scaffold directory
1 parent 581f4c1 commit e8b0bfb

File tree

17 files changed

+685
-0
lines changed

17 files changed

+685
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "sheetUrl": "" }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
baseIri: http://iflastandards.info/ns/__CODE__/
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Scaffold Template
2+
3+
This directory contains template files used for scaffolding new IFLA standards sites.
4+
5+
## Template Placeholders
6+
7+
The following placeholders are used throughout the template files and should be replaced when scaffolding a new site:
8+
9+
### Required Placeholders
10+
11+
- `__CODE__` - The short code for the standard (e.g., "LRM", "ISBDM", "fr")
12+
- `__LOWERCASE_CODE__` - The lowercase version of the code (e.g., "lrm", "isbdm", "fr")
13+
- `__TITLE__` - The full title of the standard (e.g., "IFLA LRM", "ISBD for Manifestation")
14+
- `__TAGLINE__` - A brief description/tagline for the standard
15+
- `__PREFIX__` - The vocabulary prefix (e.g., "lrm", "isbdm", "ifla")
16+
- `__NUMBER_PREFIX__` - The element number prefix (e.g., "E", "T")
17+
- `__PROFILE__` - The main vocabulary profile CSV filename
18+
- `__ELEMENTS_URI__` - The base URI for elements
19+
- `__ELEMENTS_PROFILE__` - The elements profile CSV filename
20+
- `__EDIT_URL__` - The GitHub edit URL for the standard
21+
22+
## Template Files
23+
24+
### Configuration Files
25+
26+
- `.config/docusaurus.config.ts` - Main Docusaurus configuration template
27+
- `.config/sheet.json` - Google Sheets configuration template
28+
- `.config/vocab.yaml` - Vocabulary configuration template
29+
- `sidebars.ts` - Sidebar configuration template
30+
31+
### Content Files
32+
33+
- `docs/index.mdx` - Main landing page template with QuickStart and DownloadPanel components
34+
35+
### Directory Structure
36+
37+
- `blog/` - Blog posts directory (empty)
38+
- `csv/` - CSV source files directory
39+
- `csv/vocabs/` - Vocabulary CSV files directory
40+
- `rdf/` - RDF output directories (jsonld, nt, ttl, xml)
41+
- `scripts/` - Site-specific scripts directory
42+
43+
## Usage
44+
45+
This template is used by scaffolding scripts to create new standards sites with consistent structure and configuration. The scaffolding process should:
46+
47+
1. Copy all template files to the new site directory
48+
2. Replace all placeholders with actual values
49+
3. Set up the appropriate directory structure
50+
4. Initialize any necessary configuration files
51+
52+
## Notes
53+
54+
- The template follows the current generic configuration pattern used by all IFLA standards sites
55+
- All sites use the shared `@ifla/theme` package for components and configuration
56+
- The configuration uses `createStandardSiteConfig()` for consistency across sites

scripts/scaffold-template/blog/.gitkeep

Whitespace-only changes.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
id: index
3+
title: __TITLE__
4+
slug: /
5+
hide_table_of_contents: true
6+
---
7+
8+
import { QuickStart, DownloadPanel } from '@ifla/theme';
9+
10+
# __TITLE__
11+
12+
<QuickStart
13+
standard="__CODE__"
14+
introductionPath="/intro/"
15+
elementsPath="/elements/"
16+
examplesPath="/examples/"
17+
/>
18+
19+
<DownloadPanel
20+
standard="__CODE__"
21+
pdfUrl="#"
22+
ttlUrl="/rdf/ttl/__LOWERCASE_CODE__.ttl"
23+
jsonLdUrl="/rdf/jsonld/__LOWERCASE_CODE__.jsonld"
24+
xmlUrl="/rdf/xml/__LOWERCASE_CODE__.xml"
25+
/>
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
import type { Config } from '@docusaurus/types';
2+
import type * as Preset from '@docusaurus/preset-classic';
3+
import { deepmerge } from 'deepmerge-ts';
4+
import {
5+
createBaseConfig,
6+
createThemeConfig,
7+
createIFLAPlugins,
8+
createStandardsPresetConfig,
9+
createStandardsFooter,
10+
createVocabularyConfig,
11+
createStaticDirectories,
12+
createStandardsNavbar,
13+
getSiteConfig,
14+
type SiteKey,
15+
type Environment
16+
} from '@ifla/shared-config';
17+
import navbarItems from './navbar';
18+
19+
// Determine environment from DOCS_ENV
20+
const docsEnv = process.env['DOCS_ENV'];
21+
if (!docsEnv) {
22+
throw new Error(
23+
`❌ FATAL: DOCS_ENV environment variable is required but not set.\n` +
24+
`✅ Valid values: local, preview, development, production\n` +
25+
`💡 NX builds should load DOCS_ENV from root .env file automatically.\n` +
26+
`💡 CI/production workflows must set DOCS_ENV explicitly.`
27+
);
28+
}
29+
30+
// Get configuration for this site
31+
const currentEnv = docsEnv as Environment;
32+
const siteKey = '__CODE__' as SiteKey; // This will be replaced during scaffolding
33+
const siteConfig = getSiteConfig(siteKey, currentEnv);
34+
35+
// Site metadata that was previously in .env files
36+
const SITE_TITLE = '__TITLE__';
37+
const SITE_TAGLINE = 'IFLA Standard for __TITLE__';
38+
const GITHUB_REPO_URL = 'https://github.com/iflastandards/standards-dev';
39+
const GITHUB_EDIT_URL = 'https://github.com/iflastandards/standards-dev/tree/main/standards/__CODE__/';
40+
41+
// Vocabulary configuration
42+
const VOCABULARY_PREFIX = 'ifla';
43+
const VOCABULARY_NUMBER_PREFIX = 'T';
44+
const VOCABULARY_PROFILE = 'vocabulary-profile.csv';
45+
const VOCABULARY_ELEMENT_URI = 'https://www.iflastandards.info/elements';
46+
const VOCABULARY_ELEMENT_PROFILE = 'elements-profile.csv';
47+
48+
const config: Config = deepmerge(
49+
createBaseConfig({
50+
title: SITE_TITLE,
51+
tagline: SITE_TAGLINE,
52+
url: siteConfig.url,
53+
baseUrl: siteConfig.baseUrl,
54+
projectName: '__CODE__',
55+
}),
56+
{
57+
// __CODE__-specific overrides
58+
onBrokenLinks: 'warn' as const,
59+
onBrokenMarkdownLinks: 'warn' as const,
60+
onBrokenAnchors: 'warn' as const,
61+
onDuplicateRoutes: 'warn' as const,
62+
63+
// Add future config block for compliance with regression tests
64+
future: {
65+
v4: true,
66+
},
67+
68+
// Shared static directories for standards sites
69+
staticDirectories: createStaticDirectories('standard'),
70+
71+
customFields: {
72+
// Current environment for client-side components
73+
environment: currentEnv,
74+
// Environment for site URL generation
75+
docsEnv: currentEnv,
76+
// Function to get site config for any site in current environment
77+
siteConfig: (toSiteKey: SiteKey) => getSiteConfig(toSiteKey, currentEnv),
78+
// __CODE__-specific vocabulary configuration
79+
vocabularyDefaults: createVocabularyConfig({
80+
prefix: VOCABULARY_PREFIX,
81+
numberPrefix: VOCABULARY_NUMBER_PREFIX,
82+
profile: VOCABULARY_PROFILE,
83+
elementUri: VOCABULARY_ELEMENT_URI,
84+
elementProfile: VOCABULARY_ELEMENT_PROFILE,
85+
}),
86+
},
87+
88+
presets: [
89+
[
90+
'classic',
91+
createStandardsPresetConfig({
92+
editUrl: GITHUB_EDIT_URL,
93+
enableBlog: true,
94+
showLastUpdateAuthor: true,
95+
showLastUpdateTime: true,
96+
}),
97+
],
98+
],
99+
100+
plugins: [
101+
// IFLA standard plugins
102+
...createIFLAPlugins({
103+
environment: currentEnv, // Pass environment for pure function
104+
enableLocalSearch: true,
105+
searchConfig: {
106+
indexBlog: true, // __CODE__ has a blog
107+
language: ['en'],
108+
},
109+
// imageConfig defaults are now environment-aware in the factory
110+
}),
111+
],
112+
113+
themeConfig: deepmerge(
114+
createThemeConfig({
115+
navbarTitle: '__TITLE__',
116+
navbarItems: createStandardsNavbar({
117+
title: '__TITLE__',
118+
customItems: navbarItems,
119+
includeBlog: true,
120+
includeVersionDropdown: true,
121+
includeLocaleDropdown: true,
122+
includeSearch: true,
123+
}),
124+
footerLinks: createStandardsFooter({
125+
githubUrl: GITHUB_REPO_URL,
126+
includeRdfDownloads: true,
127+
includeSitemap: true,
128+
includeBlog: true,
129+
}).links,
130+
copyright: createStandardsFooter({
131+
githubUrl: GITHUB_REPO_URL,
132+
}).copyright,
133+
}),
134+
{
135+
// __CODE__-specific theme overrides
136+
metadata: [
137+
{ name: 'keywords', content: 'ifla, library, standards, __CODE__' },
138+
],
139+
tableOfContents: {
140+
minHeadingLevel: 2,
141+
maxHeadingLevel: 6,
142+
},
143+
} satisfies Partial<Preset.ThemeConfig>,
144+
),
145+
}
146+
);
147+
148+
export default config;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// __CODE__ navbar configuration
2+
export default [
3+
// Add __CODE__-specific navbar items here as needed
4+
];

scripts/scaffold-template/rdf/jsonld/.gitkeep

Whitespace-only changes.

scripts/scaffold-template/rdf/nt/.gitkeep

Whitespace-only changes.

scripts/scaffold-template/rdf/ttl/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)