shlogg · Early preview
Ramu Narasinga @karthik-m22

I study large open-source projects and create content about their codebase architecture and best practices, sharing it through articles, videos.

Understanding Refine's .cursorignore File For AI-Driven Development

.cursorignore` in Refine codebase excludes files from AI features & indexing, similar to `.gitignore`, but with a best-effort approach. It's used to prevent sensitive secrets and proprietary code access by AI.

Warn-once: Print Warnings Exactly Once In Development

warnOnce(package, 'warning message') prints a warning exactly once in dev mode. Install with npm install warn-once for deprecation warnings & more! Only shown if NODE_ENV isn't "production".

Refine Telemetry Component Explained In 60 Characters

Refine's Telemetry component sends usage data to refine.dev, encoding payload with JSON.stringify & base64, using transport function which falls back to Image or fetch if available.

UseDeepMemo Imported From @hooks/deepMemo

useDeepMemo` imported from `@hooks/deepMemo`, memoizes dependencies with deep equality, returning same value on unchanged deps. Used in Refine's query client creation.

Optimizing React-Scan Code For Efficient Highlighting And Resizing

React-Scan code review: `createHighlightCanvas` creates a canvas for highlighting elements, handling resize events & updating canvas dimensions. Cleanup involves removing duplicate resize listeners to avoid memory leaks.

Software Engineering: Property Mangling In Preact And Microbundle

Preact's mangle.json enables property mangling, compressing property names to reduce size. Configured in package.json or a separate file, it uses Terser and regular expressions to shorten property names.

Oxlint: 50-100 Times Faster Than ESLint For Code Linting

Oxlint is a linter 50-100 times faster than ESLint, with over 480 rules. It's designed to catch errors without config & scales with CPU cores. Used in Preact source code as "oxlint": "oxlint -c oxlint.json src test/browser...

Understanding Signals In React-Scan: A State Management Primer

React-Scan uses Preact's Signals for state management. Signals are reactive primitives that automatically update components & UI when state changes, providing excellent ergonomics & performance.

Preact Used In React-scan Source Code Analysis.

Preact is a fast 3kB alternative to React with the same modern API. It's used in react-scan source code, mainly for its performance and efficiency features. Approximately 38 files use Preact, but only one file imports from "react".

Node Version Check In Father CLI: Ensuring Compatibility

checkNodeVersion() checks if node version is >= MIN_NODE_VERSION (except v15 or v17). If not, it logs an error and exits the process with code 1.

Setting Up A CLI Tool With TypeScript And Turborepo

Building a CLI tool for Next.js projects. Created a monorepo with `pnpm` and set up `tsconfig.json` using `@repo/typescript-config`. Added `tsup` to bundle TypeScript code.

Understanding UseSyncExternalStore In TipTap Editor

useSyncExternalStore used in TipTap's EditorContent, useEditorState & useEditor to sync editor instance with component state for performance reasons.

Understanding FlushSync In React Codebases

TipTap's ReactRenderer uses `flushSync` to force DOM updates synchronously, fixing a cursor positioning issue on first render. `flushSync` is uncommon and can hurt performance.

Checking Class Components In React With IsClassComponent Function

isClassComponent function checks if a React Component is a class component. It returns true if the Component is a function with an isReactComponent property.

Understanding Grida's __useInternal() Function In React Canvas

Exploring Grida's __useInternal() function, which provides state and dispatch to child components within a StandaloneDocumentEditor.

Decoding Grida's Toolbar_value_to_cursormode Function

In Grida source code, `toolbar_value_to_cursormode` function converts toolbar value to cursor mode using switch-case. It returns an object with type and node/tool properties based on the input value.

What SetCursorMode Does In Grida Source Code

setCursorMode in Grida source code sets cursor mode by dispatching an object with type "surface/cursor-mode" and cursor_mode to the _useInternal hook.

Locating The /canvas Route In Grida's Large Codebase

Found /canvas route in Grida codebase. Located in apps/forms, under dev route group, canvas/page.tsx has dynamic import of PlaygroundCanvas component from @/scaffolds/playground-canvas/playground.

Exploring ListRecursively Function In Unbuild/src/utils.ts

listRecursively function in unbuild/src/utils.ts recursively lists files & dirs. Uses Set to prevent duplicates, calls walk function for each dir.

Assert Usage In Grida Source Code And Node.js

Assert in Grida source code: assert stops execution & throws AssertionError with custom error message. Use to add defensive mechanisms with clear error messages. Read more about assert in Node.js: https://nodejs.org/api/assert.html-message

Git Submodule Setup For Grida Development Environment

To set up Grida's dev env, use `git clone --recurse-submodules https://github.com/gridaco/grida`. This clones submodules & allows pnpm install. Run `pnpm run dev` to start dev environment.

Defu Vs Lodash._merge: Key Differences In Object Merging

Defu vs lodash._merge: Defu assigns default properties recursively, but doesn't merge arrays. lodash._merge merges objects and arrays recursively. Key difference: Defu overwrites existing array items, while lodash._merge preserves them.

Exploring Unbuild's Code: Pretty-Bytes Package Uncovered

Discover pretty-bytes, a package that converts bytes to human-readable strings! Used in unbuild OSS project, it's a game-changer for reporting file sizes. npm install pretty-bytes and learn more about its usage!

Unlocking Unbuild's Secrets: Exploring Hookable And OSS Codebases

Discover Hookable, a package by Unjs for Awaitable Hooks. Learn how to use it in unbuild source code: create hooks, register them & call them to trigger callbacks.

