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: init workspace for vue webapp #2546

Open
wants to merge 70 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 68 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
77c19e3
Result of yarn add vuetify
zklosko May 12, 2023
f6bf9a0
Installed Storybook JS
zklosko May 12, 2023
23b7c1a
Adding Cypress
zklosko May 12, 2023
6dbf9e1
Renaming package name in package.json
zklosko May 12, 2023
ad52701
Adding Vitest
zklosko May 12, 2023
fb9a0dd
Adding vue-i18n
zklosko May 12, 2023
47a5f81
chore: add axios and prettier packages
zklosko May 17, 2023
2e3d79f
chore: add eslint
zklosko May 17, 2023
e37bd4c
chore: configure prettier
zklosko May 17, 2023
281fc97
ci: create github actions workflow
zklosko May 17, 2023
b239814
chore: remove vue favicon
zklosko May 17, 2023
b55539f
chore: add libretime logo to new webapp
zklosko May 17, 2023
e54c80b
chore: config eslint
zklosko May 17, 2023
65eecb2
chore: fixing lockfile
zklosko May 17, 2023
3afeec4
cI: simplify github actions runner
zklosko May 18, 2023
9f53ca6
chore: fixing number of spaces for tabs
zklosko May 18, 2023
d0d728c
chore: ran prettier
zklosko May 18, 2023
94f5861
chore: add vitest package
zklosko May 19, 2023
1539f37
!fix ci: revert to prior working github actions file
zklosko May 19, 2023
9eae296
ci: added basic cypress setup
zklosko May 19, 2023
066a4bf
chore: adding po files from legacy
zklosko May 19, 2023
500e57e
chore: removing vitest
zklosko May 19, 2023
9e25d89
chore: convert po files to json for i18next
zklosko May 19, 2023
cd2bf4d
chore: switch to i18next from vue-i18n
zklosko May 19, 2023
c10e448
chore: remove i18next, add vue-i18n
zklosko May 23, 2023
4adbd9a
feat: initialize vue-i18n translations
zklosko May 23, 2023
906a99a
!broken chore: config vite for vue-i18n
zklosko May 23, 2023
9b90b3d
!broken chore: cleaning up translation formatting
zklosko May 23, 2023
07b08b8
chore: adding eslintignore
zklosko May 27, 2023
42ca1c9
chore: config eslint, run linter
zklosko May 27, 2023
c03ef61
chore: remove prettier package, cache deps for github actions
zklosko May 27, 2023
4590d74
chore: remove prettier, cache deps for ci
zklosko May 27, 2023
e38eb19
Update readme.md
zklosko May 27, 2023
89ca615
ci: fixing names in github actions runner
zklosko May 27, 2023
ef55ac3
chore: disable video recording in cypress
zklosko May 27, 2023
3cade48
feat: global vue-i18n injection
Jun 2, 2023
ec8b2d4
chore: remove legacy po files from webapp
Jun 2, 2023
3d973a9
chore: swap webfontloader for fontsource
Jun 2, 2023
fcc921c
chore: remove storybook
Jun 2, 2023
dcca756
feat: vite handles vue-i18n bundling
Jun 2, 2023
c82656b
chore: removing HTML from translation keys
Jun 2, 2023
1629d74
chore: adding node to types
Jun 2, 2023
a2c36c2
feat: adding custom primary and secondary colors
Jun 2, 2023
3fee54f
!broken feat:create locale picker
Jun 2, 2023
2fd9c3d
fix: remove unused variable
Jun 2, 2023
7956254
chore: remove axios
Jun 2, 2023
f46e151
chore: seperate translations from index.js bundle
Jun 2, 2023
568c84e
chore: change vite preview server port
Jun 3, 2023
04b5544
chore: got dynamic imports working for vue-i18n
Jun 9, 2023
aaa527a
chore: remove empty process:env def
Jun 9, 2023
56cc9ff
chore: ran prettier
Jun 9, 2023
9efcb5a
chore: run prettier on translations
Jun 9, 2023
2c8f538
chore: exclude locale folder from codespell check
Jun 9, 2023
891fbf5
chore: cleaning formatting
Jun 9, 2023
aea3720
!fix chore: fixing incorrect python regex
Jun 9, 2023
cf15fc7
ci: codespell ignore locale.json files
Jun 9, 2023
ebba480
!fix ci: fixing python regex in pre-commit codespell
Jun 9, 2023
b1374e4
chore: fix spelling, whitespace
Jun 9, 2023
87795f8
chore: remove .editorconfig
Jun 9, 2023
7485316
!fix chore: restoring needed process.env line in vite.config.ts
Jun 9, 2023
450d8ad
feat: starting work on about page
Jun 10, 2023
8c1d819
feat: about page with i18n demo, lazy loading
Jun 10, 2023
0cb49ca
feat: more work to sample about page
Jun 12, 2023
546ed71
chore: remove unused component
zklosko Jun 30, 2023
7d78e75
feat: started MPA setup, static demo page
zklosko Jun 30, 2023
e5a75f9
chore: Fixing readme for codespell
zklosko Jun 30, 2023
8168fe7
feat: resposition about page to /about path
zklosko Jul 1, 2023
7b7f3b8
chore: run Prettier
zklosko Jul 1, 2023
02a1dde
feat: main script hardcoded to dev server
zklosko Aug 30, 2023
80b9083
chore: ran yarn upgrade
zklosko Aug 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
77 changes: 77 additions & 0 deletions .github/workflows/webapp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Webapp

