Skip to content

Commit

Permalink
Merge pull request #9 from cerberauth/vue-spa
Browse files Browse the repository at this point in the history
feat: bootstrap vuejs spa example project
  • Loading branch information
emmanuelgautier authored Oct 10, 2024
2 parents 7b8caef + 3b8322f commit d53c9e4
Show file tree
Hide file tree
Showing 29 changed files with 4,795 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
- workingDirectory: ./examples/react-spa
projectName: cerberauth-react-spa-oidc
directory: ./dist
- workingDirectory: ./examples/vue-spa
projectName: cerberauth-vue-spa-oidc
directory: ./dist
- workingDirectory: ./examples/angular-spa
projectName: cerberauth-angular-spa-oidc
directory: ./dist/angular-spa/browser
Expand Down
2 changes: 2 additions & 0 deletions examples/vue-spa/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VITE_OIDC_ISSUER="https://testid.cerberauth.com"
VITE_OIDC_CLIENT_ID=""
15 changes: 15 additions & 0 deletions examples/vue-spa/.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-typescript',
'@vue/eslint-config-prettier/skip-formatting'
],
parserOptions: {
ecmaVersion: 'latest'
}
}
30 changes: 30 additions & 0 deletions examples/vue-spa/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 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?

*.tsbuildinfo
16 changes: 16 additions & 0 deletions examples/vue-spa/.nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
server {

listen 80;

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

error_page 500 502 503 504 /50x.html;

location = /50x.html {
root /usr/share/nginx/html;
}
}
8 changes: 8 additions & 0 deletions examples/vue-spa/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 100,
"trailingComma": "none"
}
7 changes: 7 additions & 0 deletions examples/vue-spa/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"Vue.volar",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
30 changes: 30 additions & 0 deletions examples/vue-spa/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM node:lts AS development

WORKDIR /app

COPY package*.json ./
RUN npm ci

COPY . .

ENV CI=true
ENV PORT=3000

CMD [ "npm", "start" ]

FROM development AS builder

RUN npm run build

FROM nginx:alpine

# Copy config nginx
COPY --from=builder /app/.nginx/nginx.conf /etc/nginx/conf.d/default.conf

WORKDIR /usr/share/nginx/html

# Remove default nginx static assets
RUN rm -rf ./*

# Copy static assets from builder stage
COPY --from=builder /app/dist .
39 changes: 39 additions & 0 deletions examples/vue-spa/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# vue-spa

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=Vue.volar) (and disable Vetur).

## Type Support for `.vue` Imports in TS

TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.

## 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
```

### Type-Check, Compile and Minify for Production

```sh
npm run build
```

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

```sh
npm run lint
```
1 change: 1 addition & 0 deletions examples/vue-spa/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
13 changes: 13 additions & 0 deletions examples/vue-spa/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="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
Loading

0 comments on commit d53c9e4

Please sign in to comment.