Skip to content

Commit 3ea31c4

Browse files
committed
Fix the sidebar ordering
1 parent 4a6cfc2 commit 3ea31c4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2392
-308
lines changed

docs/.vitepress/config.ts

Lines changed: 17 additions & 193 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ const vitepressOptions: UserConfig = {
1212
// https://vitepress.dev/reference/default-theme-config
1313
nav: [
1414
{ text: 'Home', link: '/' },
15-
{ text: 'Module Development', link: '/modules' }
15+
{ text: 'Module Development', link: '/modules/' }
1616
],
1717
siteTitle: 'SA Modules',
18-
sociallinks: [
18+
socialLinks: [
1919
{ icon: 'github', link: _package.repository },
2020
{
2121
icon: 'gitbook',
@@ -29,204 +29,28 @@ const vitepressOptions: UserConfig = {
2929
};
3030

3131
const commonSideBarOptions: VitePressSidebarOptions = {
32-
sortMenusByFrontmatterOrder: true,
32+
documentRootPath: '/src',
33+
// sortMenusByName: true,
34+
35+
// TODO: Investigate? Do we need rewrite rules?
36+
// folderLinkNotIncludesFileName: true,
3337
useFolderLinkFromSameNameSubFile: true,
3438
useFolderTitleFromIndexFile: true,
3539
useTitleFromFrontmatter: true,
3640
useTitleFromFileHeading: true,
3741
};
3842

39-
const sideBarOptions: VitePressSidebarOptions[] = [
40-
{
41-
documentRootPath: '/src',
42-
scanStartPath: 'buildtools',
43-
resolvePath: '/buildtools/',
44-
},
45-
{
46-
documentRootPath: '/src',
47-
scanStartPath: 'modules',
48-
resolvePath: '/modules/',
49-
}
50-
].map(each => ({
43+
const sidebarConfigs: Record<string, VitePressSidebarOptions> = {
44+
buildtools: {},
45+
modules: {},
46+
lib: {}
47+
};
48+
49+
const sideBarOptions = Object.entries(sidebarConfigs).map(([startPath, options]): VitePressSidebarOptions => ({
50+
scanStartPath: startPath,
51+
resolvePath: `/${startPath}/`,
5152
...commonSideBarOptions,
52-
...each,
53+
...options
5354
}));
5455

5556
export default defineConfig(withSidebar(vitepressOptions, sideBarOptions));
56-
57-
/*
58-
export default defineConfig({
59-
60-
themeConfig: {
61-
siteTitle: 'SA Modules',
62-
// https://vitepress.dev/reference/default-theme-config
63-
nav: [
64-
{ text: 'Home', link: '/' },
65-
{ text: 'Module Development', link: '/modules' }
66-
],
67-
68-
sidebar: {
69-
'/buildtools/': [
70-
{
71-
text: 'Build Tools Overview',
72-
link: '/buildtools',
73-
items: [
74-
{
75-
text: 'Command Handlers',
76-
link: './command'
77-
},
78-
{
79-
text: 'Builders',
80-
link: './builders'
81-
},
82-
{
83-
text: 'Prebuild Tasks',
84-
link: './prebuild',
85-
},
86-
{
87-
text: 'Testing',
88-
link: './testing'
89-
},
90-
{
91-
text: 'Templates',
92-
link: './templates'
93-
}
94-
]
95-
}
96-
],
97-
'/buildtools/builders/': [{
98-
text: 'Builders',
99-
link: '/buildtools/builders',
100-
items: [
101-
{
102-
text: 'Bundles and Tabs',
103-
link: './modules'
104-
},
105-
{
106-
text: 'Documentation',
107-
link: './docs'
108-
},
109-
{
110-
text: 'Manifest',
111-
link: './manifest'
112-
}
113-
]
114-
}],
115-
'/lib/': [{
116-
text: 'Modules Libraries',
117-
items: [
118-
{
119-
text: 'ESLint Plugin',
120-
link: '/lib/lintplugin'
121-
},
122-
{
123-
text: 'Common Library',
124-
link: '/lib/modules-lib/modules'
125-
}
126-
]
127-
}],
128-
'/modules/': [
129-
{
130-
text: 'Developing Modules',
131-
items: [
132-
{
133-
text: 'Modules Overview',
134-
link: '/modules'
135-
},
136-
{
137-
text: 'Getting Started',
138-
link: '/modules/getting-started'
139-
},
140-
{
141-
text: 'Unit Testing',
142-
link: '/modules/testing'
143-
},
144-
{
145-
text: 'Linting',
146-
link: '/modules/linting'
147-
},
148-
{
149-
text: 'Module Contexts',
150-
link: '/modules/context'
151-
},
152-
{
153-
text: 'Using the Frontend',
154-
link: '/modules/tabs/frontend'
155-
},
156-
{
157-
text: 'Bundles',
158-
items: [
159-
{
160-
text: 'Bundles Overview',
161-
link: '/modules/bundle'
162-
},
163-
{
164-
text: 'Creating a Bundle',
165-
link: '/modules/bundle/creating'
166-
},
167-
{
168-
text: 'Editing a Bundle',
169-
link: '/modules/bundle/editing'
170-
},
171-
{
172-
text: 'Bundle Documentation',
173-
link: '/modules/bundle/documentation'
174-
},
175-
{
176-
text: 'Compiling a Bundle',
177-
link: '/modules/bundle/compiling'
178-
},
179-
{
180-
text: 'Bundle Type Maps',
181-
link: '/modules/bundle/type_map'
182-
}
183-
]
184-
},
185-
{
186-
text: 'Tabs',
187-
items: [
188-
{
189-
text:' Tabs Overview',
190-
link: '/modules/tabs'
191-
},
192-
{
193-
text: 'Creating a Tab',
194-
link: '/modules/tabs/creating'
195-
},
196-
{
197-
text: 'Editing a Tab',
198-
link: '/modules/tabs/editing'
199-
},
200-
{
201-
text: 'Compiling a tab',
202-
link: '/modules/tabs/compiling'
203-
},
204-
{
205-
text: 'Working with Context',
206-
link: '/modules/tabs/context'
207-
},
208-
{
209-
text: 'Using the Dev Server',
210-
link: '/modules/tabs/devserver'
211-
},
212-
213-
]
214-
}
215-
]
216-
},
217-
]
218-
},
219-
220-
sociallinks: [
221-
{ icon: 'github', link: _package.repository },
222-
{
223-
icon: 'gitbook',
224-
link: 'https://source-academy.github.io/modules/documentation/'
225-
}
226-
],
227-
search: {
228-
provider: 'local'
229-
}
230-
}
231-
});
232-
*/

docs/src/buildtools/builders/modules.md renamed to docs/src/buildtools/1-builders/1-modules.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
---
2-
order: 2
3-
---
41
# Building for Bundles and Tabs
52
## Why Bundle?
63
To run module code, `js-slang` would have to have all the dependencies of every single module, which would make building it tedious and bloated and also introduce an undesirable dependency between modules and js-slang. Instead, Source Modules are bundled before use.

docs/src/buildtools/builders/docs.md renamed to docs/src/buildtools/1-builders/2-docs.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
---
2-
order: 3
3-
---
4-
51
# Documentation Generation
62

73
There are two types of documentation used by Source, which are the jsons and the HTML documentation. Both are built using the [`typedoc`](typedoc.org) tool. By reading comments and type annotations, `typedoc` is able to generate both human readable documentation and documentation in the form of JSON.

docs/src/buildtools/builders/manifest.md renamed to docs/src/buildtools/1-builders/3-manifest.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
---
2-
order: 4
3-
---
4-
51
# The Modules Manifest
62

73
Each bundle contains its own manifest. However, after compilation, the manifest remains a separate file that doesn't get included with the bundle's compiled code.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: Builders
3+
---
4+
# Builders Overview
5+
The following pages contains information on how each asset type is produced
6+
7+
- [Bundles and Tabs](./1-modules.md)
8+
- [Documentation](./2-docs)
9+
- [Manifest](./3-manifest)

docs/src/buildtools/command.md renamed to docs/src/buildtools/2-command.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
---
2-
order: 2
3-
---
4-
51
# Command Handlers
62
Command Line parsing is handled by the [`commander`](https://github.com/tj/commander.js) library.
73

File renamed without changes.

docs/src/buildtools/builders/index.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/src/buildtools/builders/overview.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

docs/src/buildtools/index.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
11
---
22
title: Build Tools
33
---
4+
5+
# Build Tools Overview
6+
7+
The Source Academy Modules build tools are written in Typescript and designed to be run from the command line
8+
9+
The build tools are comprised of several sections:
10+
11+
- [Command Handlers](./command)
12+
- The actual code that runs command line argument parsing
13+
- [Builders](./1-builders)
14+
- The code that converts a bundle or tab into its outputs
15+
- [Prebuild Tasks](./prebuild)
16+
- Code that is intended to be run before builders
17+
- [Testing](./testing)
18+
- Code for integrating `vitest`
19+
- [Templates](./templates)
20+
- Code for the template command
21+
22+
Explanations on how the build tools repository has been structured can be found [here](./structure)

0 commit comments

Comments
 (0)