create-zudoku 0.0.0-e7477f4 → 0.0.0-e792d466

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.
@@ -0,0 +1,2 @@
1
+ # Rename this file to `.env` to use environment variables locally
2
+ ZUDOKU_PUBLIC_VAR="my-value"
@@ -16,10 +16,13 @@ pnpm dev
16
16
 
17
17
  Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18
18
 
19
- You can start editing the page by modifying `pages/intro.mdx`. You will see the content automatically update as you save the file.
19
+ You can start editing the page by modifying `pages/intro.mdx`. You will see the content
20
+ automatically update as you save the file.
20
21
 
21
22
  ## Learn More
22
23
 
23
24
  To learn more about Zudoku, you can visit the [Zudoku documentation](https://zudoku.dev/docs).
24
25
 
25
- To connect with the community join the [GitHub Discussions](https://github.com/zuplo/zudoku/discussions) or [Discord](https://discord.zudoku.dev).
26
+ To connect with the community join the
27
+ [GitHub Discussions](https://github.com/zuplo/zudoku/discussions) or
28
+ [Discord](https://discord.zudoku.dev).
@@ -12,4 +12,5 @@ To edit this page, open the `pages/introduction.mdx` file.
12
12
 
13
13
  You can find the full configuration for your Zudoku site in the `zudoku.config.jsx` file.
14
14
 
15
- For further information on how to customize your site, check out the [Zudoku documentation](https://zudoku.dev/docs).
15
+ For further information on how to customize your site, check out the
16
+ [Zudoku documentation](https://zudoku.dev/docs).
@@ -0,0 +1,2 @@
1
+ # Rename this file to `.env` to use environment variables locally
2
+ ZUDOKU_PUBLIC_VAR="my-value"
@@ -16,10 +16,13 @@ pnpm dev
16
16
 
17
17
  Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18
18
 
19
- You can start editing the page by modifying `pages/intro.mdx`. You will see the content automatically update as you save the file.
19
+ You can start editing the page by modifying `pages/intro.mdx`. You will see the content
20
+ automatically update as you save the file.
20
21
 
21
22
  ## Learn More
22
23
 
23
24
  To learn more about Zudoku, you can visit the [Zudoku documentation](https://zudoku.dev/docs).
24
25
 
25
- To connect with the community join the [GitHub Discussions](https://github.com/zuplo/zudoku/discussions) or [Discord](https://discord.zudoku.dev).
26
+ To connect with the community join the
27
+ [GitHub Discussions](https://github.com/zuplo/zudoku/discussions) or
28
+ [Discord](https://discord.zudoku.dev).
@@ -12,4 +12,5 @@ To edit this page, open the `pages/introduction.mdx` file.
12
12
 
13
13
  You can find the full configuration for your Zudoku site in the `zudoku.config.tsx` file.
14
14
 
15
- For further information on how to customize your site, check out the [Zudoku documentation](https://zudoku.dev/docs).
15
+ For further information on how to customize your site, check out the
16
+ [Zudoku documentation](https://zudoku.dev/docs).
@@ -0,0 +1,156 @@
1
+ // biome-ignore-all lint/suspicious/noConsole: Logging allowed here
2
+ import fs from "node:fs/promises";
3
+ import os from "node:os";
4
+ import path from "node:path";
5
+ import { bold, cyan } from "picocolors";
6
+ import { copy } from "../helpers/copy";
7
+ import { install } from "../helpers/install";
8
+
9
+ import type { GetTemplateFileArgs, InstallTemplateArgs } from "./types";
10
+
11
+ // When bundled by ncc, __dirname points to dist/, but templates are at dist/templates/
12
+ const TEMPLATES_DIR = __dirname.endsWith("dist")
13
+ ? path.join(__dirname, "templates")
14
+ : __dirname;
15
+
16
+ /**
17
+ * Get the file path for a given file in a template, e.g. "next.config.js".
18
+ */
19
+ export const getTemplateFile = ({
20
+ template,
21
+ mode,
22
+ file,
23
+ }: GetTemplateFileArgs): string => {
24
+ return path.join(TEMPLATES_DIR, template, mode, file);
25
+ };
26
+
27
+ /**
28
+ * Install a Zudoku internal template to a given `root` directory.
29
+ */
30
+ export const installTemplate = async ({
31
+ appName,
32
+ root,
33
+ packageManager,
34
+ isOnline,
35
+ template,
36
+ mode,
37
+ eslint,
38
+ skipInstall,
39
+ zudokuVersion,
40
+ }: InstallTemplateArgs) => {
41
+ console.log(bold(`Using ${packageManager}.`));
42
+
43
+ /**
44
+ * Copy the template files to the target directory.
45
+ */
46
+ console.log("\nInitializing project with template:", template, "\n");
47
+ const templatePath = path.join(TEMPLATES_DIR, template, mode);
48
+ const copySource = ["**"];
49
+ if (!eslint) copySource.push("!eslintrc.json");
50
+
51
+ await copy(copySource, root, {
52
+ parents: true,
53
+ cwd: templatePath,
54
+ rename(name) {
55
+ switch (name) {
56
+ case "gitignore":
57
+ case "eslintrc.json": {
58
+ return `.${name}`;
59
+ }
60
+ // README.md is ignored by webpack-asset-relocator-loader used by ncc:
61
+ // https://github.com/vercel/webpack-asset-relocator-loader/blob/e9308683d47ff507253e37c9bcbb99474603192b/src/asset-relocator.js#L227
62
+ case "README-template.md": {
63
+ return "README.md";
64
+ }
65
+ default: {
66
+ return name;
67
+ }
68
+ }
69
+ },
70
+ });
71
+
72
+ // update import alias in any files if not using the default
73
+
74
+ /** Copy the version from package.json or override for tests. */
75
+ const version = process.env.ZUDOKU_PRIVATE_TEST_VERSION ?? zudokuVersion;
76
+
77
+ /** Create a package.json for the new project and write it to disk. */
78
+ // biome-ignore lint/suspicious/noExplicitAny: Allow any type
79
+ const packageJson: any = {
80
+ name: appName,
81
+ version: "0.1.0",
82
+ type: "module",
83
+ private: true,
84
+ scripts: {
85
+ dev: "zudoku dev",
86
+ build: "zudoku build",
87
+ preview: "zudoku preview",
88
+ lint: "eslint",
89
+ },
90
+ /**
91
+ * Default dependencies.
92
+ */
93
+ dependencies: {
94
+ react: ">=19.0.0",
95
+ "react-dom": ">=19.0.0",
96
+ zudoku: version,
97
+ },
98
+ devDependencies: {},
99
+ };
100
+
101
+ /**
102
+ * TypeScript projects will have type definitions and other devDependencies.
103
+ */
104
+ if (mode === "ts") {
105
+ packageJson.devDependencies = {
106
+ ...packageJson.devDependencies,
107
+ "@types/node": "^22",
108
+ "@types/react": "^19",
109
+ "@types/react-dom": "^19",
110
+ typescript: "^5",
111
+ };
112
+ }
113
+
114
+ /* Default ESLint dependencies. */
115
+ if (eslint) {
116
+ packageJson.devDependencies = {
117
+ ...packageJson.devDependencies,
118
+ eslint: "^8",
119
+ };
120
+ }
121
+
122
+ // Typescript eslint dependencies
123
+ if (eslint && mode === "ts") {
124
+ packageJson.devDependencies = {
125
+ ...packageJson.devDependencies,
126
+ "@typescript-eslint/eslint-plugin": "^8",
127
+ "@typescript-eslint/parser": "^8",
128
+ };
129
+ }
130
+
131
+ const devDeps = Object.keys(packageJson.devDependencies).length;
132
+ if (!devDeps) delete packageJson.devDependencies;
133
+
134
+ await fs.writeFile(
135
+ path.join(root, "package.json"),
136
+ JSON.stringify(packageJson, null, 2) + os.EOL,
137
+ );
138
+
139
+ if (skipInstall) return;
140
+
141
+ console.log("\nInstalling dependencies:");
142
+ for (const dependency in packageJson.dependencies)
143
+ console.log(`- ${cyan(dependency)}`);
144
+
145
+ if (devDeps) {
146
+ console.log("\nInstalling devDependencies:");
147
+ for (const dependency in packageJson.devDependencies)
148
+ console.log(`- ${cyan(dependency)}`);
149
+ }
150
+
151
+ console.log();
152
+
153
+ await install(packageManager, isOnline);
154
+ };
155
+
156
+ export * from "./types";
@@ -0,0 +1,22 @@
1
+ import type { PackageManager } from "../helpers/get-pkg-manager";
2
+
3
+ export type TemplateType = "default" | "zuplo";
4
+ export type TemplateMode = "js" | "ts";
5
+
6
+ export interface GetTemplateFileArgs {
7
+ template: TemplateType;
8
+ mode: TemplateMode;
9
+ file: string;
10
+ }
11
+
12
+ export interface InstallTemplateArgs {
13
+ appName: string;
14
+ root: string;
15
+ packageManager: PackageManager;
16
+ isOnline: boolean;
17
+ template: TemplateType;
18
+ mode: TemplateMode;
19
+ eslint: boolean;
20
+ skipInstall: boolean;
21
+ zudokuVersion: string;
22
+ }
@@ -1,7 +1,40 @@
1
1
  # Developer Portal
2
2
 
3
- This is your Zuplo Developer Portal powered by [Zudoku](https://zudoku.dev). This developer portal allows you to ship a beautiful API documentation for your users. You can customize this portal to match your brand and style.
3
+ This is your [Zuplo Developer Portal](https://zuplo.com/docs/dev-portal/introduction). This
4
+ developer portal allows you to ship a beautiful API documentation for your users. You can customize
5
+ this portal to match your brand and style.
4
6
 
5
- This developer portal is configured to work with your Zuplo API. When you publish your API, your developer portal will be automatically published with the latest API documentation.
7
+ This developer portal is configured to work with your Zuplo API. When you publish your API, your
8
+ developer portal will be automatically published with the latest API documentation.
6
9
 
7
- For more information, visit the [Zudoku Documentation](https://zudoku.dev/docs).
10
+ For more information, visit the [Documentation](https://zuplo.com/docs/dev-portal/introduction).
11
+
12
+ The Zuplo Developer Portal is built on top of the open source [Zudoku](https://zudoku.dev) project,
13
+ a powerful tool for creating and managing API documentation. If you would like to learn more about
14
+ the project, open a feature request, or contribute to the codebase, visit the
15
+ [Zudoku GitHub repository](https://github.com/zuplo/zudoku).
16
+
17
+ ## Local Development
18
+
19
+ After you have connected your Zuplo project to
20
+ [source control](https://zuplo.com/docs/articles/source-control) you can clone your project locally.
21
+ Running the Developer Portal locally allows you to see changes in real-time with live-reload.
22
+
23
+ 1. Clone the repository
24
+
25
+ ```bash
26
+ git clone https://github.com/my-org/my-repo
27
+ cd my-repo
28
+ ```
29
+
30
+ 2. Install dependencies
31
+
32
+ ```bash
33
+ npm install
34
+ ```
35
+
36
+ 3. Start the development server
37
+
38
+ ```bash
39
+ npm run docs
40
+ ```
@@ -14,25 +14,37 @@ category: ""
14
14
 
15
15
  Welcome to your new developer portal that makes sense. 🎉
16
16
 
17
- This is your new developer portal, built with ["Zudoku by Zuplo"](https://github.com/zuplo/zudoku) and designed to elevate your API documentation experience. We've streamlined the setup process so you can focus on what matters most: creating exceptional developer experiences.
17
+ This is your new developer portal, built with ["Zudoku by Zuplo"](https://github.com/zuplo/zudoku)
18
+ and designed to elevate your API documentation experience. We've streamlined the setup process so
19
+ you can focus on what matters most: creating exceptional developer experiences.
18
20
 
19
- Think of this as your API's professional showcase—presenting your endpoints and documentation in the best possible light. Whether you're launching innovative new features or improving existing services, this portal provides the foundation for clear, accessible, and engaging developer documentation.
21
+ Think of this as your API's professional showcase—presenting your endpoints and documentation in the
22
+ best possible light. Whether you're launching innovative new features or improving existing
23
+ services, this portal provides the foundation for clear, accessible, and engaging developer
24
+ documentation.
20
25
 
21
- Let's explore what we've configured for you and how you can customize it to perfectly match your needs.
26
+ Let's explore what we've configured for you and how you can customize it to perfectly match your
27
+ needs.
22
28
 
23
29
  ## Let's Review Your Configuration
24
30
 
25
- The developer portal is configured in the `zudoku.config.tsx` file. We've created a starter configuration to get you up and running quickly.
26
- Let's walk you through everything we've set up so you know how to customize it:
31
+ The developer portal is configured in the `zudoku.config.tsx` file. We've created a starter
32
+ configuration to get you up and running quickly. Let's walk you through everything we've set up so
33
+ you know how to customize it:
27
34
 
28
35
  <Stepper>
29
36
 
30
37
  1. **Change the Basics**
31
38
 
32
- First, you may want to change the title and banner we've put in place. These are part of the `page` section in your configuration.
39
+ First, you may want to change the title and banner we've put in place. These are part of the
40
+ `page` section in your configuration.
33
41
 
34
42
  :::tip
35
- **Have a company logo?** Learn how you can [add your logo](https://zuplo.com/docs/dev-portal/zudoku/configuration/page#logo) in our documentation.
43
+
44
+ **Have a company logo?** Learn how you can
45
+ [add your logo](https://zuplo.com/docs/dev-portal/zudoku/configuration/site#logo) in our
46
+ documentation.
47
+
36
48
  :::
37
49
 
38
50
  ```jsx
@@ -55,8 +67,9 @@ Let's walk you through everything we've set up so you know how to customize it:
55
67
 
56
68
  1. **API Reference**
57
69
 
58
- Your [API Reference](/api) is generated from your Zuplo OpenAPI file in `../routes.oas.json`—you can add other APIs whenever you need them.
59
- Improve your documentation by adding more details to the OpenAPI file.
70
+ Your [API Reference](/api) is generated from your Zuplo OpenAPI file in `../routes.oas.json`—you
71
+ can add other APIs whenever you need them. Improve your documentation by adding more details to
72
+ the OpenAPI file.
60
73
 
61
74
  ```json
62
75
  {
@@ -71,10 +84,16 @@ Let's walk you through everything we've set up so you know how to customize it:
71
84
 
72
85
  1. **Authentication & Login**
73
86
 
74
- We've configured your project to use [Auth0](https://auth0.com) as an authentication provider with our demo account. We support many authentication providers—check the [documentation on how to configure](https://zuplo.com/docs/dev-portal/zudoku/configuration/authentication#authentication-providers) each one.
87
+ We've configured your project to use [Auth0](https://auth0.com) as an authentication provider
88
+ with our demo account. We support many authentication providers—check the
89
+ [documentation on how to configure](https://zuplo.com/docs/dev-portal/zudoku/configuration/authentication#authentication-providers)
90
+ each one.
75
91
 
76
92
  :::caution
77
- You must change the authentication provider before taking this to **production**. Using our demo provider is not secure for production use.
93
+
94
+ You must change the authentication provider before taking this to **production**. Using our demo
95
+ provider is not secure for production use.
96
+
78
97
  :::
79
98
 
80
99
  ```json
@@ -92,7 +111,9 @@ Let's walk you through everything we've set up so you know how to customize it:
92
111
  1. **API Keys**
93
112
 
94
113
  We've enabled API Keys on your developer portal. This connects to the API Key Service in Zuplo.
95
- To add API Keys for your users, create a consumer with the matching email address in **Services => API Key Service** in Zuplo, or [create a Consumer using the Zuplo API](https://zuplo.com/docs/api/api-keys-consumers#creates-a-consumer).
114
+ To add API Keys for your users, create a consumer with the matching email address in **Services
115
+ => API Key Service** in Zuplo, or
116
+ [create a Consumer using the Zuplo API](https://zuplo.com/docs/api/api-keys-consumers#creates-a-consumer).
96
117
 
97
118
  ```json
98
119
  {
@@ -107,7 +128,8 @@ Let's walk you through everything we've set up so you know how to customize it:
107
128
 
108
129
  ## Make It Yours
109
130
 
110
- You can customize the look and feel of your documentation site by modifying the `theme` section in `zudoku.config.tsx`. Why not try changing the primary color of your site?
131
+ You can customize the look and feel of your documentation site by modifying the `theme` section in
132
+ `zudoku.config.tsx`. Why not try changing the primary color of your site?
111
133
 
112
134
  ```json
113
135
  {
@@ -126,4 +148,6 @@ You can customize the look and feel of your documentation site by modifying the
126
148
  }
127
149
  ```
128
150
 
129
- We have extensive customization options available. From colors to fonts and borders, find the [full list of options](https://zuplo.com/docs/dev-portal/zudoku/customization/colors-theme) in our documentation.
151
+ We have extensive customization options available. From colors to fonts and borders, find the
152
+ [full list of options](https://zuplo.com/docs/dev-portal/zudoku/customization/colors-theme) in our
153
+ documentation.
@@ -2,7 +2,9 @@
2
2
 
3
3
  ## Overview
4
4
 
5
- This page demonstrates various markdown features and formatting options available in our documentation system. Whether you're writing technical documentation, guides, or tutorials, these examples will help you create beautiful and well-structured content.
5
+ This page demonstrates various markdown features and formatting options available in our
6
+ documentation system. Whether you're writing technical documentation, guides, or tutorials, these
7
+ examples will help you create beautiful and well-structured content.
6
8
 
7
9
  ### Key Features
8
10
 
@@ -15,7 +17,8 @@ This page demonstrates various markdown features and formatting options availabl
15
17
 
16
18
  ## Text Formatting
17
19
 
18
- You can make text **bold** or _italic_ to emphasize important points. For technical terms, use `inline code` formatting.
20
+ You can make text **bold** or _italic_ to emphasize important points. For technical terms, use
21
+ `inline code` formatting.
19
22
 
20
23
  ### Code Examples
21
24
 
@@ -96,7 +99,9 @@ for i in range(10):
96
99
 
97
100
  ## Conclusion
98
101
 
99
- This example demonstrates the power and flexibility of markdown for creating beautiful documentation. Feel free to use these patterns in your own documentation to maintain consistency and readability.
102
+ This example demonstrates the power and flexibility of markdown for creating beautiful
103
+ documentation. Feel free to use these patterns in your own documentation to maintain consistency and
104
+ readability.
100
105
 
101
106
  ---
102
107
 
@@ -15,6 +15,10 @@ const config: ZudokuConfig = {
15
15
  },
16
16
  },
17
17
  },
18
+ metadata: {
19
+ title: "Developer Portal",
20
+ description: "Developer Portal",
21
+ },
18
22
  navigation: [
19
23
  {
20
24
  type: "category",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-zudoku",
3
- "version": "0.0.0-e7477f4",
3
+ "version": "0.0.0-e792d466",
4
4
  "keywords": [
5
5
  "react",
6
6
  "zudoku"
@@ -28,11 +28,11 @@
28
28
  "@types/validate-npm-package-name": "4.0.2",
29
29
  "@vercel/ncc": "0.38.3",
30
30
  "async-retry": "1.3.1",
31
- "ci-info": "4.2.0",
31
+ "ci-info": "4.3.0",
32
32
  "commander": "14.0.0",
33
33
  "conf": "13.1.0",
34
34
  "cross-spawn": "7.0.6",
35
- "fast-glob": "3.3.1",
35
+ "fast-glob": "3.3.3",
36
36
  "picocolors": "1.1.1",
37
37
  "prompts": "2.4.2",
38
38
  "tar": "7.4.3",
@@ -44,6 +44,6 @@
44
44
  },
45
45
  "scripts": {
46
46
  "dev": "ncc build ./index.ts -w -o dist/",
47
- "build": "rm -rf ./dist && ncc build ./index.ts -o ./dist/ --minify --no-cache --no-source-map-register"
47
+ "build": "rm -rf ./dist && ncc build ./index.ts -o ./dist/ --minify --no-cache --no-source-map-register && cp -r templates ./dist/"
48
48
  }
49
49
  }