version: 2
jobs:
  build:
    docker:
      - image: circleci/node:8
    steps:
      - checkout
      - run:
          name: cc-install
          command: |
            curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
            chmod +x ./cc-test-reporter
      - run:
          name: cc-before
          command: |
            ./cc-test-reporter before-build
      - restore_cache:
          name: Restore Yarn Package Cache
          keys:
            - yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
      - run:
          name: Install Dependencies
          command: yarn
      - save_cache:
          name: Save Yarn Package Cache
          key: yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
          paths:
            - node_modules/
      - run:
          name: Run tests
          command: yarn test.coverage --verbose
      - run:
          name: cc-after
          command: |
            ./cc-test-reporter after-build --coverage-input-type lcov --exit-code $?
      - run:
          name: Run build
          command: yarn build

workflows:
  version: 2
  build_and_publish:
    jobs:
      - build

version: 2
jobs:
  build:
    docker:
      - image: circleci/node:8
    steps:
      - checkout
      - run:
          name: Create .npmrc for the private registry
          command: |
            echo "
              \@stoplight:registry=https://registry.npmjs.org/
              //registry.npmjs.org/:_authToken=${NPM_TOKEN}
            " > .npmrc
      - run:
          name: cc-install
          command: |
            curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
            chmod +x ./cc-test-reporter
      - run:
          name: cc-before
          command: |
            ./cc-test-reporter before-build
      - restore_cache:
          name: Restore Yarn Package Cache
          keys:
            - yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
      - run:
          name: Install Dependencies
          command: yarn
      - save_cache:
          name: Save Yarn Package Cache
          key: yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
          paths:
            - node_modules/
      - run:
          name: Run tests
          command: yarn test.coverage --verbose
      - run:
          name: cc-after
          command: |
            ./cc-test-reporter after-build --coverage-input-type lcov --exit-code $?
      - run:
          name: Run build
          command: yarn build

workflows:
  version: 2
  build_and_publish:
    jobs:
      - build

Put .npmrc at the moment
Put .npmrc at the moment
