amper-scripts
GS&F dev scripts
Last updated 3 months ago by blakek .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install amper-scripts 
SYNC missed versions from official npm registry.

amper-scripts

⏩ some tools to make project setup easier

Why

  • Learn a best-practice once then re-use it everywhere.
  • Easily opt-out: any detected config file automatically overrides defaults.
  • Easily extend: config files are made to be extendable.
  • One command can get a decent baseline for testing in 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

Install using one of the commands above.

Add or update your .eslintrc.js:

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

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",
    "validate": "amper-scripts validate"
  }
}

Getting help

If you ever forget what's 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; overwrite 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 configuration is used as the base.

To extend the config in this repo, you can add the following in your prettier.config.js:

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

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 configuration is used as the base.

To extend the config in this repo, you can add the following in your .eslintrc.js:

module.exports = {
  extends: ['amper-scripts/config/.eslintrc.js'],
  rules: [
    // Add any custom rules
  ]
};

Also, you likely need a config file at the root of your repo so your editor can use it. You can just re-export the built-in configuration in a .eslintrc.js in your project root:

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

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

$ amper-scripts lint ./source

Validating project

Run 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 the error is:

$ 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.

Current Tags

  • 0.0.3                                ...           latest (3 months ago)
  • 0.0.4-0                                ...           next (3 months ago)

4 Versions

  • 0.0.4-0                                ...           3 months ago
  • 0.0.3                                ...           3 months ago
  • 0.0.2                                ...           3 months ago
  • 0.0.1                                ...           3 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (10)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |