Destiny

raw JSON →
0.7.1 verified Sat Apr 25 auth: no javascript maintenance

Destiny v0.7.1 is a CLI tool that reorganizes JavaScript/TypeScript project file structures into a fractal pattern based on import dependencies. It scans files, builds a directed graph of imports, and restructures folders while fixing import paths. Last released in August 2020, the project appears stable but has no recent activity. It differentiates from other file organizing tools by using actual code dependency analysis rather than naming conventions, though the author notes the approach may be limited.

error Error: Cannot find module 'commander'
cause Missing dependency when running directly via node instead of npx.
fix
Use npx destiny or install globally: npm i -g destiny
error destiny: command not found
cause Package not installed globally.
fix
Run using npx destiny or install globally with npm i -g destiny
error No files matched the pattern
cause Glob pattern does not match any files.
fix
Adjust the glob pattern, e.g., 'src/**/*.{ts,js,tsx,jsx}'
breaking Only works on JavaScript/TypeScript codebases; other languages not supported.
fix Ensure project is JS/TS before running.
gotcha Snapshot tests may not format correctly after restructuring.
fix Update snapshot tests after running destiny.
gotcha Always commit to git or back up before running with -w flag; bugs may occur.
fix Use version control before running.
npm install destiny
yarn add destiny
pnpm add destiny

Shows how to install and run destiny for dry run and actual restructuring with common options.

// Install globally or use npx
npx destiny --version

// Dry run to preview restructuring
npx destiny "src/**/*.ts"

// Actually restructure files
npx destiny -w "src/**/*.ts"

// Avoid single-file folders
npx destiny -S -w "src/**/*.ts"

// Help
npx destiny --help