Skip to content

Commit

Permalink
Merge branch 'next' into feat/releases
Browse files Browse the repository at this point in the history
  • Loading branch information
vasfvitor authored Feb 29, 2024
2 parents 4245746 + 62b1d19 commit 7aa3a23
Show file tree
Hide file tree
Showing 117 changed files with 8,835 additions and 1,991 deletions.
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Order is important; the last matching pattern takes the most precedence.
* @tauri-apps/wg-doc

# Disabled until wg-devops has active members
# .github @tauri-apps/wg-devops
7 changes: 5 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[submodule "packages/tauri"]
path = packages/tauri
[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
64 changes: 57 additions & 7 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ const site = 'https://beta.tauri.app';
export default defineConfig({
site,
integrations: [
starlightLinksValidator(),
starlightBlog({ authors }),
starlight({
plugins: [
starlightBlog({ authors }),
starlightLinksValidator({ errorOnRelativeLinks: false }),
],
title: 'Tauri',
description: 'The cross-platform app building toolkit',
logo: {
Expand All @@ -77,6 +79,7 @@ export default defineConfig({
MarkdownContent: 'starlight-blog/overrides/MarkdownContent.astro',
Sidebar: 'starlight-blog/overrides/Sidebar.astro',
Header: 'src/components/overrides/Header.astro',
ThemeSelect: 'src/components/overrides/ThemeSelect.astro',
},
head: [
{
Expand Down Expand Up @@ -162,22 +165,30 @@ export default defineConfig({
{
label: 'References',
items: [
{
label: 'List of References',
link: '/references',
},
{
label: 'Tauri Configuration',
link: '2/reference/config',
link: '/references/v2/config',
},
{
label: 'Access Control List',
link: '/references/v2/acl',
},
{
label: 'Command Line Interface (CLI)',
link: '2/reference/cli',
link: '/references/v2/cli',
},
{
label: 'JavaScript API',
link: '2/reference/js',
link: '/references/v2/js',
},
{
label: 'Rust API (via Docs.rs)',
// TODO: Is there a way to link this to the latest pre-released version?
link: 'https://docs.rs/tauri/~2.0.0-alpha',
link: 'https://docs.rs/tauri/~2.0.0-beta',
},
],
},
Expand All @@ -192,7 +203,7 @@ export default defineConfig({
],
markdown: {
shikiConfig: {
langs: ['powershell', 'ts', 'rust', 'bash', 'json', 'toml'],
langs: ['powershell', 'ts', 'rust', 'bash', 'json', 'toml', 'html', 'js'],
},
rehypePlugins: [
rehypeHeadingIds,
Expand Down Expand Up @@ -239,10 +250,49 @@ export default defineConfig({
'/v1/guides/development/updating-dependencies',
'/guides/develop/updating-dependencies'
),
// v1 /guides/testing -> /guides/test
...i18nRedirect('/v1/guides/testing/mocking', '/guides/test/mocking'),
...i18nRedirect('/v1/guides/testing/webdriver/ci', '/guides/test/webdriver/ci'),
...i18nRedirect('/v1/guides/testing/webdriver/introduction', '/guides/test/webdriver/'),
...i18nRedirect(
'/v1/guides/testing/webdriver/example/setup',
'/guides/test/webdriver/example/setup'
),
...i18nRedirect(
'/v1/guides/testing/webdriver/example/selenium',
'/guides/test/webdriver/example/selenium'
),
...i18nRedirect(
'/v1/guides/testing/webdriver/example/webdriverio',
'/guides/test/webdriver/example/webdriverio'
),

// v1 /references
...i18nRedirect('/v1/references', '/concepts'),
...i18nRedirect('/v1/references/architecture', '/concepts/architecture'),
...i18nRedirect('/v1/references/architecture/process-model', '/concepts/process-model'),
...i18nRedirect('/v1/references/architecture/security', '/concepts/tauri-security'),
...i18nRedirect(
'/v1/references/architecture/inter-process-communication',
'/concepts/inter-process-communication'
),
...i18nRedirect(
'/v1/references/architecture/inter-process-communication/brownfield',
'/concepts/inter-process-communication/brownfield'
),
...i18nRedirect(
'/v1/references/architecture/inter-process-communication/isolation',
'/concepts/inter-process-communication/isolation'
),
...i18nRedirect('/v1/references/security', '/concepts/development-security'),
...i18nRedirect('/v1/references/configuration-files', '/references/configuration-files'),
...i18nRedirect('/v1/references/webview-versions', '/references/webview-versions'),

// Decommissioned locales
'/ko/[...slug]': '/[...slug]',
'/it/[...slug]': '/[...slug]',
},
//
});

// Generates a redirect for each locale.
Expand Down
2 changes: 1 addition & 1 deletion locales.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"lang": "es"
},
"zh-cn": {
"label": "中文(中国)",
"label": "简体中文",
"lang": "zh-CN"
}
}
27 changes: 14 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,33 @@
"version": "0.0.1",
"scripts": {
"dev:setup:submodules": "git submodule update --init",
"dev:setup:tauri": "yarn --cwd packages/tauri/tooling/api",
"dev:setup:tauri-v1": "yarn --cwd packages/tauri-v1/tooling/api",
"dev:setup:tauri-v2": "yarn --cwd packages/tauri-v2/tooling/api",
"dev:setup:plugins-workspace": "pnpm --prefix packages/plugins-workspace install",
"dev:setup": "pnpm dev:setup:submodules && pnpm dev:setup:tauri && pnpm dev:setup:plugins-workspace",
"dev:setup": "pnpm dev:setup:submodules && pnpm dev:setup:tauri-v1 && pnpm dev:setup:tauri-v2 && pnpm dev:setup:plugins-workspace",
"dev": "astro dev",
"format": "prettier -w --cache --plugin prettier-plugin-astro .",
"build:reference": "pnpm --filter js-api-generator run build",
"build:references": "pnpm --filter js-api-generator run build",
"build:releases": "pnpm --filter releases-generator run build",
"build:config": "pnpm --filter config-generator run build",
"build:astro": "astro build",
"build:i18n": "pnpm --filter docs-i18n-tracker run build",
"build": "pnpm dev:setup && pnpm build:reference && pnpm build:config && pnpm build:releases && pnpm build:astro && pnpm build:i18n",
"build": "pnpm dev:setup && pnpm build:references && pnpm build:config && pnpm build:releases && pnpm build:astro && pnpm build:i18n",
"preview": "astro preview"
},
"dependencies": {
"@astrojs/markdown-remark": "^4.0.1",
"@astrojs/starlight": "^0.13.0",
"@astrojs/markdown-remark": "^4.2.1",
"@astrojs/starlight": "^0.20.1",
"@types/json-schema": "^7.0.15",
"astro": "^3.6.4",
"astro": "^4.4.4",
"astro-feelback": "^0.3.4",
"prettier": "^3.1.1",
"prettier-plugin-astro": "^0.12.2",
"prettier": "^3.2.5",
"prettier-plugin-astro": "^0.13.0",
"rehype-autolink-headings": "^7.1.0",
"sharp": "^0.32.6",
"shiki": "^0.14.7",
"starlight-blog": "^0.4.0",
"starlight-links-validator": "^0.4.2"
"sharp": "^0.33.2",
"shiki": "^1.1.7",
"starlight-blog": "^0.5.0",
"starlight-links-validator": "^0.5.3"
},
"pnpm": {
"patchedDependencies": {
Expand Down
40 changes: 24 additions & 16 deletions packages/config-generator/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,35 @@ import { JSONSchema7, JSONSchema7Definition, JSONSchema7TypeName } from 'json-sc
import { existsSync, writeFileSync } from 'node:fs';
import { slug } from 'github-slugger';

const schemaFile = '../tauri/core/tauri-config-schema/schema.json';
const outputFile = '../../src/content/docs/2/reference/config.md';
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'
);

if (!existsSync(schemaFile)) {
throw Error('Could not find the Tauri config schema. Is the Tauri submodule initialized?');
}
async function buildConfig(schemaFile: string, outputFile: string) {
if (!existsSync(schemaFile)) {
throw Error('Could not find the Tauri config schema. Is the Tauri submodule initialized?');
}

let schema: JSONSchema7 = (await import(schemaFile)).default;
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---',
];
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---',
];

output.push(
...buildSchemaDefinition(schema, {
headingLevel: 2,
renderTitle: false,
})
);
output.push(
...buildSchemaDefinition(schema, {
headingLevel: 2,
renderTitle: false,
})
);

writeFileSync(outputFile, output.join('\n\n'));
writeFileSync(outputFile, output.join('\n\n'));
}

interface Options {
headingLevel: number;
Expand Down
4 changes: 2 additions & 2 deletions packages/config-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"license": "MIT",
"dependencies": {
"@types/json-schema": "^7.0.15",
"@types/node": "^20.10.0",
"@types/node": "^20.11.20",
"github-slugger": "^2.0.0",
"tsm": "^2.3.0",
"typescript": "^5.3.2"
"typescript": "^5.3.3"
}
}
4 changes: 2 additions & 2 deletions packages/i18n-tracker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"html-escaper": "^3.0.3",
"kleur": "^4.1.5",
"node-fetch": "^3.3.2",
"p-retry": "^6.1.0",
"simple-git": "^3.21.0",
"p-retry": "^6.2.0",
"simple-git": "^3.22.0",
"tsm": "^2.3.0"
}
}
81 changes: 24 additions & 57 deletions packages/js-api-generator/build.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
Application,
Comment,
DeclarationReflection,
Options,
PageEvent,
Expand All @@ -13,7 +12,6 @@ import {
MarkdownTheme,
MarkdownThemeRenderContext,
type PluginOptions,
load as loadMarkdownPlugin,
} from 'typedoc-plugin-markdown';
import path from 'node:path';
import { slug } from 'github-slugger';
Expand Down Expand Up @@ -47,18 +45,36 @@ const typeDocConfigBaseOptions: Partial<TypeDocOptions | PluginOptions> = {
};

async function generator() {
if (existsSync('../tauri/tooling/api/node_modules')) {
if (existsSync('../tauri-v1/tooling/api/node_modules')) {
const coreJsOptions: Partial<TypeDocOptions> = {
entryPoints: ['../tauri/tooling/api/src/index.ts'],
tsconfig: '../tauri/tooling/api/tsconfig.json',
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',
gitRevision: 'dev',
baseUrl: '/2/reference/js/core/',
baseUrl: '/references/v2/js/core/',
...typeDocConfigBaseOptions,
};

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

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

Expand Down Expand Up @@ -152,59 +168,10 @@ class TauriTheme extends MarkdownTheme {
}

class TauriThemeRenderContext extends MarkdownThemeRenderContext {
#markdownThemeRenderContext: MarkdownThemeRenderContext;

constructor(event: PageEvent<Reflection>, options: Options) {
super(event, options);
this.#markdownThemeRenderContext = new MarkdownThemeRenderContext(event, options);
}

// Formats `@since` to be a single line
override comment: (comment: Comment, headingLevel?: number | undefined) => string = (
comment,
headingLevel
) => {
const filteredComment = { ...comment } as Comment;
filteredComment.blockTags = [];

const customBlockTags = [];

for (const blockTag of comment.blockTags) {
if (blockTag.tag === '@since') {
customBlockTags.push(blockTag);
} else {
filteredComment.blockTags.push(blockTag);
}
}

// Adapted from https://github.com/HiDeoo/starlight-typedoc/pull/15/files for link resolution within summaries
filteredComment.summary = comment.summary.map((part) => {
if (
part.kind === 'inline-tag' &&
(part.tag === '@link' || part.tag === '@linkcode' || part.tag === '@linkplain') &&
part.target instanceof Reflection
) {
const partURL = this.relativeURL(part.target.url);

if (partURL) {
return { ...part, target: partURL };
}
}

return part;
});

let markdown = this.#markdownThemeRenderContext.comment(filteredComment, headingLevel);

for (const customCommentTag of customBlockTags) {
markdown += `\n**Since**: ${customCommentTag.content
.map((content) => content.text)
.join(', ')}\n\n`;
}

return markdown;
};

// Formats `@source` to be a single line
override sources: (
reflection: DeclarationReflection | SignatureReflection,
Expand Down
Loading

0 comments on commit 7aa3a23

Please sign in to comment.