Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into storybook-module
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasdiez committed Dec 28, 2024
2 parents 853423f + e5694b5 commit 3739566
Show file tree
Hide file tree
Showing 40 changed files with 6,723 additions and 5,664 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '3.8'
services:
app:
# Use offical typescript-node devcontainer image
image: mcr.microsoft.com/vscode/devcontainers/typescript-node:1-20@sha256:87f45e7d18579ffbe6370697cd77bf921669d0d6d3643eda3920426432fe461a
image: mcr.microsoft.com/vscode/devcontainers/typescript-node:1-20@sha256:6a200731ff2e66af7d342c8118f989822e81ab98c2ad2e5c180fa308d057e395

volumes:
- ..:/workspace:cached
Expand All @@ -20,7 +20,7 @@ services:
# (Adding the "ports" property to this file will not forward from a Codespace.)

db:
image: postgres:latest@sha256:0cf02e45421b780449f0bab6b4af7e5ab2c37d3ca729e284fcec1a18f3fa9354
image: postgres:latest@sha256:79c927b43c8bf2fc1e78b7f4badb394237ee0001032324ef015da562e57a5dcd
restart: unless-stopped
volumes:
- postgres-data:/var/lib/postgresql/data
Expand Down
2 changes: 2 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ module.exports = {
'plugin:nuxt/recommended',
// Turns off all rules that are unnecessary or might conflict with Prettier (needs to be last)
'prettier',
// Disable rules covered by oxlint
'plugin:oxlint/recommended',
],
plugins: ['unused-imports'],
rules: {
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ pip install azure-identity azure-mgmt-web azure-mgmt-storage azure-mgmt-applicat
az login
export SUBSCRIPTION_ID=<...>
export DATABASE_URL=<...>
export AZURE_SESSION_SECRET=<...>
export NUXT_SESSION_PASSWORD=<...>
python3 .github/scripts/deploy.py --env dev -v
```
4 changes: 2 additions & 2 deletions .github/scripts/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def main(environment_name: str, verbose: bool = False):
APP_INSIGHTS_NAME = "jabref-online"
REDIS_NAME = "jabref"
DATABASE_URL = os.environ.get("DATABASE_URL", "<Not specified>")
SESSION_SECRET = os.environ.get("AZURE_SESSION_SECRET", "<Not specified>")
SESSION_SECRET = os.environ.get("NUXT_SESSION_PASSWORD", "<Not specified>")
GITHUB_REPO_TOKEN = os.environ.get("GITHUB_REPO_TOKEN", "<Not specified>")

function_app_name = "jabref-function-" + environment_name
Expand Down Expand Up @@ -132,7 +132,7 @@ def main(environment_name: str, verbose: bool = False):
"name": "REDIS_PASSWORD",
"value": redis_keys.primary_key,
},
{"name": "SESSION_SECRET_PRIMARY", "value": SESSION_SECRET},
{"name": "NUXT_SESSION_PASSWORD", "value": SESSION_SECRET},
{"name": "GITHUB_REPO_TOKEN", "value": GITHUB_REPO_TOKEN},
# Disable indexing of non-production sites
# https://nuxtseo.com/robots/guides/disable-indexing#preview-staging-testing-environments
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20
cache: 'pnpm'
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:

services:
postgres:
image: postgres@sha256:0cf02e45421b780449f0bab6b4af7e5ab2c37d3ca729e284fcec1a18f3fa9354
image: postgres@sha256:79c927b43c8bf2fc1e78b7f4badb394237ee0001032324ef015da562e57a5dcd
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: jabref
Expand All @@ -68,7 +68,7 @@ jobs:
- 5432:5432

redis:
image: redis@sha256:79676a8f74e4aed85b6d6a2f4e4e3e55d8a229baa7168362e592bbfdc67b0c9b
image: redis@sha256:05f99264e2928ad472f2751b3a8d1f65c9c2cc1819be04548b2261c08e2e026b
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
Expand All @@ -82,18 +82,19 @@ jobs:
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/jabref?schema=public
GITHUB_REPO_TOKEN: ${{ secrets.GITHUBS_REPO_TOKEN }}
NUXT_SESSION_PASSWORD: somerandompasswordNxFHaqCSPpBe6n5kRz2dru4hJ7K9bjgEtmsV8QAT3MDXcUfWGL

steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
Expand Down Expand Up @@ -125,7 +126,7 @@ jobs:

- name: Publish and test Storybook
if: always()
uses: chromaui/action@fdbe7756d4dbf493e2fbb822df73be7accd07e1c # v11
uses: chromaui/action@64a9c0ca3bfb724389b0d536e544f56b7b5ff5b3 # v11
with:
projectToken: 'b3787adf2fa5'
# Don't wait until Chroma verified the build (for this we have the Github check)
Expand All @@ -134,6 +135,6 @@ jobs:
debug: true

- name: Upload coverage to Codecov
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/deploy-preview-close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
action: 'close'

- name: Login to Azure
uses: Azure/login@6c251865b4e6290e7b78be643ea2d005bc51f69a # v2
uses: Azure/login@a65d910e8af852a8061c627c456678983e180302 # v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
env:
PREVIEW_NAME: ${{ github.event.pull_request.number || github.event.inputs.preview_name }}
GITHUB_REPO_TOKEN: ${{ secrets.GITHUBS_REPO_TOKEN }}
NUXT_SESSION_PASSWORD: ${{ secrets.AZURE_SESSION_SECRET }}

steps:
# We could also add these checks to a job-wide if condition, to skip the workflow if its unsecure to run.
Expand All @@ -34,15 +35,15 @@ jobs:
run: exit 1

- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20
cache: 'pnpm'
Expand All @@ -54,7 +55,7 @@ jobs:
run: pnpm build:azure

- name: Login to Azure
uses: Azure/login@6c251865b4e6290e7b78be643ea2d005bc51f69a # v2
uses: Azure/login@a65d910e8af852a8061c627c456678983e180302 # v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand All @@ -74,7 +75,7 @@ jobs:
SWA_CLI_DEPLOYMENT_TOKEN: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_PEBBLE_0224C3803 }}

- name: Install Python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
with:
python-version: '3.10'

Expand Down Expand Up @@ -106,7 +107,6 @@ jobs:
python .github\scripts\deploy.py --env $env:PREVIEW_NAME
env:
SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_SESSION_SECRET: ${{ secrets.AZURE_SESSION_SECRET }}

- name: Deploy Function App
run: |
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@ jobs:
env:
DATABASE_URL: ${{ matrix.environment == 'Test' && secrets.AZURE_TEST_DATABASE_URL || secrets.AZURE_DATABASE_URL }}
GITHUB_REPO_TOKEN: ${{ secrets.GITHUBS_REPO_TOKEN }}
NUXT_SESSION_PASSWORD: ${{ secrets.AZURE_SESSION_SECRET }}

steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20
cache: 'pnpm'
Expand All @@ -65,7 +66,7 @@ jobs:
run: pnpm build:azure

- name: Login to Azure
uses: Azure/login@6c251865b4e6290e7b78be643ea2d005bc51f69a # v2
uses: Azure/login@a65d910e8af852a8061c627c456678983e180302 # v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand All @@ -81,7 +82,7 @@ jobs:
SWA_CLI_DEPLOYMENT_TOKEN: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_PEBBLE_0224C3803 }}

- name: Install Python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
with:
python-version: '3.10'

Expand All @@ -91,7 +92,6 @@ jobs:
python .github\scripts\deploy.py --env ${{ matrix.deployment_environment }}
env:
SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_SESSION_SECRET: ${{ secrets.AZURE_SESSION_SECRET }}

- name: Deploy Function App
run: |
Expand Down
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@
"journaltitle",
"Nuxt",
"nuxtjs",
"oxlint",
"pinia",
"scimago",
"transpiled",
"tsyringe",
"upsert"
"unstorage",
"upsert",
"vite",
"vitest"
],
"[jsonc]": {
"editor.formatOnSave": true
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@ Now close and re-open the workspace.
| pnpm prisma:studio | Explore data in the database using a visual editor. |
| pnpm storybook | Start [Storybook](#ui-workflow-storybook) in your browser. |

### Running tests locally

To run the tests locally, it's best to start the development server by running `pnpm dev`.
Then, in a separate terminal, set the environment variable `TEST_URL` to the URL of the development server (e.g., `http://localhost:3000`)

```bash
# Linux
export TEST_URL=http://localhost:3000
# Windows
$env:TEST_URL = "http://localhost:3000"
```

Then you can run the tests by executing `pnpm test`.

### Workflow for editing the database schema

1. Prototype your new feature by making the necessary changes to `schema.prisma`.
Expand Down
33 changes: 33 additions & 0 deletions auth.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
declare module '#auth-utils' {
/**
* The public information about a user stored in the session
*/
interface User {
id: string
}

/**
* The public information about the current session
*/
interface UserSession {
/**
* The secure data associated with the session, only accessible on the server
*/
server: ServerSessionData
}

/**
* Private information about the current session, only accessible on the server
* (exposed in an encrypted form to the client)
*/
interface SecureSessionData {}

/**
* The data stored for the session on the server
*/
interface ServerSessionData {
lastActive: Date
}
}

export {}
1 change: 1 addition & 0 deletions components/JabRefLogo.stories.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import JabRefLogo from './JabrefLogo.vue'
</script>

<template>
<!-- @vue-expect-error: wrong ts of vue-stories -->

Check failure on line 6 in components/JabRefLogo.stories.vue

View workflow job for this annotation

GitHub Actions / Lint

Unused '@ts-expect-error' directive.
<Stories
title="JabRef Logo"
:component="JabRefLogo"
Expand Down
6 changes: 6 additions & 0 deletions components/content/SimpleDiv.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@
/>
</div>
</template>
<script setup lang="ts">
// Workaround for https://github.com/vuejs/language-tools/issues/5082
defineSlots<{
default: any

Check warning on line 12 in components/content/SimpleDiv.vue

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
}>()
</script>
1 change: 1 addition & 0 deletions components/n-button.stories.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { NButton } from 'naive-ui'
</script>
<template>
<!-- @vue-expect-error: wrong ts of vue-stories -->

Check failure on line 5 in components/n-button.stories.vue

View workflow job for this annotation

GitHub Actions / Lint

Unused '@ts-expect-error' directive.
<Stories
title="n-button"
:component="NButton"
Expand Down
2 changes: 1 addition & 1 deletion components/t-checkbox.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const Template: StoryFn = (args) => ({
setup() {
return { args }
},
template: '<t-checkbox v-bind="args" />',
template: '<t-checkbox v-bind="args" checked />',
})

export const Default = Template.bind({})
Expand Down
6 changes: 2 additions & 4 deletions config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ export interface Config {
}
emailClient?: string
session: {
primarySecret: string
secondarySecret: string
secret: string
}
githubRepoToken: string
public: {
Expand All @@ -85,8 +84,7 @@ export function constructConfig() {
},
emailClient: process.env.EMAIL_CLIENT,
session: {
primarySecret: process.env.SESSION_SECRET_PRIMARY ?? 'session_secret',
secondarySecret: process.env.SESSION_SECRET_SECONDARY ?? 'session_secret',
secret: process.env.NUXT_SESSION_PASSWORD ?? 'session_secret',
},
githubRepoToken: process.env.GITHUB_REPO_TOKEN ?? 'UNDEFINED',
public: {
Expand Down
Loading

0 comments on commit 3739566

Please sign in to comment.