@backstage/cli-module-new 0.1.3-next.1 → 0.1.4-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/lib/defaultTemplates.cjs.js +2 -1
- package/dist/lib/defaultTemplates.cjs.js.map +1 -1
- package/dist/packages/backend-defaults/package.json.cjs.js +1 -1
- package/dist/packages/backend-plugin-api/package.json.cjs.js +1 -1
- package/dist/packages/backend-test-utils/package.json.cjs.js +1 -1
- package/dist/packages/catalog-client/package.json.cjs.js +1 -1
- package/dist/packages/cli/package.json.cjs.js +1 -1
- package/dist/packages/cli-module-new/package.json.cjs.js +1 -1
- package/dist/packages/config/package.json.cjs.js +1 -1
- package/dist/packages/core-app-api/package.json.cjs.js +1 -1
- package/dist/packages/core-components/package.json.cjs.js +1 -1
- package/dist/packages/core-plugin-api/package.json.cjs.js +1 -1
- package/dist/packages/dev-utils/package.json.cjs.js +1 -1
- package/dist/packages/errors/package.json.cjs.js +1 -1
- package/dist/packages/frontend-defaults/package.json.cjs.js +1 -1
- package/dist/packages/frontend-dev-utils/package.json.cjs.js +1 -1
- package/dist/packages/frontend-plugin-api/package.json.cjs.js +1 -1
- package/dist/packages/frontend-test-utils/package.json.cjs.js +1 -1
- package/dist/packages/test-utils/package.json.cjs.js +1 -1
- package/dist/packages/ui/package.json.cjs.js +1 -1
- package/dist/plugins/auth-backend/package.json.cjs.js +1 -1
- package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +1 -1
- package/dist/plugins/catalog-node/package.json.cjs.js +1 -1
- package/dist/plugins/scaffolder-node/package.json.cjs.js +1 -1
- package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +1 -1
- package/package.json +8 -8
- package/templates/scaffolder-field-extension-module/.eslintrc.js.hbs +1 -0
- package/templates/scaffolder-field-extension-module/README.md.hbs +17 -0
- package/templates/scaffolder-field-extension-module/package.json.hbs +43 -0
- package/templates/scaffolder-field-extension-module/portable-template.yaml +8 -0
- package/templates/scaffolder-field-extension-module/src/extensions/{{extensionName}}.test.tsx.hbs +23 -0
- package/templates/scaffolder-field-extension-module/src/extensions/{{extensionName}}.tsx.hbs +43 -0
- package/templates/scaffolder-field-extension-module/src/index.ts.hbs +1 -0
- package/templates/scaffolder-field-extension-module/src/module.tsx.hbs +7 -0
- package/templates/scaffolder-field-extension-module/src/setupTests.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @backstage/cli-module-new
|
|
2
2
|
|
|
3
|
+
## 0.1.4-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4014819: Added a new `scaffolder-field-extension-module` template for scaffolding custom Scaffolder form field extensions via `backstage-cli new`.
|
|
8
|
+
|
|
9
|
+
## 0.1.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- e9b78e9: Removed the `uuid` dependency and replaced usage with the built-in `crypto.randomUUID()`.
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
- @backstage/errors@1.3.1
|
|
16
|
+
- @backstage/cli-node@0.3.2
|
|
17
|
+
- @backstage/cli-common@0.2.2
|
|
18
|
+
|
|
3
19
|
## 0.1.3-next.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -13,7 +13,8 @@ const defaultTemplates = [
|
|
|
13
13
|
"@backstage/cli-module-new/templates/node-library",
|
|
14
14
|
"@backstage/cli-module-new/templates/cli-module",
|
|
15
15
|
"@backstage/cli-module-new/templates/catalog-provider-module",
|
|
16
|
-
"@backstage/cli-module-new/templates/scaffolder-backend-module"
|
|
16
|
+
"@backstage/cli-module-new/templates/scaffolder-backend-module",
|
|
17
|
+
"@backstage/cli-module-new/templates/scaffolder-field-extension-module"
|
|
17
18
|
];
|
|
18
19
|
|
|
19
20
|
exports.defaultTemplates = defaultTemplates;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultTemplates.cjs.js","sources":["../../src/lib/defaultTemplates.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const defaultTemplates = [\n '@backstage/cli-module-new/templates/frontend-plugin',\n '@backstage/cli-module-new/templates/frontend-plugin-module',\n '@backstage/cli-module-new/templates/legacy-frontend-plugin',\n '@backstage/cli-module-new/templates/backend-plugin',\n '@backstage/cli-module-new/templates/backend-plugin-module',\n '@backstage/cli-module-new/templates/plugin-web-library',\n '@backstage/cli-module-new/templates/plugin-node-library',\n '@backstage/cli-module-new/templates/plugin-common-library',\n '@backstage/cli-module-new/templates/web-library',\n '@backstage/cli-module-new/templates/node-library',\n '@backstage/cli-module-new/templates/cli-module',\n '@backstage/cli-module-new/templates/catalog-provider-module',\n '@backstage/cli-module-new/templates/scaffolder-backend-module',\n];\n"],"names":[],"mappings":";;AAgBO,MAAM,gBAAA,GAAmB;AAAA,EAC9B,qDAAA;AAAA,EACA,4DAAA;AAAA,EACA,4DAAA;AAAA,EACA,oDAAA;AAAA,EACA,2DAAA;AAAA,EACA,wDAAA;AAAA,EACA,yDAAA;AAAA,EACA,2DAAA;AAAA,EACA,iDAAA;AAAA,EACA,kDAAA;AAAA,EACA,gDAAA;AAAA,EACA,6DAAA;AAAA,EACA;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"defaultTemplates.cjs.js","sources":["../../src/lib/defaultTemplates.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const defaultTemplates = [\n '@backstage/cli-module-new/templates/frontend-plugin',\n '@backstage/cli-module-new/templates/frontend-plugin-module',\n '@backstage/cli-module-new/templates/legacy-frontend-plugin',\n '@backstage/cli-module-new/templates/backend-plugin',\n '@backstage/cli-module-new/templates/backend-plugin-module',\n '@backstage/cli-module-new/templates/plugin-web-library',\n '@backstage/cli-module-new/templates/plugin-node-library',\n '@backstage/cli-module-new/templates/plugin-common-library',\n '@backstage/cli-module-new/templates/web-library',\n '@backstage/cli-module-new/templates/node-library',\n '@backstage/cli-module-new/templates/cli-module',\n '@backstage/cli-module-new/templates/catalog-provider-module',\n '@backstage/cli-module-new/templates/scaffolder-backend-module',\n '@backstage/cli-module-new/templates/scaffolder-field-extension-module',\n];\n"],"names":[],"mappings":";;AAgBO,MAAM,gBAAA,GAAmB;AAAA,EAC9B,qDAAA;AAAA,EACA,4DAAA;AAAA,EACA,4DAAA;AAAA,EACA,oDAAA;AAAA,EACA,2DAAA;AAAA,EACA,wDAAA;AAAA,EACA,yDAAA;AAAA,EACA,2DAAA;AAAA,EACA,iDAAA;AAAA,EACA,kDAAA;AAAA,EACA,gDAAA;AAAA,EACA,6DAAA;AAAA,EACA,+DAAA;AAAA,EACA;AACF;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/cli-module-new",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4-next.0",
|
|
4
4
|
"description": "CLI module for Backstage CLI",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "cli-module"
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"test": "backstage-cli package test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@backstage/cli-common": "0.2.2
|
|
38
|
-
"@backstage/cli-node": "0.3.2
|
|
39
|
-
"@backstage/errors": "1.3.1
|
|
37
|
+
"@backstage/cli-common": "0.2.2",
|
|
38
|
+
"@backstage/cli-node": "0.3.2",
|
|
39
|
+
"@backstage/errors": "1.3.1",
|
|
40
40
|
"chalk": "^4.0.0",
|
|
41
41
|
"cleye": "^2.3.0",
|
|
42
42
|
"fs-extra": "^11.2.0",
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
"zod-validation-error": "^4.0.2"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@backstage/backend-test-utils": "1.11.
|
|
55
|
-
"@backstage/cli": "0.36.
|
|
56
|
-
"@backstage/core-plugin-api": "1.12.
|
|
57
|
-
"@backstage/test-utils": "1.7.
|
|
54
|
+
"@backstage/backend-test-utils": "1.11.4-next.1",
|
|
55
|
+
"@backstage/cli": "0.36.3-next.1",
|
|
56
|
+
"@backstage/core-plugin-api": "1.12.7-next.0",
|
|
57
|
+
"@backstage/test-utils": "1.7.19-next.0",
|
|
58
58
|
"@types/fs-extra": "^11.0.0",
|
|
59
59
|
"@types/inquirer": "^8.1.3",
|
|
60
60
|
"@types/lodash": "^4.14.151",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# {{packageName}}
|
|
2
|
+
|
|
3
|
+
The {{moduleId}} field extension module for the Backstage Scaffolder.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
To use this field in a Scaffolder template, reference it in the template spec:
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
properties:
|
|
11
|
+
myField:
|
|
12
|
+
title: My Field
|
|
13
|
+
type: string
|
|
14
|
+
ui:field: {{kebabCase moduleId}}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
_This plugin was created through the Backstage CLI_
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{packageName}}",
|
|
3
|
+
"description": "The {{moduleId}} field extension module for the Backstage Scaffolder.",
|
|
4
|
+
"main": "src/index.ts",
|
|
5
|
+
"types": "src/index.ts",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public",
|
|
8
|
+
"main": "dist/index.cjs.js",
|
|
9
|
+
"module": "dist/index.esm.js",
|
|
10
|
+
"types": "dist/index.d.ts"
|
|
11
|
+
},
|
|
12
|
+
"backstage": {
|
|
13
|
+
"role": "frontend-plugin-module",
|
|
14
|
+
"pluginId": "{{pluginId}}",
|
|
15
|
+
"pluginPackage": "{{pluginPackage}}"
|
|
16
|
+
},
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "backstage-cli package build",
|
|
20
|
+
"lint": "backstage-cli package lint",
|
|
21
|
+
"test": "backstage-cli package test",
|
|
22
|
+
"clean": "backstage-cli package clean",
|
|
23
|
+
"prepack": "backstage-cli package prepack",
|
|
24
|
+
"postpack": "backstage-cli package postpack"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@backstage/frontend-plugin-api": "{{versionQuery '@backstage/frontend-plugin-api'}}",
|
|
28
|
+
"@backstage/plugin-scaffolder-react": "{{versionQuery '@backstage/plugin-scaffolder-react'}}"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@backstage/cli": "{{versionQuery '@backstage/cli'}}",
|
|
32
|
+
"@testing-library/jest-dom": "{{versionQuery '@testing-library/jest-dom' '6.0.0'}}",
|
|
33
|
+
"@testing-library/react": "{{versionQuery '@testing-library/react' '16.0.0'}}",
|
|
34
|
+
"@testing-library/user-event": "{{versionQuery '@testing-library/user-event' '14.0.0'}}",
|
|
35
|
+
"react": "{{versionQuery 'react' '18.0.0'}}"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"react": "^17.0.0 || ^18.0.0"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist"
|
|
42
|
+
]
|
|
43
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
name: scaffolder-field-extension-module
|
|
2
|
+
role: frontend-plugin-module
|
|
3
|
+
description: A custom field extension for the Backstage Scaffolder
|
|
4
|
+
values:
|
|
5
|
+
pluginId: scaffolder
|
|
6
|
+
moduleVar: '{{ camelCase pluginId }}Module{{ upperFirst ( camelCase moduleId ) }}'
|
|
7
|
+
extensionName: '{{ upperFirst ( camelCase moduleId ) }}FieldExtension'
|
|
8
|
+
extensionComponent: '{{ upperFirst ( camelCase moduleId ) }}Field'
|
package/templates/scaffolder-field-extension-module/src/extensions/{{extensionName}}.test.tsx.hbs
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { {{ extensionComponent }} } from './{{ extensionName }}';
|
|
4
|
+
|
|
5
|
+
describe('{{ extensionComponent }}', () => {
|
|
6
|
+
it('should render the field and handle changes', async () => {
|
|
7
|
+
const onChange = jest.fn();
|
|
8
|
+
|
|
9
|
+
render(
|
|
10
|
+
<{{ extensionComponent }}
|
|
11
|
+
onChange={onChange}
|
|
12
|
+
rawErrors={[]}
|
|
13
|
+
required={false}
|
|
14
|
+
formData=""
|
|
15
|
+
/>,
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const input = screen.getByRole('textbox');
|
|
19
|
+
await userEvent.type(input, 'test');
|
|
20
|
+
|
|
21
|
+
expect(onChange).toHaveBeenCalled();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FormFieldBlueprint,
|
|
3
|
+
createFormField,
|
|
4
|
+
} from '@backstage/plugin-scaffolder-react/alpha';
|
|
5
|
+
import {
|
|
6
|
+
FieldExtensionComponentProps,
|
|
7
|
+
makeFieldSchema,
|
|
8
|
+
} from '@backstage/plugin-scaffolder-react';
|
|
9
|
+
|
|
10
|
+
export const {{ extensionComponent }} = ({
|
|
11
|
+
onChange,
|
|
12
|
+
required,
|
|
13
|
+
formData,
|
|
14
|
+
}: FieldExtensionComponentProps<string>) => {
|
|
15
|
+
// TODO: Replace with your custom field component
|
|
16
|
+
return (
|
|
17
|
+
<input
|
|
18
|
+
type="text"
|
|
19
|
+
onChange={e => onChange(e.target.value)}
|
|
20
|
+
value={formData ?? ''}
|
|
21
|
+
required={required}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const {{ extensionName }} = FormFieldBlueprint.make({
|
|
27
|
+
name: '{{ kebabCase moduleId }}',
|
|
28
|
+
params: {
|
|
29
|
+
field: async () =>
|
|
30
|
+
createFormField({
|
|
31
|
+
name: '{{ extensionComponent }}',
|
|
32
|
+
component: {{ extensionComponent }},
|
|
33
|
+
// Uncomment to add validation:
|
|
34
|
+
// validation: async (value, validation, { apiHolder }) => {
|
|
35
|
+
// if (!value) validation.addError('Field is required');
|
|
36
|
+
// },
|
|
37
|
+
// Uncomment to define schema for the Custom Field Explorer preview:
|
|
38
|
+
// schema: makeFieldSchema({
|
|
39
|
+
// output: z => z.string(),
|
|
40
|
+
// }),
|
|
41
|
+
}),
|
|
42
|
+
},
|
|
43
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { {{ moduleVar }} as default } from './module';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createFrontendModule } from '@backstage/frontend-plugin-api';
|
|
2
|
+
import { {{ extensionName }} } from './extensions/{{ extensionName }}';
|
|
3
|
+
|
|
4
|
+
export const {{ moduleVar }} = createFrontendModule({
|
|
5
|
+
pluginId: '{{ pluginId }}',
|
|
6
|
+
extensions: [{{ extensionName }}],
|
|
7
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|