version: 2
jobs:
  build:
    docker:
      - image: cimg/node:18.18.0
    steps:
      - checkout
      #   - run:
      #       name: update-npm
      #       command: 'sudo npm install -g npm@latest'
      - restore_cache: # special step to restore the dependency cache
          # Read about caching dependencies: https://circleci.com/docs/2.0/caching/
          key: dependency-cache-{{ checksum "package.json" }}
      - run:
          name: install-npm-wee
          command: npm install
      - save_cache: # special step to save the dependency cache
          key: dependency-cache-{{ checksum "package.json" }}
          paths:
            - ./node_modules
      - run:
          name: gen
          command: npm run gen
      - run:
          name: test
          command: npm test
      - run:
          name: build
          command: npm run build
      - run:
          name: build-demo
          command: npm run build-demo
