create-specra 0.1.7 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.MD +16 -4
- package/README.md +53 -17
- package/dist/chunk-3DKWECRK.js +45 -0
- package/dist/chunk-3DKWECRK.js.map +1 -0
- package/dist/chunk-MA7QG54W.js +74 -0
- package/dist/chunk-MA7QG54W.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +33 -0
- package/dist/cli.js.map +1 -0
- package/dist/deploy-SCEMUQNS.js +141 -0
- package/dist/deploy-SCEMUQNS.js.map +1 -0
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/login-NKDRQXRE.js +71 -0
- package/dist/login-NKDRQXRE.js.map +1 -0
- package/dist/logout-H543QEKU.js +20 -0
- package/dist/logout-H543QEKU.js.map +1 -0
- package/dist/logs-YDAUCMAV.js +71 -0
- package/dist/logs-YDAUCMAV.js.map +1 -0
- package/dist/projects-3TAY7EDJ.js +42 -0
- package/dist/projects-3TAY7EDJ.js.map +1 -0
- package/package.json +7 -3
- package/templates/book-docs/docs/v1.0.0/concepts.mdx +89 -0
- package/templates/book-docs/docs/v1.0.0/content/_category_.json +7 -0
- package/templates/book-docs/docs/v1.0.0/content/formatting.mdx +128 -0
- package/templates/book-docs/docs/v1.0.0/content/reusable-content.mdx +116 -0
- package/templates/book-docs/docs/v1.0.0/content/structure.mdx +92 -0
- package/templates/book-docs/docs/v1.0.0/customization/_category_.json +7 -0
- package/templates/book-docs/docs/v1.0.0/customization/branding.mdx +115 -0
- package/templates/book-docs/docs/v1.0.0/customization/themes.mdx +81 -0
- package/templates/book-docs/docs/v1.0.0/introduction.mdx +38 -0
- package/templates/book-docs/docs/v1.0.0/quickstart.mdx +112 -0
- package/templates/book-docs/docs/v2.0.0/concepts.mdx +89 -0
- package/templates/book-docs/docs/v2.0.0/content/_category_.json +7 -0
- package/templates/book-docs/docs/v2.0.0/content/formatting.mdx +128 -0
- package/templates/book-docs/docs/v2.0.0/content/reusable-content.mdx +116 -0
- package/templates/book-docs/docs/v2.0.0/content/structure.mdx +92 -0
- package/templates/book-docs/docs/v2.0.0/customization/_category_.json +7 -0
- package/templates/book-docs/docs/v2.0.0/customization/branding.mdx +115 -0
- package/templates/book-docs/docs/v2.0.0/customization/themes.mdx +81 -0
- package/templates/book-docs/docs/v2.0.0/introduction.mdx +39 -0
- package/templates/book-docs/docs/v2.0.0/quickstart.mdx +112 -0
- package/templates/book-docs/gitignore +7 -0
- package/templates/book-docs/package.json +28 -0
- package/templates/book-docs/postcss.config.mjs +8 -0
- package/templates/book-docs/public/api-specs/openapi-example.json +259 -0
- package/templates/book-docs/public/api-specs/postman-example.json +205 -0
- package/templates/book-docs/public/api-specs/test-api.json +256 -0
- package/templates/book-docs/public/api-specs/users-api.json +264 -0
- package/templates/book-docs/specra.config.json +77 -0
- package/templates/book-docs/src/app.css +2 -0
- package/templates/book-docs/src/app.html +12 -0
- package/templates/book-docs/src/routes/+layout.server.ts +11 -0
- package/templates/book-docs/src/routes/+layout.svelte +21 -0
- package/templates/book-docs/src/routes/+page.server.ts +9 -0
- package/templates/book-docs/src/routes/docs/[version]/[...slug]/+page.server.ts +119 -0
- package/templates/book-docs/src/routes/docs/[version]/[...slug]/+page.svelte +129 -0
- package/templates/book-docs/svelte.config.js +8 -0
- package/templates/book-docs/tsconfig.json +12 -0
- package/templates/book-docs/vite.config.ts +6 -0
- package/templates/jbrains-docs/docs/v1.0.0/advanced/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v1.0.0/advanced/async.mdx +95 -0
- package/templates/jbrains-docs/docs/v1.0.0/advanced/generics.mdx +126 -0
- package/templates/jbrains-docs/docs/v1.0.0/basics/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v1.0.0/basics/control-flow.mdx +106 -0
- package/templates/jbrains-docs/docs/v1.0.0/basics/syntax.mdx +129 -0
- package/templates/jbrains-docs/docs/v1.0.0/basics/types.mdx +135 -0
- package/templates/jbrains-docs/docs/v1.0.0/getting-started.mdx +111 -0
- package/templates/jbrains-docs/docs/v1.0.0/home.mdx +37 -0
- package/templates/jbrains-docs/docs/v1.0.0/tools/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v1.0.0/tools/build-tools.mdx +165 -0
- package/templates/jbrains-docs/docs/v1.0.0/tools/testing.mdx +112 -0
- package/templates/jbrains-docs/docs/v2.0.0/advanced/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v2.0.0/advanced/async.mdx +95 -0
- package/templates/jbrains-docs/docs/v2.0.0/advanced/generics.mdx +126 -0
- package/templates/jbrains-docs/docs/v2.0.0/basics/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v2.0.0/basics/control-flow.mdx +106 -0
- package/templates/jbrains-docs/docs/v2.0.0/basics/syntax.mdx +129 -0
- package/templates/jbrains-docs/docs/v2.0.0/basics/types.mdx +135 -0
- package/templates/jbrains-docs/docs/v2.0.0/getting-started.mdx +111 -0
- package/templates/jbrains-docs/docs/v2.0.0/home.mdx +37 -0
- package/templates/jbrains-docs/docs/v2.0.0/tools/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v2.0.0/tools/build-tools.mdx +165 -0
- package/templates/jbrains-docs/docs/v2.0.0/tools/testing.mdx +112 -0
- package/templates/jbrains-docs/gitignore +7 -0
- package/templates/jbrains-docs/package.json +28 -0
- package/templates/jbrains-docs/postcss.config.mjs +8 -0
- package/templates/jbrains-docs/public/api-specs/openapi-example.json +259 -0
- package/templates/jbrains-docs/public/api-specs/postman-example.json +205 -0
- package/templates/jbrains-docs/public/api-specs/test-api.json +256 -0
- package/templates/jbrains-docs/public/api-specs/users-api.json +264 -0
- package/templates/jbrains-docs/specra.config.json +80 -0
- package/templates/jbrains-docs/src/app.css +2 -0
- package/templates/jbrains-docs/src/app.html +12 -0
- package/templates/jbrains-docs/src/routes/+layout.server.ts +11 -0
- package/templates/jbrains-docs/src/routes/+layout.svelte +21 -0
- package/templates/jbrains-docs/src/routes/+page.server.ts +9 -0
- package/templates/jbrains-docs/src/routes/docs/[version]/[...slug]/+page.server.ts +119 -0
- package/templates/jbrains-docs/src/routes/docs/[version]/[...slug]/+page.svelte +129 -0
- package/templates/jbrains-docs/svelte.config.js +8 -0
- package/templates/jbrains-docs/tsconfig.json +12 -0
- package/templates/jbrains-docs/vite.config.ts +6 -0
- package/templates/minimal/docs/v1.0.0/about.mdx +3 -3
- package/templates/minimal/docs/v2.0.0/about.mdx +3 -3
- package/templates/minimal/gitignore +7 -0
- package/templates/minimal/package.json +18 -24
- package/templates/minimal/specra.config.json +12 -63
- package/templates/minimal/src/app.css +2 -0
- package/templates/minimal/src/app.html +12 -0
- package/templates/minimal/src/routes/+layout.server.ts +11 -0
- package/templates/minimal/src/routes/+layout.svelte +21 -0
- package/templates/minimal/src/routes/+page.server.ts +9 -0
- package/templates/minimal/src/routes/docs/[version]/[...slug]/+page.server.ts +119 -0
- package/templates/minimal/src/routes/docs/[version]/[...slug]/+page.svelte +129 -0
- package/templates/minimal/svelte.config.js +8 -0
- package/templates/minimal/tsconfig.json +7 -36
- package/templates/minimal/vite.config.ts +6 -0
- package/templates/minimal/README.md +0 -132
- package/templates/minimal/app/api/mdx-watch/route.ts +0 -6
- package/templates/minimal/app/api/search/route.ts +0 -75
- package/templates/minimal/app/docs/[version]/[...slug]/loading.tsx +0 -7
- package/templates/minimal/app/docs/[version]/[...slug]/page.tsx +0 -205
- package/templates/minimal/app/docs/[version]/[...slug]/page.tsx.bak +0 -203
- package/templates/minimal/app/docs/[version]/not-found.tsx +0 -10
- package/templates/minimal/app/docs/[version]/page.tsx +0 -27
- package/templates/minimal/app/globals.css +0 -9
- package/templates/minimal/app/layout.tsx +0 -62
- package/templates/minimal/app/not-found.tsx +0 -10
- package/templates/minimal/app/page.tsx +0 -179
- package/templates/minimal/next.config.mjs +0 -1
- package/templates/minimal/package-lock.json +0 -7881
- package/templates/minimal/proxy_.ts +0 -22
- package/templates/minimal/scripts/generate-redirects.mjs +0 -128
- package/templates/minimal/scripts/generate-static-redirects.mjs +0 -115
- package/templates/minimal/scripts/index-search.ts +0 -182
- package/templates/minimal/scripts/test-search.ts +0 -83
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Home
|
|
3
|
+
description: Welcome to the language documentation
|
|
4
|
+
sidebar_position: 1
|
|
5
|
+
icon: home
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Welcome to the v2 documentation. Learn the language from basics to advanced topics, and explore multiplatform tooling.
|
|
9
|
+
|
|
10
|
+
## Get Started
|
|
11
|
+
|
|
12
|
+
<CardGrid cols={2}>
|
|
13
|
+
<Card icon="book-open" title="Get Started" description="Set up your environment and write your first program" href="/docs/v2.0.0/getting-started" />
|
|
14
|
+
<Card icon="code" title="Basic Syntax" description="Learn the fundamental syntax and structure" href="/docs/v2.0.0/basics/syntax" />
|
|
15
|
+
<Card icon="layers" title="Types & Variables" description="Understand the type system and variable declarations" href="/docs/v2.0.0/basics/types" />
|
|
16
|
+
<Card icon="wrench" title="Build Tools" description="Configure and use build tools for your projects" href="/docs/v2.0.0/tools/build-tools" />
|
|
17
|
+
</CardGrid>
|
|
18
|
+
|
|
19
|
+
## Language
|
|
20
|
+
|
|
21
|
+
The **Language** section covers everything from basic syntax to advanced features like generics and async programming.
|
|
22
|
+
|
|
23
|
+
<Callout type="info">
|
|
24
|
+
If you're new, start with the [Getting Started](/docs/v2.0.0/getting-started) guide, then work through the Basics section.
|
|
25
|
+
</Callout>
|
|
26
|
+
|
|
27
|
+
## Multiplatform
|
|
28
|
+
|
|
29
|
+
The **Multiplatform** section covers tooling, build systems, and testing across different platforms and environments.
|
|
30
|
+
|
|
31
|
+
## What's New in v2
|
|
32
|
+
|
|
33
|
+
| Feature | Description |
|
|
34
|
+
|---------|-------------|
|
|
35
|
+
| **Improved Build Tools** | Faster builds and better error reporting |
|
|
36
|
+
| **Enhanced Type Checking** | Stricter validation and better diagnostics |
|
|
37
|
+
| **New Components** | Additional built-in components for richer content |
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Build Tools
|
|
3
|
+
description: Configure and use build tools for your documentation project
|
|
4
|
+
sidebar_position: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
This page covers the build tools used to develop, build, and deploy your documentation site.
|
|
8
|
+
|
|
9
|
+
## Development Server
|
|
10
|
+
|
|
11
|
+
Start the development server with hot reload:
|
|
12
|
+
|
|
13
|
+
<Tabs defaultValue="npm">
|
|
14
|
+
<Tab label="npm">
|
|
15
|
+
```bash
|
|
16
|
+
npm run dev
|
|
17
|
+
```
|
|
18
|
+
</Tab>
|
|
19
|
+
<Tab label="yarn">
|
|
20
|
+
```bash
|
|
21
|
+
yarn dev
|
|
22
|
+
```
|
|
23
|
+
</Tab>
|
|
24
|
+
<Tab label="pnpm">
|
|
25
|
+
```bash
|
|
26
|
+
pnpm dev
|
|
27
|
+
```
|
|
28
|
+
</Tab>
|
|
29
|
+
</Tabs>
|
|
30
|
+
|
|
31
|
+
The dev server runs on `http://localhost:5173` by default with:
|
|
32
|
+
- **Hot Module Replacement (HMR)** — instant updates when you edit MDX files
|
|
33
|
+
- **Error overlay** — displays build errors in the browser
|
|
34
|
+
- **Fast startup** — powered by Vite
|
|
35
|
+
|
|
36
|
+
## Production Build
|
|
37
|
+
|
|
38
|
+
Build the site for production:
|
|
39
|
+
|
|
40
|
+
<Tabs defaultValue="npm">
|
|
41
|
+
<Tab label="npm">
|
|
42
|
+
```bash
|
|
43
|
+
npm run build
|
|
44
|
+
```
|
|
45
|
+
</Tab>
|
|
46
|
+
<Tab label="yarn">
|
|
47
|
+
```bash
|
|
48
|
+
yarn build
|
|
49
|
+
```
|
|
50
|
+
</Tab>
|
|
51
|
+
<Tab label="pnpm">
|
|
52
|
+
```bash
|
|
53
|
+
pnpm build
|
|
54
|
+
```
|
|
55
|
+
</Tab>
|
|
56
|
+
</Tabs>
|
|
57
|
+
|
|
58
|
+
This outputs a static site to the `build/` directory.
|
|
59
|
+
|
|
60
|
+
<Callout type="info">
|
|
61
|
+
The production build pre-renders all pages for optimal performance and SEO.
|
|
62
|
+
</Callout>
|
|
63
|
+
|
|
64
|
+
## Preview
|
|
65
|
+
|
|
66
|
+
Preview the production build locally:
|
|
67
|
+
|
|
68
|
+
<Tabs defaultValue="npm">
|
|
69
|
+
<Tab label="npm">
|
|
70
|
+
```bash
|
|
71
|
+
npm run preview
|
|
72
|
+
```
|
|
73
|
+
</Tab>
|
|
74
|
+
<Tab label="yarn">
|
|
75
|
+
```bash
|
|
76
|
+
yarn preview
|
|
77
|
+
```
|
|
78
|
+
</Tab>
|
|
79
|
+
<Tab label="pnpm">
|
|
80
|
+
```bash
|
|
81
|
+
pnpm preview
|
|
82
|
+
```
|
|
83
|
+
</Tab>
|
|
84
|
+
</Tabs>
|
|
85
|
+
|
|
86
|
+
## Vite Configuration
|
|
87
|
+
|
|
88
|
+
The documentation platform uses Vite as its build tool. The default configuration is in `vite.config.ts`:
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import { sveltekit } from '@sveltejs/kit/vite';
|
|
92
|
+
import { defineConfig } from 'vite';
|
|
93
|
+
|
|
94
|
+
export default defineConfig({
|
|
95
|
+
plugins: [sveltekit()]
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## SvelteKit Configuration
|
|
100
|
+
|
|
101
|
+
SvelteKit is configured in `svelte.config.js`:
|
|
102
|
+
|
|
103
|
+
```javascript
|
|
104
|
+
import { specraConfig } from 'specra/svelte-config';
|
|
105
|
+
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
|
106
|
+
|
|
107
|
+
const config = specraConfig({
|
|
108
|
+
vitePreprocess: { vitePreprocess }
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
export default config;
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## PostCSS & Tailwind
|
|
115
|
+
|
|
116
|
+
Styling is handled by Tailwind CSS via PostCSS. Configuration is in `postcss.config.mjs`:
|
|
117
|
+
|
|
118
|
+
```javascript
|
|
119
|
+
const config = {
|
|
120
|
+
plugins: {
|
|
121
|
+
'@tailwindcss/postcss': {},
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export default config;
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## TypeScript
|
|
129
|
+
|
|
130
|
+
TypeScript is configured in `tsconfig.json` with strict mode enabled:
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"extends": "./.svelte-kit/tsconfig.json",
|
|
135
|
+
"compilerOptions": {
|
|
136
|
+
"strict": true,
|
|
137
|
+
"allowJs": true,
|
|
138
|
+
"checkJs": true
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Type Checking
|
|
144
|
+
|
|
145
|
+
Run the type checker:
|
|
146
|
+
|
|
147
|
+
<Tabs defaultValue="npm">
|
|
148
|
+
<Tab label="npm">
|
|
149
|
+
```bash
|
|
150
|
+
npm run check
|
|
151
|
+
```
|
|
152
|
+
</Tab>
|
|
153
|
+
<Tab label="yarn">
|
|
154
|
+
```bash
|
|
155
|
+
yarn check
|
|
156
|
+
```
|
|
157
|
+
</Tab>
|
|
158
|
+
<Tab label="pnpm">
|
|
159
|
+
```bash
|
|
160
|
+
pnpm check
|
|
161
|
+
```
|
|
162
|
+
</Tab>
|
|
163
|
+
</Tabs>
|
|
164
|
+
|
|
165
|
+
This runs `svelte-kit sync` followed by `svelte-check` to verify your TypeScript types.
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Testing
|
|
3
|
+
description: Verify your documentation builds and renders correctly
|
|
4
|
+
sidebar_position: 2
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
This page covers strategies for testing your documentation site to ensure content renders correctly and the build succeeds.
|
|
8
|
+
|
|
9
|
+
## Build Verification
|
|
10
|
+
|
|
11
|
+
The simplest test is to run a production build and check for errors:
|
|
12
|
+
|
|
13
|
+
<Tabs defaultValue="npm">
|
|
14
|
+
<Tab label="npm">
|
|
15
|
+
```bash
|
|
16
|
+
npm run build
|
|
17
|
+
```
|
|
18
|
+
</Tab>
|
|
19
|
+
<Tab label="yarn">
|
|
20
|
+
```bash
|
|
21
|
+
yarn build
|
|
22
|
+
```
|
|
23
|
+
</Tab>
|
|
24
|
+
<Tab label="pnpm">
|
|
25
|
+
```bash
|
|
26
|
+
pnpm build
|
|
27
|
+
```
|
|
28
|
+
</Tab>
|
|
29
|
+
</Tabs>
|
|
30
|
+
|
|
31
|
+
The build will fail if:
|
|
32
|
+
- MDX files have syntax errors
|
|
33
|
+
- Frontmatter is malformed
|
|
34
|
+
- Required fields are missing
|
|
35
|
+
|
|
36
|
+
<Callout type="tip">
|
|
37
|
+
Run `npm run build` in your CI pipeline to catch documentation errors before they reach production.
|
|
38
|
+
</Callout>
|
|
39
|
+
|
|
40
|
+
## Type Checking
|
|
41
|
+
|
|
42
|
+
Verify TypeScript types are correct:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm run check
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
This catches type errors in your SvelteKit configuration and any custom components.
|
|
49
|
+
|
|
50
|
+
## Content Checklist
|
|
51
|
+
|
|
52
|
+
When reviewing documentation changes, verify:
|
|
53
|
+
|
|
54
|
+
| Check | Description |
|
|
55
|
+
|-------|-------------|
|
|
56
|
+
| **Frontmatter** | All pages have `title`, and key pages have `description` |
|
|
57
|
+
| **Links** | Internal links point to existing pages |
|
|
58
|
+
| **Versions** | Content exists in all active version directories |
|
|
59
|
+
| **Sidebar Order** | `sidebar_position` values create a logical reading flow |
|
|
60
|
+
| **Categories** | Each folder has a `_category_.json` with `label` and `position` |
|
|
61
|
+
|
|
62
|
+
## Visual Testing
|
|
63
|
+
|
|
64
|
+
Preview the site locally and check:
|
|
65
|
+
|
|
66
|
+
<Steps>
|
|
67
|
+
<Step title="Start Dev Server">
|
|
68
|
+
Run `npm run dev` and open the site in your browser.
|
|
69
|
+
</Step>
|
|
70
|
+
|
|
71
|
+
<Step title="Check Navigation">
|
|
72
|
+
Verify sidebar links work, breadcrumbs are correct, and previous/next navigation follows the expected order.
|
|
73
|
+
</Step>
|
|
74
|
+
|
|
75
|
+
<Step title="Check Themes">
|
|
76
|
+
Toggle between light and dark themes. Ensure all content is readable in both modes.
|
|
77
|
+
</Step>
|
|
78
|
+
|
|
79
|
+
<Step title="Check Responsive">
|
|
80
|
+
Test on different viewport sizes. The mobile sidebar should collapse into a menu.
|
|
81
|
+
</Step>
|
|
82
|
+
</Steps>
|
|
83
|
+
|
|
84
|
+
## Common Issues
|
|
85
|
+
|
|
86
|
+
### Frontmatter Parsing Errors
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
Error: Invalid frontmatter in docs/v2.0.0/page.mdx
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Ensure your frontmatter uses valid YAML syntax and is enclosed by `---` delimiters.
|
|
93
|
+
|
|
94
|
+
### Missing Pages
|
|
95
|
+
|
|
96
|
+
If a page doesn't appear in the sidebar:
|
|
97
|
+
|
|
98
|
+
1. Check the file has the `.mdx` extension (not `.md`)
|
|
99
|
+
2. Verify the file is in the correct version directory
|
|
100
|
+
3. Check if `draft: true` is set in frontmatter
|
|
101
|
+
|
|
102
|
+
### Broken Links
|
|
103
|
+
|
|
104
|
+
If internal links return 404:
|
|
105
|
+
|
|
106
|
+
1. Check the path matches the file structure
|
|
107
|
+
2. Include the version prefix: `/docs/v2.0.0/page-name`
|
|
108
|
+
3. Use the file's slug (filename without `.mdx`), not the title
|
|
109
|
+
|
|
110
|
+
<Callout type="info">
|
|
111
|
+
The dev server shows detailed error messages in the browser overlay. Check the terminal output for build-time errors.
|
|
112
|
+
</Callout>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "my-docs",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite dev",
|
|
8
|
+
"build": "vite build",
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"specra": "^0.2.0"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@sveltejs/adapter-auto": "^3.0.0",
|
|
17
|
+
"@sveltejs/kit": "^2.0.0",
|
|
18
|
+
"@sveltejs/vite-plugin-svelte": "^6.0.0",
|
|
19
|
+
"@tailwindcss/postcss": "^4.1.9",
|
|
20
|
+
"@tailwindcss/typography": "^0.5.19",
|
|
21
|
+
"postcss": "^8.5",
|
|
22
|
+
"svelte": "^5.0.0",
|
|
23
|
+
"svelte-check": "^4.0.0",
|
|
24
|
+
"tailwindcss": "^4.1.9",
|
|
25
|
+
"typescript": "^5",
|
|
26
|
+
"vite": "^6.3.0"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.0.0",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "User Management API",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"description": "A simple API for managing users (OpenAPI format example)"
|
|
7
|
+
},
|
|
8
|
+
"servers": [
|
|
9
|
+
{
|
|
10
|
+
"url": "https://api.example.com/v1",
|
|
11
|
+
"description": "Production server"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"components": {
|
|
15
|
+
"securitySchemes": {
|
|
16
|
+
"bearerAuth": {
|
|
17
|
+
"type": "http",
|
|
18
|
+
"scheme": "bearer",
|
|
19
|
+
"description": "JWT Bearer token authentication"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"schemas": {
|
|
23
|
+
"User": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"properties": {
|
|
26
|
+
"id": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"example": "user_123"
|
|
29
|
+
},
|
|
30
|
+
"name": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"example": "John Doe"
|
|
33
|
+
},
|
|
34
|
+
"email": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"format": "email",
|
|
37
|
+
"example": "john@example.com"
|
|
38
|
+
},
|
|
39
|
+
"createdAt": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"format": "date-time",
|
|
42
|
+
"example": "2024-01-15T10:30:00Z"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"Error": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"properties": {
|
|
49
|
+
"error": {
|
|
50
|
+
"type": "string"
|
|
51
|
+
},
|
|
52
|
+
"code": {
|
|
53
|
+
"type": "string"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"security": [
|
|
60
|
+
{
|
|
61
|
+
"bearerAuth": []
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"paths": {
|
|
65
|
+
"/users": {
|
|
66
|
+
"get": {
|
|
67
|
+
"summary": "List all users",
|
|
68
|
+
"description": "Retrieve a paginated list of all users",
|
|
69
|
+
"operationId": "listUsers",
|
|
70
|
+
"parameters": [
|
|
71
|
+
{
|
|
72
|
+
"name": "page",
|
|
73
|
+
"in": "query",
|
|
74
|
+
"description": "Page number for pagination",
|
|
75
|
+
"schema": {
|
|
76
|
+
"type": "integer",
|
|
77
|
+
"default": 1,
|
|
78
|
+
"example": 1
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "limit",
|
|
83
|
+
"in": "query",
|
|
84
|
+
"description": "Number of items per page",
|
|
85
|
+
"schema": {
|
|
86
|
+
"type": "integer",
|
|
87
|
+
"default": 10,
|
|
88
|
+
"example": 10
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"responses": {
|
|
93
|
+
"200": {
|
|
94
|
+
"description": "List of users retrieved successfully",
|
|
95
|
+
"content": {
|
|
96
|
+
"application/json": {
|
|
97
|
+
"schema": {
|
|
98
|
+
"type": "array",
|
|
99
|
+
"items": {
|
|
100
|
+
"$ref": "#/components/schemas/User"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"example": [
|
|
104
|
+
{
|
|
105
|
+
"id": "user_123",
|
|
106
|
+
"name": "John Doe",
|
|
107
|
+
"email": "john@example.com",
|
|
108
|
+
"createdAt": "2024-01-15T10:30:00Z"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"id": "user_456",
|
|
112
|
+
"name": "Jane Smith",
|
|
113
|
+
"email": "jane@example.com",
|
|
114
|
+
"createdAt": "2024-01-16T14:20:00Z"
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"post": {
|
|
123
|
+
"summary": "Create a new user",
|
|
124
|
+
"description": "Create a new user account",
|
|
125
|
+
"operationId": "createUser",
|
|
126
|
+
"requestBody": {
|
|
127
|
+
"description": "User data to create",
|
|
128
|
+
"required": true,
|
|
129
|
+
"content": {
|
|
130
|
+
"application/json": {
|
|
131
|
+
"schema": {
|
|
132
|
+
"type": "object",
|
|
133
|
+
"required": ["name", "email"],
|
|
134
|
+
"properties": {
|
|
135
|
+
"name": {
|
|
136
|
+
"type": "string",
|
|
137
|
+
"example": "John Doe"
|
|
138
|
+
},
|
|
139
|
+
"email": {
|
|
140
|
+
"type": "string",
|
|
141
|
+
"format": "email",
|
|
142
|
+
"example": "john@example.com"
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"responses": {
|
|
150
|
+
"201": {
|
|
151
|
+
"description": "User created successfully",
|
|
152
|
+
"content": {
|
|
153
|
+
"application/json": {
|
|
154
|
+
"schema": {
|
|
155
|
+
"$ref": "#/components/schemas/User"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
"400": {
|
|
161
|
+
"description": "Invalid request data",
|
|
162
|
+
"content": {
|
|
163
|
+
"application/json": {
|
|
164
|
+
"schema": {
|
|
165
|
+
"$ref": "#/components/schemas/Error"
|
|
166
|
+
},
|
|
167
|
+
"example": {
|
|
168
|
+
"error": "Email already exists",
|
|
169
|
+
"code": "DUPLICATE_EMAIL"
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"/users/{id}": {
|
|
178
|
+
"get": {
|
|
179
|
+
"summary": "Get user by ID",
|
|
180
|
+
"description": "Retrieve a single user by their unique identifier",
|
|
181
|
+
"operationId": "getUserById",
|
|
182
|
+
"parameters": [
|
|
183
|
+
{
|
|
184
|
+
"name": "id",
|
|
185
|
+
"in": "path",
|
|
186
|
+
"required": true,
|
|
187
|
+
"description": "The user's unique identifier",
|
|
188
|
+
"schema": {
|
|
189
|
+
"type": "string",
|
|
190
|
+
"example": "user_123"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
"responses": {
|
|
195
|
+
"200": {
|
|
196
|
+
"description": "User retrieved successfully",
|
|
197
|
+
"content": {
|
|
198
|
+
"application/json": {
|
|
199
|
+
"schema": {
|
|
200
|
+
"$ref": "#/components/schemas/User"
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
"404": {
|
|
206
|
+
"description": "User not found",
|
|
207
|
+
"content": {
|
|
208
|
+
"application/json": {
|
|
209
|
+
"schema": {
|
|
210
|
+
"$ref": "#/components/schemas/Error"
|
|
211
|
+
},
|
|
212
|
+
"example": {
|
|
213
|
+
"error": "User not found",
|
|
214
|
+
"code": "USER_NOT_FOUND"
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
"delete": {
|
|
222
|
+
"summary": "Delete a user",
|
|
223
|
+
"description": "Permanently delete a user account",
|
|
224
|
+
"operationId": "deleteUser",
|
|
225
|
+
"parameters": [
|
|
226
|
+
{
|
|
227
|
+
"name": "id",
|
|
228
|
+
"in": "path",
|
|
229
|
+
"required": true,
|
|
230
|
+
"description": "The user's unique identifier",
|
|
231
|
+
"schema": {
|
|
232
|
+
"type": "string",
|
|
233
|
+
"example": "user_123"
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
],
|
|
237
|
+
"responses": {
|
|
238
|
+
"204": {
|
|
239
|
+
"description": "User deleted successfully"
|
|
240
|
+
},
|
|
241
|
+
"404": {
|
|
242
|
+
"description": "User not found",
|
|
243
|
+
"content": {
|
|
244
|
+
"application/json": {
|
|
245
|
+
"schema": {
|
|
246
|
+
"$ref": "#/components/schemas/Error"
|
|
247
|
+
},
|
|
248
|
+
"example": {
|
|
249
|
+
"error": "User not found",
|
|
250
|
+
"code": "USER_NOT_FOUND"
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|