version: 2
jobs:
  build:
    working_directory: ~/react-webpack-skeleton
    docker:
      - image: phryg1an/circleci-node:8.1.4
    steps:
      - checkout
      - restore_cache:
          keys:
            - v1-{{ checksum ".nvmrc" }}-yarn-lock-{{ checksum "yarn.lock" }}
            - v1-{{ checksum ".nvmrc" }}-npm-package-{{ checksum "package.json" }}
      - run:
          name: Installing dependencies
          command: yarn install
      - save_cache:
          key: v1-{{ checksum ".nvmrc" }}-yarn-lock-{{ checksum "yarn.lock" }}
          paths:
            - node_modules
      - save_cache:
          key: v1-{{ checksum ".nvmrc" }}-npm-package-{{ checksum "package.json" }}
          paths:
            - node_modules
      - run:
          name: Scanning dependencies for vulnerabilities
          command: yarn run security
      - run:
          name: Testing
          command: mkdir -p /tmp/test-results/junit && yarn test --silent -- --reporter xunit > /tmp/test-results/junit/test-results.xml
      - store_test_results:
          path: /tmp/test-results
      - run:
          name: Building assets for production
          command: NODE_ENV=production yarn build
      - store_artifacts:
          path: index.js

version: 2
jobs:
  build:
    working_directory: ~/react-webpack-skeleton
    docker:
      - image: phryg1an/circleci-node:8.1.4
    steps:
      - checkout
      - restore_cache:
          keys:
            - v1-{{ checksum ".nvmrc" }}-yarn-lock-{{ checksum "yarn.lock" }}
            - v1-{{ checksum ".nvmrc" }}-npm-package-{{ checksum "package.json" }}
      - run:
          name: Installing dependencies
          command: yarn install --frozen-lockfile
      - save_cache:
          key: v1-{{ checksum ".nvmrc" }}-yarn-lock-{{ checksum "yarn.lock" }}
          paths:
            - node_modules
      - save_cache:
          key: v1-{{ checksum ".nvmrc" }}-npm-package-{{ checksum "package.json" }}
          paths:
            - node_modules
      - run:
          name: Scanning dependencies for vulnerabilities
          command: yarn run security
      - run:
          name: Testing
          command: mkdir -p /tmp/test-results/junit && yarn test --silent -- --reporter xunit > /tmp/test-results/junit/test-results.xml
      - store_test_results:
          path: /tmp/test-results
      - run:
          name: Building assets for production
          command: NODE_ENV=production yarn build
      - store_artifacts:
          path: index.js

Use `--frozen-lockfile` option during `yarn install`
CI: Use `--frozen-lockfile` option during `yarn install`

Causes CI builds to fail if the yarn lockfile would be changed,
helping to ensure that the committed lockfile is up-to-date.
