Skip to content

Commit

Permalink
feat(nx-dev): display internal & deprecated options last (#14519)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcabanes committed Jan 20, 2023
1 parent c2be735 commit a1272e1
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions nx-dev/feature-package-schema-viewer/src/lib/schema-viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ function extractPropertiesByImportance(properties: PropertyModel[]): {
rest: [],
};
for (const property of properties) {
if (property.isRequired) {
result.required.push(property);
continue;
}
if (isPropertyDeprecated(property.initialSchema)) {
result.deprecated.push(property);
continue;
Expand Down Expand Up @@ -156,14 +160,6 @@ export function SchemaViewer({
});
}

const renderedProps = renderProps([
...categorizedProperties.required,
...categorizedProperties.important,
...categorizedProperties.rest,
...categorizedProperties.internal,
...categorizedProperties.deprecated,
]);

const additionalProperties = new Array<JSX.Element>();
if (typeof schema.additionalProperties === 'boolean') {
if (schema.additionalProperties) {
Expand Down Expand Up @@ -231,7 +227,7 @@ export function SchemaViewer({
);

const hasProperties =
renderedProps.length > 0 ||
Object.keys(properties).length > 0 ||
renderedPatternProperties.length > 0 ||
additionalProperties.length > 0;

Expand Down Expand Up @@ -267,14 +263,21 @@ export function SchemaViewer({
}

let allRenderedProperties = <></>;
const renderedProps = [
renderProps([
...categorizedProperties.required,
...categorizedProperties.important,
...categorizedProperties.rest,
]),
...renderedPatternProperties,
...additionalProperties,
renderProps([
...categorizedProperties.internal,
...categorizedProperties.deprecated,
]),
];
if (hasProperties) {
allRenderedProperties = (
<>
{renderedProps}
{renderedPatternProperties}
{additionalProperties}
</>
);
allRenderedProperties = <>{renderedProps}</>;
}

return (
Expand Down

1 comment on commit a1272e1

@vercel
Copy link

@vercel vercel bot commented on a1272e1 Jan 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx.dev
nx-dev-nrwl.vercel.app
nx-five.vercel.app
nx-dev-git-master-nrwl.vercel.app

Please sign in to comment.