Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,30 @@ const config = {
enableSidePanel: true,
},
},
plugins: [
[
'@signalwire/docusaurus-plugin-llms-txt',
/** @type {import('@signalwire/docusaurus-plugin-llms-txt').PluginOptions} */
({
siteTitle: 'React Native ExecuTorch',
siteDescription:
"React Native ExecuTorch brings Meta's ExecuTorch AI framework into the React Native ecosystem, enabling developers to run AI models and LLMs locally, directly on mobile devices. It provides a declarative API for on-device inference, allowing you to use local AI models without relying on cloud infrastructure. Built on the ExecuTorch foundation - part of the PyTorch Edge ecosystem - it extends efficient on-device AI deployment to cross-platform mobile applications in React Native.",
depth: 3,
enableDescriptions: true,
content: {
includeVersionedDocs: false,
relativePaths: false,
enableMarkdownFiles: false,
excludeRoutes: ['**/react-native-executorch/search'],
},
includeOrder: [
'**/docs/!(category|benchmarks)**',
'**/docs/benchmarks/**',
'**/docs/category/**',
],
}),
],
],
};

module.exports = config;
4 changes: 3 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build": "docusaurus build",
"build": "docusaurus build && npm run postbuild",
"postbuild": "node scripts/postbuild.mjs",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
Expand All @@ -25,6 +26,7 @@
"@emotion/styled": "^11.14.1",
"@mdx-js/react": "^3.0.0",
"@mui/material": "^7.3.7",
"@signalwire/docusaurus-plugin-llms-txt": "^1.2.2",
"@swmansion/t-rex-ui": "^1.2.1",
"clsx": "^2.1.0",
"copy-text-to-clipboard": "^3.2.2",
Expand Down
19 changes: 19 additions & 0 deletions docs/scripts/postbuild.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { join, dirname } from 'path';
import { fileURLToPath } from 'url';
import { fixLLMsTxtDuplicatedPaths } from './tasks/fix-llms-txt.mjs';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const BUILD_DIR = join(__dirname, '..', 'build');

async function postbuild() {
try {
fixLLMsTxtDuplicatedPaths(BUILD_DIR);
console.log('All post-build tasks completed successfully.\n');
} catch (error) {
console.error('\nPost-build script failed:', error);
process.exit(1);
}
}

postbuild();
38 changes: 38 additions & 0 deletions docs/scripts/tasks/fix-llms-txt.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { existsSync, readFileSync, writeFileSync } from 'fs';
import { join, dirname } from 'path';
import { fileURLToPath } from 'url';

export { fixLLMsTxtDuplicatedPaths };

const FILES_TO_FIX = ['llms.txt'];
const DUPLICATED_PATH = '/react-native-executorch/react-native-executorch/';
const FIXED_PATH = '/react-native-executorch/';

function fixLLMsTxtDuplicatedPaths(buildDir) {
console.log('Running LLMS.txt fix script...');
console.log(`Looking in: ${buildDir}`);

FILES_TO_FIX.forEach((fileName) => {
const filePath = join(buildDir, fileName);

if (existsSync(filePath)) {
try {
const content = readFileSync(filePath, 'utf8');

if (content.includes(DUPLICATED_PATH)) {
const fixedContent = content.replaceAll(DUPLICATED_PATH, FIXED_PATH);

writeFileSync(filePath, fixedContent, 'utf8');
console.log(`Fixed URLs in ${fileName}`);
} else {
console.info(`No broken URLs found in ${fileName}`);
}
} catch (err) {
console.error(`Could not process ${fileName}:`, err);
process.exit(1);
}
} else {
console.warn(`File ${fileName} not found`);
}
});
}
Loading