mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
chore: Fix OpenAPI docs script (#17128)
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { writeFileSync } from 'fs';
|
import { writeFileSync, existsSync, mkdirSync } from 'fs';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import shell from 'shelljs';
|
import shell from 'shelljs';
|
||||||
import { rawTimeZones } from '@vvo/tzdb';
|
import { rawTimeZones } from '@vvo/tzdb';
|
||||||
@@ -18,6 +18,7 @@ generateUserManagementEmailTemplates();
|
|||||||
generateTimezoneData();
|
generateTimezoneData();
|
||||||
|
|
||||||
if (publicApiEnabled) {
|
if (publicApiEnabled) {
|
||||||
|
createPublicApiDirectory();
|
||||||
copySwaggerTheme();
|
copySwaggerTheme();
|
||||||
bundleOpenApiSpecs();
|
bundleOpenApiSpecs();
|
||||||
}
|
}
|
||||||
@@ -40,6 +41,14 @@ function generateUserManagementEmailTemplates() {
|
|||||||
shell.cp(path.resolve(sourceDir, 'n8n-logo.png'), destinationDir);
|
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() {
|
function copySwaggerTheme() {
|
||||||
const swaggerTheme = {
|
const swaggerTheme = {
|
||||||
source: path.resolve(ROOT_DIR, 'src', 'public-api', SPEC_THEME_FILENAME),
|
source: path.resolve(ROOT_DIR, 'src', 'public-api', SPEC_THEME_FILENAME),
|
||||||
@@ -60,7 +69,8 @@ function bundleOpenApiSpecs() {
|
|||||||
.forEach((specPath) => {
|
.forEach((specPath) => {
|
||||||
const distSpecPath = path.resolve(ROOT_DIR, 'dist', specPath);
|
const distSpecPath = path.resolve(ROOT_DIR, 'dist', specPath);
|
||||||
const command = `pnpm openapi bundle src/${specPath} --output ${distSpecPath}`;
|
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