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

openscad-format

v1.0.0

Published

An opinionated formatter for the OpenSCAD language.

Downloads

21

Readme

openscad-format

A source code formatter for the OpenSCAD language.

Install

The utility is available on npm, you can install it like so:

$ npm install -g openscad-format

It packages clang-format with it for most platforms, so you don't need to worry about installing it.

Use

openscad-format is designed to be simple and flexible to use:

$ openscad-format --help
Usage: openscad-format [options]

Options:
  --version      Show version number                                   [boolean]
  -i, --input    Input file to read, file globs allowed (quotes recommended)
                                                                        [string]
  -o, --output   Output file to write                                   [string]
  -c, --config   Use the specified path to a config using the .openscad-format
                 style file                                             [string]
  -j, --javadoc  Automatically add {Java,JS}doc-style comment templates to
                 functions and modules where missing                   [boolean]
  -f, --force    Forcibly overwrite (or "fix") the source file         [boolean]
  -d, --dry      Perform a dry run, without writing                    [boolean]
  -h, --help     Show help                                             [boolean]

Examples:
  openscad-format -i input.scad -o          Formats input.scad and saves it as
  output.scad                               output.scad
  openscad-format < input.scad >            Formats input.scad and saves it as
  output.scad                               output.scad
  openscad-format < input.scad              Formats input.scad and writes to
                                            stdout
  cat input.scad | openscad-format | less   Formats input.scad and displays in
                                            less
  openscad-format -i './**/*.scad'          Formats all *.scad files recursively
                                            and writes them to their respective
                                            files

This utility requires clang-format, but this is automatically installed for most
platforms.

Configuration

This utility by default will search for the configuration file .openscad-format in one of the parent directories. If none is found it will fall back to the default.

The format used is identical to that of clang-format, the easiest way to create the .openscad-format file is using clang-format.

clang-format -style=llvm -dump-config > .openscad-format

See the clang-format docs for the full list of options. At the time of writing this the current styles supported are: LLVM, Google, Chromium, Mozilla, andWebKit.

Contribute

Make sure your PR's pass the unit tests and are free of ESLint errors. To check, run npm run all and it will guide you through what needs to be done.