npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

budgie-cli

v0.3.0

Published

Node CLI for Budgie.

Downloads

7

Readme

budgie-cli 🦜

Build Status NPM version

Node CLI for General Language Syntax (Budgie).

Usage

npm install budgie-cli --global

budgie --help

Pass any number of filenames and/or globs (matched with glob) to the CLI to convert those files to an output -l/--language.

Input files to convert from Budgie to the output language must have a .bg extension.

.ts files may also be given with -t/--tsconfig to compile to .bg files before output language conversion.

Example Usage

To convert file.bg to file.py:

budgie --language Python file.bg

To convert *.ts to *.bg, then to *.java:

budgie --language Java --tsconfig ./tsconfig *.ts

Requires Node >=8

Development

To build from scratch, install Node.js and run the following commands:

npm install
npm install budgielang ts-budgie typescript --no-save
npm run verify

Check package.json for the full list of commands. To set up source file compiling in watch mode, use tsc -w.

Tests

Run tsc -p test to build tests, or tsc -p test -w to rebuild the files in watch mode. Run npm run test:run to run tests.

Internals

When the CLI is called, the following code paths are used in order:

  1. Cli
  2. Main
  3. Preprocessing
  4. Conversions
  5. Postprocessing

Cli

Parses raw string arguments using commander. If the args are valid, it calls to the Main method.

System dependencies such as the IFileSystem and globber may be dependency-injected to override the defaults.

See cli.ts.

Main

Validates Budgie settings, sets up the conversion's Preprocess, Runner, and Postprocess, then runs them in that order. There are two real behaviors here not covered by the Cli:

  • Globbing file paths passed as glob args and reading them the file system.
  • Validating the provided language is known by Budgie.

See main.ts.

Preprocessing

If any files are passed in with native language extensions, namely .ts for TypeScript, they are converted here using that langauge's converter to their .bg equivalent.

For example, if a .ts file is provided, it will attempt to convert it using TS-Budgie and return the generated .bg file path. If a .bg file path is provided, it will do nothing and pass that path through.

Any language-specific files that are used as metadata files for that language, such as src/index.js for JavaScript, will be removed from the files list.

See preprocessFiles.ts.

Conversions

Converts each .bg file to the output language(s).

convertFiles uses an async queue to throttle the number of files that are attempted to be converted via convertFile at once, as some conversions may need asynchronous operations. Creates a BudgieConverter per output language and has each file run through them.

See convertFiles.ts and convertFile.ts.

Postprocess

Runs tasks on the converted .bg files as a project group after they've been successfully created.

If a .budgie.json is not provided or detected, this does nothing. Otherwise, it creates a root metadata file(s) as specified by each output language. These are typically one or both of:

  • Metadata file describing the output project.
  • Exports file exporting publicaly exportable objects for languages that need them.

See postprocess.ts.