### Local Development Setup for TuvixRSS (Bash) Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/deployment.md This snippet covers the steps for setting up TuvixRSS for local development without Docker. It includes installing dependencies, running database migrations, and starting the API and frontend services separately or together. ```bash # Install dependencies pnpm install # Run database migrations pnpm run db:migrate # Start both API and frontend pnpm run dev # Or start separately: pnpm run dev:api # API on :3001 pnpm run dev:app # Frontend on :5173 ``` -------------------------------- ### Development Setup for Tuvix-RSS Source: https://github.com/techsquidtv/tuvix-rss/blob/main/README.md Guides users through setting up the development environment for Tuvix-RSS. It requires Node.js 20+ with pnpm and SQLite3. The process involves installing dependencies, copying and configuring the environment file, migrating the database, and starting the development server. ```bash pnpm install cp env.example .env # Edit .env and set BETTER_AUTH_SECRET, ADMIN_* credentials pnpm run db:migrate pnpm run dev ``` -------------------------------- ### Local Development Setup: wrangler.toml.local Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/deployment.md This bash command demonstrates the recommended approach for local development setup. It involves copying an example configuration file and then editing it to include specific local settings, such as the D1 database ID. This method ensures that local configurations do not interfere with version control. ```bash cd packages/api # Copy the example file cp wrangler.toml.local.example wrangler.toml.local # Edit wrangler.toml.local and replace "your-database-id-here" with your actual D1 database ID # Example: database_id = "7078240d-69e3-46fb-bb21-aa8e5208de9b" ``` -------------------------------- ### Vitest Database Setup Utilities in TypeScript Source: https://github.com/techsquidtv/tuvix-rss/blob/main/packages/api/src/test/README.md Demonstrates the usage of database setup utilities for testing, including creating, cleaning up, and seeding a test database with user and plan data. ```typescript import { createTestDb, cleanupTestDb, seedTestUser, seedTestPlan, } from "@/test/setup"; // Create in-memory test database const db = createTestDb(); // Seed test data const { user, plainPassword } = await seedTestUser(db, { username: "testuser", email: "test@example.com", role: "admin", }); // Clean up after tests cleanupTestDb(db); ``` -------------------------------- ### Local Development Setup: wrangler.toml Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/deployment.md This bash command shows an alternative method for local development setup. It involves copying the main example configuration file directly to `wrangler.toml` and then editing it to replace placeholder values. This file is gitignored to prevent accidental commits of sensitive information. ```bash cd packages/api # Copy the example to wrangler.toml cp wrangler.example.toml wrangler.toml # Edit wrangler.toml and replace ${D1_DATABASE_ID} with your actual database ID # Note: wrangler.toml is gitignored, so your values won't be committed ``` -------------------------------- ### Docker Compose Deployment for Tuvix-RSS Source: https://github.com/techsquidtv/tuvix-rss/blob/main/README.md Provides instructions to clone the repository, navigate to the directory, copy the environment example, configure necessary credentials in the .env file, and start the Docker containers in detached mode. Assumes Docker and Docker Compose are installed. ```bash git clone https://github.com/TechSquidTV/Tuvix-RSS.git cd Tuvix-RSS cp env.example .env # Edit .env and configure: # 1. BETTER_AUTH_SECRET (generate: openssl rand -base64 32) # 2. ADMIN_USERNAME, ADMIN_EMAIL, ADMIN_PASSWORD (for your admin user) docker compose up -d ``` -------------------------------- ### Install Dependencies and Run Development Servers (Bash) Source: https://github.com/techsquidtv/tuvix-rss/blob/main/CONTRIBUTING.md Commands to clone the repository, install project dependencies using pnpm, set up environment variables, run database migrations, and start the development servers for both the API and the app. Requires Node.js 20+ and SQLite3. ```bash git clone https://github.com/YOUR_USERNAME/Tuvix-RSS.git cd Tuvix-RSS pnpm install cp env.example .env # Edit .env and set BETTER_AUTH_SECRET # Generate with: openssl rand -base64 32 pnpm run db:migrate pnpm run dev ``` -------------------------------- ### Basic Vitest Test Example in TypeScript Source: https://github.com/techsquidtv/tuvix-rss/blob/main/packages/api/src/test/README.md An example demonstrating a basic test structure using Vitest in TypeScript. It includes setup and teardown with database operations and assertions on function results. ```typescript import { describe, it, expect, beforeEach, afterEach } from "vitest"; import { createTestDb, cleanupTestDb, seedTestUser } from "@/test/setup"; import { someFunction } from "./your-module"; describe("someFunction", () => { let db: ReturnType; beforeEach(() => { db = createTestDb(); }); afterEach(() => { cleanupTestDb(db); }); it("should do something", async () => { // Arrange const { user } = await seedTestUser(db); // Act const result = await someFunction(db, user.id); // Assert expect(result).toBeDefined(); expect(result.id).toBe(user.id); }); }); ``` -------------------------------- ### Database Setup and Migration with Wrangler Source: https://github.com/techsquidtv/tuvix-rss/blob/main/packages/api/README.md Guides through the process of creating a D1 database, configuring it for local development or CI/CD, and running database migrations using Wrangler and pnpm. ```bash # 1. Create database wrangler d1 create tuvix # 2. Configure for local development: # Option A: Create wrangler.toml.local (recommended) cp wrangler.toml.local.example wrangler.toml.local # Edit wrangler.toml.local and add your database_id # Option B: Set environment variable export D1_DATABASE_ID="" # For CI/CD: Set GitHub secret gh secret set D1_DATABASE_ID --body "" # 3. Run migrations pnpm db:migrate:d1 ``` -------------------------------- ### Clone and Configure TuvixRSS Repository (Bash) Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/deployment.md This snippet guides through cloning the TuvixRSS repository, setting up the environment file, and generating a secure secret for Better Auth. It highlights essential environment variables for local development and admin user setup. ```bash git clone https://github.com/yourusername/TuvixRSS.git cd TuvixRSS cp .env.example .env openssl rand -base64 32 vim .env ``` -------------------------------- ### Browser Extension Dependency Installation (Bash) Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/architecture/tricorder-npm-publishing.md Command to install the Tricorder package in a browser extension project using npm. This is used when the package is published to a registry. ```bash npm install @tuvixrss/tricorder ``` -------------------------------- ### Starting Development Servers (Bash) Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/developer/project-integration.md These bash commands illustrate how to start the development servers for the Tuvix RSS project. `pnpm dev` starts both the API and application, while `pnpm dev:api` and `pnpm dev:app` start them independently on their respective ports. ```bash # Start both API and app pnpm dev # Or individually: pnpm dev:api # Starts on http://localhost:3001 pnpm dev:app # Starts on http://localhost:5173 ``` -------------------------------- ### Docker Compose Database Migrations Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/deployment.md This snippet shows how database migrations are automatically handled when Docker containers start. It executes local migration scripts before starting the main application. Manual migration commands are also provided. ```bash CMD ["sh", "-c", "node dist/db/migrate-local.js && node dist/adapters/express.js"] ``` ```bash # From host pnpm run db:migrate # From container docker compose exec api node dist/db/migrate-local.js ``` -------------------------------- ### Local Development Workflow Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/deployment.md Instructions for setting up and running the API (Workers) and Frontend locally. This includes starting the local Workers runtime, D1 database, and frontend development server. It also covers running tests locally. ```bash # API (Workers) cd packages/api pnpm run dev:workers # Starts: Local Workers runtime (Miniflare), Local D1 database, Auto-reload # Frontend cd packages/app pnpm run dev # Frontend runs on http://localhost:5173 # Points to API at VITE_API_URL (default: http://localhost:3001/trpc) # Testing pnpm run test npx wrangler dev # Test Workers locally npx wrangler dev --test-scheduled # Test cron trigger locally ``` -------------------------------- ### Configure Trusted Publisher for GitHub Actions (Bash) Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/architecture/tricorder-npm-publishing.md Command to configure a trusted publisher for GitHub Actions on npmjs.com. This is a one-time setup required before the first publish. ```bash gh api repos/:owner/:repo/environments/npm-registry --method PUT --field "wait_timer=0" ``` -------------------------------- ### Theme-Specific CSS Rules Example Source: https://github.com/techsquidtv/tuvix-rss/blob/main/packages/app/src/lib/themes/README.md Shows how to apply theme-specific styles using data attributes. This example targets the 'material' theme and applies a border: none style to elements with the `data-slot='card'` attribute. ```css .material [data-slot="card"] { border: none; /* Material theme: flat design, no borders */ } ``` -------------------------------- ### Vitest Test Helper Utilities in TypeScript Source: https://github.com/techsquidtv/tuvix-rss/blob/main/packages/api/src/test/README.md Shows examples of using various test helper functions for generating test data, asserting errors, and mocking console output. ```typescript import { generateTestEmail, expectError, mockConsole } from "@/test/helpers"; // Generate unique test data const email = generateTestEmail("mytest"); // Assert errors await expectError(async () => { await functionThatShouldThrow(); }, "Expected error message"); // Mock console output const consoleMock = mockConsole(); // ... code that logs to console ... consoleMock.restore(); ``` -------------------------------- ### Install Dependencies, Build, and Test Source: https://github.com/techsquidtv/tuvix-rss/blob/main/packages/tricorder/README.md Contains commands for local development of the @tuvixrss/tricorder project. It covers installing dependencies with pnpm, building the project, running tests, and performing type checking. ```bash # Install dependencies pnpm install # Build pnpm run build # Run tests pnpm run test # Type check pnpm run type-check ``` -------------------------------- ### List Articles Response Example Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/developer/project-integration.md An example JSON response for the `/trpc/articles.list` request, showing a list of articles with their details, including metadata and source information. ```json { "result": { "data": [ { "id": 1, "title": "Article Title", "description": "Article description...", "link": "https://example.com/article", "pubDate": "2025-01-13T00:00:00.000Z", "read": false, "saved": false, "source": { "id": 1, "title": "Example Blog", "url": "https://example.com/feed.xml" } } ] } } ``` -------------------------------- ### Implementing Theme Switching UI in React Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/developer/theme-system.md Provides a React component example for allowing users to switch between different available themes. It utilizes the `useTheme` hook to get the current theme and the `setTheme` function to update it. The component renders a select dropdown populated with theme options, including system preference. ```tsx import { useTheme } from "@/components/provider/theme-provider"; export function ThemeSwitcher() { const { theme, setTheme } = useTheme(); return ( ); } ``` -------------------------------- ### Login Request Example Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/developer/project-integration.md Shows an example of a POST request to the `/trpc/auth.login` endpoint for user authentication, including request headers and a JSON payload with username and password. ```http POST /trpc/auth.login HTTP/1.1 Host: localhost:3001 Content-Type: application/json { "username": "john", "password": "secure123" } ``` -------------------------------- ### List Articles Request Example Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/developer/project-integration.md An example of an authenticated POST request to `/trpc/articles.list` to retrieve a list of articles with pagination and filtering. Includes necessary headers and a JSON body. ```http POST /trpc/articles.list HTTP/1.1 Host: localhost:3001 Cookie: better-auth.session_token=... Content-Type: application/json { "offset": 0, "limit": 50, "filter": "unread" } ``` -------------------------------- ### PWA Install Prompt Component (React/TypeScript) Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/developer/pwa.md A UI component for displaying the PWA install prompt to the user. It utilizes the `usePwaInstall` hook to manage visibility and user interactions. ```typescript import React from 'react'; import { usePwaInstall } from '../hooks/use-pwa-install'; interface PwaInstallPromptProps { className?: string; } export const PwaInstallPrompt: React.FC = ({ className, }) => { const { supportsPwa, installPwa, dismiss } = usePwaInstall({ onClose: () => { /* Custom close logic if needed */ }, }); if (!supportsPwa) { return null; } return (

