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 🙏

© 2026 – Pkg Stats / Ryan Hefner

prettier-plugin-aiken

v0.2.1

Published

A Prettier plugin for Aiken language

Downloads

3

Readme

Prettier Plugin Aiken

A Prettier plugin for the Aiken smart contract language.

Overview

This plugin integrates Aiken's built-in formatter (aiken fmt) with Prettier, allowing you to format Aiken smart contract code using Prettier's workflow and editor integrations.

Features

  • 🎯 Format .ak files using Aiken's official formatter
  • 🔧 Seamless integration with Prettier
  • ⚡ Works with popular editors (VS Code, Vim, etc.)
  • 🔄 Supports Prettier's CLI and API

Installation

Prerequisites

Make sure you have Aiken installed on your system:

# Install Aiken (if not already installed)
curl -sSfL https://install.aiken-lang.org | bash

Install the Plugin

# Using npm
npm install --save-dev prettier prettier-plugin-aiken

# Using pnpm
pnpm add -D prettier prettier-plugin-aiken

# Using yarn
yarn add --dev prettier prettier-plugin-aiken

Usage

CLI

Format a single file:

npx prettier --write validator.ak

Format all Aiken files in your project:

npx prettier --write "**/*.ak"

Configuration

Add to your package.json:

{
  "prettier": {
    "plugins": ["prettier-plugin-aiken"]
  }
}

Or create a .prettierrc.js:

module.exports = {
  plugins: ["prettier-plugin-aiken"]
};

VS Code Integration

  1. Install the Prettier extension
  2. Add this plugin to your project dependencies
  3. Configure Prettier as your default formatter for .ak files

Add to your VS Code settings.json:

{
  "[aiken]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.formatOnSave": true
  }
}

How it Works

This plugin acts as a bridge between Prettier and Aiken's built-in formatter:

  1. Prettier detects .ak files using this plugin
  2. The plugin passes the file content to aiken fmt --stdin
  3. Returns the formatted code back to Prettier

Requirements

  • Node.js >= 14
  • Aiken CLI tool installed and available in PATH
  • Prettier (peer dependency)

Example

Before formatting:

validator my_validator{
pub fn spend(datum: Data,redeemer: Data,context: ScriptContext) -> Bool {
let Spend(output_reference) = context.purpose
True
}
}

After formatting:

validator my_validator {
  pub fn spend(datum: Data, redeemer: Data, context: ScriptContext) -> Bool {
    let Spend(output_reference) = context.purpose
    True
  }
}

Configuration

Setting up Aiken Binary Path

The plugin will automatically try to find your Aiken binary in the following order:

  1. Environment Variable: AIKEN_BIN (recommended for custom installations)
  2. PATH: Using which aiken command
  3. Default Location: ~/.aiken/bin/aiken (standard installation path)

Using Environment Variable

If you have Aiken installed in a custom location, set the AIKEN_BIN environment variable:

# In your shell profile (.bashrc, .zshrc, etc.)
export AIKEN_BIN="/path/to/your/aiken/binary"

# Or set it per project in .env file
AIKEN_BIN="/usr/local/bin/aiken"

For VS Code Users

Add the environment variable to your VS Code settings:

{
  "terminal.integrated.env.osx": {
    "AIKEN_BIN": "/path/to/your/aiken/binary"
  },
  "terminal.integrated.env.linux": {
    "AIKEN_BIN": "/path/to/your/aiken/binary"
  },
  "terminal.integrated.env.windows": {
    "AIKEN_BIN": "C:\\path\\to\\your\\aiken\\binary.exe"
  }
}

Troubleshooting

"aiken command not found"

Make sure Aiken is installed and available in your PATH:

aiken --version

If not installed, follow the Aiken installation instructions.

Custom Aiken Installation

If you installed Aiken in a custom location, make sure to set the AIKEN_BIN environment variable as described in the Configuration section above.

Plugin not working in VS Code

  1. Ensure the plugin is installed in your project (not globally)
  2. Restart VS Code after installing the plugin
  3. Check that Prettier is configured as the default formatter for .ak files

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Development

  1. Clone the repository
  2. Install dependencies: npm install
  3. Make your changes
  4. Test with a sample Aiken project

License

MIT License

Related Projects

  • Aiken - A modern smart contract platform for Cardano
  • Prettier - An opinionated code formatter

Changelog

See CHANGELOG.md for release history.