Development setup
Prerequisites
- Node.js 20 or later (
.node-versionpins 20.18.1 for Volta/asdf/nvm) - pnpm 10 (repo sets
packageManager: pnpm@10.0.0;engines.pnpmis >=9)
Install pnpm:
npm
bash npm install -g pnpm@10 Quick start
Bootstrap the entire project with one command:
pnpm bootstrapThis installs dependencies and builds all packages. You’re ready to develop!
Note: First-time setup takes ~2-3 minutes depending on your machine.
Install CLI from GitHub
Need to test the latest CLI changes straight from main? Because @aligntrue/cli imports other workspace packages, build the entire repo before running the binary:
git clone https://github.com/AlignTrue/aligntrue.git
cd aligntrue
pnpm install # install all workspace dependencies
pnpm build # compile every package (core/schema/exporters/cli)
cd packages/cli
pnpm link --global # exposes the aligntrue/aln commands locally
aligntrue --versionRe-run pnpm build after dependency changes, or pnpm --filter @aligntrue/cli build after CLI-only edits to refresh dist/.
Getting started
1. Install dependencies
pnpm installThis will install dependencies for all workspace packages and set up Git hooks automatically.
2. Verify installation
After installation completes, verify everything works:
pnpm typecheck # Type-check all packages
pnpm test:fast # Run tests with fast reporterIf all checks pass, you’re ready to develop!
Git hooks
Hooks are installed automatically when you run pnpm install.
Pre-commit hook
Runs automatically before each commit and enforces zero warnings:
- Warns on large staged sets (>50 files)
- Blocks temp artifacts (
temp-*) - Regenerates repo root docs if
apps/docs/content/**changed - Validates
workspace:*protocol in stagedpackage.jsonfiles - Formats + lints staged files via lint-staged (Prettier + ESLint)
- Builds all packages if any staged file is TypeScript (catches missing exports or module resolution issues)
- Validates Next.js
transpilePackagesconfig - Validates docs accuracy when docs, CLI command list, exporter list, or perf thresholds change
Typical time:
- No TypeScript changes: ~5-15s
- With TypeScript changes (build step): ~15-60s depending on scope
Commit message hook
Validates commit messages follow Conventional Commits format:
# Good commit messages
feat: Add drift detection command
fix: Resolve lockfile sync issue
docs: Update setup guide
# Bad commit messages (will be rejected)
updated stuff
WIP
fixes bugFormat: type: Subject in sentence case
Valid types: feat, fix, docs, style, refactor, perf, test, chore, ci, build
Pre-push hook
Runs pnpm pre-ci before pushing:
- Install dependencies with
--frozen-lockfile - Full build for all packages
- Full typecheck
- Full test suite (all packages,
TURBO_CONCURRENCY=1) - Validate bundle sizes
Expect several minutes on a fresh or large change; matches CI scope.
Bypassing hooks (emergency only)
If hooks are genuinely broken (not just failing validation):
git commit --no-verify # Skip pre-commit
git push --no-verify # Skip pre-pushOnly use when hooks are broken, not to skip validation.
Hooks not running
If Git hooks aren’t running after pnpm install:
pnpm prepareThis manually runs the Husky setup.
Troubleshooting
”Command not found: pnpm”
Cause: pnpm is not installed globally.
Fix: See Prerequisites section above for installation instructions.
Verify installation:
pnpm --version“Module not found” errors
Reinstall dependencies:
pnpm clean
pnpm installType errors after changes
Run type-check to see all errors:
pnpm typecheckNext.js dev server fails with “Cannot find module” errors
Symptom: Dev server crashes with errors like:
Error: Cannot find module './vendor-chunks/nextra@4.6.0...'
Cannot find module '@aligntrue/ui'Cause: Next.js doesn’t transpile workspace packages by default. The @aligntrue/ui package exports TypeScript source directly (no build step), so Next.js needs to be configured to transpile it.
Fix:
- Check your Next.js config has
transpilePackages:
// apps/docs/next.config.mjs
export default withNextra({
transpilePackages: ["@aligntrue/ui"],
// ... rest of config
});- Clean stale build caches:
rm -rf apps/docs/.next- Restart dev servers:
pnpm dev:docsPrevention:
- CI validates
transpilePackagesconfig:pnpm validate:transpile-packages - Pre-commit hook validates
transpilePackages - If you add a workspace package that exports TypeScript source, add it to
transpilePackagesin each Next.js app config
Workflow after editing docs:
# 1. Edit source files in apps/docs/content/
pnpm dev:docs # View changes at localhost:3001
# 2. When done, generate root files
pnpm generate:repo-files
# 3. Commit
git add -A
git commit -m "docs: Update documentation"Important: Never manually edit README.md, DEVELOPMENT.md, or CONTRIBUTING.md - they’re auto-generated from docs sources.
Missing DOM types in UI packages
Symptom: TypeScript errors like Cannot find name 'window', Cannot find name 'document'
Cause: UI packages with React need DOM library types in tsconfig.json.
Fix:
Add to tsconfig.json compilerOptions:
{
"compilerOptions": {
"lib": ["ES2022", "DOM", "DOM.Iterable"]
}
}Prevention: CI validates UI packages with pnpm validate:ui-tsconfig.
Missing type exports
Symptom: Property 'X' does not exist on type 'Y' in apps consuming schema types.
Cause: Type defined in schema package but not exported in packages/schema/src/index.ts.
Fix:
- Check the type exists in source file (e.g.,
packages/schema/src/catalog-entry.ts) - Add export to
packages/schema/src/index.ts:
export {
// ... existing exports
type YourMissingType,
} from "./catalog-entry.js";- Rebuild schema package:
pnpm --filter @aligntrue/schema buildPrevention: CI runs full typecheck across all packages to catch missing exports.
GitHub App for catalog submissions
Align submissions from the website use a GitHub App to raise API limits and enable ETag caching.
Create the app
- Go to GitHub → Settings → Developer settings → GitHub Apps → New GitHub App.
- Name:
AlignTrue Catalog(or similar). - Repository permissions: Contents (read). No user permissions.
- Save, then install the app on the AlignTrue org (or make it public and install on the target org).
- Download the private key PEM.
Add environment variables (Vercel)
| Name | Value |
|---|---|
GITHUB_APP_ID | App ID from the app settings |
GITHUB_APP_INSTALLATION_ID | Installation ID from the installed app |
GITHUB_APP_PRIVATE_KEY | Base64 of the PEM (one line) |
Encode the PEM:
base64 -b 0 private-key.pem # macOS (use `base64 -w0` on Linux)Notes
- Tokens auto-refresh every hour; caching refreshes 10 minutes early.
- HTTP caching (ETag) uses a 1-hour TTL; set
GITHUB_DISABLE_CACHING=trueto bypass in emergencies.
Next steps
- Learn about the workspace structure
- Explore development commands
- Understand CI validation and troubleshooting