Install this app to your device for offline access and better experience.

); }; ``` -------------------------------- ### Vitest Unit Test Example for Password Strength in TypeScript Source: https://github.com/techsquidtv/tuvix-rss/blob/main/packages/api/src/test/README.md A unit test example written in TypeScript using Vitest to test a function that calculates password strength, checking different scenarios. ```typescript describe("calculatePasswordStrength", () => { it("should return weak for short passwords", () => { const result = calculatePasswordStrength("abc"); expect(result.strength).toBe("weak"); expect(result.score).toBeLessThan(40); }); it("should return strong for complex passwords", () => { const result = calculatePasswordStrength("MyP@ssw0rd123!"); expect(result.strength).toBe("strong"); expect(result.score).toBeGreaterThan(80); }); }); ``` -------------------------------- ### Contributor Quick Start for Tuvix-RSS Source: https://github.com/techsquidtv/tuvix-rss/blob/main/README.md Outlines the initial steps for contributors to start working on the Tuvix-RSS project. This includes forking the repository, creating a feature branch, making changes, committing with conventional commits, pushing to the fork, and opening a pull request targeting the 'main' branch. ```bash git clone https://github.com/YOUR_USERNAME/Tuvix-RSS.git cd Tuvix-RSS pnpm install cp env.example .env # Edit .env and configure BETTER_AUTH_SECRET and ADMIN_* credentials pnpm run db:migrate pnpm run dev ``` -------------------------------- ### Initialize Admin User via API Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/deployment.md Shows how to initialize the admin user by sending a POST request to the initialization endpoint. This step is crucial for setting up the first administrative account in the system. ```bash curl -X POST https://api.example.com/_admin/init ``` -------------------------------- ### Production Deployment Workflow Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/deployment.md Steps for deploying the API (Workers) and Frontend to production. Includes pre-deployment checks, database migrations, building artifacts, and deploying to Cloudflare. Also shows how to verify deployment with health checks. ```bash # Pre-Deployment pnpm run type-check pnpm run test # Deploy API cd packages/api pnpm run db:migrate:d1 # Run migrations pnpm run build pnpm run deploy # Deploy Frontend cd packages/app export VITE_API_URL=https://api.example.com/trpc pnpm run build npx wrangler pages deploy dist --project-name=tuvix-app # Verify curl https://api.example.com/health curl https://feed.example.com/health ``` -------------------------------- ### OKLCH Color Space Example (Good vs. Avoid) Source: https://github.com/techsquidtv/tuvix-rss/blob/main/packages/app/src/lib/themes/README.md No description ```typescript // ✅ Good background: "oklch(0.2 0.05 250)"; // ❌ Avoid background: "#333333"; ``` -------------------------------- ### Testing Strategy Update (TypeScript) Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/planning/auth-architecture-improvements.md Illustrates the simplified testing approach after adopting tRPC. The 'Before' example shows complex mocking of a specific client. The 'After' example demonstrates a more straightforward tRPC mock setup, applicable to both frontend and backend tests. ```typescript // Frontend: Mock Better Auth client vi.mock("@/lib/auth-client"); // Backend: Test tRPC endpoint (unused by frontend) // Frontend: Mock tRPC client const mockTrpc = createMockTrpc(); // Backend: Same tests work (used by frontend) ``` -------------------------------- ### Other Projects Usage of Tricorder (TypeScript) Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/architecture/tricorder-npm-publishing.md Example of importing and using functions from the Tricorder package in a general TypeScript project. It demonstrates importing both `discoverFeeds` and `createDefaultRegistry`. ```typescript import { discoverFeeds, createDefaultRegistry } from "@tuvixrss/tricorder"; ``` -------------------------------- ### Browser Extension Usage of Tricorder (TypeScript) Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/architecture/tricorder-npm-publishing.md Example of importing and using the `discoverFeeds` function from the Tricorder package within a TypeScript project, such as a browser extension. ```typescript import { discoverFeeds } from "@tuvixrss/tricorder"; // Zero telemetry, zero overhead const feeds = await discoverFeeds(url); ``` -------------------------------- ### Start Email Template Preview Server Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/developer/email-system.md Starts a local development server for previewing email templates built with React Email. This server allows for real-time viewing and testing of templates in a browser. It's typically run from the project root or the packages/api directory. ```bash # From project root pnpm run email:preview # Or from packages/api directory cd packages/api pnpm run email:preview ``` -------------------------------- ### TypeScript Theme Registration Example Source: https://github.com/techsquidtv/tuvix-rss/blob/main/packages/app/src/lib/themes/README.md Registers all available themes in a Record, mapping theme IDs to their configuration objects. Includes special handling for a 'system' theme that resolves to light or dark based on OS preferences. ```typescript export const themes: Record = { light: lightTheme, dark: darkTheme, nord: nordTheme, material: materialTheme, system: lightTheme, // Special: resolves to light/dark based on OS }; ``` -------------------------------- ### Vitest Test for Handling Authentication Errors in TypeScript Source: https://github.com/techsquidtv/tuvix-rss/blob/main/packages/api/src/test/README.md An example test case in TypeScript using Vitest and helper utilities to verify that authentication errors are handled correctly. ```typescript it("should handle authentication errors", async () => { await expectError(() => someAuthFunction("invalid-input"), "UNAUTHORIZED"); }); ``` -------------------------------- ### Get User Details Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/guides/admin/admin-guide.md Fetches detailed information for a specific user, identified by their user ID. The returned data includes username, email, plan, usage statistics, and limits (both plan-based and custom). ```typescript const user = await client.admin.getUser.query({ userId: 123 }); console.log(user.username, user.email, user.plan); console.log("Usage:", user.usage); console.log("Limits:", user.limits); console.log("Custom Limits:", user.customLimits); ``` -------------------------------- ### Cloudflare Worker Settings Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/deployment.md Configuration details for Cloudflare Workers, including CPU limit, memory allocation, and cron trigger setup via `wrangler.toml`. Essential for optimizing worker performance and scheduling. ```toml # Cron Triggers: Configured via `wrangler.toml` (`*/5 * * * *`) ``` -------------------------------- ### TypeScript Theme Configuration Example Source: https://github.com/techsquidtv/tuvix-rss/blob/main/packages/app/src/lib/themes/README.md Defines a theme's visual properties including colors, fonts, and radius. Implements the ThemeConfig interface, using oklch() for color definitions. Supports optional custom properties like button radius. ```typescript export const lightTheme: ThemeConfig = { id: "light", name: "Light", description: "Clean and bright theme", colors: { background: "oklch(1 0 0)", foreground: "oklch(0.145 0 0)", // ... more colors }, fonts: { sans: "system-ui, -apple-system, ...", mono: "ui-monospace, SFMono-Regular, ...", }, radius: { value: "0.625rem", button: "0.625rem", // Optional: custom button radius }, grain: { opacity: 0.06, }, }; ``` -------------------------------- ### Vitest Async Test for Fetching RSS Feed in TypeScript Source: https://github.com/techsquidtv/tuvix-rss/blob/main/packages/api/src/test/README.md An asynchronous test example in TypeScript using Vitest to verify the functionality of fetching and parsing an RSS feed, using mocked network responses. ```typescript it("should fetch and parse RSS feed", async () => { global.fetch = mockFetchRssFeed(); const result = await fetchSingleFeed(1, "https://example.com/feed.xml", db); expect(result.articlesAdded).toBeGreaterThan(0); }); ``` -------------------------------- ### Express.ts Adapter Initialization Source: https://github.com/techsquidtv/tuvix-rss/blob/main/packages/api/README.md Illustrates the initialization of the Express.js adapter for the tRPC API. This file would typically contain the setup for the Express server, middleware, and the tRPC router integration, along with starting cron jobs. ```typescript // Example structure (actual code not provided in text) import express from 'express'; import { createExpressMiddleware } from '@trpc/server/adapters/express'; import { appRouter, createContext } from './trpc/router'; import './cron/scheduler'; // Assuming scheduler initializes cron jobs const app = express(); app.use( '/trpc', createExpressMiddleware({ router: appRouter, createContext, }) ); // Health check endpoint app.get('/health', (req, res) => { res.status(200).send('OK'); }); const PORT = process.env.PORT || 3001; app.listen(PORT, () => { console.log(`Server listening on http://localhost:${PORT}`); }); ``` -------------------------------- ### Develop Cloudflare Workers API Locally Source: https://github.com/techsquidtv/tuvix-rss/blob/main/packages/api/README.md Starts a local development environment for Cloudflare Workers using `wrangler dev`. This setup includes a local D1 database and allows for testing cron trigger functionality. ```bash # Start local Workers environment pnpm dev:workers ``` -------------------------------- ### Cloudflare Entry Point Export (TypeScript) Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/planning/queue-based-feed-fetching.md Example of how to export the newly created feed consumer from the Cloudflare entry point file. This ensures the consumer is recognized and available for Cloudflare Queues. It complements an existing default export for HTTP requests. ```typescript // packages/api/src/entries/cloudflare.ts (add queue consumer export) import feedConsumer from "@/queue/consumers/feed-consumer"; // Existing default export for HTTP requests export default Sentry.withSentry(/* ... */); // NEW: Export queue consumer for Cloudflare Queues export { feedConsumer as queue }; ``` -------------------------------- ### Vitest Integration Test for User Source Limits in TypeScript Source: https://github.com/techsquidtv/tuvix-rss/blob/main/packages/api/src/test/README.md An integration test example in TypeScript using Vitest to verify user source limits enforcement, seeding data and checking the limit enforcement logic. ```typescript describe("User limits integration", () => { let db: ReturnType; beforeEach(async () => { db = createTestDb(); await seedTestPlan(db, { id: "free", maxSources: 5 }); }); it("should enforce source limits", async () => { const { user } = await seedTestUser(db, { plan: "free" }); // Create 5 sources (at limit) for (let i = 0; i < 5; i++) { const source = await seedTestSource(db, { url: `https://example.com/feed${i}.xml`, }); await seedTestSubscription(db, user.id, source.id); } // Try to add one more (should fail) const limitCheck = await checkSourceLimit(db, user.id); expect(limitCheck.allowed).toBe(false); }); }); ``` -------------------------------- ### Enable First User Admin Registration (Bash) Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/guides/admin/admin-guide.md This configuration allows the very first user to register to automatically gain administrator privileges. It requires setting the `ALLOW_FIRST_USER_ADMIN` environment variable to `true` in the `.env` file. ```bash # .env ALLOW_FIRST_USER_ADMIN=true ``` -------------------------------- ### Vitest Mocking Fetch API in TypeScript Source: https://github.com/techsquidtv/tuvix-rss/blob/main/packages/api/src/test/README.md Illustrates how to mock the global fetch API for testing purposes, using provided mock functions and data to simulate network responses. ```typescript import { mockFetchRssFeed, MOCK_RSS_FEED, MOCK_BETTER_AUTH_SECRET, } from "@/test/mocks"; // Mock fetch for RSS feeds global.fetch = mockFetchRssFeed(); // Use mock data const response = await fetch("https://example.com/feed.xml"); const text = await response.text(); ``` -------------------------------- ### Set Admin Credentials via Wrangler Secrets Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/deployment.md Demonstrates how to set essential administrative credentials (username, email, password) as secrets using the Wrangler CLI. These secrets are required for the initial setup and authentication of the admin user. ```bash # Ensure all three admin secrets are set npx wrangler secret list # Should show: ADMIN_USERNAME, ADMIN_EMAIL, ADMIN_PASSWORD # If missing, set them: npx wrangler secret put ADMIN_USERNAME npx wrangler secret put ADMIN_EMAIL npx wrangler secret put ADMIN_PASSWORD ``` -------------------------------- ### Create Cloudflare Pages Project (Wrangler CLI) Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/deployment.md Creates a new Cloudflare Pages project for the Tuvix-RSS frontend using the Wrangler CLI. Includes building the frontend and deploying it to the created project. Requires Wrangler CLI and pnpm. ```bash # Create the Pages project (first time only) npx wrangler pages project create tuvix-app # Build and deploy cd packages/app export VITE_API_URL=https://api.example.com/trpc # Or if not using custom domain: https://your-worker.workers.dev/trpc pnpm run build npx wrangler pages deploy dist --project-name=tuvix-app ``` -------------------------------- ### Monitor Cron Execution using Wrangler CLI Source: https://github.com/techsquidtv/tuvix-rss/blob/main/docs/deployment.md This command uses the Wrangler CLI to search for logs related to cron job triggers in Cloudflare Workers. It helps in monitoring and debugging scheduled tasks. Ensure you have Wrangler CLI installed and configured for your Cloudflare account. ```bash npx wrangler tail --search "Cron triggered" ``` -------------------------------- ### Integrate ESLint for React and React DOM Rules (TypeScript) Source: https://github.com/techsquidtv/tuvix-rss/blob/main/packages/app/README.md This snippet shows how to integrate `eslint-plugin-react-x` and `eslint-plugin-react-dom` into an ESLint configuration for a Vite project. It enables recommended lint rules specifically for React and React DOM components, alongside type-aware TypeScript rules. ```javascript // eslint.config.js import reactX from "eslint-plugin-react-x"; import reactDom from "eslint-plugin-react-dom"; export default defineConfig([ globalIgnores(["dist"]), { files: ["**/*.{ts,tsx}"], extends: [ // Other configs... // Enable lint rules for React reactX.configs["recommended-typescript"], // Enable lint rules for React DOM reactDom.configs.recommended, ], languageOptions: { parserOptions: { project: ["./tsconfig.node.json", "./tsconfig.app.json"], tsconfigRootDir: import.meta.dirname, }, // other options... }, }, ]); ``` -------------------------------- ### Expand ESLint Configuration for Type-Aware Rules (TypeScript) Source: https://github.com/techsquidtv/tuvix-rss/blob/main/packages/app/README.md This snippet demonstrates how to expand the ESLint configuration in a Vite project to include type-aware lint rules for TypeScript files. It replaces the default recommended rules with stricter, type-checked configurations and specifies project configuration files. ```javascript export default defineConfig([ globalIgnores(["dist"]), { files: ["**/*.{ts,tsx}"], extends: [ // Other configs... // Remove tseslint.configs.recommended and replace with this tseslint.configs.recommendedTypeChecked, // Alternatively, use this for stricter rules tseslint.configs.strictTypeChecked, // Optionally, add this for stylistic rules tseslint.configs.stylisticTypeChecked, // Other configs... ], languageOptions: { parserOptions: { project: ["./tsconfig.node.json", "./tsconfig.app.json"], tsconfigRootDir: import.meta.dirname, }, // other options... }, }, ]); ```