image: node:latest

stages:
  - test
  - deploy

cache:
  paths:
    - node_modules/

test:
  script:
    - npm install
    - npx prettier --check .
    - npm test
  coverage: /All files\s*\|\s*([\d\.]+)/
  except:
    - tags
  allow_failure: true

deploy:
  stage: deploy
  script:
    - echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}'>.npmrc
    - npm publish
  except:
    - tags
