# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
  build:
    docker:
      # specify the version you desire here
      - image: circleci/node:10.4.1

    working_directory: ~/repo

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          name: Restore Yarn Package Cache
          keys:
            - yarn-packages-{{ checksum "yarn.lock" }}
            # fallback to using the latest cache if no exact match is found
            - yarn-packages-

      - run:
          name: Install Dependencies
          command: yarn install --frozen-lockfile

      - save_cache:
          paths:
            - ~/.cache/yarn
          key: v1-dependencies-{{ checksum "yarn.lock" }}

      # Let's lint first
      - run:
          name: Linting
          command: yarn tslint
      # run tests!
      - run:
          name: Testing
          command: yarn test
