mirror of
https://github.com/nestriness/nestri.git
synced 2025-12-12 08:45:38 +02:00
⭐feat(www): Add api docs (#161)
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
"qwik": "qwik"
|
"qwik": "qwik"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@builder.io/partytown": "^0.8.1",
|
||||||
"@builder.io/qwik": "^1.8.0",
|
"@builder.io/qwik": "^1.8.0",
|
||||||
"@builder.io/qwik-city": "^1.8.0",
|
"@builder.io/qwik-city": "^1.8.0",
|
||||||
"@builder.io/qwik-react": "0.5.0",
|
"@builder.io/qwik-react": "0.5.0",
|
||||||
@@ -50,6 +51,7 @@
|
|||||||
"@types/react-dom": "^18.2.13",
|
"@types/react-dom": "^18.2.13",
|
||||||
"@typescript-eslint/eslint-plugin": "7.16.1",
|
"@typescript-eslint/eslint-plugin": "7.16.1",
|
||||||
"@typescript-eslint/parser": "7.16.1",
|
"@typescript-eslint/parser": "7.16.1",
|
||||||
|
"ajv": "^8.17.1",
|
||||||
"eslint": "8.57.0",
|
"eslint": "8.57.0",
|
||||||
"eslint-plugin-qwik": "^1.8.0",
|
"eslint-plugin-qwik": "^1.8.0",
|
||||||
"howler": "^2.2.4",
|
"howler": "^2.2.4",
|
||||||
|
|||||||
19
apps/www/src/components/partytown/partytown.tsx
Normal file
19
apps/www/src/components/partytown/partytown.tsx
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import type { PartytownConfig } from "@builder.io/partytown/integration";
|
||||||
|
import { partytownSnippet } from "@builder.io/partytown/integration";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Props for `<QwikPartytown/>`, which extends the Partytown Config.
|
||||||
|
*
|
||||||
|
* https://github.com/BuilderIO/partytown#config
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export interface PartytownProps extends PartytownConfig {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
* You can pass setting with props
|
||||||
|
*/
|
||||||
|
export const QwikPartytown = (props: PartytownProps): any => {
|
||||||
|
return <script dangerouslySetInnerHTML={partytownSnippet(props)} />;
|
||||||
|
};
|
||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
} from "@builder.io/qwik-city";
|
} from "@builder.io/qwik-city";
|
||||||
import { RouterHead } from "@nestri/ui";
|
import { RouterHead } from "@nestri/ui";
|
||||||
import { isDev } from "@builder.io/qwik/build";
|
import { isDev } from "@builder.io/qwik/build";
|
||||||
|
import { QwikPartytown } from './components/partytown/partytown';
|
||||||
|
|
||||||
import "@nestri/ui/globals.css";
|
import "@nestri/ui/globals.css";
|
||||||
import { Fonts } from "@nestri/ui";
|
import { Fonts } from "@nestri/ui";
|
||||||
@@ -22,6 +23,7 @@ export default component$(() => {
|
|||||||
<Fonts>
|
<Fonts>
|
||||||
<QwikCityProvider>
|
<QwikCityProvider>
|
||||||
<head>
|
<head>
|
||||||
|
<QwikPartytown />
|
||||||
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#f5f5f5" />
|
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#f5f5f5" />
|
||||||
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#171717" />
|
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#171717" />
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
@@ -37,8 +39,8 @@ export default component$(() => {
|
|||||||
class="bg-gray-100 text-gray-950 dark:bg-gray-900 dark:text-gray-50 font-body flex flex-col items-center justify-center overflow-x-hidden antialiased"
|
class="bg-gray-100 text-gray-950 dark:bg-gray-900 dark:text-gray-50 font-body flex flex-col items-center justify-center overflow-x-hidden antialiased"
|
||||||
lang="en">
|
lang="en">
|
||||||
<RouterOutlet />
|
<RouterOutlet />
|
||||||
{/* {!isDev && <ServiceWorkerRegister />} */}
|
{!isDev && <ServiceWorkerRegister />}
|
||||||
<ServiceWorkerRegister />
|
{/* <ServiceWorkerRegister /> */}
|
||||||
</body>
|
</body>
|
||||||
</QwikCityProvider>
|
</QwikCityProvider>
|
||||||
</Fonts>
|
</Fonts>
|
||||||
|
|||||||
20
apps/www/src/routes/docs/index.tsx
Normal file
20
apps/www/src/routes/docs/index.tsx
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { component$ } from "@builder.io/qwik";
|
||||||
|
// import { ApiReference } from '@scalar/api-reference'
|
||||||
|
// import '@scalar/api-reference/style.css'
|
||||||
|
//FIXME: Fix the dropdowns
|
||||||
|
export default component$(() => {
|
||||||
|
return (
|
||||||
|
<div class="w-screen min-h-screen">
|
||||||
|
{/* <style dangerouslySetInnerHTML={ scalar_styles } /> */}
|
||||||
|
<script type="text/partytown" src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
|
||||||
|
<script
|
||||||
|
id="api-reference"
|
||||||
|
data-configuration={JSON.stringify({
|
||||||
|
defaultOpenAllTags: true,
|
||||||
|
hideDownloadButton: true,
|
||||||
|
})}
|
||||||
|
data-url="https://api.nestri.io/doc"
|
||||||
|
data-proxy-url="https://proxy.scalar.com" />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})
|
||||||
@@ -8,7 +8,8 @@ import { qwikCity } from "@builder.io/qwik-city/vite";
|
|||||||
import tsconfigPaths from "vite-tsconfig-paths";
|
import tsconfigPaths from "vite-tsconfig-paths";
|
||||||
import { qwikReact } from "@builder.io/qwik-react/vite";
|
import { qwikReact } from "@builder.io/qwik-react/vite";
|
||||||
import pkg from "./package.json";
|
import pkg from "./package.json";
|
||||||
|
import { partytownVite } from "@builder.io/partytown/utils";
|
||||||
|
import { join } from "path";
|
||||||
type PkgDep = Record<string, string>;
|
type PkgDep = Record<string, string>;
|
||||||
const { dependencies = {}, devDependencies = {} } = pkg as any as {
|
const { dependencies = {}, devDependencies = {} } = pkg as any as {
|
||||||
dependencies: PkgDep;
|
dependencies: PkgDep;
|
||||||
@@ -27,17 +28,7 @@ export default defineConfig((): UserConfig => {
|
|||||||
qwikVite(),
|
qwikVite(),
|
||||||
tsconfigPaths(),
|
tsconfigPaths(),
|
||||||
qwikReact(),
|
qwikReact(),
|
||||||
//For Moq-js (SharedArrayBuffer)
|
partytownVite({ dest: join(__dirname, "dist", "~partytown") }),
|
||||||
// {
|
|
||||||
// name: "configure-response-headers",
|
|
||||||
// configureServer: (server) => {
|
|
||||||
// server.middlewares.use((_req, res, next) => {
|
|
||||||
// res.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
|
|
||||||
// res.setHeader("Cross-Origin-Opener-Policy", "same-origin");
|
|
||||||
// next();
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
],
|
],
|
||||||
// This tells Vite which dependencies to pre-build in dev mode.
|
// This tells Vite which dependencies to pre-build in dev mode.
|
||||||
optimizeDeps: {
|
optimizeDeps: {
|
||||||
|
|||||||
Reference in New Issue
Block a user