Exploring Defu Package In Unbuild Source Code

Discover Defu, a package by Unjs that assigns default properties recursively. Learn how to use it with examples and explore its usage in unbuild source code.

Jiti Package Simplified For Software Engineers

Discover Jiti, a package by Unjs that enables seamless interoperability between ESM & CommonJS in Node.js. Used in Docusaurus & Unbuild projects for loading modules with various syntax support.

What Is .gitkeep And Where To Find It In Shadcn/ui Codebase?

.gitkeep` file: a blank file added to empty directories to sync local dir structure with GitHub repo. Found in Shadcn/ui codebase, e.g., `pages/api`, `pages`, and `registry` dirs. Not needed after initial push.

Software Engineering: Maintenance Mode Check In Grida Source Code

Maintenance mode in Vercel: Reviewing Grida's code for detecting maintenance mode and redirecting to a static page when traffic spikes or app fails.

Server Component Client In Grida Forms Server.ts

Grida Forms server.ts has multiple Server Component clients defined, using @supabase/supabase-js for custom schema configuration, differing from Supabase Auth Docs' @supabase/ssr import.

Analyzing @manypkg/get-packages In Changesets Source Code

@manypkg/get-packages utility by Thinkmill helps devs build tools for monorepos with Yarn, Bolt, Lerna, pnpm or Rush support. Used in Changesets source code to get packages.

Util Module In Changesets: Understanding Format API Usage

Util module's format API used in Changesets for string formatting, replacing placeholders with values and concatenating extra args as strings.

How Changesets Silences Logs In Tests

Changesets' Logger package silences log messages in tests using temporarilySilenceLogs function, which creates a log silencer and restores logging mechanism after test execution.

Why Dedicated Logger Packages Matter In OSS Projects

Changesets CLI package uses a dedicated logger package for consistent logging across the codebase. It imports picocolors to add color encoding to logs, improving feedback from CLI interactions.

Types Of ClientOptions Interface In T3 Env

ClientOptions interface in t3-env: Record<String, ZodType> with clientPrefix & client validation for prefixed env vars. Ensures server-side vars aren't exposed to clients.

Understanding ExtendableError In Changesets CLI Package

Learn how to create custom error classes in JavaScript with consistent behavior for error handling using ExtendableError. Preserves error stack and name, ensuring reliable stack traces across environments.

Configuring Metadata In Shadcn/ui Vs Lobechat

Shadcn/ui uses static metadata, while Lobechat uses dynamic metadata. Shadcn/ui configures metadata in a layout file with a static object, whereas Lobechat generates metadata dynamically using a function.

Software Engineering And Web Development With Biome.js In T3-env

Biome.js is a toolchain for web projects, used in t3-env for formatting and linting purposes, with commands like format, lint, and check.

Generating Static Documentation Sites With Nextra And Next.js

Nextra generates static documentation sites with Next.js & MDX. Configuring Nextra is simple, install packages, update config and create themes.config.jsx.

T3 Env: Type-Safe Environment Variables For Next.js And Beyond

T3 env is a framework agnostic validation for type-safe environment variables, preventing invalid deployments with Zod. Install with `pnpm add @t3-oss/env-core zod` and define schema in `src/env.mjs`.

Analyzing CodeMirror V6 Development Environment Setup Script

CodeMirror v6 dev env setup script processes CLI args in start() function, accessing command via process.argv[2] and executing corresponding cmdFn with apply()

CodeMirror Packages: A Deep Dive Into The CodeMirror V6 Architecture

CodeMirror uses individual repositories for each package, unlike monorepo projects. Packages are listed in bin/packages.js and loaded via loadPackages function.

Executing CLI Commands Programmatically With Execa And Child_process

Shadcn/ui uses execa, while CodeMirror uses child_process to execute CLI commands programmatically. Execa is optimized for programmatic usage and runs commands in scripts or libraries.

Postiz Editor: CopilotTextArea Vs MDEditor Comparison

Postiz uses CopilotTextArea for AI-powered editing, but only if user has AI tier enabled. Otherwise, it defaults to MDEditor by @uiw/react-md-editor.

Open-Source Vs Source Code: Understanding Enterprise Edition Licensing

Open-source projects may have a separate "ee" folder with different licensing, like Cal.com's API or Documenso's software. Respect the licensing terms to avoid copyright issues.

LobeChat Settings Form Dynamically Rendered With Lobe-ui Components

LobeChat's Settings modal renders form fields dynamically, using Lobe-ui and antd components. The code is in Common.tsx, importing Form from @lobehub/ui.

How TRPC Ctx Adds Logged-in UserId In LobeChat Source Code

LobeChat's tRPC ctx adds userId from Clerk auth, createContext returns object with context set, createContextInner function sets userId from params

Next Runtime Env In Documenso Source Code

next-runtime-env dynamically injects environment variables into Next.js apps at runtime, adhering to the "build once, deploy many" principle. Use PublicEnvScript in root layout and env() function to access variables.

Action Labels In LobeChat DevTools: Namespace Usage Explained

LobeChat uses Zustand for state management & DevTools for debugging. Action labels use Namespace to identify actions, ensuring Redux DevTools show accurate action names.

HCaptcha In Open Source Projects: Supabase And Chatwoot Examples

Learn how hCaptcha helps detect bots in Open Source projects like Supabase & Chatwoot. See code examples of its usage in React, Vue.js and more at https://www.hcaptcha.com/