cli: added backend module templating factory

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-08-17 11:39:21 +02:00
parent 47782f4bfa
commit 278d9326eb
13 changed files with 209 additions and 0 deletions
@@ -0,0 +1 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
@@ -0,0 +1,5 @@
# {{name}}
The {{moduleId}} backend module for the {{pluginId}} plugin.
_This plugin was created through the Backstage CLI_
@@ -0,0 +1,42 @@
{
"name": "{{name}}",
"description": "The {{moduleId}} backend module for the {{pluginId}} plugin.",
"version": "{{packageVersion}}",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
{{#if privatePackage}}
"private": {{privatePackage}},
{{/if}}
"publishConfig": {
{{#if npmRegistry}}
"registry": "{{npmRegistry}}",
{{/if}}
"access": "public",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
},
"backstage": {
"role": "backend-plugin-module"
},
"scripts": {
"start": "backstage-cli package start",
"build": "backstage-cli package build",
"lint": "backstage-cli package lint",
"test": "backstage-cli package test",
"clean": "backstage-cli package clean",
"prepack": "backstage-cli package prepack",
"postpack": "backstage-cli package postpack"
},
"dependencies": {
"@backstage/backend-common": "{{versionQuery '@backstage/backend-common'}}",
"@backstage/backend-plugin-api": "{{versionQuery '@backstage/backend-plugin-api'}}"
},
"devDependencies": {
"@backstage/backend-test-utils": "{{versionQuery '@backstage/backend-test-utils'}}",
"@backstage/cli": "{{versionQuery '@backstage/cli'}}"
},
"files": [
"dist"
]
}
@@ -0,0 +1,8 @@
/***/
/**
* The {{moduleId}} backend module for the {{pluginId}} plugin.
*
* @packageDocumentation
*/
export { {{moduleVar}} } from './module';
@@ -0,0 +1,14 @@
import { coreServices, createBackendModule } from '@backstage/backend-plugin-api';
export const {{moduleVar}} = createBackendModule({
pluginId: '{{pluginId}}',
moduleId: '{{moduleId}}',
register(reg) {
reg.registerInit({
deps: { logger: coreServices.logger },
async init({ logger }) {
logger.info('Hello World!')
},
});
},
});
@@ -0,0 +1,9 @@
{
"extends": "@backstage/cli/config/tsconfig.json",
"include": ["src"],
"exclude": ["node_modules"],
"compilerOptions": {
"outDir": "dist-types",
"rootDir": "."
}
}