#Using NFS for Scaffolder with overrides

1 messages · Page 1 of 1 (latest)

errant kelp
#

We are incrementally trying to adopt the NFS for our Backstage deployment. I am attempting to update to use the NFS version of scaffolder so I don't have to make a old frontend system plugin for adding a new custom field. However, when attempting to do the migration, I noticed we already use things like groups, headerOptions, etc. to override certain things. The Router component in Scaffolder is not exposed as importable by the current system. What would be the best way to go about this?

  1. Submit a patch to export Router from Scaffolder so we can override at that level?
  2. Submit a patch to create more extension points to take those as inputs?
  3. Some other option?
low rapids
#

You mean to customize the ScaffolderPage? You can use overrides i.e


import { default as scaffolderPlugin } from "@backstage/plugin-scaffolder/alpha"
import { compatWrapper } from "@backstage/core-compat-api"

const page = scaffolderPlugin.getExtension("page:scaffolder").override({
  params: {
    loader: () => import("@backstage/plugin-scaffolder").then(m => compatWrapper(<m.ScaffolderPage headerOptions={{ pageTitleOverride: "ahhh" }} />))
  }
})

export const scaffolderPluginOverride = scaffolderPlugin.withOverrides({
  extensions: [
    page
  ]
}) as ReturnType<typeof scaffolderPlugin.withOverrides>

const app = createApp({
  features: [
    // ...
    scaffolderPluginOverride
  ]
})
errant kelp
#

ScaffolderPage is wrapped in the Old Frontend System so I was concerned about crossing the streams and not getting all the right stuff

low rapids
#

I believe that’s what compatWrapper is for. It will convert the old frontend provides to be a usable react component along with any contexts etc for NFS

errant kelp
#

Thanks!

keen sorrel
#

Sorry just seen this thread.

You can do it as suggested above, but that will lead to breakages in the future as the ScaffolderPage element export will be deleted once we remove support for the legacy frontend system.

That said though, there will be ways to customize the relevant things in the new frontend system, but they're be more in line with the ideologies of that system rather than JSX.

Not sure when this will be, but I'm hoping to be able to OSS some code around this within the coming months.