Skip to content

Commit

Permalink
refactor: move to inertia new folder structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien-R44 committed Mar 9, 2024
1 parent 37a762e commit be61dee
Show file tree
Hide file tree
Showing 49 changed files with 198 additions and 198 deletions.
2 changes: 1 addition & 1 deletion adonisrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default defineConfig({
reloadServer: false,
},
{
pattern: 'resources/assets/fonts/**',
pattern: 'inertia/assets/fonts/**',
reloadServer: false,
},
{
Expand Down
2 changes: 1 addition & 1 deletion app/services/og_image/og_image_renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class OgImageGenerator {
async #generateSvg(name: string, description: string) {
const markup = this.#buildMarkup(name, description)

const fontsPath = app.makePath('resources/assets/fonts')
const fontsPath = app.makePath('inertia/assets/fonts')

const fontPath1 = `${fontsPath}/Graphik-Regular.ttf`
const fontPath2 = `${fontsPath}/PolySans-Median.ttf`
Expand Down
3 changes: 1 addition & 2 deletions config/inertia.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { defineConfig } from '@adonisjs/inertia'

export default defineConfig({
rootView: 'app_root',
assetsVersion: 1,
rootView: 'inertia',
ssr: {
enabled: true,
},
Expand Down
4 changes: 2 additions & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// @ts-check
import { julr } from '@julr/tooling-configs/eslint'

export default julr({
unocss: false,
typescript: {
tsconfigPath: ['./tsconfig.json', './resources/tsconfig.json'],
tsconfigPath: ['./tsconfig.json', './inertia/tsconfig.json'],
typeAwareRules: false,
},
})
6 changes: 3 additions & 3 deletions resources/app.ts → inertia/app/app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './css/app.css'
import '../css/app.css'
import 'virtual:uno.css'
import '@unocss/reset/tailwind.css'
import 'floating-vue/dist/style.css'
Expand All @@ -14,8 +14,8 @@ void createInertiaApp({

resolve: (name) => {
return resolvePageComponent(
`./pages/${name}.vue`,
import.meta.glob<DefineComponent>('./pages/**/*.vue'),
`../pages/${name}.vue`,
import.meta.glob<DefineComponent>('../pages/**/*.vue'),
)
},

Expand Down
6 changes: 3 additions & 3 deletions resources/ssr.ts → inertia/app/ssr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { renderToString } from '@vue/server-renderer'
import { createSSRApp, h, type DefineComponent, ref } from 'vue'
import { resolvePageComponent } from '@adonisjs/inertia/helpers'

export default function render(page) {
export default function render(page: any) {
return createInertiaApp({
page,
render: renderToString,
resolve: (name) => {
return resolvePageComponent(
`./pages/${name}.vue`,
import.meta.glob<DefineComponent>('./pages/**/*.vue'),
`../pages/${name}.vue`,
import.meta.glob<DefineComponent>('../pages/**/*.vue'),
)
},

Expand Down
2 changes: 1 addition & 1 deletion resources/types.ts → inertia/app/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Ref } from 'vue'

export * from '../types/main.js'
export * from '../../types/main.js'

declare module 'vue' {
interface ComponentCustomProperties {
Expand Down
2 changes: 1 addition & 1 deletion uno.config.ts → inertia/app/uno.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default defineConfig({
scale: 1.2,
warn: true,
collections: {
custom: FileSystemIconLoader('./resources/assets/icons', (svg) =>
custom: FileSystemIconLoader('./inertia/assets/icons', (svg) =>
svg.replace(/#fff/, 'currentColor'),
),
},
Expand Down
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { categories } from '~/content/categories'
import type { PackageInfo } from '@/types'
import type { PackageInfo } from '@/app/types'
defineProps<{
package: PackageInfo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { millify } from 'millify'
import type { PackageInfo } from '@/types'
import type { PackageInfo } from '@/app/types'
defineProps<{
package: PackageInfo
Expand Down Expand Up @@ -41,3 +41,4 @@ function numberFormatter(num: number) {
</template>

<style scoped></style>
@/app/types
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import type { PackageCategories, PackageCategory } from '@/types'
import type { PackageCategories, PackageCategory } from '@/app/types'
const props = defineProps<{
categories: PackageCategories
Expand Down Expand Up @@ -101,3 +101,4 @@ const versionModel = defineModel<string | null>('version')
</div>
</div>
</template>
@/app/types
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { PackageInfo } from '@/types'
import PackageCard from './package_card.vue'
import type { PackageInfo } from '@/app/types'
import Button from '@/components/ui/button.vue'
defineProps<{
Expand Down Expand Up @@ -38,3 +38,4 @@ defineOptions({
</Button>
</div>
</template>
@/app/types
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { computed } from 'vue'
import { Link } from '@inertiajs/vue3'
import Tag from '@/components/tag.vue'
import type { PackageInfo } from '@/types'
import type { PackageInfo } from '@/app/types'
import PackageLogo from '@/components/package_logo.vue'
import PackageStats from '@/components/package_stats.vue'
import AdonisIcon from '@/components/icons/adonis_icon.vue'
Expand Down Expand Up @@ -69,3 +69,4 @@ const isV6Compatible = computed(() => props.package.compatibility?.adonis.includ
border: 1px solid transparent;
}
</style>
@/app/types
5 changes: 3 additions & 2 deletions resources/pages/home/main.vue → inertia/pages/home/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type {
PackageCategory,
PackagesFilters,
SortOrder,
} from '@/types'
} from '@/app/types'
const props = defineProps<GetHomeResponse>()
const params = useUrlSearchParams<Partial<PackagesFilters>>('history')
Expand Down Expand Up @@ -74,7 +74,7 @@ const orderBy = ref<string>(params.orderBy || orderByOptions[3].value)
* Filters
*/
const selectedVersion = ref<string | null>(params.version || null)
const officialPackagesOnly = ref<boolean>(params.officialOnly)
const officialPackagesOnly = ref<boolean>(params.officialOnly || false)
/**
* Refetch when any of the filters change
Expand Down Expand Up @@ -189,3 +189,4 @@ function fetchNewPageData(page: number) {
background-image: url('@/assets/topography.svg');
}
</style>
@/app/types
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import type { PackageInfo } from '@/types'
import type { PackageInfo } from '@/app/types'
import PackageLogo from '@/components/package_logo.vue'
import PackageStats from '@/components/package_stats.vue'
Expand All @@ -26,3 +26,4 @@ defineProps<{
</template>

<style scoped></style>
@/app/types
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import type { PackageInfo } from '@/types'
import type { PackageInfo } from '@/app/types'
defineProps<{
package: PackageInfo
Expand Down Expand Up @@ -39,3 +39,4 @@ defineProps<{
</template>

<style scoped></style>
@/app/types
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Toc from './components/toc.vue'
import Layout from '@/layouts/default.vue'
import Links from './components/links.vue'
import Heading from './components/heading.vue'
import type { GetPackageResponse } from '@/types'
import type { GetPackageResponse } from '@/app/types'
const props = defineProps<GetPackageResponse>()
</script>
Expand Down Expand Up @@ -111,3 +111,4 @@ const props = defineProps<GetPackageResponse>()
}
}
</style>
@/app/types
14 changes: 14 additions & 0 deletions inertia/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "@adonisjs/tsconfig/tsconfig.client.json",
"compilerOptions": {
"jsx": "preserve",
"jsxImportSource": "vue",
"baseUrl": ".",
"module": "ESNext",
"paths": {
"@/*": ["./*"],
"~/*": ["../*"]
}
},
"include": ["env.d.ts", "./**/*.ts", "./**/*.vue"]
}
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"build:preview": "pnpm build && sed 's/NODE_ENV=development/NODE_ENV=production/' .env > ./build/.env && cp -r ./content ./build/ && cp -r ./tmp ./build/",
"quick:test": "node ace test",
"typecheck:adonis": "tsc --noEmit -p tsconfig.json",
"typecheck:vue": "vue-tsc --noEmit -p resources/tsconfig.json",
"typecheck:vue": "vue-tsc --noEmit -p inertia/tsconfig.json",
"typecheck": "pnpm typecheck:adonis && pnpm typecheck:vue",
"checks": "pnpm lint && pnpm typecheck"
},
Expand All @@ -37,12 +37,12 @@
"dependencies": {
"@adonisjs/cache": "1.0.0-2",
"@adonisjs/core": "6.3.1",
"@adonisjs/inertia": "1.0.0-13",
"@adonisjs/inertia": "1.0.0-19",
"@adonisjs/lucid": "19.0.0",
"@adonisjs/session": "7.1.1",
"@adonisjs/shield": "8.1.1",
"@adonisjs/static": "^1.1.1",
"@adonisjs/vite": "3.0.0-4",
"@adonisjs/vite": "3.0.0-8",
"@formkit/auto-animate": "^0.8.1",
"@headlessui/vue": "^1.7.19",
"@inertiajs/vue3": "^1.0.15",
Expand Down Expand Up @@ -73,8 +73,8 @@
"vue": "^3.4.21"
},
"devDependencies": {
"@adonisjs/assembler": "7.2.2",
"@adonisjs/tsconfig": "^1.2.1",
"@adonisjs/assembler": "7.2.3",
"@adonisjs/tsconfig": "^1.3.0",
"@faker-js/faker": "^8.4.1",
"@iconify/json": "^2.2.166",
"@iconify/utils": "^2.1.22",
Expand All @@ -90,7 +90,7 @@
"@types/js-yaml": "^4.0.9",
"@types/luxon": "^3.4.2",
"@types/markdown-it": "^13.0.7",
"@types/node": "^20.11.21",
"@types/node": "^20.11.25",
"@types/sanitize-html": "^2.11.0",
"@unocss/reset": "^0.58.5",
"@vitejs/plugin-vue": "^5.0.4",
Expand All @@ -100,10 +100,10 @@
"postcss-nested": "^6.0.1",
"prettier": "^3.2.5",
"ts-node": "^10.9.2",
"typescript": "~5.2.2",
"typescript": "~5.4.2",
"unocss": "^0.58.5",
"unocss-preset-radix": "^2.5.5",
"vite": "^5.1.4",
"vite": "^5.1.5",
"vue-tsc": "^1.8.27"
},
"prettier": "@julr/tooling-configs/prettier"
Expand Down
Loading

0 comments on commit be61dee

Please sign in to comment.