version: 2.1
orbs:
  node: circleci/node@5.0.3
jobs:
  build:
    docker:
      - image: cimg/base:stable
    steps:
      - checkout
      - node/install:
          node-version: '14.19.3'
      - node/install-packages:
          cache-path: ~/project/node_modules
          override-ci-command: npm install
      - run:
          name: Running audit
          command: npm run audit
      - run:
          name: Running Mocha Tests
          command: npm test

workflows:
  version: 2

  build:
    jobs:
      - build

  nightly:
    triggers:
      - schedule:
          cron: "0 0 * * *"
          filters:
            branches:
              only:
                - master
    jobs:
      - build
