---
# System prepended metadata

title: webversion

---

# webversion

## vite build time check cli
```typescript
> npx vite build --degbug

//持續性log build time
> npx vite build --degbug --watch
```

```typescript
// build.sh

#!/bin/bash

start_time=$(date +%s)

# Run your build command here
npx vite build

end_time=$(date +%s)
total_time=$((end_time - start_time))

echo "Build completed in $total_time seconds."

```


```typescript
//.gitlab-ci.yml


// APP_VERSION 會是根據ci pipiline version
variables:
  APP_VERSION: $CI_PIPELINE_IID


build website:
  stage: build
  script:
    - echo $CI_PIPELINE_SOURCE
    - chmod +x build.sh
    - ./build.sh | grep 'Build completed in' > dist/version.html
    - echo $APP_VERSION >> dist/version.html
  artifacts:
    paths:
      - dist

// test url include web version
.deploy:
  image:
    name: amazon/aws-cli
    entrypoint: [""]
  rules:
    - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
    - if: '$CI_COMMIT_BRANCH == "develop"'
      when : never
  script:
    - aws --version
    - echo "Hello S3"> test.txt
    - aws s3 sync build s3://$AWS_S3_BUCKET --delete
    - curl  $CI_ENVIRONMENT_URL | grep "React App"  
    - echo $APP_VERSION 
    - curl  $CI_ENVIRONMENT_URL/version.html | grep $APP_VERSION  
    - curl  $CI_ENVIRONMENT_URL/version.html | grep "Build completed in"  
```