feat(create-app): add catalog and scaffolder plugins

This commit is contained in:
Rémi DOREAU
2020-08-09 12:35:27 +02:00
committed by Patrik Oldsberg
parent c6c44c20a6
commit 635850a1c1
4 changed files with 56 additions and 0 deletions
@@ -24,6 +24,10 @@
"plugins/*"
]
},
"dependencies": {
"@backstage/plugin-catalog": "^{{version}}",
"@backstage/plugin-scaffolder": "^{{version}}"
},
"devDependencies": {
"@backstage/cli": "^{{version}}",
"@spotify/prettier-config": "^7.0.0",
@@ -1,8 +1,10 @@
import { createApp } from '@backstage/core';
import React, { FC } from 'react';
import { apis } from './apis';
import * as plugins from './plugins';
const app = createApp({
apis,
plugins: Object.values(plugins),
});
@@ -0,0 +1,48 @@
/*
* Copyright 2020 Spotify AB
*
* 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 { ApiRegistry, ConfigApi } from '@backstage/core';
import { catalogApiRef, CatalogClient } from '@backstage/plugin-catalog';
import { scaffolderApiRef, ScaffolderApi } from '@backstage/plugin-scaffolder';
export const apis = (config: ConfigApi) => {
// eslint-disable-next-line no-console
console.log(`Creating APIs for ${config.getString('app.title')}`);
const backendUrl = config.getString('backend.baseUrl');
const builder = ApiRegistry.builder();
builder.add(
catalogApiRef,
new CatalogClient({
apiOrigin: backendUrl,
basePath: '/catalog',
}),
);
builder.add(
scaffolderApiRef,
new ScaffolderApi({
apiOrigin: backendUrl,
basePath: '/scaffolder/v1',
}),
);
return builder.build();
};
@@ -1 +1,3 @@
export { plugin as WelcomePlugin } from 'plugin-welcome';
export { plugin as CatalogPlugin } from '@backstage/plugin-catalog';
export { plugin as ScaffolderPlugin } from '@backstage/plugin-scaffolder';