create-specra 0.1.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 +21 -0
- package/README.md +137 -0
- package/package.json +42 -0
- package/templates/minimal/README.md +132 -0
- package/templates/minimal/app/api/mdx-watch/route.ts +80 -0
- package/templates/minimal/app/docs/[version]/[...slug]/loading.tsx +7 -0
- package/templates/minimal/app/docs/[version]/[...slug]/page.tsx +212 -0
- package/templates/minimal/app/docs/[version]/not-found.tsx +10 -0
- package/templates/minimal/app/docs/[version]/page.tsx +27 -0
- package/templates/minimal/app/globals.css +1 -0
- package/templates/minimal/app/layout.tsx +89 -0
- package/templates/minimal/app/page.tsx +185 -0
- package/templates/minimal/docs/v1.0.0/about.mdx +57 -0
- package/templates/minimal/docs/v1.0.0/components/_category_.json +8 -0
- package/templates/minimal/docs/v1.0.0/components/callout.mdx +83 -0
- package/templates/minimal/docs/v1.0.0/components/code-block.mdx +103 -0
- package/templates/minimal/docs/v1.0.0/components/index.mdx +8 -0
- package/templates/minimal/docs/v1.0.0/components/tabs.mdx +92 -0
- package/templates/minimal/docs/v1.0.0/configuration.mdx +322 -0
- package/templates/minimal/docs/v1.0.0/features.mdx +197 -0
- package/templates/minimal/docs/v1.0.0/getting-started.mdx +183 -0
- package/templates/minimal/docs/v1.0.0/index.mdx +29 -0
- package/templates/minimal/middleware.ts +23 -0
- package/templates/minimal/next.config.default.mjs +36 -0
- package/templates/minimal/next.config.export.mjs +62 -0
- package/templates/minimal/next.config.mjs +18 -0
- package/templates/minimal/package-lock.json +7338 -0
- package/templates/minimal/package.json +32 -0
- package/templates/minimal/postcss.config.mjs +8 -0
- package/templates/minimal/public/api-specs/openapi-example.json +259 -0
- package/templates/minimal/public/api-specs/postman-example.json +205 -0
- package/templates/minimal/public/api-specs/test-api.json +256 -0
- package/templates/minimal/public/api-specs/users-api.json +264 -0
- package/templates/minimal/scripts/generate-redirects.mjs +88 -0
- package/templates/minimal/scripts/index-search.ts +159 -0
- package/templates/minimal/scripts/test-search.ts +83 -0
- package/templates/minimal/specra.config.json +124 -0
- package/templates/minimal/tsconfig.json +41 -0
- package/templates/minimal/yarn.lock +3909 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Welcome to Your Documentation
|
|
3
|
+
description: Get started with your Specra documentation site
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Welcome to Your Documentation
|
|
7
|
+
|
|
8
|
+
This is your documentation home page. Start editing this file to create your own content!
|
|
9
|
+
|
|
10
|
+
## Quick Start
|
|
11
|
+
|
|
12
|
+
1. **Edit this file** at `docs/v1.0.0/index.mdx`
|
|
13
|
+
2. **Add new pages** by creating `.mdx` files in the `docs/v1.0.0/` directory
|
|
14
|
+
3. **Customize your site** by editing `specra.config.json`
|
|
15
|
+
|
|
16
|
+
## Example Pages
|
|
17
|
+
|
|
18
|
+
Check out these example pages to learn how to use Specra:
|
|
19
|
+
|
|
20
|
+
- [Getting Started](./getting-started) - Learn the basics
|
|
21
|
+
- [Features](./features) - Explore what Specra can do
|
|
22
|
+
- [Configuration](./configuration) - Customize your site
|
|
23
|
+
- [Components](./components) - See available components
|
|
24
|
+
|
|
25
|
+
## Need Help?
|
|
26
|
+
|
|
27
|
+
- Read the [Specra documentation](https://specra.dev/docs)
|
|
28
|
+
- Check out [Next.js docs](https://nextjs.org/docs)
|
|
29
|
+
- Learn about [MDX](https://mdxjs.com)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { NextResponse } from "next/server"
|
|
2
|
+
import type { NextRequest } from "next/server"
|
|
3
|
+
|
|
4
|
+
// Note: Redirects from frontmatter are handled at build time via next.config.js
|
|
5
|
+
// This middleware can be extended for dynamic redirects if needed
|
|
6
|
+
|
|
7
|
+
export function middleware(request: NextRequest) {
|
|
8
|
+
// Add any runtime middleware logic here
|
|
9
|
+
return NextResponse.next()
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const config = {
|
|
13
|
+
matcher: [
|
|
14
|
+
/*
|
|
15
|
+
* Match all request paths except for the ones starting with:
|
|
16
|
+
* - api (API routes)
|
|
17
|
+
* - _next/static (static files)
|
|
18
|
+
* - _next/image (image optimization files)
|
|
19
|
+
* - favicon.ico (favicon file)
|
|
20
|
+
*/
|
|
21
|
+
"/((?!api|_next/static|_next/image|favicon.ico).*)",
|
|
22
|
+
],
|
|
23
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import fs from "fs"
|
|
2
|
+
import path from "path"
|
|
3
|
+
import { fileURLToPath } from "url"
|
|
4
|
+
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
6
|
+
const __dirname = path.dirname(__filename)
|
|
7
|
+
|
|
8
|
+
// Load redirects from generated file
|
|
9
|
+
let redirects = []
|
|
10
|
+
try {
|
|
11
|
+
const redirectsPath = path.join(__dirname, "redirects.json")
|
|
12
|
+
if (fs.existsSync(redirectsPath)) {
|
|
13
|
+
redirects = JSON.parse(fs.readFileSync(redirectsPath, "utf8"))
|
|
14
|
+
}
|
|
15
|
+
} catch (error) {
|
|
16
|
+
console.warn("Could not load redirects.json:", error.message)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** @type {import('next').NextConfig} */
|
|
20
|
+
const nextConfig = {
|
|
21
|
+
output: "standalone", // Default to standalone for Vercel/Node.js hosting
|
|
22
|
+
typescript: {
|
|
23
|
+
ignoreBuildErrors: true,
|
|
24
|
+
},
|
|
25
|
+
images: {
|
|
26
|
+
unoptimized: true,
|
|
27
|
+
},
|
|
28
|
+
// Empty turbopack config to silence the warning
|
|
29
|
+
// Turbopack handles file watching automatically
|
|
30
|
+
turbopack: {},
|
|
31
|
+
async redirects() {
|
|
32
|
+
return redirects
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default nextConfig
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import fs from "fs"
|
|
2
|
+
import path from "path"
|
|
3
|
+
import { fileURLToPath } from "url"
|
|
4
|
+
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
6
|
+
const __dirname = path.dirname(__filename)
|
|
7
|
+
|
|
8
|
+
// Load redirects from generated file
|
|
9
|
+
let redirects = []
|
|
10
|
+
try {
|
|
11
|
+
const redirectsPath = path.join(__dirname, "redirects.json")
|
|
12
|
+
if (fs.existsSync(redirectsPath)) {
|
|
13
|
+
redirects = JSON.parse(fs.readFileSync(redirectsPath, "utf8"))
|
|
14
|
+
}
|
|
15
|
+
} catch (error) {
|
|
16
|
+
console.warn("Could not load redirects.json:", error.message)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Load deployment config from specra.config.json
|
|
20
|
+
let basePath = ""
|
|
21
|
+
try {
|
|
22
|
+
const configPath = path.join(__dirname, "specra.config.json")
|
|
23
|
+
if (fs.existsSync(configPath)) {
|
|
24
|
+
const config = JSON.parse(fs.readFileSync(configPath, "utf8"))
|
|
25
|
+
const deployment = config.deployment || {}
|
|
26
|
+
|
|
27
|
+
// Only apply basePath for GitHub Pages without custom domain
|
|
28
|
+
if (deployment.target === "github-pages" && !deployment.customDomain && deployment.basePath) {
|
|
29
|
+
basePath = deployment.basePath.startsWith("/")
|
|
30
|
+
? deployment.basePath
|
|
31
|
+
: `/${deployment.basePath}`
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
console.log(`\nš¦ Building for static export with deployment target: ${deployment.target || 'not specified'}`)
|
|
35
|
+
if (basePath) {
|
|
36
|
+
console.log(`š Using basePath: ${basePath}`)
|
|
37
|
+
} else {
|
|
38
|
+
console.log(`š No basePath applied (custom domain or root deployment)`)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.warn("Could not load deployment config from specra.config.json:", error.message)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** @type {import('next').NextConfig} */
|
|
46
|
+
const nextConfig = {
|
|
47
|
+
output: "export", // Always export for static hosting
|
|
48
|
+
basePath: basePath || undefined,
|
|
49
|
+
typescript: {
|
|
50
|
+
ignoreBuildErrors: true,
|
|
51
|
+
},
|
|
52
|
+
images: {
|
|
53
|
+
unoptimized: true,
|
|
54
|
+
},
|
|
55
|
+
// Empty turbopack config to silence the warning
|
|
56
|
+
turbopack: {},
|
|
57
|
+
async redirects() {
|
|
58
|
+
return redirects
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default nextConfig
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const mode = process.env.NEXT_BUILD_MODE || "default";
|
|
2
|
+
|
|
3
|
+
let config;
|
|
4
|
+
let target = ""
|
|
5
|
+
|
|
6
|
+
switch (mode) {
|
|
7
|
+
case "export":
|
|
8
|
+
config = await import("./next.config.export.mjs");
|
|
9
|
+
target = "export"
|
|
10
|
+
break;
|
|
11
|
+
default:
|
|
12
|
+
config = await import("./next.config.default.mjs");
|
|
13
|
+
target = "server"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
console.log(`Building for target: ${target}`)
|
|
17
|
+
|
|
18
|
+
export default config.default ?? config;
|