Skip to content

Commit

Permalink
feat: site restructuring (#2082)
Browse files Browse the repository at this point in the history
* merge conflicts resolved

* fix: link validation

* fix: ordering

* fix: js renamed to javascript

* fix: removed accidentally committed generated files

* fix: removed tauri

* fix: added tauri

* fix: releases should only be built in prod
  • Loading branch information
simonhyll authored Apr 22, 2024
1 parent 2e826c7 commit dfc1f3b
Show file tree
Hide file tree
Showing 210 changed files with 936 additions and 1,329 deletions.
9 changes: 3 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
[submodule "packages/tauri-v2"]
path = packages/tauri-v2
url = https://github.com/tauri-apps/tauri.git
[submodule "packages/plugins-workspace"]
path = packages/plugins-workspace
url = https://github.com/tauri-apps/plugins-workspace.git
branch = v2
[submodule "packages/tauri-v1"]
path = packages/tauri-v1
url = https://github.com/tauri-apps/tauri.git
[submodule "packages/awesome-tauri"]
path = packages/awesome-tauri
url = https://github.com/tauri-apps/awesome-tauri
[submodule "packages/tauri"]
path = packages/tauri
url = https://github.com/tauri-apps/tauri.git
191 changes: 33 additions & 158 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ export default defineConfig({
tag: 'meta',
attrs: { property: 'twitter:image', content: site + '/og.png?v=1' },
},
{
tag: 'script',
attrs: {
src: '/navigate.js'
}
},
],
// TODO: Be sure this is updated when the branch is switched
editLink: {
Expand All @@ -102,175 +108,44 @@ export default defineConfig({
sidebar: [
{
label: 'Quick Start',
translations: {
'zh-CN': '快速开始',
},
collapsed: true,
items: [
{
label: 'What is Tauri?',
translations: {
'zh-CN': '什么是 Tauri?',
},
link: 'guides',
},
{
label: 'Prerequisites',
translations: {
es: 'Prerrequisitos',
'zh-CN': '前置条件',
},
link: 'guides/prerequisites',
},
{
label: 'Create a Project',
translations: {
'zh-CN': '创建项目',
},
link: 'guides/create',
},
{
label: 'Frontend Configuration',
translations: {
es: 'Configuración del Frontend',
'zh-CN': '前端配置',
},
link: 'guides/frontend',
},
{
label: 'Upgrade & Migrate',
translations: {
'zh-CN': '升级和迁移',
},
link: 'guides/upgrade-migrate',
},
{
label: 'Core Concepts',
translations: {
'zh-CN': '核心概念',
},
link: 'concepts',
},
{
label: 'Troubleshooting',
translations: {
'zh-CN': '故障排除',
},
link: 'guides/troubleshoot',
},
],
autogenerate: { directory: 'start' },
},
{
label: 'Guides',
translations: {
'zh-CN': '指引',
},
label: 'Core Concepts',
collapsed: true,
items: [
{
label: 'Develop',
translations: {
'zh-CN': '开发',
},
link: 'guides/develop/',
},
{
label: 'Debug',
translations: {
'zh-CN': '调试',
},
link: 'guides/debug/',
},
{
label: 'Test',
translations: {
'zh-CN': '测试',
},
link: 'guides/test',
},
{
label: 'Build',
translations: {
'zh-CN': '构建',
},
link: 'guides/build',
},
{
label: 'Distribute',
translations: {
'zh-CN': '分发',
},
link: 'guides/distribute',
},
{
label: 'Plugin Development',
translations: {
'zh-CN': '插件开发',
},
link: 'guides/plugins',
},
],
autogenerate: { directory: 'concepts' },
},
{
label: 'References',
translations: {
'zh-CN': '参考',
},
label: 'Security',
collapsed: true,
autogenerate: { directory: 'security' },
},
{
label: 'Develop',
collapsed: true,
autogenerate: { directory: 'develop' },
},
{
label: 'Test',
collapsed: true,
autogenerate: { directory: 'test' },
},
{
label: 'Distribute',
collapsed: true,
items: [
{
label: 'List of References',
translations: {
'zh-CN': '参考列表',
},
link: '/references',
},
{
label: 'Tauri Configuration',
translations: {
'zh-CN': 'Tauri 配置',
},
link: '/references/v2/config',
},
{
label: 'Access Control List',
translations: {
'zh-CN': '访问控制列表(ACL)',
},
link: '/references/v2/acl',
},
{
label: 'Command Line Interface (CLI)',
translations: {
'zh-CN': '命令行接口(CLI)',
},
link: '/references/v2/cli',
},
{
label: 'JavaScript API',
translations: {
'zh-CN': 'JavaScript 接口',
},
link: '/references/v2/js',
},
{
label: 'Rust API (via Docs.rs)',
translations: {
'zh-CN': 'Rust 接口',
},
// TODO: Is there a way to link this to the latest pre-released version?
link: 'https://docs.rs/tauri/~2.0.0-beta',
},
],
autogenerate: { directory: 'distribute' },
},
{
label: 'Features & Recipes',
translations: {
'zh-CN': '功能和秘诀',
},
collapsed: true,
autogenerate: { directory: 'features' },
},
{
label: 'References',
collapsed: true,
autogenerate: { directory: 'references' },
},
],
locales,
lastUpdated: true,
Expand Down Expand Up @@ -331,15 +206,15 @@ export default defineConfig({
...i18nRedirect('/v1/guides/testing/webdriver/introduction', '/guides/test/webdriver/'),
...i18nRedirect(
'/v1/guides/testing/webdriver/example/setup',
'/guides/test/webdriver/example/setup'
'/guides/test/webdriver/example/'
),
...i18nRedirect(
'/v1/guides/testing/webdriver/example/selenium',
'/guides/test/webdriver/example/selenium'
),
...i18nRedirect(
'/v1/guides/testing/webdriver/example/webdriverio',
'/guides/test/webdriver/example/webdriverio'
'/test/webdriver/example/webdriverio'
),

// v1 /references
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
"version": "0.0.1",
"scripts": {
"dev:setup:submodules": "git submodule update --init",
"dev:setup:tauri-v1": "yarn --cwd packages/tauri-v1/tooling/api",
"dev:setup:tauri-v2": "yarn --cwd packages/tauri-v2/tooling/api",
"dev:setup:tauri": "yarn --cwd packages/tauri/tooling/api",
"dev:setup:plugins-workspace": "pnpm --prefix packages/plugins-workspace install",
"dev:setup": "pnpm dev:setup:submodules && pnpm dev:setup:tauri-v1 && pnpm dev:setup:tauri-v2 && pnpm dev:setup:plugins-workspace",
"dev:setup": "pnpm dev:setup:submodules && pnpm dev:setup:tauri && pnpm dev:setup:plugins-workspace",
"dev": "astro dev",
"format": "prettier -w --cache --plugin prettier-plugin-astro .",
"build:references": "pnpm --filter js-api-generator run build",
Expand Down
10 changes: 3 additions & 7 deletions packages/config-generator/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@ import { existsSync, writeFileSync } from 'node:fs';
import { slug } from 'github-slugger';

buildConfig(
'../tauri-v1/core/tauri-config-schema/schema.json',
'../../src/content/docs/references/v1/config.md'
);
buildConfig(
'../tauri-v2/core/tauri-config-schema/schema.json',
'../../src/content/docs/references/v2/config.md'
'../tauri/core/tauri-config-schema/schema.json',
'../../src/content/docs/references/config.md'
);

async function buildConfig(schemaFile: string, outputFile: string) {
Expand All @@ -19,7 +15,7 @@ async function buildConfig(schemaFile: string, outputFile: string) {
let schema: JSONSchema7 = (await import(schemaFile)).default;

const output = [
'---\n# NOTE: This file is auto-generated in packages/config-generator/build.ts\n# For corrections please edit https://github.com/tauri-apps/tauri/blob/dev/core/tauri-utils/src/config.rs directly\n\ntitle: Configuration\n---',
'---\n# NOTE: This file is auto-generated in packages/config-generator/build.ts\n# For corrections please edit https://github.com/tauri-apps/tauri/blob/dev/core/tauri-utils/src/config.rs directly\n\ntitle: Configuration\nsidebar:\n order: 1\n---',
];

output.push(
Expand Down
26 changes: 5 additions & 21 deletions packages/js-api-generator/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,12 @@ const typeDocConfigBaseOptions: Partial<TypeDocOptions | PluginOptions> = {
};

async function generator() {
if (existsSync('../tauri-v1/tooling/api/node_modules')) {
if (existsSync('../tauri/tooling/api/node_modules')) {
const coreJsOptions: Partial<TypeDocOptions> = {
entryPoints: ['../tauri-v1/tooling/api/src/index.ts'],
tsconfig: '../tauri-v1/tooling/api/tsconfig.json',
gitRevision: '1.x',
baseUrl: '/references/v1/js/',
...typeDocConfigBaseOptions,
};

await generateDocs(coreJsOptions);
} else {
console.log(
'Tauri V1 submodule is not initialized, respective API routes will not be rendered.'
);
}

if (existsSync('../tauri-v2/tooling/api/node_modules')) {
const coreJsOptions: Partial<TypeDocOptions> = {
entryPoints: ['../tauri-v2/tooling/api/src/index.ts'],
tsconfig: '../tauri-v2/tooling/api/tsconfig.json',
entryPoints: ['../tauri/tooling/api/src/index.ts'],
tsconfig: '../tauri/tooling/api/tsconfig.json',
gitRevision: 'dev',
baseUrl: '/references/v2/js/core/',
baseUrl: '/references/javascript/api/',
...typeDocConfigBaseOptions,
};

Expand Down Expand Up @@ -111,7 +95,7 @@ async function generator() {
entryPoints: [`../plugins-workspace/plugins/${plugin}/guest-js/index.ts`],
tsconfig: `../plugins-workspace/plugins/${plugin}/tsconfig.json`,
gitRevision: 'v2',
baseUrl: `/references/v2/js/${plugin}`,
baseUrl: `/references/javascript/${plugin}`,
...typeDocConfigBaseOptions,
};

Expand Down
1 change: 1 addition & 0 deletions packages/tauri
Submodule tauri added at 198f11
1 change: 0 additions & 1 deletion packages/tauri-v1
Submodule tauri-v1 deleted from 596681
1 change: 0 additions & 1 deletion packages/tauri-v2
Submodule tauri-v2 deleted from 1b2d31
45 changes: 45 additions & 0 deletions public/navigate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
async function chapterNavigation() {
let navigating = false
document.addEventListener("keydown", function (e) {
if (navigating) return
if (e.altKey || e.ctrlKey || e.metaKey) {
return;
}
if (window.search && document.activeElement === window.search) {
return;
}

switch (e.key) {
case "ArrowLeft":
e.preventDefault();
let previousButton = document.querySelector('a[rel="prev"]');
if (!previousButton && window.location.pathname !== '/') previousButton = { href: '/' }

if (document.referrer.includes(window.location.host))
if (previousButton) {
window.location.href = previousButton.href;
navigating = true;
}
break;
case "ArrowRight":
e.preventDefault();
let nextButton = document.querySelector('a[rel="next"]');
if (!nextButton && window.location.pathname === '/') nextButton = { href: "/start/" }

if (nextButton) {
window.location.href = nextButton.href;
navigating = true;
}
break;
}
});
};

window.addEventListener('DOMContentLoaded', () => {
chapterNavigation()
})

window.onload = function () {
document.body.setAttribute('tabindex', '-1');
document.body.focus();
};
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ en Rust:

### JavaScript

Consulta todas las [Opciones de diálogo](/references/v2/js/dialog/) en la referencia de la API de JavaScript.
Consulta todas las [Opciones de diálogo](/references/javascript/dialog/) en la referencia de la API de JavaScript.

{/* ASK */}

Expand Down
File renamed without changes.
Loading

0 comments on commit dfc1f3b

Please sign in to comment.