Skip to content

Latest commit

 

History

History

radashi-helper

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

radashi-helper

Gitter.im License npm code style: biome.js

The command-line tool powering the Radashi template. If you stumbled upon this package and don't know about the Radashi template yet, you probably want that instead.

Installation

pnpm add -D radashi-helper

Alternatively, you can install this globally.

pnpm add -g radashi-helper

Usage

After installing this from NPM, you can use the radashi help command to get started.

pnpm radashi help

Alternatively, there's a guide over at the Radashi website.

Note: This tool expects a specific project structure (the one used by radashi-org/radashi-template).

 

radashi fn create [name]

Scaffold the files for a new custom function.

Aliasesfn add

It creates the following files, skipping any that already exist:

  • src/<group>/<name>.ts
  • tests/<group>/<name>.test.ts
  • docs/<group>/<name>.mdx
  • benchmarks/<group>/<name>.bench.ts

The name can be a full path, like array/sum, or just the function name, like sum. If not provided, you will be prompted to name the function and/or select a group.

You'll also be prompted for a short description, which is added to the metadata at the top of the docs/ file.

 

radashi fn move [name] [dest]

Rename the files for a custom function.

Aliasesfn rename, fn mv

The name should include the group and function names, like number/sum or object/pick. If not provided, you will be prompted to pick the function you want.

The dest can be a group name, like array, or a full path, like array/sum. If not provided, you will be prompted to decide what to do.

Important: This command doesn't update any of the code. It will only rename the files. This is being tracked in #1.

# Interactive mode
pnpm radashi fn move

# Rename objectify without changing the group
pnpm radashi fn move array/objectify objectToArray

# Move sum to the array group without changing the name
pnpm radashi fn move number/sum array/sum

 

radashi fn override [query]

Copy the files for an existing function into your project's overrides folder.

The query is a partial function name. If there's a tie for best match or no query is provided, you will be prompted to pick the function you want.

# Interactive mode
pnpm radashi fn override

# Copy the files for "number/sum" into your project
pnpm radashi fn override number/sum

 

radashi fn remove [name]

Remove the files for a custom function.

# Interactive mode
pnpm radashi fn remove

# Remove the files for "number/sum"
pnpm radashi fn remove number/sum

 

radashi pr import <pr-id>

Copy the files for a Radashi “pull request” into your project.

# Import all changes from a PR
pnpm radashi pr import 208

Notes

  • GitHub CLI must be installed for this command.
  • The pr-id must be a valid PR ID in the radashi-org/radashi repository. See the pull requests page to find one.
  • The PR will be automatically committed to your Radashi.
  • If the PR title doesn't follow the Conventional Commits format, you will be prompted to provide a commit message.
  • There's no need to run pnpm build after importing a PR, as this command will do it for you.

 

radashi build

Compile and bundle the project, writing to the filesystem.

# Perform a production build.
pnpm radashi build

# Watch for changes and rebuild automatically.
pnpm radashi build --watch

# If you're using radashi-template:
pnpm build

 

radashi lint [...globs]

Check your Radashi files for possible bugs, formatting issues, and other problems.

Currently, this command supports Biome and ESLint.

# Lint all files.
pnpm radashi lint

# Lint only the files in the src folder.
pnpm radashi lint src/**/*.ts

# If you're using radashi-template:
pnpm lint

 

radashi format [...globs]

Format your Radashi files using Biome.

# Format all files.
pnpm radashi format

# Format only the files in the src folder.
pnpm radashi format src/**/*.ts

# If you're using radashi-template:
pnpm format

 

radashi test [...globs]

Run the tests for your custom Radashi functions.

This command expects Vitest to be installed in your project. This means any flags supported by Vitest will work.

# Run all tests.
pnpm radashi test

# Run only the tests for your "foo" function.
pnpm radashi test foo

# Run only the tests for the files that match the globs.
pnpm radashi test src/array/*.ts

# If you're using radashi-template:
pnpm test

 

radashi open [query]

Open the files for a custom Radashi function in your preferred editor.

If you don't have a preferred editor, you will be prompted to pick one.

If you don't specify a query, you will be prompted to pick a function.

# Open the source file for the function named "foo".
pnpm radashi open foo

# Open all of the files related to the function named "foo".
pnpm radashi open foo -A

Flags

When no flags are provided, this command will open the source file by default.

  • -s, --source: Open the source file.
  • -t, --test: Open the test file.
  • -T, --type-test: Open the type test file.
  • -b, --benchmark: Open the benchmark file.
  • -d, --docs: Open the documentation file.
  • -A, --all: Open all related files.