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

amper-scripts

v1.2.4

Published

GS&F dev scripts

Downloads

92

Readme

amper-scripts

⏩ some tools to make project setup easier

Why

  • Create one set of basic standards and re-use them everywhere.
  • Easily opt-out: any detected config file automatically overrides defaults.
  • Easily extend: config files are made to be basic and extendable.
  • One command can get a decent baseline for testing on your CI servers.

Install

Using Yarn:

$ yarn add -D amper-scripts

…or using npm:

$ npm i --save-dev amper-scripts

Usage

Setting up in a project

A lot of setup is included, but you'll need to do a little setup. This is because your text editor likely expects config files to be in the project directory.

First, install using one of the commands above.

Quick setup

Add or update your .eslintrc.js:

module.exports = require('amper-scripts/config/eslint');

Add or update your prettier.config.js:

module.exports = require('amper-scripts/config/prettier.config.js');

Change scripts in your package.json or CI/CD setup to run this instead of eslint or prettier:

{
  "scripts": {
    "lint": "amper-scripts lint",
    "format": "amper-scripts format-write",
    "validate": "amper-scripts validate"
  }
}

Using different settings

Most commands allow you to extend or opt-out of the default config. In most cases to opt-out, just write the config file as you normally would and it'll be picked up.

Example: Extending ESLint config:

module.exports = {
  extends: [require.resolve('amper-scripts/config/eslint')],
  rules: {
    /* your custom rules */
  }
  // you can also change any other settings, such as `env`
};

Example: Extending Prettier config

const gsandfDefaults = require('amper-scripts/config/prettier.config.js');

module.exports = {
  ...gsandfDefaults
  // your rules
};

Getting help

If you ever forget what commands are available, just ask for help:

$ amper-scripts --help

If you need help on a specific command, run the help script:

$ amper-scripts help [command]

Enforcing code formatting

Check project code formatting using Prettier and list any differing files:

$ amper-scripts format-check

Enforce code formatting using Prettier, overwriting differing files:

$ amper-scripts format-write

Or, just get vanilla Prettier with the default config and ignore applied:

$ amper-scripts format [arguments]

Override the Prettier config by adding any allowed config file. The configuration is not merged; any detected configuration file is used as the base.

Catching code errors

Lint the project using ESLint:

$ amper-scripts lint

Override linting rules by adding any configuration file allowed by ESLint. The configuration is not merged; any detected configuration file is used as the base.

To extend the config in this repo, see "using different settings" above.

Additional arguments are passed to ESLint. For example, you can specify files to validate:

$ amper-scripts lint ./source

Validating project

This runs commands to generally check the project (i.e. lint, format-check) all at once. This is good for CI servers because it's fast, exits if anything fails, and is oriented toward showing you where errors occur:

$ amper-scripts validate

You can opt-out of individual steps as needed:

$ amper-scripts validate --no-lint

Use amper-scripts help validate for all available options.