create-docusaurus-openapi-docs 0.0.0-1235
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 +21 -0
- package/bin/index.js +36 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +191 -0
- package/package.json +48 -0
- package/templates/default/blog/2019-05-28-first-blog-post.md +12 -0
- package/templates/default/blog/2019-05-29-long-blog-post.md +44 -0
- package/templates/default/blog/2021-08-01-mdx-blog-post.mdx +20 -0
- package/templates/default/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg +0 -0
- package/templates/default/blog/2021-08-26-welcome/index.md +25 -0
- package/templates/default/blog/authors.yml +17 -0
- package/templates/default/docs/intro.md +49 -0
- package/templates/default/docs/petstore/add-pet.ParamsDetails.json +19 -0
- package/templates/default/docs/petstore/add-pet.RequestSchema.json +288 -0
- package/templates/default/docs/petstore/add-pet.StatusCodes.json +1 -0
- package/templates/default/docs/petstore/add-pet.api.mdx +45 -0
- package/templates/default/docs/petstore/create-user.RequestSchema.json +345 -0
- package/templates/default/docs/petstore/create-user.StatusCodes.json +1 -0
- package/templates/default/docs/petstore/create-user.api.mdx +45 -0
- package/templates/default/docs/petstore/create-users-with-array-input.RequestSchema.json +348 -0
- package/templates/default/docs/petstore/create-users-with-array-input.StatusCodes.json +1 -0
- package/templates/default/docs/petstore/create-users-with-array-input.api.mdx +47 -0
- package/templates/default/docs/petstore/create-users-with-list-input.RequestSchema.json +348 -0
- package/templates/default/docs/petstore/create-users-with-list-input.StatusCodes.json +1 -0
- package/templates/default/docs/petstore/create-users-with-list-input.api.mdx +47 -0
- package/templates/default/docs/petstore/delete-order.ParamsDetails.json +11 -0
- package/templates/default/docs/petstore/delete-order.RequestSchema.json +1 -0
- package/templates/default/docs/petstore/delete-order.StatusCodes.json +6 -0
- package/templates/default/docs/petstore/delete-order.api.mdx +49 -0
- package/templates/default/docs/petstore/delete-pet.ParamsDetails.json +18 -0
- package/templates/default/docs/petstore/delete-pet.RequestSchema.json +1 -0
- package/templates/default/docs/petstore/delete-pet.StatusCodes.json +1 -0
- package/templates/default/docs/petstore/delete-pet.api.mdx +43 -0
- package/templates/default/docs/petstore/delete-user.ParamsDetails.json +11 -0
- package/templates/default/docs/petstore/delete-user.RequestSchema.json +1 -0
- package/templates/default/docs/petstore/delete-user.StatusCodes.json +6 -0
- package/templates/default/docs/petstore/delete-user.api.mdx +45 -0
- package/templates/default/docs/petstore/find-pets-by-status.ParamsDetails.json +21 -0
- package/templates/default/docs/petstore/find-pets-by-status.RequestSchema.json +1 -0
- package/templates/default/docs/petstore/find-pets-by-status.StatusCodes.json +522 -0
- package/templates/default/docs/petstore/find-pets-by-status.api.mdx +51 -0
- package/templates/default/docs/petstore/find-pets-by-tags.ParamsDetails.json +12 -0
- package/templates/default/docs/petstore/find-pets-by-tags.RequestSchema.json +1 -0
- package/templates/default/docs/petstore/find-pets-by-tags.StatusCodes.json +522 -0
- package/templates/default/docs/petstore/find-pets-by-tags.api.mdx +55 -0
- package/templates/default/docs/petstore/get-inventory.RequestSchema.json +1 -0
- package/templates/default/docs/petstore/get-inventory.StatusCodes.json +15 -0
- package/templates/default/docs/petstore/get-inventory.api.mdx +43 -0
- package/templates/default/docs/petstore/get-order-by-id.ParamsDetails.json +16 -0
- package/templates/default/docs/petstore/get-order-by-id.RequestSchema.json +1 -0
- package/templates/default/docs/petstore/get-order-by-id.StatusCodes.json +127 -0
- package/templates/default/docs/petstore/get-order-by-id.api.mdx +49 -0
- package/templates/default/docs/petstore/get-pet-by-id.ParamsDetails.json +12 -0
- package/templates/default/docs/petstore/get-pet-by-id.RequestSchema.json +1 -0
- package/templates/default/docs/petstore/get-pet-by-id.StatusCodes.json +517 -0
- package/templates/default/docs/petstore/get-pet-by-id.api.mdx +49 -0
- package/templates/default/docs/petstore/get-user-by-name.ParamsDetails.json +11 -0
- package/templates/default/docs/petstore/get-user-by-name.RequestSchema.json +1 -0
- package/templates/default/docs/petstore/get-user-by-name.StatusCodes.json +683 -0
- package/templates/default/docs/petstore/get-user-by-name.api.mdx +47 -0
- package/templates/default/docs/petstore/login-user.ParamsDetails.json +18 -0
- package/templates/default/docs/petstore/login-user.RequestSchema.json +1 -0
- package/templates/default/docs/petstore/login-user.StatusCodes.json +29 -0
- package/templates/default/docs/petstore/login-user.api.mdx +43 -0
- package/templates/default/docs/petstore/logout-user.RequestSchema.json +1 -0
- package/templates/default/docs/petstore/logout-user.StatusCodes.json +1 -0
- package/templates/default/docs/petstore/logout-user.api.mdx +39 -0
- package/templates/default/docs/petstore/new-pet.RequestSchema.json +260 -0
- package/templates/default/docs/petstore/new-pet.StatusCodes.json +7 -0
- package/templates/default/docs/petstore/new-pet.api.mdx +45 -0
- package/templates/default/docs/petstore/pet.tag.mdx +15 -0
- package/templates/default/docs/petstore/place-order.RequestSchema.json +96 -0
- package/templates/default/docs/petstore/place-order.StatusCodes.json +133 -0
- package/templates/default/docs/petstore/place-order.api.mdx +43 -0
- package/templates/default/docs/petstore/schemas/cat.Schema.json +224 -0
- package/templates/default/docs/petstore/schemas/cat.schema.mdx +30 -0
- package/templates/default/docs/petstore/sidebar.ts +180 -0
- package/templates/default/docs/petstore/store.tag.mdx +15 -0
- package/templates/default/docs/petstore/subscribe-to-the-store-events.RequestSchema.2.json +28 -0
- package/templates/default/docs/petstore/subscribe-to-the-store-events.RequestSchema.3.json +28 -0
- package/templates/default/docs/petstore/subscribe-to-the-store-events.RequestSchema.4.json +25 -0
- package/templates/default/docs/petstore/subscribe-to-the-store-events.RequestSchema.5.json +20 -0
- package/templates/default/docs/petstore/subscribe-to-the-store-events.RequestSchema.json +27 -0
- package/templates/default/docs/petstore/subscribe-to-the-store-events.StatusCodes.2.json +21 -0
- package/templates/default/docs/petstore/subscribe-to-the-store-events.StatusCodes.3.json +17 -0
- package/templates/default/docs/petstore/subscribe-to-the-store-events.StatusCodes.4.json +9 -0
- package/templates/default/docs/petstore/subscribe-to-the-store-events.StatusCodes.5.json +9 -0
- package/templates/default/docs/petstore/subscribe-to-the-store-events.StatusCodes.json +20 -0
- package/templates/default/docs/petstore/subscribe-to-the-store-events.api.mdx +120 -0
- package/templates/default/docs/petstore/swagger-petstore-yaml.info.mdx +249 -0
- package/templates/default/docs/petstore/update-pet-with-form.ParamsDetails.json +11 -0
- package/templates/default/docs/petstore/update-pet-with-form.RequestSchema.json +22 -0
- package/templates/default/docs/petstore/update-pet-with-form.StatusCodes.json +1 -0
- package/templates/default/docs/petstore/update-pet-with-form.api.mdx +49 -0
- package/templates/default/docs/petstore/update-pet.ParamsDetails.json +19 -0
- package/templates/default/docs/petstore/update-pet.RequestSchema.json +288 -0
- package/templates/default/docs/petstore/update-pet.StatusCodes.json +7 -0
- package/templates/default/docs/petstore/update-pet.api.mdx +43 -0
- package/templates/default/docs/petstore/update-user.ParamsDetails.json +11 -0
- package/templates/default/docs/petstore/update-user.RequestSchema.json +345 -0
- package/templates/default/docs/petstore/update-user.StatusCodes.json +6 -0
- package/templates/default/docs/petstore/update-user.api.mdx +45 -0
- package/templates/default/docs/petstore/upload-file.ParamsDetails.json +11 -0
- package/templates/default/docs/petstore/upload-file.RequestSchema.json +10 -0
- package/templates/default/docs/petstore/upload-file.StatusCodes.json +20 -0
- package/templates/default/docs/petstore/upload-file.api.mdx +43 -0
- package/templates/default/docs/petstore/user.tag.mdx +15 -0
- package/templates/default/docs/tutorial-basics/_category_.json +8 -0
- package/templates/default/docs/tutorial-basics/congratulations.md +23 -0
- package/templates/default/docs/tutorial-basics/create-a-blog-post.md +36 -0
- package/templates/default/docs/tutorial-basics/create-a-document.md +55 -0
- package/templates/default/docs/tutorial-basics/create-a-page.md +45 -0
- package/templates/default/docs/tutorial-basics/deploy-your-site.md +31 -0
- package/templates/default/docs/tutorial-basics/markdown-features.mdx +145 -0
- package/templates/default/docs/tutorial-extras/_category_.json +7 -0
- package/templates/default/docs/tutorial-extras/manage-docs-versions.md +57 -0
- package/templates/default/docs/tutorial-extras/translate-your-site.md +90 -0
- package/templates/default/docusaurus.config.ts +273 -0
- package/templates/default/examples/petstore.yaml +1271 -0
- package/templates/default/gitignore +21 -0
- package/templates/default/package.json +44 -0
- package/templates/default/sidebars.ts +37 -0
- package/templates/default/src/components/HomepageFeatures/index.js +64 -0
- package/templates/default/src/components/HomepageFeatures/styles.module.css +11 -0
- package/templates/default/src/css/custom.css +77 -0
- package/templates/default/src/pages/index.js +42 -0
- package/templates/default/src/pages/index.module.css +23 -0
- package/templates/default/src/pages/markdown-page.md +7 -0
- package/templates/default/static/.nojekyll +0 -0
- package/templates/default/static/img/docusaurus.png +0 -0
- package/templates/default/static/img/favicon.ico +0 -0
- package/templates/default/static/img/logo.svg +1 -0
- package/templates/default/static/img/tutorial/docsVersionDropdown.png +0 -0
- package/templates/default/static/img/tutorial/localeDropdown.png +0 -0
- package/templates/default/static/img/undraw_docusaurus_mountain.svg +171 -0
- package/templates/default/static/img/undraw_docusaurus_react.svg +170 -0
- package/templates/default/static/img/undraw_docusaurus_tree.svg +40 -0
- package/templates/default/tsconfig.json +10 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Palo Alto Networks
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/bin/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/* ============================================================================
|
|
4
|
+
* Copyright (c) Palo Alto Networks
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
* ========================================================================== */
|
|
9
|
+
|
|
10
|
+
"use strict";
|
|
11
|
+
|
|
12
|
+
const pkg = require("../package.json");
|
|
13
|
+
|
|
14
|
+
const { program } = require("commander");
|
|
15
|
+
|
|
16
|
+
program
|
|
17
|
+
.name("create-docusaurus-openapi-docs")
|
|
18
|
+
.version(pkg.version)
|
|
19
|
+
.arguments("[siteName]")
|
|
20
|
+
.option(
|
|
21
|
+
"-p, --package-manager <manager>",
|
|
22
|
+
"package manager to use (yarn, npm, pnpm, bun)"
|
|
23
|
+
)
|
|
24
|
+
.option("-s, --skip-install", "skip dependency installation")
|
|
25
|
+
.description("Create a new Docusaurus site with OpenAPI docs.")
|
|
26
|
+
.action(async (siteName, options) => {
|
|
27
|
+
try {
|
|
28
|
+
const { init } = require("../lib/index.js");
|
|
29
|
+
await init(process.cwd(), siteName, options);
|
|
30
|
+
} catch (err) {
|
|
31
|
+
console.error(err.message || err);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
program.parse(process.argv);
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* Copyright (c) Palo Alto Networks
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
* ========================================================================== */
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.init = init;
|
|
13
|
+
const fs_1 = __importDefault(require("fs"));
|
|
14
|
+
const path_1 = __importDefault(require("path"));
|
|
15
|
+
const cross_spawn_1 = __importDefault(require("cross-spawn"));
|
|
16
|
+
const prompts_1 = __importDefault(require("prompts"));
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
18
|
+
const pkg = require("../package.json");
|
|
19
|
+
const TEMPLATE_DIR = path_1.default.join(__dirname, "..", "templates", "default");
|
|
20
|
+
const PACKAGE_MANAGERS = ["npm", "yarn", "pnpm", "bun"];
|
|
21
|
+
const LOCKFILE_NAMES = {
|
|
22
|
+
npm: "package-lock.json",
|
|
23
|
+
yarn: "yarn.lock",
|
|
24
|
+
pnpm: "pnpm-lock.yaml",
|
|
25
|
+
bun: "bun.lockb",
|
|
26
|
+
};
|
|
27
|
+
function siteNameToPackageName(siteName) {
|
|
28
|
+
const match = siteName.match(/[A-Z]{2,}(?=[A-Z][a-z]+\d*|\b|_)|[A-Z]?[a-z]+\d*|[A-Z]|\d+/g);
|
|
29
|
+
return match ? match.map((x) => x.toLowerCase()).join("-") : siteName;
|
|
30
|
+
}
|
|
31
|
+
function findPackageManagerFromLockFile(dir) {
|
|
32
|
+
for (const pm of PACKAGE_MANAGERS) {
|
|
33
|
+
if (fs_1.default.existsSync(path_1.default.join(dir, LOCKFILE_NAMES[pm]))) {
|
|
34
|
+
return pm;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
function findPackageManagerFromUserAgent() {
|
|
40
|
+
return PACKAGE_MANAGERS.find((pm) => { var _a; return (_a = process.env.npm_config_user_agent) === null || _a === void 0 ? void 0 : _a.startsWith(pm); });
|
|
41
|
+
}
|
|
42
|
+
function runCommand(command, args) {
|
|
43
|
+
var _a;
|
|
44
|
+
const result = cross_spawn_1.default.sync(command, args, { stdio: "inherit" });
|
|
45
|
+
return (_a = result.status) !== null && _a !== void 0 ? _a : 1;
|
|
46
|
+
}
|
|
47
|
+
async function getPackageManager(dest, cliOption) {
|
|
48
|
+
if (cliOption) {
|
|
49
|
+
if (!PACKAGE_MANAGERS.includes(cliOption)) {
|
|
50
|
+
throw new Error(`Invalid package manager "${cliOption}". Must be one of: ${PACKAGE_MANAGERS.join(", ")}`);
|
|
51
|
+
}
|
|
52
|
+
return cliOption;
|
|
53
|
+
}
|
|
54
|
+
// Check for lockfile in destination
|
|
55
|
+
const fromDest = findPackageManagerFromLockFile(dest);
|
|
56
|
+
if (fromDest)
|
|
57
|
+
return fromDest;
|
|
58
|
+
// Check for lockfile in current directory
|
|
59
|
+
const fromCwd = findPackageManagerFromLockFile(process.cwd());
|
|
60
|
+
if (fromCwd)
|
|
61
|
+
return fromCwd;
|
|
62
|
+
// Check user agent
|
|
63
|
+
const fromAgent = findPackageManagerFromUserAgent();
|
|
64
|
+
if (fromAgent)
|
|
65
|
+
return fromAgent;
|
|
66
|
+
// Prompt user
|
|
67
|
+
const { packageManager } = await (0, prompts_1.default)({
|
|
68
|
+
type: "select",
|
|
69
|
+
name: "packageManager",
|
|
70
|
+
message: "Select a package manager:",
|
|
71
|
+
choices: PACKAGE_MANAGERS.map((pm) => ({ title: pm, value: pm })),
|
|
72
|
+
});
|
|
73
|
+
return packageManager !== null && packageManager !== void 0 ? packageManager : "npm";
|
|
74
|
+
}
|
|
75
|
+
async function getSiteName(reqName, rootDir) {
|
|
76
|
+
if (reqName) {
|
|
77
|
+
const dest = path_1.default.resolve(rootDir, reqName);
|
|
78
|
+
if (reqName !== "." && fs_1.default.existsSync(dest)) {
|
|
79
|
+
throw new Error(`Directory already exists at ${dest}`);
|
|
80
|
+
}
|
|
81
|
+
if (reqName === "." && fs_1.default.readdirSync(dest).length > 0) {
|
|
82
|
+
throw new Error(`Directory not empty at ${dest}`);
|
|
83
|
+
}
|
|
84
|
+
return reqName;
|
|
85
|
+
}
|
|
86
|
+
const { siteName } = await (0, prompts_1.default)({
|
|
87
|
+
type: "text",
|
|
88
|
+
name: "siteName",
|
|
89
|
+
message: "What should we name this site?",
|
|
90
|
+
initial: "my-website",
|
|
91
|
+
validate: (name) => {
|
|
92
|
+
if (!name)
|
|
93
|
+
return "A website name is required.";
|
|
94
|
+
const dest = path_1.default.resolve(rootDir, name);
|
|
95
|
+
if (name !== "." && fs_1.default.existsSync(dest)) {
|
|
96
|
+
return `Directory already exists at ${dest}`;
|
|
97
|
+
}
|
|
98
|
+
return true;
|
|
99
|
+
},
|
|
100
|
+
}, {
|
|
101
|
+
onCancel() {
|
|
102
|
+
console.error("A website name is required.");
|
|
103
|
+
process.exit(1);
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
return siteName;
|
|
107
|
+
}
|
|
108
|
+
async function init(rootDir, reqName, options) {
|
|
109
|
+
const siteName = await getSiteName(reqName, rootDir);
|
|
110
|
+
const dest = path_1.default.resolve(rootDir, siteName);
|
|
111
|
+
console.log();
|
|
112
|
+
console.log("Creating new Docusaurus site with OpenAPI docs...");
|
|
113
|
+
console.log();
|
|
114
|
+
// Copy template files
|
|
115
|
+
fs_1.default.cpSync(TEMPLATE_DIR, dest, { recursive: true });
|
|
116
|
+
// Rename gitignore to .gitignore (npm strips dotfiles from published packages)
|
|
117
|
+
const gitignoreSrc = path_1.default.join(dest, "gitignore");
|
|
118
|
+
const gitignoreDest = path_1.default.join(dest, ".gitignore");
|
|
119
|
+
if (!fs_1.default.existsSync(gitignoreDest) && fs_1.default.existsSync(gitignoreSrc)) {
|
|
120
|
+
fs_1.default.renameSync(gitignoreSrc, gitignoreDest);
|
|
121
|
+
}
|
|
122
|
+
if (fs_1.default.existsSync(gitignoreSrc)) {
|
|
123
|
+
fs_1.default.rmSync(gitignoreSrc);
|
|
124
|
+
}
|
|
125
|
+
// Update package.json with site name and correct plugin/theme versions
|
|
126
|
+
const pkgJsonPath = path_1.default.join(dest, "package.json");
|
|
127
|
+
const sitePkg = JSON.parse(fs_1.default.readFileSync(pkgJsonPath, "utf-8"));
|
|
128
|
+
sitePkg.name = siteNameToPackageName(siteName);
|
|
129
|
+
sitePkg.version = "0.0.0";
|
|
130
|
+
sitePkg.private = true;
|
|
131
|
+
// Inject the correct plugin/theme version (matches this CLI's version via lerna)
|
|
132
|
+
const openapiVersion = pkg.version;
|
|
133
|
+
if (sitePkg.dependencies["docusaurus-plugin-openapi-docs"]) {
|
|
134
|
+
sitePkg.dependencies["docusaurus-plugin-openapi-docs"] = openapiVersion;
|
|
135
|
+
}
|
|
136
|
+
if (sitePkg.dependencies["docusaurus-theme-openapi-docs"]) {
|
|
137
|
+
sitePkg.dependencies["docusaurus-theme-openapi-docs"] = openapiVersion;
|
|
138
|
+
}
|
|
139
|
+
fs_1.default.writeFileSync(pkgJsonPath, JSON.stringify(sitePkg, null, 2) + "\n");
|
|
140
|
+
const pkgManager = await getPackageManager(dest, options.packageManager);
|
|
141
|
+
const cdPath = path_1.default.relative(process.cwd(), dest);
|
|
142
|
+
if (!options.skipInstall) {
|
|
143
|
+
console.log(`Installing dependencies with ${pkgManager}...`);
|
|
144
|
+
console.log();
|
|
145
|
+
const prevDir = process.cwd();
|
|
146
|
+
process.chdir(dest);
|
|
147
|
+
const installCmd = pkgManager === "yarn"
|
|
148
|
+
? "yarn"
|
|
149
|
+
: pkgManager === "bun"
|
|
150
|
+
? "bun"
|
|
151
|
+
: pkgManager;
|
|
152
|
+
const installArgs = pkgManager === "yarn" ? [] : ["install"];
|
|
153
|
+
const exitCode = runCommand(installCmd, installArgs);
|
|
154
|
+
process.chdir(prevDir);
|
|
155
|
+
if (exitCode !== 0) {
|
|
156
|
+
console.error("Dependency installation failed.");
|
|
157
|
+
console.log(`You can retry by typing:`);
|
|
158
|
+
console.log();
|
|
159
|
+
console.log(` cd ${cdPath}`);
|
|
160
|
+
console.log(` ${pkgManager} install`);
|
|
161
|
+
console.log();
|
|
162
|
+
process.exit(1);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
const runPrefix = pkgManager === "npm" || pkgManager === "bun" ? "run " : "";
|
|
166
|
+
console.log();
|
|
167
|
+
console.log(`Success! Created ${cdPath}`);
|
|
168
|
+
console.log();
|
|
169
|
+
console.log("Inside that directory, you can run several commands:");
|
|
170
|
+
console.log();
|
|
171
|
+
console.log(` ${pkgManager} start`);
|
|
172
|
+
console.log(" Starts the development server.");
|
|
173
|
+
console.log();
|
|
174
|
+
console.log(` ${pkgManager} ${runPrefix}build`);
|
|
175
|
+
console.log(" Bundles your website into static files for production.");
|
|
176
|
+
console.log();
|
|
177
|
+
console.log(` ${pkgManager} ${runPrefix}serve`);
|
|
178
|
+
console.log(" Serves the built website locally.");
|
|
179
|
+
console.log();
|
|
180
|
+
console.log(` ${pkgManager} ${runPrefix}gen-api-docs`);
|
|
181
|
+
console.log(" Generates API docs from your OpenAPI spec.");
|
|
182
|
+
console.log();
|
|
183
|
+
console.log(` ${pkgManager} ${runPrefix}clean-api-docs`);
|
|
184
|
+
console.log(" Removes generated API docs.");
|
|
185
|
+
console.log();
|
|
186
|
+
console.log("We recommend that you begin by typing:");
|
|
187
|
+
console.log();
|
|
188
|
+
console.log(` cd ${cdPath}`);
|
|
189
|
+
console.log(` ${pkgManager} start`);
|
|
190
|
+
console.log();
|
|
191
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-docusaurus-openapi-docs",
|
|
3
|
+
"description": "Create Docusaurus sites with OpenAPI docs.",
|
|
4
|
+
"version": "0.0.0-1235",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"openapi",
|
|
8
|
+
"docusaurus",
|
|
9
|
+
"create",
|
|
10
|
+
"scaffolding",
|
|
11
|
+
"cli"
|
|
12
|
+
],
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/PaloAltoNetworks/docusaurus-openapi-docs.git",
|
|
19
|
+
"directory": "packages/create-docusaurus-openapi-docs"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/issues"
|
|
23
|
+
},
|
|
24
|
+
"bin": "bin/index.js",
|
|
25
|
+
"main": "lib/index.js",
|
|
26
|
+
"files": [
|
|
27
|
+
"bin/",
|
|
28
|
+
"lib/",
|
|
29
|
+
"templates/"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc",
|
|
33
|
+
"watch": "tsc --watch"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"commander": "^14.0.3",
|
|
37
|
+
"cross-spawn": "^7.0.0",
|
|
38
|
+
"prompts": "^2.4.2"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/cross-spawn": "^6.0.6",
|
|
42
|
+
"@types/prompts": "^2.4.9"
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=18"
|
|
46
|
+
},
|
|
47
|
+
"gitHead": "427c573853691a38219a41cbbbadf300043ce92e"
|
|
48
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
slug: first-blog-post
|
|
3
|
+
title: First Blog Post
|
|
4
|
+
authors:
|
|
5
|
+
name: Gao Wei
|
|
6
|
+
title: Docusaurus Core Team
|
|
7
|
+
url: https://github.com/wgao19
|
|
8
|
+
image_url: https://github.com/wgao19.png
|
|
9
|
+
tags: [hola, docusaurus]
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
slug: long-blog-post
|
|
3
|
+
title: Long Blog Post
|
|
4
|
+
authors: endi
|
|
5
|
+
tags: [hello, docusaurus]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
This is the summary of a very long blog post,
|
|
9
|
+
|
|
10
|
+
Use a `<!--` `truncate` `-->` comment to limit blog post size in the list view.
|
|
11
|
+
|
|
12
|
+
<!--truncate-->
|
|
13
|
+
|
|
14
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
|
15
|
+
|
|
16
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
|
17
|
+
|
|
18
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
|
19
|
+
|
|
20
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
|
21
|
+
|
|
22
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
|
23
|
+
|
|
24
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
|
25
|
+
|
|
26
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
|
27
|
+
|
|
28
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
|
29
|
+
|
|
30
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
|
31
|
+
|
|
32
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
|
33
|
+
|
|
34
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
|
35
|
+
|
|
36
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
|
37
|
+
|
|
38
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
|
39
|
+
|
|
40
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
|
41
|
+
|
|
42
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
|
43
|
+
|
|
44
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
slug: mdx-blog-post
|
|
3
|
+
title: MDX Blog Post
|
|
4
|
+
authors: [slorber]
|
|
5
|
+
tags: [docusaurus]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Blog posts support [Docusaurus Markdown features](https://docusaurus.io/docs/markdown-features), such as [MDX](https://mdxjs.com/).
|
|
9
|
+
|
|
10
|
+
:::tip
|
|
11
|
+
|
|
12
|
+
Use the power of React to create interactive blog posts.
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
<button onClick={() => alert("button clicked!")}>Click me!</button>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
<button onClick={() => alert("button clicked!")}>Click me!</button>
|
|
19
|
+
|
|
20
|
+
:::
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
slug: welcome
|
|
3
|
+
title: Welcome
|
|
4
|
+
authors: [slorber, yangshun]
|
|
5
|
+
tags: [facebook, hello, docusaurus]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
[Docusaurus blogging features](https://docusaurus.io/docs/blog) are powered by the [blog plugin](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-blog).
|
|
9
|
+
|
|
10
|
+
Simply add Markdown files (or folders) to the `blog` directory.
|
|
11
|
+
|
|
12
|
+
Regular blog authors can be added to `authors.yml`.
|
|
13
|
+
|
|
14
|
+
The blog post date can be extracted from filenames, such as:
|
|
15
|
+
|
|
16
|
+
- `2019-05-30-welcome.md`
|
|
17
|
+
- `2019-05-30-welcome/index.md`
|
|
18
|
+
|
|
19
|
+
A blog post folder can be convenient to co-locate blog post images:
|
|
20
|
+
|
|
21
|
+

|
|
22
|
+
|
|
23
|
+
The blog supports tags as well!
|
|
24
|
+
|
|
25
|
+
**And if you don't want a blog**: just delete this directory, and use `blog: false` in your Docusaurus config.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
endi:
|
|
2
|
+
name: Endilie Yacop Sucipto
|
|
3
|
+
title: Maintainer of Docusaurus
|
|
4
|
+
url: https://github.com/endiliey
|
|
5
|
+
image_url: https://github.com/endiliey.png
|
|
6
|
+
|
|
7
|
+
yangshun:
|
|
8
|
+
name: Yangshun Tay
|
|
9
|
+
title: Front End Engineer @ Facebook
|
|
10
|
+
url: https://github.com/yangshun
|
|
11
|
+
image_url: https://github.com/yangshun.png
|
|
12
|
+
|
|
13
|
+
slorber:
|
|
14
|
+
name: Sébastien Lorber
|
|
15
|
+
title: Docusaurus maintainer
|
|
16
|
+
url: https://sebastienlorber.com
|
|
17
|
+
image_url: https://github.com/slorber.png
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 1
|
|
3
|
+
tags:
|
|
4
|
+
- test
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Tutorial Intro
|
|
8
|
+
|
|
9
|
+
Let's discover **Docusaurus in less than 5 minutes**.
|
|
10
|
+
|
|
11
|
+
## Getting Started
|
|
12
|
+
|
|
13
|
+
Get started by **creating a new site**.
|
|
14
|
+
|
|
15
|
+
Or **try Docusaurus immediately** with **[docusaurus.new](https://docusaurus.new)**.
|
|
16
|
+
|
|
17
|
+
### What you'll need
|
|
18
|
+
|
|
19
|
+
- [Node.js](https://nodejs.org/en/download/) version 14 or above:
|
|
20
|
+
- When installing Node.js, you are recommended to check all checkboxes related to dependencies.
|
|
21
|
+
|
|
22
|
+
## Generate a new site
|
|
23
|
+
|
|
24
|
+
Generate a new Docusaurus site using the **classic template**.
|
|
25
|
+
|
|
26
|
+
The classic template will automatically be added to your project after you run the command:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm init docusaurus@latest my-website classic
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
You can type this command into Command Prompt, Powershell, Terminal, or any other integrated terminal of your code editor.
|
|
33
|
+
|
|
34
|
+
The command also installs all necessary dependencies you need to run Docusaurus.
|
|
35
|
+
|
|
36
|
+
## Start your site
|
|
37
|
+
|
|
38
|
+
Run the development server:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
cd my-website
|
|
42
|
+
npm run start
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The `cd` command changes the directory you're working with. In order to work with your newly created Docusaurus site, you'll need to navigate the terminal there.
|
|
46
|
+
|
|
47
|
+
The `npm run start` command builds your website locally and serves it through a development server, ready for you to view at http://localhost:3000/.
|
|
48
|
+
|
|
49
|
+
Open `docs/intro.md` (this page) and edit some lines: the site **reloads automatically** and displays your changes.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"parameters": [
|
|
3
|
+
{
|
|
4
|
+
"name": "Accept-Language",
|
|
5
|
+
"in": "header",
|
|
6
|
+
"description": "The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US",
|
|
7
|
+
"example": "en-US",
|
|
8
|
+
"required": false,
|
|
9
|
+
"schema": { "type": "string", "default": "en-AU" }
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "cookieParam",
|
|
13
|
+
"in": "cookie",
|
|
14
|
+
"description": "Some cookie",
|
|
15
|
+
"required": true,
|
|
16
|
+
"schema": { "type": "integer", "format": "int64" }
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|