build:npm:
  image: harbor.vimpelcom.ru/dockerhub/library/node:lts
  stage: build
  cache:
    - key:
        files:
          - package.json
      paths:
        - node_modules/
  rules:
    - !reference [.build-npm-rules, rules]
  variables:
    PRODUCT: "$PRODUCT_PROD"
  script:
    - export PRODUCT_VERSION=$(node -p "require('./package.json').version")
    - echo PRODUCT_VERSION="$PRODUCT_VERSION" >> .env
    - echo PRODUCT="$PRODUCT_PROD" >> .env
    - npm install
    - npm run build
    - export VITE_NEW_VERSION="true"
    - echo "$DMZ_DIST_DIR"
    - ./node_modules/.bin/vitepress build src --outDir "$DMZ_DIST_DIR"
  artifacts:
    paths:
      - "$DIST_DIR"
      - "$DMZ_DIST_DIR"
    reports:
      dotenv: .env
    expire_in: 1h
