Skip to content

Commit 1f0b196

Browse files
committed
docs: minor cleanup to getting started guide
1 parent 90a3bd7 commit 1f0b196

File tree

6 files changed

+37
-20
lines changed

6 files changed

+37
-20
lines changed

docs-viewer/src/site-utils.ts

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import path from 'path';
22
// @ts-expect-error missing from Bun types
33
import { globSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
4+
import { write } from 'node:console';
45

56
const DefaultOpenGroups: string[] = [];
67
const AlwaysOpenGroups: string[] = ['configuration.setup'];
@@ -138,7 +139,16 @@ export async function getGuidesStructure(withRewrites = false) {
138139
const result = deepConvert(groups);
139140
// console.log(JSON.stringify(result, null, 2));
140141
// console.log(JSON.stringify(rewritten, null, 2));
141-
142+
const structure = { paths: result, rewritten };
143+
144+
writeFileSync(
145+
path.join(__dirname, '../docs.warp-drive.io/guides/nav.json'),
146+
JSON.stringify(structure, null, 2),
147+
'utf-8'
148+
);
149+
await import(path.join(__dirname, '../docs.warp-drive.io/guides/nav.json'), {
150+
with: { type: 'json' },
151+
});
142152
return { paths: result, rewritten };
143153
}
144154

@@ -158,7 +168,7 @@ function deepConvert(obj: Record<string, any>) {
158168
});
159169
}
160170

161-
type SidebarItem = { text: string; items?: SidebarItem[] };
171+
type SidebarItem = { text: string; items?: SidebarItem[]; link?: string; collapsed?: boolean };
162172

163173
const OLD_PACKAGES = [
164174
'@ember-data/adapter',
@@ -256,24 +266,40 @@ outline:
256266
level: [2, 3]
257267
---
258268
`;
269+
const ApiDocumentation = `# API Docs\n\n`;
259270

260271
export async function postProcessApiDocs() {
261272
const dir = path.join(__dirname, '../tmp/api');
262273
const outDir = path.join(__dirname, '../docs.warp-drive.io/api');
263274
mkdirSync(outDir, { recursive: true });
264-
console.log('Ensured API Docs Directory Exists:', outDir);
265275

266276
// cleanup and prepare the sidebar items
267277
const sidebarPath = path.join(outDir, 'typedoc-sidebar.json');
268278
const navStructure = JSON.parse(readFileSync(path.join(dir, 'typedoc-sidebar.json'), 'utf-8')) as SidebarItem[];
269279
const sidebar = splitApiDocsSidebar(cleanSidebarItems(navStructure));
270280
writeFileSync(sidebarPath, JSON.stringify(sidebar, null, 2), 'utf-8');
271281

272-
console.log(`Processed API Docs Sidebar: ${sidebarPath}`);
282+
// get the package list
283+
const NewPackages: string[] = [];
284+
const OldPackages: string[] = [];
285+
for (const item of sidebar.newPackages) {
286+
NewPackages.push(`- [${item.text}](${item.link!})`);
287+
}
288+
for (const item of sidebar.oldPackages) {
289+
OldPackages.push(`- [${item.text}](${item.link!})`);
290+
}
291+
292+
// generate the API documentation
293+
const apiDocumentation = `${ApiDocumentation}\n\n## Main Packages\n\n${NewPackages.join('\n')}\n\n## Legacy Packages\n\n${OldPackages.join('\n')}\n\n`;
273294

274295
// copy the rest of the files
275296
const files = globSync('**/*.md', { cwd: dir, nodir: true });
276297
for (const file of files) {
298+
if (file === 'index.md') {
299+
// Generate a custom index.md file
300+
writeFileSync(path.join(outDir, 'index.md'), apiDocumentation, 'utf-8');
301+
continue;
302+
}
277303
const content = readFileSync(path.join(dir, file), 'utf-8');
278304
const outFile = path.join(outDir, file);
279305
mkdirSync(path.dirname(outFile), { recursive: true });

guides/1-configuration/1-overview.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
title: Overview
33
---
44

5-
::: tip EmberData/WarpDrive Packages Have Been [Simplified](https://rfcs.emberjs.com/id/1075-warp-drive-package-unification/)!
6-
7-
Looking for the [Old Package Setup Guide?](./4-old-package-setup/1-overview.md)
5+
::: warning 💡 Looking for the [Legacy Package Configuration Guide?](./4-legacy-package-setup/1-overview)
86
:::
97

108
# Configuration

guides/1-configuration/2-setup/1-universal.md

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ outline:
33
level: 2,3
44
---
55

6-
::: tip EmberData/WarpDrive Packages Have Been [Simplified](https://rfcs.emberjs.com/id/1075-warp-drive-package-unification/)
7-
8-
Looking for the [Old Package Setup Guide?](../4-old-package-setup/1-overview.md)
6+
::: warning 💡 Looking for the [Legacy Package Setup Guide?](../4-legacy-package-setup/2-setup/1-universal)
97
:::
108

119
# Setup
1210

13-
All frameworks should follow this configuration first.
11+
All frameworks should follow this configuration before continuing on to their framework
12+
specific setup guide.
1413

1514
## Configure the Build Plugin
1615

@@ -85,19 +84,13 @@ module.exports = async function (defaults) {
8584

8685
## Configure the Store
8786

88-
To get up and running we need to configure a `Store` to understand how we want
89-
to handle requests, what our data looks like, how to cache it, and what sort of
90-
reactive objects to create for that data.
87+
The `Store` is the central piece of the ***Warp*Drive** experience, linking
88+
together how we handle requests, the schemas for what our data looks like,
89+
how to cache it, and what sort of reactive objects to create for that data.
9190

9291
Here's an example final configuration. Below we'll show each bit in parts and
9392
discuss what each does.
9493

95-
::: tip 💡 Guide
96-
Looking for Legacy Adapter/Serializer Support?
97-
98-
→ After finishing this page read the guide for [Ember.js](./2-ember.md)
99-
:::
100-
10194
::: code-group
10295

10396
```ts [Universal]

0 commit comments

Comments
 (0)