machine:
    pre:
        - mkdir ~/.yarn-cache
    node:
        version: 4.3.2
    environment:
        YARN_VERSION: 0.19.1
        PATH: "${PATH}:${HOME}/.yarn/bin"

dependencies:
    pre:
        - |
            if [[ ! -e ~/.yarn/bin/yarn || $(yarn --version) != "${YARN_VERSION}" ]]; then
                curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $YARN_VERSION
            fi
    cache_directories:
        - ~/.yarn
        - ~/.yarn-cache
    override:
        - yarn install --ignore-engines # ignore engines is temporary until serverless offline 3.5.5 is released
test:
    override:
        - yarn run test-all
deployment:
    master:
        branch: master
        commands:
            - yarn run build
            - node scripts/bundle
            - cd bundle
            - yarn install --ignore-engines --prod
            - node ../node_modules/.bin/serverless deploy -v -s prod
            - cd ../
