-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathconfig.mts
More file actions
199 lines (183 loc) · 6.82 KB
/
config.mts
File metadata and controls
199 lines (183 loc) · 6.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
import {defineConfig} from 'vitepress';
import typedocSidebar from '../api/typedoc-sidebar.json';
// Build configuration from environment
const isDevBuild = process.env.IS_DEV_BUILD === 'true';
// Base paths - dev build lives in /dev/ subdirectory, stable/release is at root
const siteBase = '/b2c-developer-tooling';
const basePath = isDevBuild ? `${siteBase}/dev/` : `${siteBase}/`;
// Build version dropdown items
// VitePress prepends base path to links starting with /, so we use relative paths
// that work correctly for each build context
function getVersionItems() {
if (isDevBuild) {
// Dev build: base is /b2c-developer-tooling/dev/
// Use ../ to navigate up to stable docs at root
return [
{text: 'Latest Release', link: '../'},
{text: 'Development (main)', link: '/'},
];
}
// Stable build: base is /b2c-developer-tooling/
return [
{text: 'Latest Release', link: '/'},
{text: 'Development (main)', link: '/dev/'},
];
}
const guidesSidebar = [
{
text: 'Getting Started',
items: [
{text: 'Introduction', link: '/guide/'},
{text: 'CLI Installation', link: '/guide/installation'},
{text: 'CLI Configuration', link: '/guide/configuration'},
{text: 'Agent Skills & Plugins', link: '/guide/agent-skills'},
],
},
{
text: 'How-To',
items: [
{text: 'Authentication Setup', link: '/guide/authentication'},
{text: 'CI/CD with GitHub Actions', link: '/guide/ci-cd'},
{text: 'Account Manager', link: '/guide/account-manager'},
{text: 'Analytics Reports (CIP/CCAC)', link: '/guide/analytics-reports-cip-ccac'},
{text: 'IDE Integration', link: '/guide/ide-integration'},
{text: 'Scaffolding', link: '/guide/scaffolding'},
{text: 'Security', link: '/guide/security'},
{text: 'Storefront Next', link: '/guide/storefront-next'},
{text: 'MRT Utilities', link: '/guide/mrt-utilities'},
],
},
{
text: 'MCP Server',
items: [
{text: 'Overview', link: '/mcp/'},
{text: 'MCP Installation', link: '/mcp/installation'},
{text: 'MCP Configuration', link: '/mcp/configuration'},
{text: 'Toolsets & Tools', link: '/mcp/toolsets'},
{text: 'Figma Tools Setup', link: '/mcp/figma-tools-setup'},
],
},
{
text: 'Extending',
items: [
{text: 'Custom Plugins', link: '/guide/extending'},
{text: '3rd Party Plugins', link: '/guide/third-party-plugins'},
],
},
];
const referenceSidebar = [
{
text: 'CLI Commands',
items: [
{text: 'Overview', link: '/cli/'},
{text: 'Account Manager', link: '/cli/account-manager'},
{text: 'Auth', link: '/cli/auth'},
{text: 'CIP', link: '/cli/cip'},
{text: 'Code', link: '/cli/code'},
{text: 'Content', link: '/cli/content'},
{text: 'Custom APIs', link: '/cli/custom-apis'},
{text: 'Docs', link: '/cli/docs'},
{text: 'eCDN', link: '/cli/ecdn'},
{text: 'Jobs', link: '/cli/jobs'},
{text: 'Logs', link: '/cli/logs'},
{text: 'MRT', link: '/cli/mrt'},
{text: 'Sandbox', link: '/cli/sandbox'},
{text: 'Scaffold', link: '/cli/scaffold'},
{text: 'SCAPI Schemas', link: '/cli/scapi-schemas'},
{text: 'Setup', link: '/cli/setup'},
{text: 'Sites', link: '/cli/sites'},
{text: 'SLAS', link: '/cli/slas'},
{text: 'WebDAV', link: '/cli/webdav'},
{text: 'Logging', link: '/cli/logging'},
],
},
{
text: 'MCP Tools',
items: [
{text: 'cartridge_deploy', link: '/mcp/tools/cartridge-deploy'},
{text: 'mrt_bundle_push', link: '/mcp/tools/mrt-bundle-push'},
{text: 'pwakit_development_guidelines', link: '/mcp/tools/pwakit-development-guidelines'},
{text: 'scapi_schemas_list', link: '/mcp/tools/scapi-schemas-list'},
{text: 'scapi_custom_api_scaffold', link: '/mcp/tools/scapi-custom-api-scaffold'},
{text: 'scapi_custom_apis_status', link: '/mcp/tools/scapi-custom-apis-status'},
{text: 'storefront_next_development_guidelines', link: '/mcp/tools/storefront-next-development-guidelines'},
{text: 'storefront_next_figma_to_component_workflow', link: '/mcp/tools/storefront-next-figma-to-component-workflow'},
{text: 'storefront_next_generate_component', link: '/mcp/tools/storefront-next-generate-component'},
{text: 'storefront_next_map_tokens_to_theme', link: '/mcp/tools/storefront-next-map-tokens-to-theme'},
{text: 'storefront_next_page_designer_decorator', link: '/mcp/tools/storefront-next-page-designer-decorator'},
{text: 'storefront_next_site_theming', link: '/mcp/tools/storefront-next-site-theming'},
],
},
];
// Script to force hard navigation for version switching links
// VitePress SPA router can't handle navigation between separate VitePress builds
const versionSwitchScript = `
document.addEventListener('click', (e) => {
const link = e.target.closest('a');
if (!link) return;
const href = link.getAttribute('href');
// Check if this is a version switch link
if (href && (href.includes('/dev/') || href === '../')) {
e.preventDefault();
e.stopPropagation();
if (href === '../') {
// Navigate from /dev/ back to stable root - construct path explicitly
// to avoid relative path issues with trailing slashes
const path = window.location.pathname;
const stablePath = path.replace(/\\/dev\\/.*$/, '/').replace(/\\/dev$/, '/');
window.location.href = stablePath;
} else {
window.location.href = link.href;
}
}
}, true);
`;
export default defineConfig({
title: 'B2C DX',
description: 'Salesforce B2C Commerce Developer Experience - CLI, MCP Server, and SDK',
base: basePath,
head: [['script', {}, versionSwitchScript]],
// Ignore dead links in api-readme.md (links are valid after TypeDoc generates the API docs)
ignoreDeadLinks: [/^\.\/clients\//],
// Show deeper heading levels in the outline
markdown: {
toc: {level: [2, 3, 4]},
},
themeConfig: {
logo: '/logo.svg',
outline: {
level: [2, 3],
},
nav: [
{text: 'Guides', link: '/guide/'},
{text: 'MCP', link: '/mcp/'},
{text: 'Reference', link: '/cli/'},
{text: 'SDK', link: '/api/'},
{
text: isDevBuild ? 'Dev' : 'Latest',
items: getVersionItems(),
},
],
footer: {
message: 'Released under the Apache-2.0 License.',
copyright: `Copyright © ${new Date().getFullYear()} Salesforce, Inc.`,
},
sidebar: {
'/mcp/tools/': referenceSidebar,
'/mcp/': guidesSidebar,
'/cli/': referenceSidebar,
'/guide/': guidesSidebar,
'/api/': [
{
text: 'SDK Reference',
items: [{text: 'Overview', link: '/api/'}],
},
...typedocSidebar,
],
},
socialLinks: [{icon: 'github', link: 'https://github.com/SalesforceCommerceCloud/b2c-developer-tooling'}],
search: {
provider: 'local',
},
},
});