Skip to content

Commit a89835d

Browse files
committed
chore: reorganize content and technology template
Reorganize the documentation to make it more streamlined.
1 parent 4e1686a commit a89835d

File tree

14 files changed

+126
-108
lines changed

14 files changed

+126
-108
lines changed

docs/types-of-xplat/browser-engine.md renamed to docs/browser-engine/browser-engine.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
---
2-
id: browser
2+
id: overview
3+
slug: /browser-engine
34
---
45

5-
# Browser engine
6+
# Overview
67

78
Cross-platform technologies that use a browser engine (also called rendering engine) to render
89
their UI have been around for many years, more precisely since 2009. Chrome was released the year
@@ -134,5 +135,5 @@ There are many strategies in here, each one with its pros and cons:
134135
[NW.js]: https://nwjs.io/
135136
[Tauri]: https://tauri.studio/
136137
[V8]: https://en.wikipedia.org/wiki/V8_(JavaScript_engine)
137-
[Web and PWA]: ./web.md
138-
[WebSockets]: https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API
138+
[Web and PWA]: ../web/web.md
139+
[WebSockets]: https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API
File renamed without changes.

docs/intro.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Why cross-platform development?
3+
slug: /introduction
34
---
45

56
# Why cross-platform development?
File renamed without changes.

docs/types-of-xplat/types.md renamed to docs/types.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,24 @@ are:
2828

2929
<!-- TODO: Add a diagram representing the above -->
3030

31-
[Browser engine]: ./browser-engine.md
31+
[Browser engine]: ./browser-engine/browser-engine.md
3232
[Chromium]: http://www.chromium.org/Home
3333
[Chrome]: https://www.google.com/chrome/index.html
3434
[Chromium Embedded Framework]: https://bitbucket.org/chromiumembedded/cef/wiki/Home
35-
[Compiled]: ./compiled.md
35+
[Compiled]: ./compiled/compiled.md
3636
[Edge]: https://www.microsoft.com/en-us/edge
3737
[Electron]: https://www.electronjs.org
3838
[Firefox]: https://www.mozilla.org/en-US/firefox/new/
3939
[Flutter]: https://flutter.dev/
4040
[Gecko]: https://developer.mozilla.org/en-US/docs/Mozilla/Gecko
41-
[JavaScript projection]: ./javascript-projection.md
41+
[JavaScript projection]: ./javascript-projection/javascript-projection.md
4242
[NativeScript]: https://nativescript.org/
4343
[NodeGui]: https://docs.nodegui.org/
4444
[NW.js]: https://nwjs.io/
4545
[Qt]: https://www.qt.io/
4646
[React Native]: https://reactnative.dev
4747
[Safari]: https://www.apple.com/safari/
4848
[Tauri]: https://tauri.studio/
49-
[Web]: ./web.md
49+
[Web]: ./web/web.md
5050
[WebKit]: https://webkit.org/
5151
[Xamarin]: https://dotnet.microsoft.com/apps/xamarin

docs/types-of-xplat/web.md renamed to docs/web/web.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
2+
id: web
3+
slug: /web
34
---
45

56
# Web and PWA

docusaurus.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module.exports = {
2323
type: 'doc',
2424
docId: 'intro',
2525
position: 'left',
26-
label: 'Introduction',
26+
label: 'cross-platform development',
2727
},
2828
// {to: '/blog', label: 'Blog', position: 'left'},
2929
{

scripts/add-technology.js

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ const TECHNOLOGY = {
3939
documentation: 'https://',
4040
};
4141

42+
const categories = [
43+
'Browser engine',
44+
'Compiled',
45+
'JavaScript projection',
46+
'Web',
47+
];
48+
4249
/**
4350
* Listens for stdin and returns the first line of text received.
4451
* @returns {Promise<string>}
@@ -133,7 +140,9 @@ const writeTemplates = async (templates, information, destination) => {
133140
const files = [];
134141

135142
for (const [filePath, content] of templates) {
136-
const finalPath = path.join(destination, filePath);
143+
// 🛑 HACK ahead!! we assume that `information[1]` is `normalizedTechnology`. We should probably validate this
144+
const finalPath = path.join(destination, filePath).replace('technology', information[1].value);
145+
137146
const interpolatedContent = interpolate(content, information);
138147

139148
await fs.writeFile(finalPath, interpolatedContent, 'utf-8');
@@ -148,6 +157,15 @@ const start = async () => {
148157
const technology = await getInput();
149158
const normalizedTechnology = normalize(technology);
150159

160+
console.log(`Category? (${categories.join(', ')})`);
161+
const category = await getInput();
162+
163+
if (!categories.includes(category)) {
164+
console.error(`Category "${category}" is not valid. Please use one of the following ones the next time:
165+
${categories.join('\n')}`);
166+
}
167+
const normalizedCategory = normalize(category);
168+
151169
const templates = await loadTemplates('.md');
152170

153171
const information = [
@@ -159,12 +177,20 @@ const start = async () => {
159177
key: 'normalizedTechnology',
160178
value: normalizedTechnology,
161179
},
180+
{
181+
key: 'category',
182+
value: category,
183+
},
184+
{
185+
key: 'normalizedCategory',
186+
value: normalizedCategory,
187+
},
162188
];
163189

164190
const createdFiles = await writeTemplates(
165191
templates,
166192
information,
167-
path.join(DOCS_ROOT, normalizedTechnology)
193+
path.join(DOCS_ROOT, normalizedCategory)
168194
);
169195

170196
console.log(`Documentation files created:
@@ -178,17 +204,21 @@ ${createdFiles.join('\n')}`);
178204
'utf-8'
179205
);
180206

181-
const category = {
182-
type: 'category',
183-
label: technology,
184-
items: [{ type: 'autogenerated', dirName: normalizedTechnology }],
185-
};
186-
187207
const sidebars = require(SIDEBARS_PATH);
188208

189-
sidebars.websiteSidebar.push(category);
209+
const categoryItem = sidebars.websiteSidebar.find((item) =>{
210+
return item.label === category;
211+
});
212+
213+
if(!categoryItem){
214+
console.error(`There was an error adding the element to "sidebars.js" under the category ${category}, please do it manually`);
215+
process.exit(1);
216+
}
190217

191218
console.log(`Updating sidebars.js`);
219+
220+
categoryItem.items.push(`${normalizedCategory}/${normalizedTechnology}`);
221+
192222
await fs.writeFile(
193223
SIDEBARS_PATH,
194224
`module.exports = ${stringify(sidebars, null, 2)};\n`,

scripts/templates/technology/architecture.md

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

scripts/templates/technology/devex.md

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

0 commit comments

Comments
 (0)