@backstage/repo-tools 0.2.0 → 0.3.0
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 +20 -0
- package/dist/cjs/{constants-d6934676.cjs.js → constants-2eebdd79.cjs.js} +2 -2
- package/dist/cjs/{generate-9b41d8d7.cjs.js → generate-6f0190dd.cjs.js} +13 -4
- package/dist/cjs/{verify-be04e091.cjs.js → verify-46e56357.cjs.js} +3 -3
- package/dist/index.cjs.js +12 -7
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @backstage/repo-tools
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 799c33047ed: **BREAKING**: The OpenAPI commands are now found within the `schema openapi` sub-command. For example `yarn backstage-repo-tools schema:openapi:verify` is now `yarn backstage-repo-tools schema openapi verify`.
|
|
8
|
+
- 27956d78671: Generated OpenAPI files now have a `.generated.ts` file name and a warning header at the top, to highlight that they should not be edited by hand.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
- @backstage/cli-common@0.1.12
|
|
14
|
+
- @backstage/cli-node@0.1.0
|
|
15
|
+
- @backstage/errors@1.1.5
|
|
16
|
+
|
|
17
|
+
## 0.3.0-next.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- 27956d78671: Generated OpenAPI files now have a `.generated.ts` file name and a warning header at the top, to highlight that they should not be edited by hand.
|
|
22
|
+
|
|
3
23
|
## 0.2.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
|
@@ -32,11 +32,11 @@ async function runner(paths$1, command) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
const YAML_SCHEMA_PATH = "src/schema/openapi.yaml";
|
|
35
|
-
const TS_MODULE = "src/schema/openapi";
|
|
35
|
+
const TS_MODULE = "src/schema/openapi.generated";
|
|
36
36
|
const TS_SCHEMA_PATH = `${TS_MODULE}.ts`;
|
|
37
37
|
|
|
38
38
|
exports.TS_MODULE = TS_MODULE;
|
|
39
39
|
exports.TS_SCHEMA_PATH = TS_SCHEMA_PATH;
|
|
40
40
|
exports.YAML_SCHEMA_PATH = YAML_SCHEMA_PATH;
|
|
41
41
|
exports.runner = runner;
|
|
42
|
-
//# sourceMappingURL=constants-
|
|
42
|
+
//# sourceMappingURL=constants-2eebdd79.cjs.js.map
|
|
@@ -4,10 +4,10 @@ var fs = require('fs-extra');
|
|
|
4
4
|
var YAML = require('js-yaml');
|
|
5
5
|
var chalk = require('chalk');
|
|
6
6
|
var path = require('path');
|
|
7
|
-
var
|
|
7
|
+
var paths = require('./paths-9ab9b8a8.cjs.js');
|
|
8
|
+
var constants = require('./constants-2eebdd79.cjs.js');
|
|
8
9
|
var util = require('util');
|
|
9
10
|
var child_process = require('child_process');
|
|
10
|
-
require('./paths-9ab9b8a8.cjs.js');
|
|
11
11
|
require('@backstage/cli-common');
|
|
12
12
|
require('@backstage/cli-node');
|
|
13
13
|
require('minimatch');
|
|
@@ -33,9 +33,18 @@ async function generate(directoryPath, config) {
|
|
|
33
33
|
const tsPath = path.resolve(directoryPath, constants.TS_SCHEMA_PATH);
|
|
34
34
|
await fs__default["default"].writeFile(
|
|
35
35
|
tsPath,
|
|
36
|
-
|
|
36
|
+
`//
|
|
37
|
+
|
|
38
|
+
// ******************************************************************
|
|
39
|
+
// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. *
|
|
40
|
+
// ******************************************************************
|
|
41
|
+
|
|
42
|
+
export default ${JSON.stringify(yaml, null, 2)} as const;`
|
|
37
43
|
);
|
|
38
44
|
await exec(`yarn backstage-cli package lint --fix ${tsPath}`);
|
|
45
|
+
if (await paths.paths.resolveTargetRoot("node_modules/.bin/prettier")) {
|
|
46
|
+
await exec(`yarn prettier --write ${tsPath}`);
|
|
47
|
+
}
|
|
39
48
|
}
|
|
40
49
|
async function bulkCommand(paths = []) {
|
|
41
50
|
const resultsList = await constants.runner(
|
|
@@ -63,4 +72,4 @@ async function bulkCommand(paths = []) {
|
|
|
63
72
|
}
|
|
64
73
|
|
|
65
74
|
exports.bulkCommand = bulkCommand;
|
|
66
|
-
//# sourceMappingURL=generate-
|
|
75
|
+
//# sourceMappingURL=generate-6f0190dd.cjs.js.map
|
|
@@ -6,7 +6,7 @@ var lodash = require('lodash');
|
|
|
6
6
|
var path = require('path');
|
|
7
7
|
var chalk = require('chalk');
|
|
8
8
|
var Parser = require('@apidevtools/swagger-parser');
|
|
9
|
-
var constants = require('./constants-
|
|
9
|
+
var constants = require('./constants-2eebdd79.cjs.js');
|
|
10
10
|
var paths = require('./paths-9ab9b8a8.cjs.js');
|
|
11
11
|
require('p-limit');
|
|
12
12
|
require('@backstage/cli-common');
|
|
@@ -56,7 +56,7 @@ async function verify(directoryPath) {
|
|
|
56
56
|
if (!lodash.isEqual(schema.default, yaml)) {
|
|
57
57
|
const path$1 = path.relative(paths.paths.targetRoot, directoryPath);
|
|
58
58
|
throw new Error(
|
|
59
|
-
`\`${constants.YAML_SCHEMA_PATH}\` and \`${constants.TS_SCHEMA_PATH}\` do not match. Please run \`yarn backstage-repo-tools schema
|
|
59
|
+
`\`${constants.YAML_SCHEMA_PATH}\` and \`${constants.TS_SCHEMA_PATH}\` do not match. Please run \`yarn backstage-repo-tools schema openapi generate ${path$1}\` to regenerate \`${constants.TS_SCHEMA_PATH}\`.`
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -79,4 +79,4 @@ async function bulkCommand(paths = []) {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
exports.bulkCommand = bulkCommand;
|
|
82
|
-
//# sourceMappingURL=verify-
|
|
82
|
+
//# sourceMappingURL=verify-46e56357.cjs.js.map
|
package/dist/index.cjs.js
CHANGED
|
@@ -37,6 +37,16 @@ ${chalk__default["default"].red(`${error}`)}
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
function registerSchemaCommand(program) {
|
|
41
|
+
const command = program.command("schema [command]").description("Various tools for working with API schema");
|
|
42
|
+
const openApiCommand = command.command("openapi [command]").description("Tooling for OpenApi schema");
|
|
43
|
+
openApiCommand.command("verify [paths...]").description(
|
|
44
|
+
"Verify that all OpenAPI schemas are valid and have a matching `schemas/openapi.generated.ts` file."
|
|
45
|
+
).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/verify-46e56357.cjs.js'); }).then((m) => m.bulkCommand)));
|
|
46
|
+
openApiCommand.command("generate [paths...]").description(
|
|
47
|
+
"Generates a Typescript file from an OpenAPI yaml spec. For use with the `@backstage/backend-openapi-utils` ApiRouter type."
|
|
48
|
+
).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/generate-6f0190dd.cjs.js'); }).then((m) => m.bulkCommand)));
|
|
49
|
+
}
|
|
40
50
|
function registerCommands(program) {
|
|
41
51
|
program.command("api-reports [paths...]").option("--ci", "CI run checks that there is no changes on API reports").option("--tsc", "executes the tsc compilation before extracting the APIs").option("--docs", "generates the api documentation").option(
|
|
42
52
|
"--include <pattern>",
|
|
@@ -65,12 +75,7 @@ function registerCommands(program) {
|
|
|
65
75
|
)
|
|
66
76
|
);
|
|
67
77
|
program.command("type-deps").description("Find inconsistencies in types of all packages and plugins").action(lazy(() => Promise.resolve().then(function () { return require('./cjs/type-deps-5eacd931.cjs.js'); }).then((m) => m.default)));
|
|
68
|
-
program
|
|
69
|
-
"Verify that all OpenAPI schemas are valid and have a matching `schemas/openapi.ts` file."
|
|
70
|
-
).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/verify-be04e091.cjs.js'); }).then((m) => m.bulkCommand)));
|
|
71
|
-
program.command("schema:openapi:generate [paths...]").description(
|
|
72
|
-
"Generates a Typescript file from an OpenAPI yaml spec. For use with the `@backstage/backend-openapi-utils` ApiRouter type."
|
|
73
|
-
).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/generate-9b41d8d7.cjs.js'); }).then((m) => m.bulkCommand)));
|
|
78
|
+
registerSchemaCommand(program);
|
|
74
79
|
}
|
|
75
80
|
function lazy(getActionFunc) {
|
|
76
81
|
return async (...args) => {
|
|
@@ -85,7 +90,7 @@ function lazy(getActionFunc) {
|
|
|
85
90
|
};
|
|
86
91
|
}
|
|
87
92
|
|
|
88
|
-
var version = "0.
|
|
93
|
+
var version = "0.3.0";
|
|
89
94
|
|
|
90
95
|
const main = (argv) => {
|
|
91
96
|
commander.program.name("backstage-repo-tools").version(version);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/repo-tools",
|
|
3
3
|
"description": "CLI for Backstage repo tooling ",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"ts-node": "^10.0.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@backstage/cli": "^0.22.
|
|
52
|
+
"@backstage/cli": "^0.22.7",
|
|
53
53
|
"@backstage/types": "^1.0.2",
|
|
54
54
|
"@types/is-glob": "^4.0.2",
|
|
55
55
|
"@types/mock-fs": "^4.13.0",
|