Merge pull request #4856 from backstage/docs/custom-action
docs: updating the example action to be valid typescript
This commit is contained in:
@@ -19,7 +19,7 @@ passed as `input` to the function.
|
||||
In `packages/backend/src/actions/custom.ts` we can create a new action.
|
||||
|
||||
```ts
|
||||
import { createTemplateAction } from '../../createTemplateAction';
|
||||
import { createTemplateAction } from '@backstage/plugin-scaffolder-backend';
|
||||
import fs from 'fs-extra';
|
||||
|
||||
export const createNewFileAction = () => {
|
||||
@@ -35,7 +35,7 @@ export const createNewFileAction = () => {
|
||||
title: 'Contents',
|
||||
description: 'The contents of the file',
|
||||
},
|
||||
contents: {
|
||||
filename: {
|
||||
type: 'string',
|
||||
title: 'Filename',
|
||||
description: 'The filename of the file that will be created',
|
||||
@@ -46,7 +46,7 @@ export const createNewFileAction = () => {
|
||||
async handler(ctx) {
|
||||
await fs.outputFile(
|
||||
`${ctx.workspacePath}/${ctx.input.filename}`,
|
||||
ctx.input.content,
|
||||
ctx.input.contents,
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user