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

Migrate to Nuxt 3 #1009

Merged
merged 75 commits into from
Jun 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
044e378
On the way to working prototype
tobiasdiez Apr 21, 2022
d829c11
A few more fixes
tobiasdiez Apr 22, 2022
20fac0a
Fix graphql server
tobiasdiez Apr 22, 2022
b57ebef
Put server again at /api
tobiasdiez Apr 22, 2022
307320f
Convert tailwind-vue config to variantjs
tobiasdiez Apr 22, 2022
aa4133b
Fix config
tobiasdiez Apr 23, 2022
65121da
Fix all lint errors
tobiasdiez Apr 23, 2022
e0cd66e
Fix eslint
tobiasdiez Apr 23, 2022
474e77b
Fix typescript errors
tobiasdiez Apr 23, 2022
dd37022
Upgrade vue-jest
tobiasdiez Apr 23, 2022
59fafe9
Fix imports
tobiasdiez Apr 23, 2022
255f303
Fix tests
tobiasdiez Apr 23, 2022
17bb61b
Fix config of redis
tobiasdiez Apr 25, 2022
dbcde36
Move favicon to public folder
tobiasdiez Apr 25, 2022
fa3deca
Pinia is now compatible with esm
tobiasdiez Apr 25, 2022
b523e43
Use layout with named slots
tobiasdiez Apr 25, 2022
54920e5
Add t-nuxtlink
tobiasdiez Apr 25, 2022
14ccf96
Remove apollo client from transpile
tobiasdiez Apr 26, 2022
fefad15
Remove vue-tailwind from transpile (no longer used)
tobiasdiez Apr 26, 2022
a62209f
Remove more transpile and externals
tobiasdiez Apr 26, 2022
3cd2dd0
Use auto-imports
tobiasdiez Apr 26, 2022
22f9fc8
More auto-imports
tobiasdiez Apr 26, 2022
b635be6
Cleanup config
tobiasdiez Apr 26, 2022
f7948b1
Towards prototype storybook
tobiasdiez Apr 26, 2022
237762e
Working prototype
tobiasdiez Apr 27, 2022
b19252c
Cleanup
tobiasdiez Apr 27, 2022
8e595d0
Cleanup deps
tobiasdiez Apr 27, 2022
5fcbcf8
Fix build
tobiasdiez Apr 28, 2022
5aa3c6c
Fix variantjs config
tobiasdiez Apr 30, 2022
7675c61
Disable ssr for now
tobiasdiez Apr 30, 2022
51923e3
Try to fix storybook
tobiasdiez Apr 30, 2022
f87d065
Try to fix HMR
tobiasdiez Apr 30, 2022
9a846f4
Enough to forward 24xxx port?
tobiasdiez Apr 30, 2022
313af35
Use new vue3 way to wrap components
tobiasdiez Apr 30, 2022
8f4284b
Fix sidebar
tobiasdiez Apr 30, 2022
1752073
Remove virtual scoller for now
tobiasdiez Apr 30, 2022
8ebc92f
Merge branch 'main' into nuxt3
tobiasdiez May 15, 2022
99f8634
Make storybook prototype work
tobiasdiez May 15, 2022
818ab7e
Add typescript info to story
tobiasdiez May 16, 2022
b1f9449
Fix typescript for story
tobiasdiez May 16, 2022
45c0346
Fix typescript error in iframe
tobiasdiez May 16, 2022
e61649d
Update patches to match new versions
tobiasdiez May 16, 2022
371c2c4
Clarify that port for hmr is not working
tobiasdiez May 16, 2022
294295a
Update to nuxt rc3
tobiasdiez May 16, 2022
0ed8932
Remove nuxt types package
tobiasdiez May 16, 2022
c83bcd2
Merge remote-tracking branch 'origin/main' into nuxt3
tobiasdiez May 18, 2022
9bf14cc
Fix issues related to tailwindcss module
tobiasdiez May 18, 2022
3f6144b
Completely remove nuxt/types
tobiasdiez May 19, 2022
37d85bc
Try to fix storybook ci
tobiasdiez May 19, 2022
c52dc30
Fix tests
tobiasdiez May 19, 2022
784c775
Build storybook seperatly
tobiasdiez May 19, 2022
5853604
Try to fix storybook
tobiasdiez May 19, 2022
afc8879
Alias
tobiasdiez May 19, 2022
7f50f18
Merge remote-tracking branch 'origin/main' into nuxt3
tobiasdiez Jun 19, 2022
5986fda
Add event handler
tobiasdiez Jun 19, 2022
b2a485a
Put graphql server again at /api
tobiasdiez Jun 19, 2022
6a5e43c
Add note about takeover mode
tobiasdiez Jun 19, 2022
a38c9d8
Fix storybook imports
tobiasdiez Jun 19, 2022
b4718a9
Simple data table as start
tobiasdiez Jun 19, 2022
389f85e
Fix ts
tobiasdiez Jun 19, 2022
fbcc601
Add storybook style
tobiasdiez Jun 20, 2022
6a92b30
Remove unused storybook iframe
tobiasdiez Jun 20, 2022
b397493
Update lock file
tobiasdiez Jun 20, 2022
67b5ac1
Add padding to input
tobiasdiez Jun 20, 2022
381fe7e
Try to add alias
tobiasdiez Jun 20, 2022
766e7bc
Fix ttable import
tobiasdiez Jun 20, 2022
04288f7
Add storybook stories for all components
tobiasdiez Jun 20, 2022
be9018a
Fix table import
tobiasdiez Jun 20, 2022
61a1b6c
Fix more controls
tobiasdiez Jun 20, 2022
08b802d
Add t-table synonym
tobiasdiez Jun 23, 2022
8f65c5c
Add styleing to table
tobiasdiez Jun 24, 2022
f8eb8a0
Fix style
tobiasdiez Jun 24, 2022
0a3aa3d
Cleanup nuxt config
tobiasdiez Jun 24, 2022
5dae6c0
Add remark in storybook modue that this is unfinished work
tobiasdiez Jun 24, 2022
e81480d
Fix style
tobiasdiez Jun 24, 2022
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
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,20 @@ jobs:
- name: Run tests
run: yarn test --ci --coverage

