@backstage/cli 0.30.0-next.1 → 0.30.0-next.3
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 +54 -0
- package/config/jestSwcTransform.js +1 -1
- package/dist/commands/index.cjs.js +3 -0
- package/dist/commands/new/new.cjs.js +39 -80
- package/dist/commands/versions/bump.cjs.js +2 -0
- package/dist/lib/builder/plugins.cjs.js +20 -1
- package/dist/lib/new/createNewPackage.cjs.js +32 -0
- package/dist/lib/new/defaultTemplates.cjs.js +16 -0
- package/dist/lib/new/execution/PortableTemplater.cjs.js +91 -0
- package/dist/lib/new/execution/executePortableTemplate.cjs.js +54 -0
- package/dist/lib/new/execution/installNewPackage.cjs.js +127 -0
- package/dist/lib/new/execution/writeTemplateContents.cjs.js +111 -0
- package/dist/lib/new/preparation/collectPortableTemplateInput.cjs.js +157 -0
- package/dist/lib/new/preparation/loadPortableTemplate.cjs.js +82 -0
- package/dist/lib/new/preparation/loadPortableTemplateConfig.cjs.js +121 -0
- package/dist/lib/new/preparation/resolvePackageParams.cjs.js +40 -0
- package/dist/lib/new/preparation/selectTemplateInteractively.cjs.js +38 -0
- package/dist/lib/new/types.cjs.js +15 -4
- package/dist/lib/packager/createDistWorkspace.cjs.js +6 -8
- package/dist/lib/packager/productionPack.cjs.js +3 -0
- package/dist/lib/tasks.cjs.js +0 -111
- package/dist/lib/typeDistProject.cjs.js +2 -7
- 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/cli/package.json.cjs.js +3 -3
- package/dist/packages/core-components/package.json.cjs.js +1 -1
- package/dist/packages/dev-utils/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 +13 -13
- package/templates/{default-backend-plugin → backend-plugin}/README.md.hbs +4 -4
- package/templates/{default-backend-plugin → backend-plugin}/dev/index.ts.hbs +5 -5
- package/templates/{default-backend-plugin → backend-plugin}/package.json.hbs +1 -9
- package/templates/backend-plugin/portable-template.yaml +5 -0
- package/templates/{default-backend-plugin → backend-plugin}/src/plugin.test.ts.hbs +5 -5
- package/templates/{default-backend-plugin → backend-plugin}/src/plugin.ts.hbs +1 -1
- package/templates/{default-backend-module → backend-plugin-module}/README.md.hbs +1 -1
- package/templates/{default-backend-module → backend-plugin-module}/package.json.hbs +1 -9
- package/templates/backend-plugin-module/portable-template.yaml +5 -0
- package/templates/{default-plugin → frontend-plugin}/README.md.hbs +3 -3
- package/templates/{default-plugin → frontend-plugin}/dev/index.tsx.hbs +1 -1
- package/templates/{default-plugin → frontend-plugin}/package.json.hbs +1 -9
- package/templates/frontend-plugin/portable-template.yaml +6 -0
- package/templates/{default-plugin → frontend-plugin}/src/components/ExampleComponent/ExampleComponent.test.tsx.hbs +1 -1
- package/templates/{default-plugin → frontend-plugin}/src/components/ExampleComponent/ExampleComponent.tsx.hbs +1 -1
- package/templates/{default-plugin → frontend-plugin}/src/plugin.test.ts.hbs +1 -1
- package/templates/{default-plugin → frontend-plugin}/src/plugin.ts.hbs +1 -1
- package/templates/{default-plugin → frontend-plugin}/src/routes.ts.hbs +1 -1
- package/templates/{node-library-package → node-library}/README.md.hbs +2 -2
- package/templates/{node-library-package → node-library}/package.json.hbs +1 -9
- package/templates/node-library/portable-template.yaml +3 -0
- package/templates/plugin-common-library/README.md.hbs +5 -0
- package/templates/{default-common-plugin-package → plugin-common-library}/package.json.hbs +2 -10
- package/templates/plugin-common-library/portable-template.yaml +3 -0
- package/templates/{default-common-plugin-package → plugin-common-library}/src/index.ts.hbs +1 -1
- package/templates/plugin-node-library/README.md.hbs +5 -0
- package/templates/{default-node-plugin-package → plugin-node-library}/package.json.hbs +2 -10
- package/templates/plugin-node-library/portable-template.yaml +3 -0
- package/templates/{default-node-plugin-package → plugin-node-library}/src/index.ts.hbs +1 -1
- package/templates/plugin-web-library/README.md.hbs +5 -0
- package/templates/{default-react-plugin-package → plugin-web-library}/package.json.hbs +2 -10
- package/templates/plugin-web-library/portable-template.yaml +3 -0
- package/templates/{default-react-plugin-package → plugin-web-library}/src/index.ts.hbs +1 -1
- package/templates/scaffolder-backend-module/README.md.hbs +5 -0
- package/templates/{scaffolder-module → scaffolder-backend-module}/package.json.hbs +2 -10
- package/templates/scaffolder-backend-module/portable-template.yaml +6 -0
- package/templates/{scaffolder-module → scaffolder-backend-module}/src/index.ts.hbs +1 -1
- package/templates/{web-library-package → web-library}/README.md.hbs +2 -2
- package/templates/{web-library-package → web-library}/package.json.hbs +1 -9
- package/templates/web-library/portable-template.yaml +3 -0
- package/dist/lib/new/FactoryRegistry.cjs.js +0 -96
- package/dist/lib/new/factories/backendModule.cjs.js +0 -82
- package/dist/lib/new/factories/backendPlugin.cjs.js +0 -78
- package/dist/lib/new/factories/common/prompts.cjs.js +0 -57
- package/dist/lib/new/factories/common/tasks.cjs.js +0 -66
- package/dist/lib/new/factories/common/util.cjs.js +0 -16
- package/dist/lib/new/factories/frontendPlugin.cjs.js +0 -107
- package/dist/lib/new/factories/index.cjs.js +0 -24
- package/dist/lib/new/factories/nodeLibraryPackage.cjs.js +0 -57
- package/dist/lib/new/factories/pluginCommon.cjs.js +0 -58
- package/dist/lib/new/factories/pluginNode.cjs.js +0 -58
- package/dist/lib/new/factories/pluginWeb.cjs.js +0 -58
- package/dist/lib/new/factories/scaffolderModule.cjs.js +0 -90
- package/dist/lib/new/factories/webLibraryPackage.cjs.js +0 -57
- package/templates/default-backend-module/tsconfig.json +0 -9
- package/templates/default-backend-plugin/tsconfig.json +0 -13
- package/templates/default-common-plugin-package/README.md.hbs +0 -5
- package/templates/default-common-plugin-package/tsconfig.json +0 -9
- package/templates/default-node-plugin-package/README.md.hbs +0 -5
- package/templates/default-node-plugin-package/tsconfig.json +0 -9
- package/templates/default-plugin/tsconfig.json +0 -12
- package/templates/default-react-plugin-package/README.md.hbs +0 -5
- package/templates/default-react-plugin-package/tsconfig.json +0 -11
- package/templates/node-library-package/tsconfig.json +0 -11
- package/templates/scaffolder-module/README.md.hbs +0 -5
- package/templates/scaffolder-module/tsconfig.json +0 -9
- package/templates/web-library-package/tsconfig.json +0 -11
- /package/templates/{default-backend-plugin → backend-plugin}/.eslintrc.js.hbs +0 -0
- /package/templates/{default-backend-plugin → backend-plugin}/src/index.ts.hbs +0 -0
- /package/templates/{default-backend-plugin → backend-plugin}/src/router.test.ts +0 -0
- /package/templates/{default-backend-plugin → backend-plugin}/src/router.ts +0 -0
- /package/templates/{default-backend-plugin → backend-plugin}/src/services/TodoListService/createTodoListService.ts +0 -0
- /package/templates/{default-backend-plugin → backend-plugin}/src/services/TodoListService/index.ts +0 -0
- /package/templates/{default-backend-plugin → backend-plugin}/src/services/TodoListService/types.ts +0 -0
- /package/templates/{default-backend-plugin → backend-plugin}/src/setupTests.ts +0 -0
- /package/templates/{default-backend-module → backend-plugin-module}/.eslintrc.js.hbs +0 -0
- /package/templates/{default-backend-module → backend-plugin-module}/src/index.ts.hbs +0 -0
- /package/templates/{default-backend-module → backend-plugin-module}/src/module.ts.hbs +0 -0
- /package/templates/{default-common-plugin-package → frontend-plugin}/.eslintrc.js.hbs +0 -0
- /package/templates/{default-plugin → frontend-plugin}/src/components/ExampleComponent/index.ts +0 -0
- /package/templates/{default-plugin → frontend-plugin}/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx.hbs +0 -0
- /package/templates/{default-plugin → frontend-plugin}/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx.hbs +0 -0
- /package/templates/{default-plugin → frontend-plugin}/src/components/ExampleFetchComponent/index.ts +0 -0
- /package/templates/{default-plugin → frontend-plugin}/src/index.ts.hbs +0 -0
- /package/templates/{default-plugin → frontend-plugin}/src/setupTests.ts +0 -0
- /package/templates/{default-node-plugin-package → node-library}/.eslintrc.js.hbs +0 -0
- /package/templates/{node-library-package → node-library}/src/index.ts.hbs +0 -0
- /package/templates/{default-common-plugin-package → node-library}/src/setupTests.ts +0 -0
- /package/templates/{default-plugin → plugin-common-library}/.eslintrc.js.hbs +0 -0
- /package/templates/{default-node-plugin-package → plugin-common-library}/src/setupTests.ts +0 -0
- /package/templates/{default-react-plugin-package → plugin-node-library}/.eslintrc.js.hbs +0 -0
- /package/templates/{node-library-package → plugin-node-library}/src/setupTests.ts +0 -0
- /package/templates/{node-library-package → plugin-web-library}/.eslintrc.js.hbs +0 -0
- /package/templates/{default-react-plugin-package → plugin-web-library}/src/components/ExampleComponent/ExampleComponent.test.tsx +0 -0
- /package/templates/{default-react-plugin-package → plugin-web-library}/src/components/ExampleComponent/ExampleComponent.tsx +0 -0
- /package/templates/{default-react-plugin-package → plugin-web-library}/src/components/ExampleComponent/index.ts +0 -0
- /package/templates/{default-react-plugin-package → plugin-web-library}/src/components/index.ts +0 -0
- /package/templates/{default-react-plugin-package → plugin-web-library}/src/hooks/index.ts +0 -0
- /package/templates/{default-react-plugin-package → plugin-web-library}/src/hooks/useExample/index.ts +0 -0
- /package/templates/{default-react-plugin-package → plugin-web-library}/src/hooks/useExample/useExample.ts +0 -0
- /package/templates/{default-react-plugin-package → plugin-web-library}/src/setupTests.ts +0 -0
- /package/templates/{scaffolder-module → scaffolder-backend-module}/.eslintrc.js.hbs +0 -0
- /package/templates/{scaffolder-module → scaffolder-backend-module}/src/actions/example.test.ts +0 -0
- /package/templates/{scaffolder-module → scaffolder-backend-module}/src/actions/example.ts +0 -0
- /package/templates/{scaffolder-module → scaffolder-backend-module}/src/module.ts +0 -0
- /package/templates/{web-library-package → web-library}/.eslintrc.js.hbs +0 -0
- /package/templates/{web-library-package → web-library}/src/index.ts.hbs +0 -0
- /package/templates/{web-library-package → web-library}/src/setupTests.ts +0 -0
package/dist/lib/tasks.cjs.js
CHANGED
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chalk = require('chalk');
|
|
4
|
-
var fs = require('fs-extra');
|
|
5
|
-
var handlebars = require('handlebars');
|
|
6
4
|
var ora = require('ora');
|
|
7
5
|
var util = require('util');
|
|
8
|
-
var path = require('path');
|
|
9
|
-
var recursive = require('recursive-readdir');
|
|
10
6
|
var child_process = require('child_process');
|
|
11
7
|
var errors = require('@backstage/errors');
|
|
12
|
-
var paths = require('./paths.cjs.js');
|
|
13
8
|
|
|
14
9
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
15
10
|
|
|
16
11
|
var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
|
|
17
|
-
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
18
|
-
var handlebars__default = /*#__PURE__*/_interopDefaultCompat(handlebars);
|
|
19
12
|
var ora__default = /*#__PURE__*/_interopDefaultCompat(ora);
|
|
20
|
-
var recursive__default = /*#__PURE__*/_interopDefaultCompat(recursive);
|
|
21
13
|
|
|
22
14
|
const exec = util.promisify(child_process.exec);
|
|
23
15
|
const TASK_NAME_MAX_LENGTH = 14;
|
|
@@ -80,109 +72,6 @@ ${chalk__default.default.red(message)}
|
|
|
80
72
|
}
|
|
81
73
|
}
|
|
82
74
|
}
|
|
83
|
-
async function templatingTask(templateDir, destinationDir, context, versionProvider, isMonoRepo) {
|
|
84
|
-
const files = await recursive__default.default(templateDir).catch((error) => {
|
|
85
|
-
throw new Error(`Failed to read template directory: ${error.message}`);
|
|
86
|
-
});
|
|
87
|
-
for (const file of files) {
|
|
88
|
-
const destinationFile = file.replace(templateDir, destinationDir);
|
|
89
|
-
await fs__default.default.ensureDir(path.dirname(destinationFile));
|
|
90
|
-
if (file.endsWith(".hbs")) {
|
|
91
|
-
await Task.forItem("templating", path.basename(file), async () => {
|
|
92
|
-
const destination = destinationFile.replace(/\.hbs$/, "");
|
|
93
|
-
const template = await fs__default.default.readFile(file);
|
|
94
|
-
const compiled = handlebars__default.default.compile(template.toString(), {
|
|
95
|
-
strict: true
|
|
96
|
-
});
|
|
97
|
-
const contents = compiled(
|
|
98
|
-
{ name: path.basename(destination), ...context },
|
|
99
|
-
{
|
|
100
|
-
helpers: {
|
|
101
|
-
versionQuery(name, versionHint) {
|
|
102
|
-
return versionProvider(
|
|
103
|
-
name,
|
|
104
|
-
typeof versionHint === "string" ? versionHint : void 0
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
);
|
|
110
|
-
await fs__default.default.writeFile(destination, contents).catch((error) => {
|
|
111
|
-
throw new Error(
|
|
112
|
-
`Failed to create file: ${destination}: ${error.message}`
|
|
113
|
-
);
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
} else {
|
|
117
|
-
if (isMonoRepo && file.match("tsconfig.json")) {
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
await Task.forItem("copying", path.basename(file), async () => {
|
|
121
|
-
await fs__default.default.copyFile(file, destinationFile).catch((error) => {
|
|
122
|
-
const destination = destinationFile;
|
|
123
|
-
throw new Error(
|
|
124
|
-
`Failed to copy file to ${destination} : ${error.message}`
|
|
125
|
-
);
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
async function addPackageDependency(path, options) {
|
|
132
|
-
try {
|
|
133
|
-
const pkgJson = await fs__default.default.readJson(path);
|
|
134
|
-
const normalize = (obj) => {
|
|
135
|
-
if (Object.keys(obj).length === 0) {
|
|
136
|
-
return void 0;
|
|
137
|
-
}
|
|
138
|
-
return Object.fromEntries(
|
|
139
|
-
Object.keys(obj).sort().map((key) => [key, obj[key]])
|
|
140
|
-
);
|
|
141
|
-
};
|
|
142
|
-
pkgJson.dependencies = normalize({
|
|
143
|
-
...pkgJson.dependencies,
|
|
144
|
-
...options.dependencies
|
|
145
|
-
});
|
|
146
|
-
pkgJson.devDependencies = normalize({
|
|
147
|
-
...pkgJson.devDependencies,
|
|
148
|
-
...options.devDependencies
|
|
149
|
-
});
|
|
150
|
-
pkgJson.peerDependencies = normalize({
|
|
151
|
-
...pkgJson.peerDependencies,
|
|
152
|
-
...options.peerDependencies
|
|
153
|
-
});
|
|
154
|
-
await fs__default.default.writeJson(path, pkgJson, { spaces: 2 });
|
|
155
|
-
} catch (error) {
|
|
156
|
-
throw new Error(`Failed to add package dependencies, ${error}`);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
async function addToBackend(name, options) {
|
|
160
|
-
if (await fs__default.default.pathExists(paths.paths.resolveTargetRoot("packages/backend"))) {
|
|
161
|
-
await Task.forItem("backend", `adding ${options.type}`, async () => {
|
|
162
|
-
const backendFilePath = paths.paths.resolveTargetRoot(
|
|
163
|
-
"packages/backend/src/index.ts"
|
|
164
|
-
);
|
|
165
|
-
if (!await fs__default.default.pathExists(backendFilePath)) {
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
const content = await fs__default.default.readFile(backendFilePath, "utf8");
|
|
169
|
-
const lines = content.split("\n");
|
|
170
|
-
const backendAddLine = `backend.add(import('${name}'));`;
|
|
171
|
-
const backendStartIndex = lines.findIndex(
|
|
172
|
-
(line) => line.match(/backend.start/)
|
|
173
|
-
);
|
|
174
|
-
if (backendStartIndex !== -1) {
|
|
175
|
-
const [indentation] = lines[backendStartIndex].match(/^\s*/);
|
|
176
|
-
lines.splice(backendStartIndex, 0, `${indentation}${backendAddLine}`);
|
|
177
|
-
const newContent = lines.join("\n");
|
|
178
|
-
await fs__default.default.writeFile(backendFilePath, newContent, "utf8");
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
75
|
|
|
184
76
|
exports.Task = Task;
|
|
185
|
-
exports.addPackageDependency = addPackageDependency;
|
|
186
|
-
exports.addToBackend = addToBackend;
|
|
187
|
-
exports.templatingTask = templatingTask;
|
|
188
77
|
//# sourceMappingURL=tasks.cjs.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var cliNode = require('@backstage/cli-node');
|
|
3
4
|
var path = require('path');
|
|
4
5
|
var tsMorph = require('ts-morph');
|
|
5
6
|
var paths = require('./paths.cjs.js');
|
|
@@ -18,12 +19,6 @@ const targetPackageRoles = [
|
|
|
18
19
|
"web-library",
|
|
19
20
|
"node-library"
|
|
20
21
|
];
|
|
21
|
-
const targetFeatureTypes = [
|
|
22
|
-
"@backstage/BackendFeature",
|
|
23
|
-
"@backstage/BackstagePlugin",
|
|
24
|
-
"@backstage/FrontendPlugin",
|
|
25
|
-
"@backstage/FrontendModule"
|
|
26
|
-
];
|
|
27
22
|
const getEntryPointDefaultFeatureType = (role, packageDir, project, entryPoint) => {
|
|
28
23
|
if (isTargetPackageRole(role)) {
|
|
29
24
|
const distPath = path.resolve(packageDir, entryPoint);
|
|
@@ -86,7 +81,7 @@ function isTargetPackageRole(role) {
|
|
|
86
81
|
return !!role && targetPackageRoles.includes(role);
|
|
87
82
|
}
|
|
88
83
|
function isTargetFeatureType(type) {
|
|
89
|
-
return !!type &&
|
|
84
|
+
return !!type && cliNode.packageFeatureType.includes(type);
|
|
90
85
|
}
|
|
91
86
|
|
|
92
87
|
exports.createTypeDistProject = createTypeDistProject;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var version = "0.30.0-next.
|
|
3
|
+
var version = "0.30.0-next.3";
|
|
4
4
|
var dependencies = {
|
|
5
5
|
"@backstage/catalog-model": "workspace:^",
|
|
6
6
|
"@backstage/cli-common": "workspace:^",
|
|
@@ -85,7 +85,6 @@ var dependencies = {
|
|
|
85
85
|
"node-libs-browser": "^2.2.1",
|
|
86
86
|
"npm-packlist": "^5.0.0",
|
|
87
87
|
ora: "^5.3.0",
|
|
88
|
-
"p-limit": "^3.1.0",
|
|
89
88
|
"p-queue": "^6.6.2",
|
|
90
89
|
pirates: "^4.0.6",
|
|
91
90
|
postcss: "^8.1.0",
|
|
@@ -115,7 +114,8 @@ var dependencies = {
|
|
|
115
114
|
yargs: "^16.2.0",
|
|
116
115
|
"yml-loader": "^2.1.0",
|
|
117
116
|
yn: "^4.0.0",
|
|
118
|
-
zod: "^3.22.4"
|
|
117
|
+
zod: "^3.22.4",
|
|
118
|
+
"zod-validation-error": "^3.4.0"
|
|
119
119
|
};
|
|
120
120
|
var devDependencies = {
|
|
121
121
|
"@backstage/backend-plugin-api": "workspace:^",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/cli",
|
|
3
|
-
"version": "0.30.0-next.
|
|
3
|
+
"version": "0.30.0-next.3",
|
|
4
4
|
"description": "CLI for developing Backstage plugins and apps",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "cli"
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@backstage/catalog-model": "1.7.3",
|
|
51
51
|
"@backstage/cli-common": "0.1.15",
|
|
52
|
-
"@backstage/cli-node": "0.2.13-next.
|
|
52
|
+
"@backstage/cli-node": "0.2.13-next.1",
|
|
53
53
|
"@backstage/config": "1.3.2",
|
|
54
54
|
"@backstage/config-loader": "1.9.6-next.0",
|
|
55
55
|
"@backstage/errors": "1.2.7",
|
|
@@ -130,7 +130,6 @@
|
|
|
130
130
|
"node-libs-browser": "^2.2.1",
|
|
131
131
|
"npm-packlist": "^5.0.0",
|
|
132
132
|
"ora": "^5.3.0",
|
|
133
|
-
"p-limit": "^3.1.0",
|
|
134
133
|
"p-queue": "^6.6.2",
|
|
135
134
|
"pirates": "^4.0.6",
|
|
136
135
|
"postcss": "^8.1.0",
|
|
@@ -160,23 +159,24 @@
|
|
|
160
159
|
"yargs": "^16.2.0",
|
|
161
160
|
"yml-loader": "^2.1.0",
|
|
162
161
|
"yn": "^4.0.0",
|
|
163
|
-
"zod": "^3.22.4"
|
|
162
|
+
"zod": "^3.22.4",
|
|
163
|
+
"zod-validation-error": "^3.4.0"
|
|
164
164
|
},
|
|
165
165
|
"devDependencies": {
|
|
166
|
-
"@backstage/backend-plugin-api": "1.2.0-next.
|
|
167
|
-
"@backstage/backend-test-utils": "1.3.0-next.
|
|
166
|
+
"@backstage/backend-plugin-api": "1.2.0-next.2",
|
|
167
|
+
"@backstage/backend-test-utils": "1.3.0-next.3",
|
|
168
168
|
"@backstage/catalog-client": "1.9.1",
|
|
169
169
|
"@backstage/config": "1.3.2",
|
|
170
170
|
"@backstage/core-app-api": "1.15.5-next.0",
|
|
171
|
-
"@backstage/core-components": "0.16.4-next.
|
|
171
|
+
"@backstage/core-components": "0.16.4-next.1",
|
|
172
172
|
"@backstage/core-plugin-api": "1.10.4-next.0",
|
|
173
|
-
"@backstage/dev-utils": "1.1.7-next.
|
|
173
|
+
"@backstage/dev-utils": "1.1.7-next.3",
|
|
174
174
|
"@backstage/errors": "1.2.7",
|
|
175
|
-
"@backstage/plugin-auth-backend": "0.24.3-next.
|
|
176
|
-
"@backstage/plugin-auth-backend-module-guest-provider": "0.2.5-next.
|
|
177
|
-
"@backstage/plugin-catalog-node": "1.16.0-next.
|
|
178
|
-
"@backstage/plugin-scaffolder-node": "0.7.0-next.
|
|
179
|
-
"@backstage/plugin-scaffolder-node-test-utils": "0.1.19-next.
|
|
175
|
+
"@backstage/plugin-auth-backend": "0.24.3-next.3",
|
|
176
|
+
"@backstage/plugin-auth-backend-module-guest-provider": "0.2.5-next.2",
|
|
177
|
+
"@backstage/plugin-catalog-node": "1.16.0-next.3",
|
|
178
|
+
"@backstage/plugin-scaffolder-node": "0.7.0-next.2",
|
|
179
|
+
"@backstage/plugin-scaffolder-node-test-utils": "0.1.19-next.3",
|
|
180
180
|
"@backstage/test-utils": "1.7.5-next.0",
|
|
181
181
|
"@backstage/theme": "0.6.4-next.0",
|
|
182
182
|
"@rspack/core": "^1.0.10",
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
# {{
|
|
1
|
+
# {{pluginId}}
|
|
2
2
|
|
|
3
3
|
This plugin backend was templated using the Backstage CLI. You should replace this text with a description of your plugin backend.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
This plugin is installed via the `{{
|
|
7
|
+
This plugin is installed via the `{{packageName}}` package. To install it to your backend package, run the following command:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
# From your root directory
|
|
11
|
-
yarn --cwd packages/backend add {{
|
|
11
|
+
yarn --cwd packages/backend add {{packageName}}
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
Then add the plugin to your backend in `packages/backend/src/index.ts`:
|
|
@@ -16,7 +16,7 @@ Then add the plugin to your backend in `packages/backend/src/index.ts`:
|
|
|
16
16
|
```ts
|
|
17
17
|
const backend = createBackend();
|
|
18
18
|
// ...
|
|
19
|
-
backend.add(import('{{
|
|
19
|
+
backend.add(import('{{packageName}}'));
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
## Development
|
|
@@ -11,17 +11,17 @@ import { catalogServiceMock } from '@backstage/plugin-catalog-node/testUtils';
|
|
|
11
11
|
//
|
|
12
12
|
// Create a new todo item, standalone or for the sample component:
|
|
13
13
|
//
|
|
14
|
-
// curl http://localhost:7007/api/{{
|
|
15
|
-
// curl http://localhost:7007/api/{{
|
|
14
|
+
// curl http://localhost:7007/api/{{pluginId}}/todos -H 'Content-Type: application/json' -d '{"title": "My Todo"}'
|
|
15
|
+
// curl http://localhost:7007/api/{{pluginId}}/todos -H 'Content-Type: application/json' -d '{"title": "My Todo", "entityRef": "component:default/sample"}'
|
|
16
16
|
//
|
|
17
17
|
// List TODOs:
|
|
18
18
|
//
|
|
19
|
-
// curl http://localhost:7007/api/{{
|
|
19
|
+
// curl http://localhost:7007/api/{{pluginId}}/todos
|
|
20
20
|
//
|
|
21
21
|
// Explicitly make an unauthenticated request, or with service auth:
|
|
22
22
|
//
|
|
23
|
-
// curl http://localhost:7007/api/{{
|
|
24
|
-
// curl http://localhost:7007/api/{{
|
|
23
|
+
// curl http://localhost:7007/api/{{pluginId}}/todos -H 'Authorization: Bearer mock-none-token'
|
|
24
|
+
// curl http://localhost:7007/api/{{pluginId}}/todos -H 'Authorization: Bearer mock-service-token'
|
|
25
25
|
|
|
26
26
|
const backend = createBackend();
|
|
27
27
|
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "{{
|
|
3
|
-
"version": "{{pluginVersion}}",
|
|
2
|
+
"name": "{{packageName}}",
|
|
4
3
|
"main": "src/index.ts",
|
|
5
4
|
"types": "src/index.ts",
|
|
6
|
-
"license": "{{license}}",
|
|
7
|
-
{{#if privatePackage}}
|
|
8
|
-
"private": {{privatePackage}},
|
|
9
|
-
{{/if}}
|
|
10
5
|
"publishConfig": {
|
|
11
|
-
{{#if npmRegistry}}
|
|
12
|
-
"registry": "{{npmRegistry}}",
|
|
13
|
-
{{/if}}
|
|
14
6
|
"access": "public",
|
|
15
7
|
"main": "dist/index.cjs.js",
|
|
16
8
|
"types": "dist/index.d.ts"
|
|
@@ -17,12 +17,12 @@ describe('plugin', () => {
|
|
|
17
17
|
features: [{{pluginVar}}],
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
await request(server).get('/api/{{
|
|
20
|
+
await request(server).get('/api/{{pluginId}}/todos').expect(200, {
|
|
21
21
|
items: [],
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
const createRes = await request(server)
|
|
25
|
-
.post('/api/{{
|
|
25
|
+
.post('/api/{{pluginId}}/todos')
|
|
26
26
|
.send({ title: 'My Todo' });
|
|
27
27
|
|
|
28
28
|
expect(createRes.status).toBe(201);
|
|
@@ -36,13 +36,13 @@ describe('plugin', () => {
|
|
|
36
36
|
const createdTodoItem = createRes.body;
|
|
37
37
|
|
|
38
38
|
await request(server)
|
|
39
|
-
.get('/api/{{
|
|
39
|
+
.get('/api/{{pluginId}}/todos')
|
|
40
40
|
.expect(200, {
|
|
41
41
|
items: [createdTodoItem],
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
await request(server)
|
|
45
|
-
.get(`/api/{{
|
|
45
|
+
.get(`/api/{{pluginId}}/todos/${createdTodoItem.id}`)
|
|
46
46
|
.expect(200, createdTodoItem);
|
|
47
47
|
});
|
|
48
48
|
|
|
@@ -71,7 +71,7 @@ describe('plugin', () => {
|
|
|
71
71
|
});
|
|
72
72
|
|
|
73
73
|
const createRes = await request(server)
|
|
74
|
-
.post('/api/{{
|
|
74
|
+
.post('/api/{{pluginId}}/todos')
|
|
75
75
|
.send({ title: 'My Todo', entityRef: 'component:default/my-component' });
|
|
76
76
|
|
|
77
77
|
expect(createRes.status).toBe(201);
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "{{
|
|
2
|
+
"name": "{{packageName}}",
|
|
3
3
|
"description": "The {{moduleId}} backend module for the {{pluginId}} plugin.",
|
|
4
|
-
"version": "{{packageVersion}}",
|
|
5
4
|
"main": "src/index.ts",
|
|
6
5
|
"types": "src/index.ts",
|
|
7
|
-
"license": "{{license}}",
|
|
8
|
-
{{#if privatePackage}}
|
|
9
|
-
"private": {{privatePackage}},
|
|
10
|
-
{{/if}}
|
|
11
6
|
"publishConfig": {
|
|
12
|
-
{{#if npmRegistry}}
|
|
13
|
-
"registry": "{{npmRegistry}}",
|
|
14
|
-
{{/if}}
|
|
15
7
|
"access": "public",
|
|
16
8
|
"main": "dist/index.cjs.js",
|
|
17
9
|
"types": "dist/index.d.ts"
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# {{
|
|
1
|
+
# {{pluginId}}
|
|
2
2
|
|
|
3
|
-
Welcome to the {{
|
|
3
|
+
Welcome to the {{pluginId}} plugin!
|
|
4
4
|
|
|
5
5
|
_This plugin was created through the Backstage CLI_
|
|
6
6
|
|
|
7
7
|
## Getting started
|
|
8
8
|
|
|
9
|
-
Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn start` in the root directory, and then navigating to [/{{
|
|
9
|
+
Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn start` in the root directory, and then navigating to [/{{pluginId}}](http://localhost:3000/{{pluginId}}).
|
|
10
10
|
|
|
11
11
|
You can also serve the plugin in isolation by running `yarn start` in the plugin directory.
|
|
12
12
|
This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads.
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "{{
|
|
3
|
-
"version": "{{pluginVersion}}",
|
|
2
|
+
"name": "{{packageName}}",
|
|
4
3
|
"main": "src/index.ts",
|
|
5
4
|
"types": "src/index.ts",
|
|
6
|
-
"license": "{{license}}",
|
|
7
|
-
{{#if privatePackage}}
|
|
8
|
-
"private": {{privatePackage}},
|
|
9
|
-
{{/if}}
|
|
10
5
|
"publishConfig": {
|
|
11
|
-
{{#if npmRegistry}}
|
|
12
|
-
"registry": "{{npmRegistry}}",
|
|
13
|
-
{{/if}}
|
|
14
6
|
"access": "public",
|
|
15
7
|
"main": "dist/index.esm.js",
|
|
16
8
|
"types": "dist/index.d.ts"
|
|
@@ -23,7 +23,7 @@ describe('ExampleComponent', () => {
|
|
|
23
23
|
it('should render', async () => {
|
|
24
24
|
await renderInTestApp(<ExampleComponent />);
|
|
25
25
|
expect(
|
|
26
|
-
screen.getByText('Welcome to {{
|
|
26
|
+
screen.getByText('Welcome to {{pluginId}}!'),
|
|
27
27
|
).toBeInTheDocument();
|
|
28
28
|
});
|
|
29
29
|
});
|
|
@@ -13,7 +13,7 @@ import { ExampleFetchComponent } from '../ExampleFetchComponent';
|
|
|
13
13
|
|
|
14
14
|
export const ExampleComponent = () => (
|
|
15
15
|
<Page themeId="tool">
|
|
16
|
-
<Header title="Welcome to {{
|
|
16
|
+
<Header title="Welcome to {{pluginId}}!" subtitle="Optional subtitle">
|
|
17
17
|
<HeaderLabel label="Owner" value="Team X" />
|
|
18
18
|
<HeaderLabel label="Lifecycle" value="Alpha" />
|
|
19
19
|
</Header>
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "{{
|
|
3
|
-
"version": "{{pluginVersion}}",
|
|
2
|
+
"name": "{{packageName}}",
|
|
4
3
|
"main": "src/index.ts",
|
|
5
4
|
"types": "src/index.ts",
|
|
6
|
-
"license": "{{license}}",
|
|
7
|
-
{{#if privatePackage}}
|
|
8
|
-
"private": {{privatePackage}},
|
|
9
|
-
{{/if}}
|
|
10
5
|
"publishConfig": {
|
|
11
|
-
{{#if npmRegistry}}
|
|
12
|
-
"registry": "{{npmRegistry}}",
|
|
13
|
-
{{/if}}
|
|
14
6
|
"access": "public",
|
|
15
7
|
"main": "dist/index.cjs.js",
|
|
16
8
|
"types": "dist/index.d.ts"
|