Skip to content
A collection of base configs and CLI wrappers used to speed up development @ Spotify.
TypeScript JavaScript Shell
Branch: master
Clone or download
Latest commit 00e55be Aug 21, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows Call the test pipeline "tests"; update badge on README (#49) Aug 20, 2019
packages fix(web-scripts): ignore TypeScript declaration files from coverage Aug 13, 2019
.gitignore chore: use global .gitignore to ignore web-scripts generated files Jul 1, 2019
.gitmodules ci: add Github actions test pipeline Aug 20, 2019
.npmrc chore: Initial commit Jun 20, 2019
.prettierrc.js chore: Initial commit Jun 20, 2019
CHANGELOG.md v1.2.0 Jul 29, 2019
LICENSE chore: Initial commit Jun 20, 2019
NOTICE Create NOTICE Jun 26, 2019
README.md Update README.md Aug 21, 2019
lerna.json v1.2.0 Jul 29, 2019
package.json
yarn.lock fix(deps): fix vulnerabilities Jul 16, 2019

README.md

@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": "^1.0.0",
    "husky": "^2.5.0"
  },
  "scripts": {
    "build": "web-scripts build",
    "test": "web-scripts test",
    "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

For now, we will release this repo manually with fixed versions. To do that, use:

lerna publish --conventional-commits --registry=https://registry.npmjs.com
You can’t perform that action at this time.