- name: Build Storybook
run: |
yarn nuxi generate
yarn storybook:build
cp .output/public/_storybook/external-iframe/index.html storybook-static/iframe.html
cp -r .output/public/_nuxt storybook-static

- name: Publish and test Storybook
uses: chromaui/action@v1
with:
projectToken: 'b3787adf2fa5'
buildScriptName: storybook:build
# Don't wait until Chroma verified the build (for this we have the Github check)
exitOnceUploaded: true
storybookBuildDir: storybook-static

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3.1.0
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ storybook-static/
# End of https://www.toptal.com/developers/gitignore/api/vscode,nuxtjs,node

# Automatically generated files
api/graphql.ts
server/graphql.ts
apollo/gql.ts
apollo/graphql.ts
apollo/index.ts
Expand Down
14 changes: 10 additions & 4 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,19 @@ tasks:
DATABASE_URL: postgresql://gitpod@localhost/jabrefonline

vscode:
# Add handy VS Code extensions: https://www.gitpod.io/docs/ides-and-editors/vscode-extensions
extensions:
- johnsoncodehk.volar
- dbaeumer.vscode-eslint
- github.copilot
- streetsidesoftware.code-spell-checker
- github.vscode-pull-request-github
- gitHub.copilot
- eamodio.gitlens
- graphql.vscode-graphql
- graphQL.vscode-graphql
- orta.vscode-jest
- esbenp.prettier-vscode
- prisma.prisma
- bradlc.vscode-tailwindcss
- streetsidesoftware.code-spell-checker
- github.vscode-pull-request-github
- Vue.volar
- antfu.goto-alias

