-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for Zuplo dev-portal.json configuration (#433)
* Add support for zuplo dev-portal.json * Added support for dev-portal.json config * updated type import * Fixed server output path * generate code for @zudoku/config
- Loading branch information
Showing
46 changed files
with
1,399 additions
and
566 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"version": "0.2.0", | ||
"inputs": [ | ||
{ | ||
"type": "promptString", | ||
"description": "The example to use", | ||
"id": "example", | ||
"default": "with-config" | ||
} | ||
], | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "zudoku:build", | ||
"env": { | ||
"NODE_ENV": "development" | ||
}, | ||
"smartStep": true, | ||
"runtimeExecutable": "nx", | ||
"args": ["run", "${input:example}:build", "--debugPort=9229"], | ||
"skipFiles": ["<node_internals>/**"], | ||
"console": "integratedTerminal", | ||
"sourceMaps": true, | ||
"resolveSourceMapLocations": [ | ||
"${workspaceFolder}/apps/**/dist/**", | ||
"${workspaceFolder}/packages/**/dist/**", | ||
"${workspaceFolder}/sdks/**/dist/**", | ||
"${workspaceFolder}/test-fixtures/**/dist/**", | ||
"!**/node_modules/**" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.zuplo/ | ||
.cache/ | ||
dist/ | ||
node_modules/ | ||
.env | ||
.env.zuplo | ||
.husky/_ | ||
|
||
# OS Stuff | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"policies": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"openapi": "3.1.0", | ||
"info": { | ||
"version": "1.0.0", | ||
"title": "My Zuplo API" | ||
}, | ||
"paths": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"basePath": "/docs", | ||
"topNavigation": [ | ||
{ "id": "docs", "label": "Documentation" }, | ||
{ "id": "api", "label": "API Reference" } | ||
], | ||
"sidebar": { | ||
"docs": [ | ||
{ | ||
"type": "category", | ||
"label": "Overview", | ||
"items": ["/introduction"] | ||
} | ||
] | ||
}, | ||
"redirects": [{ "from": "/", "to": "/introduction" }], | ||
"apis": { | ||
"type": "file", | ||
"input": "config/routes.oas.json", | ||
"navigationId": "api" | ||
}, | ||
"docs": { | ||
"files": "/pages/**/*.mdx" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
EXAMPLE_SECRET=👀 What you looking at? | ||
EXAMPLE_CONFIG=https://twitter.com/zuplo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"name": "with-zuplo", | ||
"version": "0.1.0", | ||
"type": "module", | ||
"private": true, | ||
"scripts": { | ||
"dev": "zudoku dev", | ||
"build": "zudoku build" | ||
}, | ||
"nx": { | ||
"tags": [ | ||
"example" | ||
], | ||
"targets": { | ||
"build": { | ||
"dependsOn": [ | ||
"zudoku:build" | ||
] | ||
} | ||
} | ||
}, | ||
"dependencies": { | ||
"react": "18.3.1", | ||
"react-dom": "18.3.1", | ||
"@mdx-js/react": "3.0.1", | ||
"zudoku": "workspace:*" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20", | ||
"typescript": "^5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
title: Welcome | ||
description: Welcome to your new Zudoku documentation site. | ||
--- | ||
|
||
## Welcome to Zudoku | ||
|
||
Zudoku is a documentation generator that allows you to create beautiful documentation sites with ease. It supports MDX, OpenAPI, and is entirely customizable. | ||
|
||
### Start customizing | ||
|
||
You can customize your documentation site by modifying the `zudoku.config.js` file in the root of your project. Why not try changing the primary color of your site? | ||
|
||
```json | ||
{ | ||
// ... | ||
"theme": { | ||
"light": { | ||
"primary": "316 100% 50%", | ||
"primaryForeground": "360 100% 100%" | ||
}, | ||
"dark": { | ||
"primary": "316 100% 50%", | ||
"primaryForeground": "360 100% 100%" | ||
} | ||
} | ||
// ... | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "with-zuplo", | ||
"$schema": "../node_modules/nx/schemas/nx-schema.json", | ||
"targets": { | ||
"build": { | ||
"options": { | ||
"env": { | ||
"ZUPLO": "1" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2022", | ||
"lib": ["ESNext", "DOM", "DOM.Iterable", "WebWorker"], | ||
"module": "ESNext", | ||
"moduleResolution": "Bundler", | ||
"useDefineForClassFields": true, | ||
"skipLibCheck": true, | ||
"skipDefaultLibCheck": true, | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"useUnknownInCatchVariables": false, | ||
"jsx": "react-jsx" | ||
}, | ||
"include": ["src", "zudoku.config.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# @zudoku/config | ||
|
||
This module is for internal use only. It is used to load the configuration of Zudoku projects when running as part of the Zuplo build. | ||
|
||
This module may change at any time. Do not rely on it in your own projects. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import esbuild from "esbuild"; | ||
import { copyFile, writeFile } from "node:fs/promises"; | ||
import { createTypeAlias, printNode, zodToTs } from "zod-to-ts"; | ||
import { CommonConfigSchema } from "../../zudoku/dist/config/validators/common.js"; | ||
|
||
/** | ||
* This file does three things: | ||
* 1. Build the index.ts file using esbuild - this references the functions | ||
* from zudoku we need to bundle in this module | ||
* 2. Generates the CommonConfig type alias from the zod type in zoduku | ||
* 3. Copies the manually written index.d.ts file to the dist folder | ||
*/ | ||
|
||
const result = await esbuild.build({ | ||
entryPoints: [new URL("../src/index.ts", import.meta.url).pathname], | ||
outdir: "dist", | ||
bundle: true, | ||
target: "es2022", | ||
splitting: true, | ||
format: "esm", | ||
platform: "node", | ||
packages: "external", | ||
metafile: true, | ||
}); | ||
|
||
const externals = Object.values(result.metafile?.inputs) | ||
.map((input) => input.imports) | ||
.flat() | ||
.filter((input) => input.external); | ||
|
||
await writeFile( | ||
new URL("../dist/meta.json", import.meta.url).pathname, | ||
JSON.stringify(externals, null, 2), | ||
); | ||
|
||
const { node } = zodToTs(CommonConfigSchema, "User"); | ||
const typeAlias = createTypeAlias(node, "CommonConfig"); | ||
const nodeString = printNode(typeAlias); | ||
|
||
const code = `export ${nodeString}`; | ||
|
||
await writeFile(new URL("../dist/config.d.ts", import.meta.url).pathname, code); | ||
await copyFile( | ||
new URL("../src/index.d.ts", import.meta.url).pathname, | ||
new URL("../dist/index.d.ts", import.meta.url).pathname, | ||
); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.