Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

chore: reintroduce sitemap generation (#2874)

Andrew Bastin830373efb3aa
diff --git a/packages/hoppscotch-common/src/components.d.ts b/packages/hoppscotch-common/src/components.d.ts
index c78414770..ed96a3671 100644
--- a/packages/hoppscotch-common/src/components.d.ts
+++ b/packages/hoppscotch-common/src/components.d.ts
@@ -99,7 +99,6 @@ declare module '@vue/runtime-core' {
HttpTests: typeof import('./components/http/Tests.vue')['default']
HttpURLEncodedParams: typeof import('./components/http/URLEncodedParams.vue')['default']
IconLucideArrowLeft: typeof import('~icons/lucide/arrow-left')['default']
- IconLucideBrush: typeof import('~icons/lucide/brush')['default']
IconLucideCheckCircle: typeof import('~icons/lucide/check-circle')['default']
IconLucideChevronRight: typeof import('~icons/lucide/chevron-right')['default']
IconLucideGlobe: typeof import('~icons/lucide/globe')['default']
@@ -108,11 +107,9 @@ declare module '@vue/runtime-core' {
IconLucideLayers: typeof import('~icons/lucide/layers')['default']
IconLucideLoader: typeof import('~icons/lucide/loader')['default']
IconLucideMinus: typeof import('~icons/lucide/minus')['default']
- IconLucideRss: typeof import('~icons/lucide/rss')['default']
IconLucideSearch: typeof import('~icons/lucide/search')['default']
IconLucideUser: typeof import('~icons/lucide/user')['default']
IconLucideUsers: typeof import('~icons/lucide/users')['default']
- IconLucideVerified: typeof import('~icons/lucide/verified')['default']
LensesHeadersRenderer: typeof import('./components/lenses/HeadersRenderer.vue')['default']
LensesHeadersRendererEntry: typeof import('./components/lenses/HeadersRendererEntry.vue')['default']
LensesRenderersHTMLLensRenderer: typeof import('./components/lenses/renderers/HTMLLensRenderer.vue')['default']
@@ -122,6 +119,7 @@ declare module '@vue/runtime-core' {
LensesRenderersRawLensRenderer: typeof import('./components/lenses/renderers/RawLensRenderer.vue')['default']
LensesRenderersXMLLensRenderer: typeof import('./components/lenses/renderers/XMLLensRenderer.vue')['default']
LensesResponseBodyRenderer: typeof import('./components/lenses/ResponseBodyRenderer.vue')['default']
+ Newcollections: typeof import('./components/newcollections/index.vue')['default']
ProfilePicture: typeof import('./components/profile/Picture.vue')['default']
ProfileShortcode: typeof import('./components/profile/Shortcode.vue')['default']
RealtimeCommunication: typeof import('./components/realtime/Communication.vue')['default']
diff --git a/packages/hoppscotch-web/.gitignore b/packages/hoppscotch-web/.gitignore
index a547bf36d..5b70e816d 100644
--- a/packages/hoppscotch-web/.gitignore
+++ b/packages/hoppscotch-web/.gitignore
@@ -22,3 +22,6 @@ dist-ssr
*.njsproj
*.sln
*.sw?
+
+# Sitemap Generation Artifacts (see vite.config.ts)
+.sitemap-gen
diff --git a/packages/hoppscotch-web/package.json b/packages/hoppscotch-web/package.json
index 5f5b20ef4..99c153c8c 100644
--- a/packages/hoppscotch-web/package.json
+++ b/packages/hoppscotch-web/package.json
@@ -49,6 +49,7 @@
"vite-plugin-pages": "^0.26.0",
"vite-plugin-pages-sitemap": "^1.4.0",
"vite-plugin-pwa": "^0.13.1",
+ "vite-plugin-static-copy": "^0.12.0",
"vite-plugin-vue-layouts": "^0.7.0",
"vite-plugin-windicss": "^1.8.8",
"vue-tsc": "^1.0.9",
diff --git a/packages/hoppscotch-web/vite.config.ts b/packages/hoppscotch-web/vite.config.ts
index 7ad79b9ae..1b2ffaf76 100644
--- a/packages/hoppscotch-web/vite.config.ts
+++ b/packages/hoppscotch-web/vite.config.ts
@@ -1,6 +1,7 @@
-import { defineConfig, loadEnv } from "vite"
+import { defineConfig, loadEnv, normalizePath } from "vite"
import { APP_INFO, META_TAGS } from "./meta"
-// import generateSitemap from "vite-plugin-pages-sitemap"
+import { viteStaticCopy as StaticCopy } from "vite-plugin-static-copy"
+import generateSitemap from "vite-plugin-pages-sitemap"
import HtmlConfig from "vite-plugin-html-config"
import Vue from "@vitejs/plugin-vue"
import VueI18n from "@intlify/vite-plugin-vue-i18n"
@@ -73,16 +74,25 @@ export default defineConfig({
routeStyle: "nuxt",
dirs: "../hoppscotch-common/src/pages",
importMode: "async",
- onRoutesGenerated() {
- // TODO: Figure this out ?
- // return generateSitemap({
- // routes,
- // nuxtStyle: true,
- // allowRobots: true,
- // hostname: ENV.VITE_BASE_URL,
- // })
+ onRoutesGenerated(routes) {
+ // HACK: See: https://github.com/jbaubree/vite-plugin-pages-sitemap/issues/173
+ return ((generateSitemap as any).default as typeof generateSitemap)({
+ routes,
+ nuxtStyle: true,
+ allowRobots: true,
+ dest: ".sitemap-gen",
+ hostname: ENV.VITE_BASE_URL,
+ })
},
}),
+ StaticCopy({
+ targets: [
+ {
+ src: normalizePath(path.resolve(__dirname, "./.sitemap-gen/*")),
+ dest: normalizePath(path.resolve(__dirname, "./dist")),
+ },
+ ],
+ }),
Layouts({
layoutsDirs: "../hoppscotch-common/src/layouts",
defaultLayout: "default",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ba5594a12..546ffbfcb 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -441,6 +441,7 @@ importers:
vite-plugin-pages: ^0.26.0
vite-plugin-pages-sitemap: ^1.4.0
vite-plugin-pwa: ^0.13.1
+ vite-plugin-static-copy: ^0.12.0
vite-plugin-vue-layouts: ^0.7.0
vite-plugin-windicss: ^1.8.8
vue: ^3.2.41
@@ -477,6 +478,7 @@ importers:
vite-plugin-pages: [email protected]
vite-plugin-pages-sitemap: 1.4.0
vite-plugin-pwa: 0.13.1_3kw35epztoiwny7qtfesjexvtu
+ vite-plugin-static-copy: [email protected]
vite-plugin-vue-layouts: [email protected][email protected]
vite-plugin-windicss: [email protected]
@@ -12955,6 +12957,19 @@ packages:
- supports-color
dev: true
+ /vite-plugin-static-copy/[email protected]:
+ resolution: {integrity: sha512-5a8hCjYJdf/rl8s7ct/YWt97gXdGPGNSOoJtkY5IYhbnSq04X1gTt5GpFHKfAxhHoed1Grfw3Ed13t7AjJi7gw==}
+ engines: {node: ^14.18.0 || >=16.0.0}
+ peerDependencies:
+ vite: ^3.0.0
+ dependencies:
+ chokidar: 3.5.3
+ fast-glob: 3.2.11
+ fs-extra: 10.1.0
+ picocolors: 1.0.0
+ vite: 3.2.4
+ dev: true
+
/vite-plugin-vue-layouts/0.7.0_oewzdqozxqnqgsrjzmwikx34vi:
resolution: {integrity: sha512-k5XDmRNFo4M/GmUjhbRXj2WmJiFcGoVI8l/uZ72RHyRDQr4wE/6Zq/KFq0lqXomWQxTSzakQRUswzNwtvZLE8A==}
peerDependencies: