15.0.0 • Published 12 months ago

@spotify/web-scripts-utils v15.0.0

Weekly downloads
760
License
Apache-2.0
Repository
github
Last release
12 months ago

@spotify/web-scripts

Actions Status Version

A monorepo of base configs and CLI wrappers used to speed up development @ Spotify.

Want to use it? Check out the CLI documentation to get started!

About this project

web-scripts CLI

@spotify/web-scripts is a CLI that combines shared configuration for building, linting, testing, formatting, and releasing libraries for Node and the browser. It is opinionated, but allows configuration to avoid lock-in. You can also pick and choose which scripts you use. It is inspired by other tooling bundles like react-scripts and kcd-scripts.

yarn add --dev @spotify/web-scripts husky

It is intended to be used within a project as a series of npm scripts.

{
  "devDependencies": {
    "@spotify/web-scripts": "^2.0.0",
    "husky": "^2.5.0"
  },
  "scripts": {
    "build": "web-scripts build",
    "test": "web-scripts test",
    "format": "web-scripts format",
    "lint": "web-scripts lint",
    "commit": "web-scripts commit",
    "release": "web-scripts release"
  },
  "husky": {
    "hooks": {
      "pre-commit": "web-scripts precommit",
      "commit-msg": "web-scripts commitmsg"
    }
  }
}

View the full CLI documentation for more details on how to get started.

Create a new library

To quickly get started with a new @spotify/web-scripts library, you can build one with our library scaffolding tool:

yarn create @spotify/web-scripts-library my-library-name

Spotify shared configurations

The other projects in this repo are shared configurations for common tools we use for building, linting, and formatting our code. They can be installed separately and used by anyone should they opt to follow our standards. We have a specialized point-of-view on what belongs in our configs. They are all used by the web-scripts CLI by default.

Methodology

We have a few guiding principles for this project.

  1. Style rules should be auto-fixable and if you can, errors should be linted ahead of runtime.
  2. Avoid enforcing code style in static analysis; search for bugs with static analysis, and let auto-formatting deal with code style.
  3. Push "fast" checks as far left as you can. Optimize for code editors/IDEs fixing issues and enforcing things; write Git hooks that catch things as a failsafe; and use static analysis in CI to prevent bad things from getting into master.
  4. web-scripts is meant to be configurable. We want to avoid the "eject" problem. You should be able to easily take the base configs and extend them in your project.

Related projects we use

  • TypeScript: a superset of JavaScript which we think helps make code readable and less bug-prone.
  • ESLint: used for static code analysis with some auto-fixing.
  • Prettier: use to format code pre-commit and automatically in your editor.
  • Jest: our preferred JavaScript test framework.
  • husky: allows us to hook into git events in a convenient way.
  • lint-staged: allows us to write pre-commit hooks which target specific paths and run a series of commands.

Contributing

This project adheres to the Open Code of Conduct. By participating, you are expected to honor this code.

This project is an opinionated approach to static analysis, code formatting, testing, and publishing. It's the result of consensus between many web engineers inside Spotify, and the default configs will mostly be written by Spotify employees. We may reject PRs to the ESLint config if we don't agree that the rule makes sense as part of our baseline, for example. Use it if it aligns with your needs!

Running Tests locally

If you get an error like Cannot find module '../cjs' when running yarn test, you need to bootstrap web-scripts.

$ yarn lerna run bootstrap

Releasing

The repo releases automatically on merge to master using semantic-release and lerna in a Github Action.

15.0.0

12 months ago

14.1.6

1 year ago

14.1.5

1 year ago

14.1.3

1 year ago

14.1.4

1 year ago

14.1.1

1 year ago

14.1.2

1 year ago

14.0.0

2 years ago

14.1.0

2 years ago

14.0.1

2 years ago

14.0.2

2 years ago

13.0.1

2 years ago

12.0.1-dev.1

2 years ago

13.0.0

2 years ago

12.0.0

3 years ago

11.0.1-dev.6

3 years ago

11.0.0

3 years ago

10.0.0

3 years ago

9.0.3-rc.18

3 years ago

9.0.3-dev.14

3 years ago

9.0.0

4 years ago

8.0.0

4 years ago

7.0.0

4 years ago

6.1.1

4 years ago

5.3.0

4 years ago

6.0.0

4 years ago

5.1.0

4 years ago

5.0.2

4 years ago

5.0.0

4 years ago

4.0.0

4 years ago

3.3.0

4 years ago

3.1.0

4 years ago

3.0.0

5 years ago

2.1.0

5 years ago