Expand All @@ -63,3 +65,7 @@ ports:
# Prisma Studio
- port: 5555
onOpen: open-preview
# HMR websocket https://github.com/nuxt/framework/issues/1796#issuecomment-1111618663
# Still needs to be configured manually :(
- port: 24678
onOpen: open-preview
Empty file added .storybook/config.ts
Empty file.
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"tsyringe",
"upsert"
],
"vetur.experimental.templateInterpolationService": true,
"[jsonc]": {
"editor.formatOnSave": true
},
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ An up-to-date version of all Storybook components can be found [online](https://
- `store` contains Vuex Store files. [Nuxt documentation](https://nuxtjs.org/guide/vuex-store).

## Recommended VS Code and Browser extensions
- [Vetur](https://marketplace.visualstudio.com/items?itemName=octref.vetur): Add syntax highlighting and other tooling for Vue.
- [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar): Add syntax highlighting and other tooling for Vue. It is also recommended to activate the [takeover mode](https://vuejs.org/guide/typescript/overview.html#takeover-mode).
- [Prisma](https://marketplace.visualstudio.com/items?itemName=Prisma.prisma): Add syntax highlighting, formatting, jump-to-definition and linting for Prisma Schema files.
- [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode): Format code and enforces consistent style.
- [EditorConfig](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig): Override user/workspace VS Code settings with the provided settings in `.editorconfig`.
Expand Down
53 changes: 0 additions & 53 deletions api/index.ts

This file was deleted.

6 changes: 4 additions & 2 deletions components/DetailPane.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@
<FontAwesomeIcon icon="times" />
</t-button>
<slot>
<document-editor :document-id="selectedDocumentId"></document-editor>
<document-editor
v-if="selectedDocumentId"
:document-id="selectedDocumentId"
></document-editor>
</slot>
</div>
</transition>
</div>
</template>
<script lang="ts">
import { defineComponent, computed } from '@vue/composition-api'
import { useUiStore } from './../store'

export default defineComponent({
Expand Down
1 change: 0 additions & 1 deletion components/DocumentEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
</template>

<script lang="ts">
import { defineComponent, computed } from '@vue/composition-api'
import { useResult, useQuery } from '@vue/apollo-composable'
import Tags from './tagify.vue'
import { gql } from '~/apollo'
Expand Down
2 changes: 0 additions & 2 deletions components/DocumentEditorHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
</p>
</template>
<script lang="ts">
import { defineComponent } from '@vue/composition-api'

export default defineComponent({
props: { heading: { type: String, default: '' } },
})
Expand Down
1 change: 0 additions & 1 deletion components/DocumentEditorInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
</template>

<script lang="ts">
import { defineComponent } from '@vue/composition-api'
export default defineComponent({
props: {
value: {
Expand Down
8 changes: 1 addition & 7 deletions components/DocumentView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,7 @@
</template>

<script lang="ts">
import {
defineComponent,
PropType,
ref,
computed,
toRefs,
} from '@vue/composition-api'
import type { PropType } from 'vue'
import { gql, DocumentType } from '~/apollo'
import { useUiStore } from '~/store'

Expand Down
1 change: 0 additions & 1 deletion components/HorizontalRule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
/>
</template>
<script lang="ts">
import { defineComponent } from '@vue/composition-api'
export default defineComponent({
props: {
content: {
Expand Down
5 changes: 3 additions & 2 deletions components/JabRefLogo.stories.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Meta, Story } from '@storybook/vue3'
import JabRefLogo from './JabrefLogo.vue'

export default {
title: 'JabRef Logo',
component: JabRefLogo,
}
} as Meta

export const Default = () => ({
export const Default: Story = () => ({
components: { JabRefLogo },
template: '<JabRefLogo />',
})
6 changes: 2 additions & 4 deletions components/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@

<script lang="ts">
import { useApolloClient, useMutation } from '@vue/apollo-composable'
import { defineComponent, ref, watch } from '@vue/composition-api'
import { useRouter } from '#app'
import { gql } from '~/apollo'
import { useUiStore } from '~/store'
import { cacheCurrentUser } from '~/apollo/cache'
Expand All @@ -145,12 +143,12 @@ export default defineComponent({
},
}
)
const router = useRouter()

onDone(() => {
// Reset graphql cache
void resolveClient().clearStore()

void router.push({ name: 'index' })
void navigateTo({ name: 'index' })
})

const uiStore = useUiStore()
Expand Down
23 changes: 2 additions & 21 deletions components/PasswordInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<div class="relative">
<t-input
ref="input"
v-model="password"
:class="[classes]"
v-bind="$attrs"
:type="showHiddenPassword ? 'password' : 'text'"
x-model="password"
/>
Expand All @@ -20,29 +19,11 @@
</div>
</template>
<script lang="ts">
import { computed, defineComponent, ref } from '@vue/composition-api'

export default defineComponent({
props: {
value: {
type: String,
default: '',
},
classes: {
type: [Object, Array, String],
default: '',
},
},
setup(props, { emit }) {
setup() {
const showHiddenPassword = ref(true)

const password = computed({
get: () => props.value,
set: (value): void => emit('input', value),
})

return {
password,
showHiddenPassword,
}
},
Expand Down
10 changes: 6 additions & 4 deletions components/SideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@

<BaseTree
v-if="groups"
:tree-data="groups"
:tree-data="
// @ts-ignore -- issue with BaseTree not being generic
groups as any
"
children-key="children"
:gap="7"
class="groupsTree"
Expand Down Expand Up @@ -93,12 +96,11 @@
</div>
</template>
<script lang="ts">
import { defineComponent } from '@vue/composition-api'
import { useResult, useQuery } from '@vue/apollo-composable'
import { BaseTree } from '@he-tree/vue2'
import { BaseTree } from '@he-tree/vue3'
import { gql } from '~/apollo'
import { useUiStore } from '~/store'
import '@he-tree/vue2/dist/he-tree-vue2.css'
import '@he-tree/vue3/dist/he-tree-vue3.css'

export default defineComponent({
components: {
Expand Down
54 changes: 54 additions & 0 deletions components/TTable.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<!-- Simle table, needed as long as variantjs doesn't provide one https://github.com/variantjs/vue/issues/26 -->
<template>
<table :class="tableClass">
<thead>
<tr>
<th
v-for="header in headers"
:key="header"
:class="headerClass"
>
{{ header }}
</th>
</tr>
</thead>
<tbody :class="tbodyClass">
<tr
v-for="(row, index) in data"
:key="index"
>
<td
v-for="cell in row"
:key="cell"
:class="tdClass"
>
{{ cell }}
</td>
</tr>
</tbody>
</table>
</template>
<script lang="ts" setup>
interface Props {
headers?: string[]
data?: any[]
variant?: string
}

const props = withDefaults(defineProps<Props>(), {
headers: () => [],
data: () => [],
variant: '',
})

let tableClass =
'min-w-full divide-y divide-gray-100 shadow-sm border-gray-200 border'
const headerClass = 'px-3 py-2 font-semibold text-left bg-gray-100 border-b'
let tbodyClass = 'bg-white divide-y divide-gray-100'
let tdClass = 'px-3 py-2 whitespace-no-wrap'
if (props.variant === 'plain') {
tableClass = ''
tbodyClass = 'bg-transparent'
tdClass = 'px-3 py-1 whitespace-no-wrap'
}
</script>
4 changes: 2 additions & 2 deletions components/t-alert.stories.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Story, Meta } from '@storybook/vue'
import { TAlert } from 'vue-tailwind/dist/components'
import { Story, Meta } from '@storybook/vue3'
import { TAlert } from '@variantjs/vue'

export default {
component: TAlert,
Expand Down
4 changes: 2 additions & 2 deletions components/t-button.stories.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Story, Meta } from '@storybook/vue'
import { TButton } from 'vue-tailwind/dist/components'
import { Story, Meta } from '@storybook/vue3'
import { TButton } from '@variantjs/vue'

export default {
component: TButton,
Expand Down
4 changes: 2 additions & 2 deletions components/t-checkbox.stories.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Story, Meta } from '@storybook/vue'
import { TCheckbox } from 'vue-tailwind/dist/components'
import { Story, Meta } from '@storybook/vue3'
import { TCheckbox } from '@variantjs/vue'

export default {
component: TCheckbox,
Expand Down
4 changes: 2 additions & 2 deletions components/t-dropdown.stories.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Story, Meta } from '@storybook/vue'
import { TDropdown } from 'vue-tailwind/dist/components'
import { Story, Meta } from '@storybook/vue3'
import { TDropdown } from '@variantjs/vue'

export default {
component: TDropdown,
Expand Down