An open API service indexing awesome lists of open source software.

https://github.com/dalisoft/dprint-rs-npm

Pluggable and configurable code formatting platform written in Rust.
https://github.com/dalisoft/dprint-rs-npm

formatter javascript json markdown rust typescript

Last synced: 10 months ago
JSON representation

Pluggable and configurable code formatting platform written in Rust.

Awesome Lists containing this project

README

          

# dprint-rs-npm

Pluggable and configurable code formatting platform written in Rust.

> **npm** integration for [dprint-rs](https://github.com/dprint/dprint) without any overhead so using full power of `dprint` CLI performance and feature

## Documentations

Look at [official documentation](https://dprint.dev)

## Motivation

The tools inherently exhibit rapid performance, yet the `npm` `bin.js` script introduces a discernible overhead when deployed for **Rust** projects, leading to suboptimal startup times. This solution effectively addresses and eliminates this overhead, ensuring that **Rust** projects operate with the expected efficiency. For detailed insights, please refer to the pull requests [dprint#839](https://github.com/dprint/dprint/pull/839) and [dprint#840](https://github.com/dprint/dprint/pull/840).

> This package is specifically designed for direct Command-Line Interface (CLI) interaction or as an extension for Visual Studio Code.

### The functionality for npx or bunx is not included and is not anticipated to be incorporated in the future

## How this is fast?

This project leverages the [binary2npm](https://github.com/dalisoft/binary2npm) utility to streamline the acquisition of platform-specific binaries. The binaries provided by the author are highly optimized, surpassing the performance of the traditional **Node.js** `bin.js` approach. By invoking the binaries directly, we circumvent unnecessary overhead, resulting in significantly reduced startup times and enhanced efficiency.

## Installation

```sh
npm install dalisoft/dprint-rs-npm -D
# or
yarn install dalisoft/dprint-rs-npm -D
# or
bun add dalisoft/dprint-rs-npm -D
```

## Environment variables

| Name | Description | Required |
| -------------- | ----------------------------------------------------------------------------------------------- | -------- |
| `GITHUB_TOKEN` | For [GitHub API](https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting) | Yes |

## Usage

See [Documentations](#documentations), requires [Environment variables](#environment-variables)

## License

Apache-2.0