Skip to content

Commit 817e79f

Browse files
committed
Implement test
1 parent 31b163b commit 817e79f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1566
-80
lines changed

bun.lock

Lines changed: 270 additions & 46 deletions
Large diffs are not rendered by default.

examples/next-webpack/.gitignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# local env files
28+
.env*.local
29+
30+
# vercel
31+
.vercel
32+
33+
# typescript
34+
*.tsbuildinfo
35+
next-env.d.ts
36+
37+
# devup-api
38+
.devup-api
39+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
* {
2+
box-sizing: border-box;
3+
padding: 0;
4+
margin: 0;
5+
}
6+
7+
html,
8+
body {
9+
max-width: 100vw;
10+
overflow-x: hidden;
11+
}
12+
13+
body {
14+
color: rgb(var(--foreground-rgb));
15+
background: linear-gradient(
16+
to bottom,
17+
transparent,
18+
rgb(var(--background-end-rgb))
19+
)
20+
rgb(var(--background-start-rgb));
21+
}
22+
23+
:root {
24+
--foreground-rgb: 0, 0, 0;
25+
--background-start-rgb: 214, 219, 220;
26+
--background-end-rgb: 255, 255, 255;
27+
}
28+
29+
@media (prefers-color-scheme: dark) {
30+
:root {
31+
--foreground-rgb: 255, 255, 255;
32+
--background-start-rgb: 0, 0, 0;
33+
--background-end-rgb: 0, 0, 0;
34+
}
35+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import type { Metadata } from 'next'
2+
import './globals.css'
3+
4+
export const metadata: Metadata = {
5+
title: 'Next.js Webpack Example - devup-api',
6+
description: 'Example Next.js app with devup-api plugin (Webpack)',
7+
}
8+
9+
export default function RootLayout({
10+
children,
11+
}: {
12+
children: React.ReactNode
13+
}) {
14+
return (
15+
<html lang="en">
16+
<body>{children}</body>
17+
</html>
18+
)
19+
}

examples/next-webpack/app/page.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
'use client'
2+
3+
export default function Home() {
4+
return (
5+
<main className="flex min-h-screen flex-col items-center justify-center p-24">
6+
<div className="z-10 max-w-5xl w-full items-center justify-between font-mono text-sm">
7+
<h1 className="text-4xl font-bold mb-8">Next.js Example (Webpack)</h1>
8+
<p className="mb-4">
9+
This example uses Next.js with Webpack and devup-api plugin.
10+
</p>
11+
<div className="mt-8 p-4 bg-gray-100 rounded">
12+
<p className="font-semibold mb-2">Environment Variables:</p>
13+
<pre className="text-xs overflow-auto">
14+
{(() => {
15+
try {
16+
const urlMap = process.env.DEVUP_API_URL_MAP
17+
if (!urlMap) return 'Not available'
18+
const parsed =
19+
typeof urlMap === 'string' ? JSON.parse(urlMap) : urlMap
20+
return JSON.stringify(parsed, null, 2)
21+
} catch {
22+
return 'Error parsing URL map'
23+
}
24+
})()}
25+
</pre>
26+
</div>
27+
</div>
28+
</main>
29+
)
30+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import devupApi from '@devup-api/next-plugin'
2+
3+
const config = devupApi(
4+
{
5+
reactStrictMode: true,
6+
},
7+
{
8+
openapiFile: './openapi.json',
9+
tempDir: '.devup-api',
10+
},
11+
)
12+
13+
export default config

examples/next-webpack/openapi.json

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
{
2+
"openapi": "3.0.0",
3+
"info": {
4+
"title": "Example API",
5+
"version": "1.0.0",
6+
"description": "Example OpenAPI specification for testing devup-api"
7+
},
8+
"paths": {
9+
"/users": {
10+
"get": {
11+
"summary": "Get all users",
12+
"operationId": "getUsers",
13+
"responses": {
14+
"200": {
15+
"description": "List of users",
16+
"content": {
17+
"application/json": {
18+
"schema": {
19+
"type": "array",
20+
"items": {
21+
"$ref": "#/components/schemas/User"
22+
}
23+
}
24+
}
25+
}
26+
}
27+
}
28+
},
29+
"post": {
30+
"summary": "Create a new user",
31+
"operationId": "createUser",
32+
"requestBody": {
33+
"required": true,
34+
"content": {
35+
"application/json": {
36+
"schema": {
37+
"$ref": "#/components/schemas/CreateUserRequest"
38+
}
39+
}
40+
}
41+
},
42+
"responses": {
43+
"201": {
44+
"description": "User created",
45+
"content": {
46+
"application/json": {
47+
"schema": {
48+
"$ref": "#/components/schemas/User"
49+
}
50+
}
51+
}
52+
}
53+
}
54+
}
55+
},
56+
"/users/{id}": {
57+
"get": {
58+
"summary": "Get user by ID",
59+
"operationId": "getUserById",
60+
"parameters": [
61+
{
62+
"name": "id",
63+
"in": "path",
64+
"required": true,
65+
"schema": {
66+
"type": "integer"
67+
}
68+
}
69+
],
70+
"responses": {
71+
"200": {
72+
"description": "User details",
73+
"content": {
74+
"application/json": {
75+
"schema": {
76+
"$ref": "#/components/schemas/User"
77+
}
78+
}
79+
}
80+
}
81+
}
82+
}
83+
}
84+
},
85+
"components": {
86+
"schemas": {
87+
"User": {
88+
"type": "object",
89+
"properties": {
90+
"id": {
91+
"type": "integer"
92+
},
93+
"name": {
94+
"type": "string"
95+
},
96+
"email": {
97+
"type": "string",
98+
"format": "email"
99+
},
100+
"createdAt": {
101+
"type": "string",
102+
"format": "date-time"
103+
}
104+
},
105+
"required": ["id", "name", "email"]
106+
},
107+
"CreateUserRequest": {
108+
"type": "object",
109+
"properties": {
110+
"name": {
111+
"type": "string"
112+
},
113+
"email": {
114+
"type": "string",
115+
"format": "email"
116+
}
117+
},
118+
"required": ["name", "email"]
119+
}
120+
}
121+
}
122+
}

examples/next-webpack/package.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "next-webpack-example",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"dev": "next dev",
7+
"build": "next build",
8+
"start": "next start",
9+
"lint": "next lint"
10+
},
11+
"dependencies": {
12+
"next": "^16.0.4",
13+
"react": "^19.2.0",
14+
"react-dom": "^19.2.0",
15+
"@devup-api/next-plugin": "workspace:*",
16+
"@devup-api/core": "workspace:*"
17+
},
18+
"devDependencies": {
19+
"@types/node": "^24",
20+
"@types/react": "^19",
21+
"@types/react-dom": "^19",
22+
"typescript": "^5"
23+
}
24+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2017",
4+
"lib": ["dom", "dom.iterable", "esnext"],
5+
"allowJs": true,
6+
"skipLibCheck": true,
7+
"strict": true,
8+
"noEmit": true,
9+
"esModuleInterop": true,
10+
"module": "esnext",
11+
"moduleResolution": "bundler",
12+
"resolveJsonModule": true,
13+
"isolatedModules": true,
14+
"jsx": "react-jsx",
15+
"incremental": true,
16+
"plugins": [
17+
{
18+
"name": "next"
19+
}
20+
],
21+
"paths": {
22+
"@/*": ["./*"]
23+
}
24+
},
25+
"include": [
26+
"next-env.d.ts",
27+
"**/*.ts",
28+
"**/*.tsx",
29+
".next/types/**/*.ts",
30+
".next/dev/types/**/*.ts"
31+
],
32+
"exclude": ["node_modules"]
33+
}

examples/next/.gitignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# local env files
28+
.env*.local
29+
30+
# vercel
31+
.vercel
32+
33+
# typescript
34+
*.tsbuildinfo
35+
next-env.d.ts
36+
37+
# devup-api
38+
.devup-api
39+

0 commit comments

Comments
 (0)