# This is a sample build configuration for JavaScript.
# Check our guides at https://confluence.atlassian.com/x/14UWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: node:8.9.4

pipelines:
  branches:
    master:
      - step:
          caches:
            - node
          script: # Modify the commands below to build your repository.
            - npm install
            - npm run compile
            - npm test
            - npm run report-coverage
    release:
      - step:
          caches:
            - node
          script: # Modify the commands below to build your repository.
            - printf "//`node -p \"require('url').parse(process.env.NPM_REGISTRY_URL || 'https://registry.npmjs.org').host\"`/:_authToken=${NPM_TOKEN}\nregistry=${NPM_REGISTRY_URL:-https://registry.npmjs.org}\n" >> ~/.npmrc
            - npm install
            - npm run compile
            - npm test
            - npm run report-coverage
            - npm publish