on:
workflow_dispatch:
push:
branches: [main, stable]
paths:
- .github/workflows/webapp.yml
- webapp/**

pull_request:
branches: [main, stable]
paths:
- .github/workflows/webapp.yml
- webapp/**

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
eslint-lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18"
cache: "yarn"
cache-dependency-path: "webapp/yarn.lock"
- name: Install packages
run: yarn install --frozen-lockfile
working-directory: webapp
- name: Lint
run: yarn lint
working-directory: webapp

cypress-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18"
cache: "yarn"
cache-dependency-path: "webapp/yarn.lock"
- name: Install packages
run: yarn install --frozen-lockfile
working-directory: webapp
- name: Run tests with Cypress
run: yarn cypress:run
working-directory: webapp

test-build:
runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18"
cache: "yarn"
cache-dependency-path: "webapp/yarn.lock"
- name: Install packages
run: yarn install --frozen-lockfile
working-directory: webapp
- name: Build
run: yarn build
working-directory: webapp
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ repos:
hooks:
- id: prettier
files: \.(md|mdx|yml|yaml|js|jsx|ts|tsx|json|css)$
exclude: ^legacy/public(?!/js/airtime)
exclude: (^legacy/public(?!/js/airtime)|^webapp/package.json)

- repo: https://github.com/asottile/pyupgrade
rev: v3.4.0
Expand Down Expand Up @@ -63,7 +63,7 @@ repos:
hooks:
- id: codespell
args: [--ignore-words=.codespellignore]
exclude: (^api/schema.yml|^legacy.*|yarn\.lock)$
exclude: (^api/schema.yml|^legacy.*|yarn\.lock|.json$)$

- repo: local
hooks:
Expand Down
4 changes: 4 additions & 0 deletions webapp/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
> 1%
last 2 versions
not dead
not ie 11
26 changes: 26 additions & 0 deletions webapp/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.DS_Store
node_modules
/dist


# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

.eslintrc.js
src/vite-env.d.ts
27 changes: 27 additions & 0 deletions webapp/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
"eslint:recommended",
"plugin:vue/vue3-essential",
"plugin:@typescript-eslint/recommended",
],
ignorePatterns: [],
overrides: [],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
plugins: ["vue", "@typescript-eslint"],
// rules: {
// quotes: ["error", "single"],
// "array-bracket-spacing": ["error", "never"],
// "array-bracket-newline": ["error", "never"],
// "no-mixed-spaces-and-tabs": "error",
// "no-trailing-spaces": "error",
// indent: ["error", 2],
// },
}
23 changes: 23 additions & 0 deletions webapp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist


# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
5 changes: 5 additions & 0 deletions webapp/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dist
node_modules
public
// src/locale
package.json
6 changes: 6 additions & 0 deletions webapp/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 4,
"semi": false,
"singleQuote": false
}
44 changes: 44 additions & 0 deletions webapp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Libretime Vue UI Development

## Project setup

We use yarn for package management for this Node.js project. If you don't have yarn, install it with

```
npm i -g yarn
```

## Project commands

```
# install all packages
yarn

# start dev environment
yarn dev

# build
yarn build

# run Eslint
yarn lint

# run Prettier, writing formatting changes to files
npx prettier -w src

# run tests with Cypress
yarn cypress:run
```

## Translation files

Ultimately, Weblate will be set up to translate strings in the new UI; for now, generated `.json` files are available in `src/locale`. The `.json` translations are decoupled from Weblate, and so Weblate updates will not update this part of the repo. These are just provided for development purposes.

## MPA file structure

This folder is split up into multiple apps.

- Main: `index.html` endpoint, `/` in the browser
- About: `src/about/index.html` endpoint, `/src/about` in the browser

Once built into static pages, the URL paths will be the same as the folder structure mentioned above. Both apps can use the same plugins, components, translations, etc., they just have different endpoints so we can statically build them separately.
11 changes: 11 additions & 0 deletions webapp/about/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<template>
<v-app>
<v-main>
<about />
</v-main>
</v-app>
</template>

<script setup lang="ts">
import About from "../src/views/About.vue"
</script>
14 changes: 14 additions & 0 deletions webapp/about/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vuetify 3</title>
</head>

<body>
<div id="app"></div>
<script type="module" src="/about/main.ts"></script>
</body>
</html>
20 changes: 20 additions & 0 deletions webapp/about/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* main.ts
*
* Bootstraps Vuetify and other plugins then mounts the App`
*/

// Components
import App from "./App.vue"

// Composables
import { createApp } from "vue"

// Plugins
import { registerPlugins } from "../src/plugins/index"

const app = createApp(App)

registerPlugins(app)

app.mount("#app")
10 changes: 10 additions & 0 deletions webapp/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from "cypress"

export default defineConfig({
e2e: {
setupNodeEvents(on, config) {

Check warning on line 5 in webapp/cypress.config.ts

View workflow job for this annotation

GitHub Actions / eslint-lint

'on' is defined but never used

Check warning on line 5 in webapp/cypress.config.ts

View workflow job for this annotation

GitHub Actions / eslint-lint

'config' is defined but never used
// implement node event listeners here
},
},
video: false,
})
9 changes: 9 additions & 0 deletions webapp/cypress/e2e/hello.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe("template spec", () => {
it("passes", () => {
cy.visit("https://example.cypress.io")

cy.contains("type").click()

cy.url().should("include", "/commands/actions")
})
})
5 changes: 5 additions & 0 deletions webapp/cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
37 changes: 37 additions & 0 deletions webapp/cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/// <reference types="cypress" />
// ***********************************************
// This example commands.ts shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
//
// declare global {
// namespace Cypress {
// interface Chainable {
// login(email: string, password: string): Chainable<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }
20 changes: 20 additions & 0 deletions webapp/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/e2e.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import "./commands"

// Alternatively you can use CommonJS syntax:
// require('./commands')
14 changes: 14 additions & 0 deletions webapp/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vuetify 3</title>
</head>

<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>