chore: initial approach for field extensions

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2024-09-23 14:28:52 +02:00
parent b304f78a31
commit bf6eaf35c8
78 changed files with 924 additions and 268 deletions
@@ -0,0 +1,5 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, {
rules: {
'@backstage/no-top-level-material-ui-4-imports': 'error',
},
});
+3
View File
@@ -0,0 +1,3 @@
# @internal/scaffolder
This is an internal package used by the other scaffolder packages. It does not get published to NPM, but instead inlined into consuming packages due to the `backstage.inline` flag in `package.json`.
@@ -0,0 +1,9 @@
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: internal-scaffolder
title: '@internal/scaffolder'
spec:
lifecycle: experimental
type: backstage-web-library
owner: maintainers
+32
View File
@@ -0,0 +1,32 @@
{
"name": "@internal/scaffolder",
"version": "0.0.1",
"backstage": {
"role": "web-library",
"inline": true
},
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/backstage/backstage",
"directory": "packages/scaffolder-internal"
},
"license": "Apache-2.0",
"sideEffects": false,
"main": "src/index.ts",
"types": "src/index.ts",
"files": [
"dist"
],
"scripts": {
"lint": "backstage-cli package lint",
"test": "backstage-cli package test"
},
"dependencies": {
"@backstage/plugin-scaffolder-react": "workspace:^",
"zod": "^3.22.4"
},
"devDependencies": {
"@backstage/cli": "workspace:^"
}
}
+17
View File
@@ -0,0 +1,17 @@
/*
* Copyright 2024 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 './wiring';
@@ -0,0 +1,33 @@
/*
* Copyright 2024 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.
*/
import { OpaqueType } from '@internal/opaque';
import { z } from 'zod';
import { FormFieldExtensionData } from '@backstage/plugin-scaffolder-react/alpha';
/** @alpha */
export interface FormField {
readonly $$type: '@backstage/scaffolder/FormField';
}
/** @alpha */
export const OpaqueFormField = OpaqueType.create<{
public: FormField;
versions: FormFieldExtensionData<z.ZodType, z.ZodType> & {
readonly version: 'v1';
};
}>({ type: '@backstage/scaffolder/FormField', versions: ['v1'] });
@@ -0,0 +1,16 @@
/*
* Copyright 2024 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 { OpaqueFormField, type FormField } from './InternalFormField';