Skip to content

Commit

Permalink
Deployment config
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertBroersma committed Nov 23, 2023
1 parent d2150e4 commit e57f3e2
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 23 deletions.
2 changes: 2 additions & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ logs
.env
.env.*
!.env.example

/public/stac
14 changes: 7 additions & 7 deletions app/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import vuetify, { transformAssetUrls } from "vite-plugin-vuetify";
import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify'

export default defineNuxtConfig({
devtools: { enabled: true },
Expand All @@ -9,12 +9,12 @@ export default defineNuxtConfig({
mapboxToken: process.env.NUXT_PUBLIC_MAPBOX_TOKEN,
},
},
css: ["vuetify/styles"],
css: ['vuetify/styles'],
modules: [
(_options, nuxt) => {
nuxt.hooks.hook("vite:extendConfig", (config) => {
config.plugins?.push(vuetify({ autoImport: true }));
});
nuxt.hooks.hook('vite:extendConfig', (config) => {
config.plugins?.push(vuetify({ autoImport: true }))
})
},
],
vite: {
Expand All @@ -24,7 +24,7 @@ export default defineNuxtConfig({
},
},
ssr: {
noExternal: ["vuetify"],
noExternal: ['vuetify'],
},
},
});
})
1 change: 1 addition & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"type": "module",
"scripts": {
"build": "nuxt build",
"prebuild": "cp -R ../STAC/data/current ./public/stac",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
Expand Down
14 changes: 7 additions & 7 deletions app/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ let { data: catalogJson } = await useFetch<CatalogType>(catalogPath)
let catalog = catalogJson.value
let childrenLinks = catalog?.links.filter(link => link.rel === 'child') ?? []
let childrenLinks = catalog?.links.filter((link) => link.rel === 'child') ?? []
let collections = (
await Promise.all(
childrenLinks.map(async childLink => {
childrenLinks.map(async (childLink) => {
let { data } = await useFetch<CollectionType>(
`${stacRoot}/${childLink.href}`,
)
return data.value
}),
)
).filter(collection => collection?.links.some(link => link.rel === 'item'))
).filter((collection) => collection?.links.some((link) => link.rel === 'item'))
let activeCollectionId = ref(collections[0]?.id)
let activeCollection = computed(() => {
return collections.find(
collection => collection?.id === activeCollectionId.value,
(collection) => collection?.id === activeCollectionId.value,
)
})
Expand Down Expand Up @@ -81,12 +81,12 @@ let activeItemUrl = computed(() => {
if (!activeCollection.value) return
let foundLink =
activeCollection.value.links
.filter(l => l.rel === 'item')
.find(link => {
.filter((l) => l.rel === 'item')
.find((link) => {
return Object.entries(variables.value).every(
([key, value]) => link.properties?.[key] === value,
)
}) ?? activeCollection.value.links.filter(l => l.rel === 'item')[0]
}) ?? activeCollection.value.links.filter((l) => l.rel === 'item')[0]
return foundLink?.href
})
Expand Down
16 changes: 10 additions & 6 deletions app/server/routes/stac/[...].ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import fs from "node:fs/promises";
import fs from 'node:fs/promises'

export default defineEventHandler(async (event) => {
let path = event.context.params?.["_"];
let path = event.context.params?.['_']

if (!path) throw new Error("No path provided");
if (!path) throw new Error('No path provided')

let json = await fs.readFile(`${process.cwd()}/../STAC/data/current/${path}`);
let json = await fs.readFile(
process.env.NODE_ENV === 'development'
? `${process.cwd()}/../STAC/data/current/${path}`
: `${process.cwd()}/public/stac/${path}`,
)

return json;
});
return json
})
3 changes: 0 additions & 3 deletions app/server/tsconfig.json

This file was deleted.

0 comments on commit e57f3e2

Please sign in to comment.