mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 23:24:03 +00:00
Slightly improve performance when merging schemas definitions with new lines
This commit is contained in:
parent
da3cf961c5
commit
1fe3db7126
@ -43,6 +43,18 @@ const generateSchemasDefinitions = async (options = {}) => {
|
||||
definition: generateSchemaDefinition(schema),
|
||||
}));
|
||||
|
||||
const formattedSchemasDefinitions = schemasDefinitions.reduce((acc, def) => {
|
||||
acc.push(
|
||||
// Definition
|
||||
def.definition,
|
||||
|
||||
// Add a newline between each interface declaration
|
||||
factory.createIdentifier('\n')
|
||||
);
|
||||
|
||||
return acc;
|
||||
}, []);
|
||||
|
||||
const allDefinitions = [
|
||||
// Imports
|
||||
generateImportDefinition(),
|
||||
@ -51,15 +63,7 @@ const generateSchemasDefinitions = async (options = {}) => {
|
||||
factory.createIdentifier('\n'),
|
||||
|
||||
// Schemas
|
||||
...schemasDefinitions.reduce(
|
||||
(acc, def) => [
|
||||
...acc,
|
||||
def.definition,
|
||||
// Add a newline between each interface declaration
|
||||
factory.createIdentifier('\n'),
|
||||
],
|
||||
[]
|
||||
),
|
||||
...formattedSchemasDefinitions,
|
||||
|
||||
// Global
|
||||
generateGlobalDefinition(schemasDefinitions),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user