mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 09:36:44 +00:00
chore: Fix OpenAPI docs script (#17128)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import path from 'path';
|
||||
import { writeFileSync } from 'fs';
|
||||
import { writeFileSync, existsSync, mkdirSync } from 'fs';
|
||||
import { fileURLToPath } from 'url';
|
||||
import shell from 'shelljs';
|
||||
import { rawTimeZones } from '@vvo/tzdb';
|
||||
@@ -18,6 +18,7 @@ generateUserManagementEmailTemplates();
|
||||
generateTimezoneData();
|
||||
|
||||
if (publicApiEnabled) {
|
||||
createPublicApiDirectory();
|
||||
copySwaggerTheme();
|
||||
bundleOpenApiSpecs();
|
||||
}
|
||||
@@ -40,6 +41,14 @@ function generateUserManagementEmailTemplates() {
|
||||
shell.cp(path.resolve(sourceDir, 'n8n-logo.png'), destinationDir);
|
||||
}
|
||||
|
||||
function createPublicApiDirectory() {
|
||||
const publicApiDirectory = path.resolve(ROOT_DIR, 'dist', 'public-api', 'v1');
|
||||
if (!existsSync(publicApiDirectory)) {
|
||||
console.log('Creating directory', publicApiDirectory);
|
||||
mkdirSync(publicApiDirectory, { recursive: true });
|
||||
}
|
||||
}
|
||||
|
||||
function copySwaggerTheme() {
|
||||
const swaggerTheme = {
|
||||
source: path.resolve(ROOT_DIR, 'src', 'public-api', SPEC_THEME_FILENAME),
|
||||
@@ -60,7 +69,8 @@ function bundleOpenApiSpecs() {
|
||||
.forEach((specPath) => {
|
||||
const distSpecPath = path.resolve(ROOT_DIR, 'dist', specPath);
|
||||
const command = `pnpm openapi bundle src/${specPath} --output ${distSpecPath}`;
|
||||
shell.exec(command, { silent: false });
|
||||
|
||||
shell.exec(command, { silent: true });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user