mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
<!--
Make sure you've read the CONTRIBUTING.md guidelines:
https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md
-->
<!-- ELLIPSIS_HIDDEN -->
----
> [!IMPORTANT]
> This pull request updates the Stack Auth documentation structure,
enhances navigation and layout functionalities, and introduces new
components for improved user experience.
>
> - **Behavior**:
> - Introduces `PlatformRedirect` component in `platform-redirect.tsx`
for redirecting users to their preferred platform.
> - Adds `usePlatformPreference` hook in `use-platform-preference.ts`
for managing platform preferences.
> - Updates `getSmartRedirectUrl()` in `navigation-utils.ts` to use
`getSmartPlatformRedirect()`.
> - **Layout and Navigation**:
> - Enhances sidebar functionality with collapsible sections in
`docs.tsx` and `sidebar-context.tsx`.
> - Adds `DocsSidebarCollapseTrigger` in `docs.tsx` for sidebar
collapse/expand functionality.
> - Updates `SharedHeader` in `shared-header.tsx` to include
platform-aware navigation links.
> - **Documentation Structure**:
> - Updates `meta.json` files in `templates` to reflect new
documentation structure.
> - Renames `overview.mdx` to `index.mdx` in `sdk` and `components`
directories.
> - Adds detailed documentation for `Team`, `TeamUser`, and
`ContactChannel` in respective `.mdx` files.
>
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=stack-auth%2Fstack-auth&utm_source=github&utm_medium=referral)<sup>
for 21e55737cb. You can
[customize](https://app.ellipsis.dev/stack-auth/settings/summaries) this
summary. It will automatically update as commits are pushed.</sup>
<!-- ELLIPSIS_HIDDEN -->
---------
Co-authored-by: Stack-Bot <[email protected]>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: Konsti Wohlwend <[email protected]>
59 lines
1.6 KiB
JavaScript
59 lines
1.6 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
import fs from 'fs';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
// Get __dirname equivalent in ES modules
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
/**
|
|
* Recursively remove all files and directories within a directory
|
|
* but keep the directory itself
|
|
*/
|
|
function clearDirectory(dirPath) {
|
|
if (!fs.existsSync(dirPath)) {
|
|
console.log(`Directory ${dirPath} does not exist.`);
|
|
return;
|
|
}
|
|
|
|
const items = fs.readdirSync(dirPath);
|
|
|
|
for (const item of items) {
|
|
const itemPath = path.join(dirPath, item);
|
|
const stat = fs.statSync(itemPath);
|
|
|
|
if (stat.isDirectory()) {
|
|
// Recursively remove directory and all its contents
|
|
fs.rmSync(itemPath, { recursive: true, force: true });
|
|
console.log(`Removed directory: ${itemPath}`);
|
|
} else {
|
|
// Remove file
|
|
fs.unlinkSync(itemPath);
|
|
console.log(`Removed file: ${itemPath}`);
|
|
}
|
|
}
|
|
}
|
|
|
|
function main() {
|
|
const docsPath = path.join(__dirname, '..', 'content', 'docs');
|
|
const apiDocsPath = path.join(__dirname, '..', 'content', 'api');
|
|
|
|
console.log('🧹 Clearing all files and directories in content/docs, and content/api');
|
|
console.log(`Target directory: ${docsPath}`);
|
|
console.log(`Target directory: ${apiDocsPath}`);
|
|
|
|
try {
|
|
clearDirectory(docsPath);
|
|
clearDirectory(apiDocsPath);
|
|
console.log('✅ Successfully cleared content/docs directory!');
|
|
} catch (error) {
|
|
console.error('❌ Error clearing content/docs directory:', error.message);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
// Run the script
|
|
main();
|