# @sandvikcode/web-tooling

> Configs and CLI for JavaScript/TypeScript projects.

Latest version **1.4.0** (published 2021-03-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @sandvikcode/web-tooling
pnpm add @sandvikcode/web-tooling
yarn add @sandvikcode/web-tooling
bun add @sandvikcode/web-tooling
```

Provides the command `web-tooling`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2021-03-05 |
| First published | 2019-07-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 53 |
| Unpacked size | 32.5 KB |
| Known vulnerabilities | 0 (+6 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | sandvikcode_owner |

## Links

- npm: https://www.npmjs.com/package/@sandvikcode/web-tooling
- Repository: https://github.com/sandvikcode/web-tooling
- npm.io page: https://npm.io/package/@sandvikcode/web-tooling

## Dependencies (53)

- [jest](https://npm.io/package/jest.md) ^24.9.0
- [eslint](https://npm.io/package/eslint.md) ^6.6.0
- [webpack](https://npm.io/package/webpack.md) ^4.41.2
- [fs-extra](https://npm.io/package/fs-extra.md) ^8.1.0
- [prettier](https://npm.io/package/prettier.md) ^1.19.1
- [commander](https://npm.io/package/commander.md) ^3.0.2
- [stylelint](https://npm.io/package/stylelint.md) ^9.10.1
- [babel-jest](https://npm.io/package/babel-jest.md) ^24.9.0
- [css-loader](https://npm.io/package/css-loader.md) ^3.2.0
- [typescript](https://npm.io/package/typescript.md) ^3.7.2
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.7.2
- [@types/jest](https://npm.io/package/@types/jest.md) ^24.0.22
- [cross-spawn](https://npm.io/package/cross-spawn.md) ^6.0.5
- [file-loader](https://npm.io/package/file-loader.md) ^4.2.0
- [lint-staged](https://npm.io/package/lint-staged.md) ^9.4.2
- [webpack-cli](https://npm.io/package/webpack-cli.md) ^3.3.10
- [babel-loader](https://npm.io/package/babel-loader.md) ^8.0.6
- [style-loader](https://npm.io/package/style-loader.md) ^1.0.0
- [@svgr/webpack](https://npm.io/package/@svgr/webpack.md) ^4.3.3
- [emptyfunction](https://npm.io/package/emptyfunction.md) 1.0.0
- [worker-loader](https://npm.io/package/worker-loader.md) ^2.0.0
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.7.2
- [@storybook/cli](https://npm.io/package/@storybook/cli.md) 6.2.0-alpha.1
- [postcss-loader](https://npm.io/package/postcss-loader.md) ^3.0.0
- [@storybook/html](https://npm.io/package/@storybook/html.md) 6.2.0-alpha.1
- [stylelint-order](https://npm.io/package/stylelint-order.md) ^2.2.1
- [@storybook/react](https://npm.io/package/@storybook/react.md) 6.2.0-alpha.1
- [@babel/preset-env](https://npm.io/package/@babel/preset-env.md) ^7.7.1
- [identity-obj-proxy](https://npm.io/package/identity-obj-proxy.md) ^3.0.0
- [postcss-preset-env](https://npm.io/package/postcss-preset-env.md) ^6.7.0
- [webpack-dev-server](https://npm.io/package/webpack-dev-server.md) ^3.9.0
- [@babel/preset-react](https://npm.io/package/@babel/preset-react.md) ^7.7.0
- [copy-webpack-plugin](https://npm.io/package/copy-webpack-plugin.md) ^5.0.5
- [eslint-plugin-react](https://npm.io/package/eslint-plugin-react.md) ^7.16.0
- [html-webpack-plugin](https://npm.io/package/html-webpack-plugin.md) ^3.2.0
- [eslint-plugin-import](https://npm.io/package/eslint-plugin-import.md) ^2.18.2
- [terser-webpack-plugin](https://npm.io/package/terser-webpack-plugin.md) ^2.2.1
- [eslint-config-prettier](https://npm.io/package/eslint-config-prettier.md) ^6.5.0
- [mini-css-extract-plugin](https://npm.io/package/mini-css-extract-plugin.md) ^0.8.0
- [webpack-bundle-analyzer](https://npm.io/package/webpack-bundle-analyzer.md) ^3.6.0
- [@babel/preset-typescript](https://npm.io/package/@babel/preset-typescript.md) ^7.7.2
- [@typescript-eslint/parser](https://npm.io/package/@typescript-eslint/parser.md) ^2.7.0
- [eslint-plugin-react-hooks](https://npm.io/package/eslint-plugin-react-hooks.md) ^2.2.0
- [stylelint-config-prettier](https://npm.io/package/stylelint-config-prettier.md) ^5.2.0
- [eslint-plugin-import-helpers](https://npm.io/package/eslint-plugin-import-helpers.md) ^1.0.2
- [stylelint-config-recommended](https://npm.io/package/stylelint-config-recommended.md) ^2.2.0
- [@babel/plugin-transform-runtime](https://npm.io/package/@babel/plugin-transform-runtime.md) ^7.6.2
- [@typescript-eslint/eslint-plugin](https://npm.io/package/@typescript-eslint/eslint-plugin.md) ^2.7.0
- [html-webpack-inline-source-plugin](https://npm.io/package/html-webpack-inline-source-plugin.md) ^0.0.10
- [optimize-css-assets-webpack-plugin](https://npm.io/package/optimize-css-assets-webpack-plugin.md) ^5.0.3
- [@babel/plugin-syntax-dynamic-import](https://npm.io/package/@babel/plugin-syntax-dynamic-import.md) ^7.2.0
- [@babel/plugin-proposal-class-properties](https://npm.io/package/@babel/plugin-proposal-class-properties.md) ^7.7.0
- [stylelint-value-no-unknown-custom-properties](https://npm.io/package/stylelint-value-no-unknown-custom-properties.md) ^2.0.0

## Recent versions

- 1.4.0 (latest) — 2021-03-05
- 1.3.0 — 2020-05-13
- 1.2.0 — 2020-05-05
- 1.1.0 — 2020-02-21
- 1.0.0 — 2019-12-20
- 0.15.1 — 2019-11-12
- 0.15.0 — 2019-11-12
- 0.14.2 — 2019-10-14
- 0.14.1 — 2019-09-30
- 0.14.0 — 2019-09-30
- 0.13.3 — 2019-08-20
- 0.13.2 — 2019-08-15
- 0.13.1 — 2019-08-15
- 0.13.0 — 2019-08-15
- 0.12.2 — 2019-08-06
- … 18 more at https://npm.io/package/@sandvikcode/web-tooling/versions

## README

# @sandvikcode/web-tooling

> Opinionated configs and CLI for JavaScript/TypeScript projects.

## Installation

Add `@sandvikcode/web-tooling` and `husky` as a devDependencies:

```bash
yarn add @sandvikcode/web-tooling husky --dev
```

## Usage

Add this to your `package.json`:

```json
{
  "scripts": {
    "start": "web-tooling webpack-dev-server",
    "build": "web-tooling webpack",
    "analyze": "web-tooling analyze",
    "format": "web-tooling format",
    "lint": "web-tooling lint",
    "storybook": "web-tooling storybook:react",
    "test": "web-tooling test",
    "type-check": "web-tooling type-check"
  },
  "husky": {
    "hooks": {
      "pre-commit": "web-tooling pre-commit",
      "pre-push": "web-tooling pre-push"
    }
  }
}
```

### CLI

```
Usage: web-tooling [options] [command]

Configs and CLI for JavaScript/TypeScript projects.

Options:
  -V, --version                 output the version number
  -h, --help                    output usage information

Commands:
  analyze                       Analyze Webpack build
  format [options] [glob]       Format files using Prettier
  lint [options] [glob]         Lint files using ESLint and Stylelint
  pre-commit                    Run lint-staged commands
  pre-push [options]            Type-check, lint and test
  storybook:html [options]      Run Storybook for HTML
  storybook:react [options]     Run Storybook for React
  test [options]                Run tests using Jest
  type-check [options]          Run type-checking
  webpack [options]             Build using Webpack
  webpack-dev-server [options]  Start webpack-dev-server
```

Run `web-tooling [command] --help` to see options for each command.

### Configuration

Create configuration files depending on which tools you wish to use from this project. Note that configuring these tools in any other way (for example through package.json) is NOT supported.

All configurations that are .js files can be extended like this:

```js
const config = require('@sandvikcode/web-tooling/config/eslint');
config = {
  ...config,
  rules: {
    ...config.rules,
    'no-console': 'off',
  },
};
module.exports = config;
```

#### .eslintrc.js

```js
module.exports = require('@sandvikcode/web-tooling/config/eslint');
```

#### .prettierrc.js

```js
module.exports = require('@sandvikcode/web-tooling/config/prettier');
```

#### .stylelintrc.js

```js
module.exports = require('@sandvikcode/web-tooling/config/stylelint');
```

#### jest.config.js

```js
module.exports = require('@sandvikcode/web-tooling/config/jest');
```

#### lint-staged.config.js

```js
module.exports = require('@sandvikcode/web-tooling/config/lint-staged');
```

#### tsconfig.json

```json
{
  "extends": "@sandvikcode/web-tooling/config/tsconfig",
  "include": ["src/**/*"]
}
```

#### .browserslistrc

This file is optional, it defaults to:

```
>0.5%
not dead
last 2 versions
not ie <= 11
not op_mini all
```

#### babel.config.js

```js
module.exports = require('@sandvikcode/web-tooling/config/babel');
```

#### webpack.config.js

Default entrypoint for webpack config is "/src/" (index.js or index.ts or index.tsx)

```js
const createConfig = require('@sandvikcode/web-tooling/config/webpack');

module.exports = createConfig({
  // environment variables to add to the bundles
  // can be accessed through process.env.VARIABLE_NAME
  envVariables: {
    VARIABLE_NAME: 'true',
  },

  // see config/webpack.js for all the options
});
```

#### .storybook/config.js

```js
const {
  configure,
} = require('@sandvikcode/web-tooling/config/storybook-react');

configure(require.context('../src', true, /\.stories\.tsx$/), module);
```

#### .storybook/webpack.config.js

```js
const {
  webpackConfig,
} = require('@sandvikcode/web-tooling/config/storybook-react');

module.exports = webpackConfig;
```

---
_Source: https://npm.io/package/@sandvikcode/web-tooling · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
