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 🙏

© 2024 – Pkg Stats / Ryan Hefner

prettier-plugin-move

v0.0.54

Published

This is a Move language plugin for the [Prettier](https://prettier.io/) code formatter. It uses a Move [parser](https://github.com/tzakian/tree-sitter-move) built on top of the [tree-sitter](https://tree-sitter.github.io/) parser generator and maintained

Downloads

259

Readme

Prettier Move Plugin

This is a Move language plugin for the Prettier code formatter. It uses a Move parser built on top of the tree-sitter parser generator and maintained by Tim Zakian.

The plugin is platform-independent by utilizing a WASM-ified version of the Move parser included in this repository at (./tree-sitter-move.wasm). You can re-generate the WASM-ified version of the parser by running the scripts/treesitter-wasm-gen.sh script (prerequisites for this are listed in the script itself). You should be careful when doing so, as certain changes to the parser may break the plugin (e.g., if parse tree node types are modified).

Prerequisites

Currently, in order to use the plugin, you need to install npm command (brew install npm on a Mac). You can use the plugin to format Move files (.move extension) both on the command line and using Prettier's VSCode extension. When the plugin is complete, we will make it available directly from Move's VSCode extension.

Installation

Currently, you need to install plugin from sources (when the plugin is complete, we will submit it to the NPM package registry for direct download).

Clone Sui repository into $SUI directory:

git clone https://github.com/MystenLabs/sui.git "$SUI"

Go to "$SUI"/external-crates/move/crates/move-analyzer/prettier-plugin and run the following command:

npm run build

Usage

Go to the root directory of the Move package whose files you'd like to format (i.e., the directory containing the Move.toml manifest file for this package) and run the following command:

npm install [email protected] "$SUI"/external-crates/move/crates/move-analyzer/prettier-plugin

This will install both the prettier formatter and the plugin in the ./node_modules directory.

Command-line Usage

You can format Move files in the package where you completed the installation step by running the following command:

./node_modules/.bin/prettier --plugin=prettier-plugin-move "$PATH_TO_MOVE_FILE"

VSCode integration

In order to use the plugin in VSCode you first need to install Prettier's VSCode extension.

Then, in the root directory of the package where you completed the installation step you need to place the .prettierrc file containing the following configuration:

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

After completing these steps, if you open the root directory of the package where you completed the installation step and choose any of the Move source files in this package, you will be able to format them by choosing Format Code command from VSCode's command palette.

Here is the plugin at work in VSCode:

Contribute

If you decide to contribute to this project, please choose the scope of your contribution (e.g., implement formatting for structs) and file an issue in the Sui repository describing the work you plan to do, and wait for a response from a core team member so that we can avoid duplication of efforts.

Please make sure that the code you add is well documented and that you add relevant tests - please use existing code as guidance.