Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Barrel Roll logo

Barrel Roll

CI Code Style: Prettier Coverage ESLint License: Apache-2.0 Quality Checks TypeScript VS Code Marketplace Installs VS Code Marketplace Version

Barrel Roll is a Visual Studio Code extension that automates creation and maintenance of index.ts barrel files. Right-click a folder, run a Barrel Roll command, and the extension generates exports from real TypeScript declarations while keeping output deterministic and readable.

Features

  • Right-click generation of index.ts barrel files from the VS Code explorer
  • Two command modes: single directory and recursive directory processing
  • Recursive barrel generation for child folders with parent re-export wiring
  • Export detection for TypeScript values, type-only exports, and default exports
  • Stable alphabetical ordering to keep diffs small and predictable
  • Sanitized updates that preserve direct definitions in existing index.ts
  • Built-in safeguards for ignored directories and oversized files

Installation

From VS Code Marketplace

  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
  3. Search for Barrel Roll
  4. Click Install

From VSIX

  1. Download the latest .vsix file from the releases page
  2. In VS Code, go to Extensions
  3. Click the ... menu and select Install from VSIX...
  4. Select the downloaded file

Usage

  1. Right-click a folder in the VS Code explorer
  2. Run one of these commands:
    • Barrel Roll Directory
    • Barrel Roll Directory (Recursive)
  3. Barrel Roll will:
    • scan .ts/.tsx files (excluding index.ts, declaration files, and test files)
    • generate or update index.ts
    • recursively generate child barrels when recursive mode is selected
    • preserve direct definitions in existing index files while refreshing export lines

You can also run both commands from the Command Palette.

Example

Given:

// user.ts
export class User {}
export interface UserData {}

// auth.ts
export function login() {}
export function logout() {}

// constants.ts
export const API_URL = 'https://api.example.com';

Barrel Roll generates:

// index.ts
export { login, logout } from './auth.js';
export { API_URL } from './constants.js';
export { User } from './user.js';
export type { UserData } from './user.js';

Development

Prerequisites

  • Node.js 22.13+
  • npm 10+

Common commands

npm install
npm run compile
npm run compile-tests
npm run test
npm run test:unit
npm run test:vscode
npm run coverage:verify
npm run memory:check
npm run lint
npm run deps:check
npm run quality

The quality command checks formatting and lint rules, unused and architectural dependencies, duplicate code, and TypeScript circular/orphan modules.

Testing notes

  • npm test runs compile, lint, dependency check, then the Node test suite via scripts/run-tests.cjs.
  • npm run test:unit runs a faster compile + test path without lint.
  • npm run coverage:verify requires every executable production file to exceed 95% statements, branches, functions, and lines.
  • Test compilation clears stale TypeScript output before coverage so removed files cannot silently remain in the measured dist/src tree.
  • npm run memory:check runs the bounded cache/parser heap-retention probe with forced garbage collection; it is intentionally separate from the fast unit suite.
  • npm run test:vscode builds the current extension bundle and launches a real VS Code extension host. The contract activates the extension, verifies both contributed commands, executes barrel generation, and validates the generated index.ts. The first run may download the VS Code test binary; headless Linux environments require a display host such as Xvfb.
  • Unit and integration tests live under src/test/.
  • Unit test names must start with should and follow FAST: fast, autonomous, self-validating, and timely.

Dependency checking

npm run deps:check uses scripts/run-depcheck.cjs (programmatic depcheck runner). It writes .depcheck.json, filters known script/repository references, and fails when unused dependencies remain.

Packaging and release

# Build production bundle used by VS Code prepublish
npm run package

# Build VSIX package
npm run ext:package

# Install latest packaged VSIX locally
npm run ext:install

# Build + install
npm run ext:reinstall

VSIX contents

Publishing uses an allowlist in .vscodeignore so only runtime assets are intentionally included:

  • package.json
  • LICENSE
  • README.md
  • dist/extension.js
  • public/img/barrel-roll-icon.png

Use npx @vscode/vsce ls to inspect final package contents before publishing.

Known limitations

  • Scans only .ts and .tsx source files.
  • Dynamic runtime-created named exports cannot be statically detected.
  • Existing index.ts content is sanitized to preserve direct declarations, but malformed export syntax may still require manual cleanup.

Architecture

For architecture details and module-level responsibilities, see ARCHITECTURE.md.

Contributing

Contributions are welcome. See CONTRIBUTING.md and AGENTS.md for contribution and automation details.

License

Apache 2.0. See LICENSE.

Ownership

Maintained by Robert Lindley.

About

Visual Studio Code extension to automatically export types, functions, constants, and classes through barrel files.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages