Merge pull request #15816 from backstage/rugvip/subpath

[PRFC] Add support for subpath exports
This commit is contained in:
Patrik Oldsberg
2023-02-21 16:32:15 +01:00
committed by GitHub
314 changed files with 3275 additions and 1523 deletions
+18
View File
@@ -0,0 +1,18 @@
/*
* Copyright 2022 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './next';
export type { FormProps } from './next';
-2
View File
@@ -20,5 +20,3 @@ export * from './secrets';
export * from './api';
export * from './hooks';
export * from './layouts';
export * from './next';
@@ -26,7 +26,7 @@ import { type IChangeEvent } from '@rjsf/core-v5';
import { ErrorSchema } from '@rjsf/utils';
import React, { useCallback, useMemo, useState, type ReactNode } from 'react';
import { NextFieldExtensionOptions } from '../../extensions';
import { TemplateParameterSchema } from '../../../types';
import { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';
import {
createAsyncValidators,
type FormValidation,
@@ -36,7 +36,7 @@ import { useTemplateSchema } from '../../hooks/useTemplateSchema';
import validator from '@rjsf/validator-ajv8';
import { useFormDataFromQuery } from '../../hooks';
import { FormProps } from '../../types';
import { LayoutOptions } from '../../../layouts';
import { LayoutOptions } from '@backstage/plugin-scaffolder-react';
import { useTransformSchemaToProps } from '../../hooks/useTransformSchemaToProps';
import { hasErrors } from './utils';
import * as FieldOverrides from './FieldOverrides';
@@ -16,7 +16,7 @@
import React from 'react';
import { Box, Paper } from '@material-ui/core';
import { LinkOutputs } from './LinkOutputs';
import { ScaffolderTaskOutput } from '../../../api';
import { ScaffolderTaskOutput } from '@backstage/plugin-scaffolder-react';
/**
* The DefaultOutputs renderer for the scaffolder task output
@@ -21,7 +21,8 @@ import {
} from './types';
import { Extension, attachComponentData } from '@backstage/core-plugin-api';
import { UIOptionsType } from '@rjsf/utils';
import { FieldExtensionComponent } from '../../extensions';
// eslint-disable-next-line import/no-extraneous-dependencies
import { FieldExtensionComponent } from '@backstage/plugin-scaffolder-react';
import { FIELD_EXTENSION_KEY } from '../../extensions/keys';
/**
@@ -22,7 +22,7 @@ import {
} from '@rjsf/utils';
import { PropsWithChildren } from 'react';
import { JsonObject } from '@backstage/types';
import { CustomFieldExtensionSchema } from '../../extensions';
import { CustomFieldExtensionSchema } from '@backstage/plugin-scaffolder-react';
/**
* Type for Field Extension Props for RJSF v5
@@ -1,5 +1,3 @@
import { useApi } from '@backstage/core-plugin-api';
/*
* Copyright 2023 The Backstage Authors
*
@@ -15,8 +13,11 @@ import { useApi } from '@backstage/core-plugin-api';
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import useAsync from 'react-use/lib/useAsync';
import { scaffolderApiRef } from '../../api/ref';
import { useApi } from '@backstage/core-plugin-api';
import { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';
/**
* @alpha
@@ -28,5 +29,5 @@ export const useTemplateParameterSchema = (templateRef: string) => {
[scaffolderApi, templateRef],
);
return { manifest: value, loading, error };
return { manifest: value as TemplateParameterSchema, loading, error };
};
@@ -18,7 +18,7 @@ import { renderHook } from '@testing-library/react-hooks';
import { TestApiProvider } from '@backstage/test-utils';
import React from 'react';
import { featureFlagsApiRef } from '@backstage/core-plugin-api';
import { TemplateParameterSchema } from '../../types';
import { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';
describe('useTemplateSchema', () => {
it('should generate the correct schema', () => {
@@ -16,7 +16,7 @@
import { featureFlagsApiRef, useApi } from '@backstage/core-plugin-api';
import { JsonObject } from '@backstage/types';
import { UiSchema } from '@rjsf/utils';
import { TemplateParameterSchema } from '../../types';
import { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';
import { extractSchemaFromStep } from '../lib';
/**
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { type ParsedTemplateSchema } from './useTemplateSchema';
import { type LayoutOptions } from '../../layouts';
import { type LayoutOptions } from '@backstage/plugin-scaffolder-react';
interface Options {
layouts?: LayoutOptions[];
+1 -1
View File
@@ -23,7 +23,7 @@ import type { FormProps as SchemaFormProps } from '@rjsf/core-v5';
/**
* Any `@rjsf/core` form properties that are publicly exposed to the `NextScaffolderpage`
*
* @public
* @alpha
*/
export type FormProps = Pick<
SchemaFormProps,