Rattail

raw JSON →
2.0.6 verified Mon Apr 27 auth: no javascript

Rattail is a Vite+ oriented and AI Agent friendly front-end toolchain, currently at version 2.0.6. It provides presets for linting, formatting, pre-commit hooks, and git hooks, a CLI toolchain for publishing, logs, commit lint, and API generation, 140+ utility functions covering common, string, number, array, object, and math scenarios, an axios-based progressive request tool with Vue composition API support (Axle), a chainable validation rule factory (Ruler Factory), and type-safe enum utilities. It ships with TypeScript types, is tree-shakable, and has 90%+ test coverage. Rivals like Vite plugins and utility libraries often focus on one area, while Rattail bundles all these into a single Vite+ ecosystem package. Release cadence appears active with multiple minor versions.

error Cannot find module 'rattail' or 'ERR_REQUIRE_ESM'
cause Trying to require() an ESM-only module in a CommonJS context.
fix
Use 'import rattail from 'rattail' in an ESM context, or enable ESM in your package.json by adding 'type': 'module'.
error Uncaught SyntaxError: The requested module 'rattail' does not provide an export named 'createAxle'
cause Importing from 'rattail' directly; createAxle is a subpath export from 'rattail/axle'
fix
Change import to 'import { createAxle } from 'rattail/axle'.
error Module not found: Error: Can't resolve 'rattail/utils'
cause The subpath export 'rattail/utils' might not be present in older v1.x versions, or the package version is too old.
fix
Upgrade to rattail >=2.0.0: pnpm update rattail
error Could not resolve dependency: peer @voidzero-dev/vite-plus-core@>=0.1.16 from rattail@2.0.6
cause Missing peer dependency during installation.
fix
Run 'pnpm add @voidzero-dev/vite-plus-core' or use pnpm with auto-install-peers=true.
breaking In v2.0.0, the package was overhauled to be ESM-only and subpath exports were introduced. Previous v1.x CJS imports no longer work.
fix Update imports to ESM syntax and use subpath exports (e.g., 'rattail/utils' instead of 'rattail'). If using CommonJS, consider migrating to ESM.
breaking In v2.0.0, 'Axle' was moved to 'rattail/axle' subpath. Direct import from 'rattail' will not work.
fix Change import { createAxle } from 'rattail/axle'.
breaking In v2.0.0, many utility functions were moved to 'rattail/utils'. Direct imports from 'rattail' are deprecated and may be removed.
fix Use 'import { isString } from 'rattail/utils'' instead of 'import { isString } from 'rattail''.
gotcha The package requires pnpm >= 10.0.0. Using npm or yarn may cause peer dependency issues.
fix Install pnpm globally (npm install -g pnpm) and use pnpm for this project.
gotcha Peer dependencies @voidzero-dev/vite-plus-core and vite-plus are required. If not installed, imports may fail at runtime.
fix Ensure these are installed: pnpm add @voidzero-dev/vite-plus-core vite-plus
npm install rattail
yarn add rattail
pnpm add rattail

Shows how to install, configure with defineRattailConfig, and use utility functions, Axle, RulerFactory, and createEnum.

// Install: pnpm add rattail @voidzero-dev/vite-plus-core vite-plus

// vite.config.ts
import { defineRattailConfig } from 'rattail';

export default defineRattailConfig({
  // base Vite+ config
});

// Use a utility function
import { isString } from 'rattail/utils';
console.log(isString('hello')); // true

// Use Axle request tool
import { createAxle } from 'rattail/axle';
const axle = createAxle({ baseURL: 'https://api.example.com' });
async function fetchData() {
  const res = await axle.get('/data');
  return res.data;
}

// Use Ruler Factory for validation
import { RulerFactory } from 'rattail/ruler';
const rules = new RulerFactory()
  .required('Name is required')
  .minLength(2, 'Name too short')
  .build();

// Use createEnum
import { createEnum } from 'rattail/enum';
const Status = createEnum({
  Pending: 0,
  Active: 1,
  Inactive: 2,
});