🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

@volvo-cars/vcc-scripts

Package Overview
Dependencies
Maintainers
11
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@volvo-cars/vcc-scripts

Build, lint, test and format your frontend code with Volvo Cars default configurations

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
46
187.5%
Maintainers
11
Weekly downloads
 
Created
Source

@volvo-cars/vcc-scripts

Wraps build, test, lint and formatting tools and keeps them up to date for you.

Basic usage

yarn add @volvo-cars/vcc-scripts

Example package.json

{
  "main": "lib/index.js",
  "module": "es/index.js",
  "files": ["lib", "es"],
  "scripts": {
    "build": "vcc-scripts build",
    "lint": "vcc-scripts lint",
    "format": "vcc-scripts format",
    "test": "vcc-scripts test"
  },
  "devDependencies": {
    "vcc-scripts": "^0.0.5"
  }
}

build

Runs Babel on a package, using fields from package.json as configuration. See vcc-scripts build --help for more information.

  • Compiles src/ to CommonJS modules to the dirname of package.json#main.
  • Compiles src/ to ES modules to the dirname of package.json#module, if it exists.
  • Compiles src/ to ES modules for modern browsers to the dirname of package.json#esnext, if it exists.
  • Outputs TypeScript definition files to the dirname of package.json#types, if it exists and the package has a tsconfig.json.

@volvo-cars/babel-preset-react-app is used as the Babel configuration. You can add your own plugins with a .babelrc file that will be merged into the default configuration, but please send a pull request to the Babel preset if your change might benefit others.

To avoid including duplicated helper functions in your compiled code, run yarn add @babel/runtime to use the shared Babel runtime and vcc-scripts will adjust the Babel config.

Example package.json

{
  "main": "lib/index.js",
  "module": "es/index.js",
  "esnext": "esnext/index.js",
  "types": "types/index.d.ts",
  "files": ["lib", "es", "esnext", "types"],
  "scripts": {
    "build": "vcc-scripts build",
    "build:watch": "vcc-scripts build --watch"
  },
  "dependencies": {
    "@babel/runtime": "^7.4.0"
  }
}

test

Runs Jest with a default configuration. See vcc-scripts test --help for more information.

Any additional arguments will be passed through to the Jest cli.

Commonly used setup scripts are added automatically, such as a Google Analytics global and @testing-library/jest-dom/extend-expect. To add your own setup scripts, use the --setupFiles or --setupFilesAfterEnv options.

Example package.json

{
  "scripts": {
    "test": "vcc-scripts test --coverage --setupFiles ./testing/setup.js",
    "test:watch": "vcc-scripts test --watch --setupFiles .//testing/setup.js"
  }
}

lint

Runs eslint with the official Volvo Cars eslint configurations without having to install eslint or configurations separately. See vcc-scripts lint --help for more information.

Any additional arguments will be passed through to the eslint cli.

You can add your own configuration with custom .eslintrc files in sub-folders.

For your editor plugins to pick up the correct eslint config, create an .eslintrc.js in the root of your project with

module.exports = require('@volvo-cars/vcc-scripts/config/eslint.js');

Example package.json

{
  "scripts": {
    "lint": "vcc-scripts lint",
    "lint:fix": "vcc-scripts lint --fix"
  }
}

format

Runs prettier with the official Volvo Cars configuration without having to install prettier or configuration separately.

For your editor to pick up the correct prettier config, create a .prettierrc file with "@volvo-cars/prettier-config" in your project root.

Example package.json

{
  "scripts": {
    "format": "vcc-scripts format",
    "format:check": "vcc-scripts format --dry-run"
  }
}

FAQs

Package last updated on 12 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts