Menu

Development Workflow

Relevant source files

Purpose and Scope

This page provides a practical guide for developers working on the AStack codebase, covering common development tasks, package management, and release workflows. It documents the daily commands and procedures used when contributing to or extending AStack.

For information about the monorepo structure itself, see Monorepo Structure. For details on the build system configuration, see Build System and Tooling. For dependency management and versioning concepts, see Dependencies and Versioning.


Daily Development Tasks

Running Development Servers

The monorepo provides development mode for packages that support hot-reloading:

Start all packages in development mode:

This executes turbo run dev package.json14 which runs the dev script in all packages that define it. Individual packages like @astack-tech/integrations use tsup --watch packages/integrations/package.json34 to rebuild on file changes.

Start development for specific packages:

Building Packages

Build all packages:

This runs turbo run build package.json13 which orchestrates builds across the monorepo with dependency awareness. Turbo caches build outputs for faster rebuilds.

Build specific packages:

Package-level builds use tsup packages/integrations/package.json35 to bundle TypeScript into CJS and ESM formats.

Clean build artifacts:

This removes all dist directories and the root node_modules package.json19

Linting and Formatting

Check code style:

Executes eslint against packages/**/*.{ts,tsx} and examples/**/*.{ts,tsx} package.json16

Auto-fix linting issues:

Applies automatic fixes where possible package.json17

Format code:

Runs prettier --write on all TypeScript and Markdown files package.json20

Type Checking

Verify TypeScript types:

Runs tsc --noEmit in all packages via Turbo package.json21 checking types without emitting output.

Running Tests

Run all tests:

Executes turbo run test package.json18 running tests in all packages that define a test script. Individual packages use vitest run packages/integrations/package.json38

Run tests in watch mode (package-level):


Development Workflow Diagram

Sources: package.json12-21


Package Management

Adding a New Package

  1. Create package directory:
  1. Initialize package.json:
  1. Add to workspace: The package is automatically included via the workspaces pattern package.json9-11:
  1. Configure build: Create tsup.config.ts following the pattern in existing packages.

Installing Dependencies

Install dependencies for all packages:

Add dependency to specific package:

Add workspace dependency:

The workspace:* protocol ensures the package always uses the local version packages/integrations/package.json60

Updating Dependencies

Update all dependencies:

Update specific package:


Script Execution Hierarchy

Sources: package.json12-21 packages/integrations/package.json33-39


Release Workflow

AStack uses Changesets for version management and publishing.

Creating a Changeset

When making changes that should trigger a release:

Generate changeset:

This prompts for:

  1. Which packages changed
  2. Version bump type (major, minor, patch)
  3. Summary of changes

The tool creates a markdown file in .changeset/ .changeset/modern-ducks-drop.md1-6:

Versioning Packages

Update package versions:

This runs changeset version package.json23 which:

  1. Consumes changeset files
  2. Updates package.json versions
  3. Updates CHANGELOG.md files packages/integrations/CHANGELOG.md1-22
  4. Deletes consumed changesets

Publishing Releases

Standard Release

Publish to npm:

Executes turbo run build && changeset publish package.json24 which:

  1. Builds all packages
  2. Publishes to npm with public access
  3. Creates git tags

Beta (Pre-release) Workflow

Enter pre-release mode:

Runs changeset pre enter beta package.json25 creating .changeset/pre.json .changeset/pre.json1-15:

Publish beta version:

Executes pnpm build && pnpm -r publish --tag beta --access public package.json27 publishing with the beta tag.

Exit pre-release mode:

Runs changeset pre exit package.json26 removing pre-release configuration.

Publish stable version:

Publishes to the latest tag package.json28


Release Workflow Diagram

Sources: package.json22-28 .changeset/pre.json1-15 .changeset/modern-ducks-drop.md1-6


Common Development Scenarios

Scenario 1: Adding a New Feature

StepCommandPurpose
1pnpm installEnsure dependencies are up to date
2pnpm devStart development servers
3(edit code)Implement feature
4pnpm lint:fixFix linting issues
5pnpm check-typesVerify TypeScript types
6pnpm testRun test suite
7pnpm buildVerify build succeeds
8pnpm changesetDocument changes
9git commitCommit with changeset

Scenario 2: Fixing a Bug

StepCommandPurpose
1(write failing test)Reproduce bug
2pnpm testConfirm test fails
3(fix code)Implement fix
4pnpm testVerify test passes
5pnpm lint && pnpm check-typesQuality checks
6pnpm changesetDocument patch
7git commitCommit fix

Scenario 3: Publishing a Beta Release

StepCommandPurpose
1pnpm pre:betaEnter beta mode
2(make changes and add changesets)Development
3pnpm version-packagesBump to beta versions
4git commit -m "Version beta"Commit version changes
5pnpm publish:betaPublish to npm beta tag
6git push --follow-tagsPush changes and tags

Scenario 4: Promoting Beta to Stable

StepCommandPurpose
1pnpm pre:exitExit beta mode
2pnpm version-packagesBump to stable versions
3git commit -m "Version stable"Commit version changes
4pnpm releaseBuild and publish
5git push --follow-tagsPush changes and tags

Turbo Configuration

Turbo caches task outputs based on input file hashes. The configuration is in turbo.json at the monorepo root, though the file wasn't provided in the source materials.

Key Turbo behaviors:

  • Dependency awareness: Builds packages in dependency order
  • Caching: Skips tasks when inputs haven't changed
  • Parallelization: Runs independent tasks concurrently
  • Remote caching: Can share cache between team members (if configured)

Turbo commands used:


Environment Setup

Prerequisites

Node.js version:

Package manager:

Initial Setup


Troubleshooting

Build Failures

Issue: tsup fails with module resolution errors

Solution:

  1. Clean build artifacts: pnpm clean
  2. Reinstall dependencies: pnpm install
  3. Rebuild: pnpm build

Dependency Conflicts

Issue: Conflicting peer dependencies

Solution: Use pnpm install --force to override peer dependency checks (use cautiously).

Turbo Cache Issues

Issue: Stale cache causing incorrect builds

Solution:

Changeset Issues

Issue: Pre-release mode stuck

Solution:

Sources: package.json1-51 packages/integrations/package.json1-63 .changeset/pre.json1-15