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

@magic/format

v0.0.65

Published

format your code.

Downloads

788

Readme

@magic/format

run prettier and format your code.

html docs

NPM version Linux Build Status Windows Build Status Coverage Status Greenkeeper badge Known Vulnerabilities

getting started

be in a nodejs project.

npm i --save-dev @magic/format

npm run scripts

edit package.json:

{
  "scripts": {
    "format": "f -w",
    "format:check": "f"
  }
}

npm run format will format and overwrite your source files,

npm run format:check will list the files that would be changed.

cli

you can install this library globally, but the recommendation is to add the dependency and scripts to the package.json file.

this both explains to everyone that your app has this dependencies as well as keeping your bash free of clutter

npm i -g @magic/format

// check formatting using prettier but do not write
f

// format and overwrite files using prettier
f -w
prettier plugins

@magic/format supports a number of prettier plugins out of the box as optional peerDependencies. Just install any of the following and prettier will start checking the appropriate files:

  • ext: plugin
  • haml: @prettier/plugin-haml
  • lua: @prettier/plugin-lua
  • php: @prettier/plugin-php
  • pug: @prettier/plugin-pug
  • py: @prettier/plugin-python
  • rb: @prettier/plugin-ruby
  • gemspec: @prettier/plugin-ruby
  • xml: @prettier/plugin-xml
  • toml: @voltiso/prettier-plugin-toml
  • astro: prettier-plugin-astro
  • java: prettier-plugin-java
  • svelte: prettier-plugin-svelte

Changelog

0.0.1

first commit

0.0.2
  • change error output
  • node version is strict
0.0.3

update deps

0.0.4

update info messages

0.0.5

update dependencies

0.0.6

messages now being logged from bin.mjs, making src/index.mjs return a list of changedFiles instead.

0.0.7
  • cli script awaits format before displaying information
  • add --silent option to suppress info if nothing got changed
0.0.8

update dependencies

0.0.9

update prettier

0.0.10

update dependencies

0.0.11

bump required node version to 14.2.0

0.0.12
  • do not error if .gitignore does not exist
0.0.13
  • npm i -g @magic/format now is actually usable.
0.0.14

update dependencies

0.0.15

update dependencies

0.0.16

update dependencies

0.0.17

update dependencies

0.0.18

update dependencies

0.0.19

update dependencies

0.0.20

update dependencies

0.0.21
  • bump required node version to 14.15.4
  • update dependencies
0.0.22

update dependencies (@magic/fs)

0.0.23

update dependencies

0.0.24

update dependencies

0.0.25
  • update dependencies (@magic/fs)
  • ** broken npm cache **
0.0.26

release to refresh npm cache

0.0.27

update @magic/types and intermediate deps to avoid circular dependency

0.0.28

update depdendencies

0.0.29

update dependencies

0.0.30

update dependencies

0.0.31

update dependencies

0.0.32
  • format .js files by default
  • update dependencies
0.0.33
  • update dependencies
0.0.34
  • less runtime errors
  • more tests
  • update dependencies
0.0.35

update dependencies

0.0.36

update dependencies

0.0.37

update dependencies

0.0.38

update dependencies

0.0.39
  • update dependencies
  • make sure errors happening whilst formatting files do not lead to data loss in other files that are being written at that same point in time
0.0.40

update dependencies

0.0.41

update dependencies

0.0.42

update dependencies

0.0.43

update dependencies

0.0.44
  • add svelte and astro support (prettier-plugin-svelte and prettier-plugin-astro)
  • support more filetypes as default: mjs, js, ts, json, jsx, tsx, svelte, astro, markdown, md
0.0.45

add css, scss, sass filetypes

0.0.46

catch SIGINT and wait for files to write before executing process.exit()

0.0.47
  • add pug and gltf to default --file-types
  • update dependencies
0.0.48

actually distribute @prettier/plugin-pug

0.0.49
  • update dependencies
  • move all prettier plugins to optionalDependencies, we can install them where needed
0.0.50
  • update dependencies
  • add various prettier plugins as optional peerDependencies, and check for them in the cli. if they exist, add their extensions to the prettier fileTypes
  • catch SIGTERM in addition to SIGINT. SIGKILL is uncatchable.
0.0.51

update dependencies

0.0.52

update dependencies

0.0.53
  • manually import preinstalled optional prettier plugins
  • update dependencies
0.0.54
  • expose format and formatString as javascript api
  • update dependencies
0.0.55
  • peerDependencies allow newer versions
0.0.56
  • peerDependencies allow any version
0.0.57
  • fix peerDependency resolution
0.0.58
  • readd plugins: [] to defaultConfig, allowing us to expand them with installed peerDependencies
0.0.59
  • update dependencies
  • add glsl shader support (plugin-prettier-glsl)
0.0.60
  • update deps
0.0.61
  • add htmlWhitespaceSensitivity: ignore
  • update deps
0.0.62
  • add prettier-plugin-tailwindcss
  • update prettier dependency
0.0.63
  • use prettier-plugin-tailwindcss for svelte files
0.0.64
  • prettier-plugin-tailwindcss: add to svelte and astro apps
0.0.65
  • remove prettier-plugin-tailwindcss, it breaks a lot of svelte code
0.0.66 - unreleased

...