Skip to content

Latest commit

 

History

History
248 lines (172 loc) · 9.45 KB

DEVELOPMENT.md

File metadata and controls

248 lines (172 loc) · 9.45 KB
file_type documentation
title Development Setup
description Developer setup guide and repository contribution instructions for the LightSpeed community health repository
version 1.1
last_updated 2026-08-29
owners
LightSpeed Team
tags
development
setup
installation
contributing
references
path description
CONTRIBUTING.md
Full contribution guidelines
path description
docs/LINTING.md
Linting standards and troubleshooting
path description
.github/projects/active/nodejs-upgrade-2026-q4/COMPLETION_REPORT.md
Node.js 24 upgrade project completion report

Community Health Repository Setup

This document provides guidance for contributing to and maintaining this community health repository for the LightSpeed organization.

Prerequisites

  • Node.js (v24 or later) — Required as of 2026-08-29
  • npm (v10 or later) — Required as of 2026-08-29

Note: This repository requires Node.js 24 following the completion of the Node.js 24 Upgrade Project on 2026-08-29. All workflows and scripts are configured for Node.js 24 via .nvmrc. Using an older version may cause compatibility issues.

Installation & Package Review

  1. Clone the repository:

    git clone https://github.com/lightspeedwp/.github.git
    cd .github
  2. Install dependencies:

    npm install
  3. Review package.json: Before getting started, check the package.json file to understand available scripts, dependencies, and tooling relevant to this repository.

Linting and Code Quality

This repository provides linting tools for JavaScript, TypeScript, YAML, JSON, and Markdown, run through Node scripts. The fast feedback path is Oxlint; the authoritative JS/TS quality gate is ESLint; Prettier runs as a standalone formatter (not as an ESLint rule).

  • Fast lint (Oxlint, non-blocking):

    npm run lint:fast
  • Lint JavaScript/TypeScript (ESLint, read-only):

    npm run lint:js
  • Lint JavaScript/TypeScript (ESLint, auto-fix):

    npm run lint:js:fix
  • Type-check (TypeScript):

    npm run typecheck
  • Lint GitHub Actions workflows (actionlint). This needs actionlint on your PATH (brew install actionlint, scoop install actionlint, or a release from https://github.com/rhysd/actionlint/releases). On x86-64 Linux the checked-in binary is used when none is installed:

    npm run lint:actionlint
  • Run all linters (JS + YAML + package JSON, in parallel):

    npm run lint
  • Check formatting (Prettier):

    npm run format:check

npm run format:check is repo-wide and informational: the repository carries a large backlog of pre-existing formatting drift (626 files), so it is not enforced as a required CI check. Format only the files you touch, with npx prettier --write path/to/file.js, or let lint-staged do it at commit time. npm run format:js rewrites every JS and TS file in the repository, so use it only for an intentional repository-wide formatting change.

npm run lint:js is read-only. Use npm run lint:js:fix to apply ESLint fixes and the format:* scripts to apply Prettier formatting. ESLint runs with a content-based cache (.eslintcache, gitignored) for fast repeat runs.

TypeScript

npm run typecheck runs tsc against two real tsconfig.json files (strict, noEmit, skipLibCheck):

  • tsconfig.json — the repository's standalone TypeScript: the packages/metadata-agent/types definitions and website/src/scripts.
  • website/tsconfig.json — the Astro website module (website/src/lib, website/src/content.config.ts). It adds astro:content and marked module shims (website/src/env.d.ts) so the module type-checks without the Astro toolchain installed.

tsc cannot read .astro files, so a type error in a page's markup or inline script passes npm run typecheck. npm run typecheck:astro runs astro check over the website's .astro and .ts files. It needs the website's own dependencies (npm ci --prefix website), which is why it is not part of npm run typecheck. It currently reports 36 existing findings, mostly untyped DOM access in inline scripts, so CI runs it as an informational step that does not fail the Typecheck job. Remove continue-on-error from the "Astro check" step in .github/workflows/lint.yml once they are cleared.

Git Hooks & Automation with Husky

This repository uses Husky to automate code quality checks via Git hooks. Husky runs automatically when you commit or push code, ensuring all changes meet quality standards before they're shared.

How Husky Works

Husky is configured to run automatically when you install dependencies (npm install). Two Git hooks are configured:

  1. pre-commit: Runs linting and formatting checks on staged files before each commit
  2. pre-push: Validates the name of every branch being pushed

Pre-commit Hook

The pre-commit hook uses lint-staged to run checks only on files you've staged for commit. This keeps the process fast and focused:

  • JavaScript/TypeScript files (*.{js,jsx,ts,tsx}):

    • ESLint with auto-fix
    • Prettier formatting
  • Markdown files (*.{md,mdx}):

    • Changed-line Markdownlint (only violations on lines the commit touches, via scripts/validation/lint-md-staged.cjs)
  • JSON files (*.json):

    • Prettier formatting
  • YAML files (*.{yml,yaml}):

    • Prettier formatting

If any checks fail, the commit will be blocked until you fix the issues.

Pre-push Hook

The pre-push hook validates the branch names being pushed, not the test suite. Git feeds the hook one ref-update record per branch on standard input, and each pushed branch is checked against the repository's naming policy before the push is allowed:

node lib/hooks/pre-push

docs/HUSKY_PRECOMMITS.md documents the policy in full. Running the test suite locally before pushing is still worth doing, but it is not what this hook does — the full suite runs in CI, which is the gate that matters.

Bypassing Hooks (Not Recommended)

In rare cases where you need to bypass hooks (e.g., work-in-progress commits), you can use:

git commit --no-verify -m "WIP: description"
git push --no-verify

Note: Bypassing hooks should be avoided in most cases, as it may introduce code quality issues or failing tests into the repository.

Troubleshooting

If hooks aren't running:

  1. Ensure dependencies are installed: npm install
  2. Check that .husky/ directory exists
  3. Verify hooks are executable: ls -la .husky/
  4. Re-initialize Husky: npm run prepare

Agents & Shared Scripts

A scripts/ folder is used to contain shared functions for agents. Agents are written in JavaScript, and reusable logic or utilities should be placed here for maintainability and collaboration across the organization.

Git Workflow

  1. Create a feature branch for your work:

    git checkout -b feature/your-feature-name
  2. Make your changes and commit them:

    git add .
    git commit -m "Your descriptive commit message"
  3. Push your changes and create a pull request:

    git push origin feature/your-feature-name
  4. Reference any related issues in your pull request description. Please use the pull request template for summaries.

Need Help?

Contributing and Code of Conduct

We welcome contributions! Please review our Contributing Guidelines and Code of Conduct.

License

This project is licensed under the GNU General Public License v3.0 — see the LICENSE file for details.

License: GPL v3

Reference

This page brought to you by the 🦄 Magic Automation Unicorns of LightSpeedWP. Automation Docs