Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(web-ux): add web-ux #585

Merged
merged 5 commits into from
Apr 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/codeql/codeql-web-ux-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: "CodeQL web-ux config"

paths:
- code/web-ux
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ updates:

# Maintain dependencies for npm
- package-ecosystem: "npm"
directory: "/code/web-ui"
directory: "/code/web-ux"
target-branch: "main"
schedule:
interval: "daily"
Expand Down
106 changes: 106 additions & 0 deletions .github/workflows/build-web-ux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: build web-ux

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v3.4.1
with:
paths: '["code/web-ux/**", ".github/workflows/build-web-ux.yaml"]'
cancel_others: 'true'
do_not_skip: '["workflow_dispatch", "push"]'
semantic-release:
needs: prepare
if: ${{ needs.prepare.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: false
outputs:
new_release_published: ${{ steps.release.outputs.new_release_published }}
new_release_version: ${{ steps.release.outputs.new_release_version }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Semantic Release web-ux
id: release
uses: cycjimmy/semantic-release-action@v2
with:
working_directory: code/web-ux
semantic_version: 18
dry_run: false
extra_plugins: |
@semantic-release/commit-analyzer@9.0.2
@semantic-release/release-notes-generator@10.0.3
@semantic-release/exec@6.0.2
@semantic-release/npm@8.0.3
@semantic-release/git@10.0.1
extends: |
semantic-release-monorepo
env:
GH_TOKEN: ${{ secrets.PAT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-web-ux:
needs:
- prepare
- semantic-release
if: ${{ needs.prepare.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
ref: ${{ github.ref }}
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: javascript
config-file: .github/codeql/codeql-web-ux-config.yml
- name: Get project version
id: getVersion
working-directory: code/web-ux
run: |
PROJECT_VERSION=$(make -s get-version)
echo ::set-output name=projectVersion::${PROJECT_VERSION}
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
with:
projectBaseDir: code/web-ux
args: >
-Dsonar.projectVersion=${{ steps.getVersion.outputs.projectVersion }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build
working-directory: code/web-ux
run: make build
- name: Login to DockerHub
if: ${{ needs.semantic-release.outputs.new_release_published == 'true' }}
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push
if: ${{ needs.semantic-release.outputs.new_release_published == 'true' }}
working-directory: code/web-ux
run: make push VERSION=${{ needs.semantic-release.outputs.new_release_version }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
with:
category: "ara_web-ux"
3 changes: 3 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ on:
jobs:
prepare:
runs-on: ubuntu-latest
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: false
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
paths_result: ${{ steps.skip_check.outputs.paths_result }}
Expand Down
15 changes: 15 additions & 0 deletions code/web-ux/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* eslint-env node */
require("@rushstack/eslint-patch/modern-module-resolution");

module.exports = {
root: true,
extends: [
"plugin:vue/vue3-essential",
"eslint:recommended",
"@vue/eslint-config-prettier",
],
env: {
"vue/setup-compiler-macros": true,
node: true,
},
};
28 changes: 28 additions & 0 deletions code/web-ux/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
dist-ssr
coverage
*.local

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
20 changes: 20 additions & 0 deletions code/web-ux/.releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"branches": [
{"name": "main"}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
["@semantic-release/exec", {
"verifyConditionsCmd": "git pull"
}],
"@semantic-release/npm",
["@semantic-release/git", {
"assets": ["package.json"],
"message": "chore(web-ux): ara-web-ux ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}]
],
"extends": [
"semantic-release-monorepo"
]
}
3 changes: 3 additions & 0 deletions code/web-ux/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["johnsoncodehk.volar", "johnsoncodehk.vscode-typescript-vue-plugin"]
}
20 changes: 20 additions & 0 deletions code/web-ux/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# STAGE 1 : build
FROM node:16 as builder

WORKDIR /usr/src/app

COPY . ./

RUN npm ci

RUN npm run build

# STAGE 2 : serve

FROM nginx:1.20.2

ENV PORT 7000
EXPOSE ${PORT}

COPY --from=builder /usr/src/app/dist /usr/share/nginx/html
COPY config/default.conf.template /etc/nginx/templates/default.conf.template
46 changes: 46 additions & 0 deletions code/web-ux/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#####################################
## VARIABLES ##
#####################################

NODE_VERSION=16
FULL_IMAGE?=decathlon/ara-web-ux
VERSION?=$(shell make -s get-version)

#####################################
## DEVELOP ##
#####################################

# WITH NODE

npm-install: ## DEV - install project
@npm install

npm-run: ## DEV - run web-ui
@npm run dev

#####################################
## PACKAGE ##
#####################################

build: ## Build docker image
@docker build -t $(FULL_IMAGE) .

push: ## Push docker image. You can use VERSION to specify one.
@docker image tag $(FULL_IMAGE) $(FULL_IMAGE):$(VERSION)
@docker image push $(FULL_IMAGE):$(VERSION)

#####################################
## UTILS ##
#####################################

get-version: ## Get component version
@cat package.json | jq -r '.version'

update-version: ## Update component version
@npm version $(VERSION)

.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

.DEFAULT_GOAL := help
41 changes: 41 additions & 0 deletions code/web-ux/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# arav2

This template should help get you started developing with Vue 3 in Vite.

## Recommended IDE Setup

[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.vscode-typescript-vue-plugin).

## Customize configuration

See [Vite Configuration Reference](https://vitejs.dev/config/).

## Project Setup

```sh
npm install
```

### Compile and Hot-Reload for Development

```sh
npm run dev
```

### Compile and Minify for Production

```sh
npm run build
```

### Run Unit Tests with [Vitest](https://vitest.dev/)

```sh
npm run test:unit
```

### Lint with [ESLint](https://eslint.org/)

```sh
npm run lint
```
45 changes: 45 additions & 0 deletions code/web-ux/config/default.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
server {
listen $PORT;
server_name localhost;

#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
13 changes: 13 additions & 0 deletions code/web-ux/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="./src/assets/img/logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Ara</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
Loading