@backstage/repo-tools 0.19.2-next.1 → 0.19.2-next.2
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 +9 -0
- package/dist/commands/api-reports/cli-reports/runCliExtraction.cjs.js +4 -3
- package/dist/commands/generate-catalog-info/generate-catalog-info.cjs.js +22 -3
- package/dist/commands/package/schema/openapi/fuzz.cjs.js +2 -3
- package/dist/commands/package/schema/openapi/generate/server.cjs.js +3 -4
- package/dist/lib/openapi/helpers.cjs.js +4 -5
- package/dist/lib/yaml.cjs.js +11 -0
- package/dist/package.json.cjs.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @backstage/repo-tools
|
|
2
2
|
|
|
3
|
+
## 0.19.2-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b8c8132: CLI API reports now support help output with separate groups and commands sections, including commands nested within groups.
|
|
8
|
+
- 76ac6ed: Updated dependency `js-yaml` to `^5.0.0`.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @backstage/cli-node@0.3.5-next.1
|
|
11
|
+
|
|
3
12
|
## 0.19.2-next.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -23,7 +23,7 @@ function parseHelpPage(helpPageContent) {
|
|
|
23
23
|
}
|
|
24
24
|
const lines = helpPageContent.split(/\r?\n/);
|
|
25
25
|
let options = new Array();
|
|
26
|
-
|
|
26
|
+
const commands = new Array();
|
|
27
27
|
let commandArguments = new Array();
|
|
28
28
|
while (lines.length > 0) {
|
|
29
29
|
while (lines.length > 0 && !lines[0].endsWith(":")) {
|
|
@@ -39,8 +39,8 @@ function parseHelpPage(helpPageContent) {
|
|
|
39
39
|
const sectionItems = sectionLines.map((line) => line.match(/^\s{1,8}(.*?)\s\s+/)?.[1]).filter(Boolean);
|
|
40
40
|
if (sectionName === "options:" || sectionName === "flags:") {
|
|
41
41
|
options = sectionItems;
|
|
42
|
-
} else if (sectionName === "commands:") {
|
|
43
|
-
commands
|
|
42
|
+
} else if (sectionName === "commands:" || sectionName === "groups:") {
|
|
43
|
+
commands.push(...sectionItems);
|
|
44
44
|
} else if (sectionName === "arguments:") {
|
|
45
45
|
commandArguments = sectionItems;
|
|
46
46
|
} else if (sectionName === "usage:") {
|
|
@@ -150,5 +150,6 @@ async function runCliExtraction({
|
|
|
150
150
|
);
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
+
exports.parseHelpPage = parseHelpPage;
|
|
153
154
|
exports.runCliExtraction = runCliExtraction;
|
|
154
155
|
//# sourceMappingURL=runCliExtraction.cjs.js.map
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var YAML = require('js-yaml');
|
|
6
|
+
var yaml = require('../../lib/yaml.cjs.js');
|
|
6
7
|
var pLimit = require('p-limit');
|
|
7
8
|
var path = require('node:path');
|
|
8
9
|
var yamlDiffPatch = require('yaml-diff-patch');
|
|
@@ -13,7 +14,25 @@ var utils = require('./utils.cjs.js');
|
|
|
13
14
|
|
|
14
15
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
function _interopNamespaceCompat(e) {
|
|
18
|
+
if (e && typeof e === 'object' && 'default' in e) return e;
|
|
19
|
+
var n = Object.create(null);
|
|
20
|
+
if (e) {
|
|
21
|
+
Object.keys(e).forEach(function (k) {
|
|
22
|
+
if (k !== 'default') {
|
|
23
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
24
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return e[k]; }
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
n.default = e;
|
|
32
|
+
return Object.freeze(n);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var YAML__namespace = /*#__PURE__*/_interopNamespaceCompat(YAML);
|
|
17
36
|
var pLimit__default = /*#__PURE__*/_interopDefaultCompat(pLimit);
|
|
18
37
|
var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
|
|
19
38
|
|
|
@@ -87,7 +106,7 @@ async function createCatalogInfoYaml(options) {
|
|
|
87
106
|
if (dryRun) {
|
|
88
107
|
console.error(instruction);
|
|
89
108
|
} else {
|
|
90
|
-
await utils.writeFile(yamlPath,
|
|
109
|
+
await utils.writeFile(yamlPath, YAML__namespace.dump(entity));
|
|
91
110
|
}
|
|
92
111
|
return instruction;
|
|
93
112
|
}
|
|
@@ -100,7 +119,7 @@ async function fixCatalogInfoYaml(options) {
|
|
|
100
119
|
const safeName = utils.safeEntityName(packageJson.name);
|
|
101
120
|
let yamlJson;
|
|
102
121
|
try {
|
|
103
|
-
yamlJson =
|
|
122
|
+
yamlJson = yaml.loadYaml(yamlString);
|
|
104
123
|
} catch (e) {
|
|
105
124
|
throw new Error(`Unable to parse ${path.relative(".", yamlPath)}: ${e}`);
|
|
106
125
|
}
|
|
@@ -6,7 +6,7 @@ var chalk = require('chalk');
|
|
|
6
6
|
var exec = require('../../../../lib/exec.cjs.js');
|
|
7
7
|
var helpers = require('../../../../lib/openapi/helpers.cjs.js');
|
|
8
8
|
var configLoader = require('@backstage/config-loader');
|
|
9
|
-
var
|
|
9
|
+
var yaml = require('../../../../lib/yaml.cjs.js');
|
|
10
10
|
var path = require('node:path');
|
|
11
11
|
var commandExists = require('command-exists');
|
|
12
12
|
|
|
@@ -14,7 +14,6 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
14
14
|
|
|
15
15
|
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
16
16
|
var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
|
|
17
|
-
var YAML__default = /*#__PURE__*/_interopDefaultCompat(YAML);
|
|
18
17
|
|
|
19
18
|
async function fuzz(opts) {
|
|
20
19
|
const resolvedOpenapiPath = await helpers.getPathToCurrentOpenApiSpec();
|
|
@@ -26,7 +25,7 @@ async function fuzz(opts) {
|
|
|
26
25
|
);
|
|
27
26
|
process.exit(1);
|
|
28
27
|
}
|
|
29
|
-
const openapiSpec =
|
|
28
|
+
const openapiSpec = yaml.loadYaml(
|
|
30
29
|
await fs__default.default.readFile(resolvedOpenapiPath, "utf8")
|
|
31
30
|
);
|
|
32
31
|
const configSource = configLoader.ConfigSources.default({
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
4
4
|
var chalk = require('chalk');
|
|
5
5
|
var fs = require('fs-extra');
|
|
6
|
-
var
|
|
6
|
+
var yaml = require('../../../../../lib/yaml.cjs.js');
|
|
7
7
|
var path = require('node:path');
|
|
8
8
|
var exec = require('../../../../../lib/exec.cjs.js');
|
|
9
9
|
var constants = require('../../../../../lib/openapi/constants.cjs.js');
|
|
@@ -15,11 +15,10 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
15
15
|
|
|
16
16
|
var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
|
|
17
17
|
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
18
|
-
var YAML__default = /*#__PURE__*/_interopDefaultCompat(YAML);
|
|
19
18
|
|
|
20
19
|
async function generateSpecFile() {
|
|
21
20
|
const openapiPath = await helpers.getPathToCurrentOpenApiSpec();
|
|
22
|
-
const yaml =
|
|
21
|
+
const yaml$1 = yaml.loadYaml(await fs__default.default.readFile(openapiPath, "utf8"));
|
|
23
22
|
const tsPath = cliCommon.targetPaths.resolve(constants.TS_SCHEMA_PATH);
|
|
24
23
|
const schemaDir = path.dirname(tsPath);
|
|
25
24
|
await fs__default.default.mkdirp(schemaDir);
|
|
@@ -37,7 +36,7 @@ async function generateSpecFile() {
|
|
|
37
36
|
// ******************************************************************
|
|
38
37
|
import {createValidatedOpenApiRouterFromGeneratedEndpointMap} from '@backstage/backend-openapi-utils';
|
|
39
38
|
import {EndpointMap} from './apis';
|
|
40
|
-
export const spec = ${JSON.stringify(yaml, null, 2)} as const;
|
|
39
|
+
export const spec = ${JSON.stringify(yaml$1, null, 2)} as const;
|
|
41
40
|
export const createOpenApiRouter = async (
|
|
42
41
|
options?: Parameters<typeof createValidatedOpenApiRouterFromGeneratedEndpointMap>['1'],
|
|
43
42
|
) => createValidatedOpenApiRouterFromGeneratedEndpointMap<EndpointMap>(spec, options);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var Parser = require('@apidevtools/swagger-parser');
|
|
4
4
|
var fs = require('fs-extra');
|
|
5
|
-
var
|
|
5
|
+
var yaml = require('../yaml.cjs.js');
|
|
6
6
|
var lodash = require('lodash');
|
|
7
7
|
var cliCommon = require('@backstage/cli-common');
|
|
8
8
|
var path = require('node:path');
|
|
@@ -12,7 +12,6 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
12
12
|
|
|
13
13
|
var Parser__default = /*#__PURE__*/_interopDefaultCompat(Parser);
|
|
14
14
|
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
15
|
-
var YAML__default = /*#__PURE__*/_interopDefaultCompat(YAML);
|
|
16
15
|
|
|
17
16
|
const getPathToFile = async (directory, filename) => {
|
|
18
17
|
return path.resolve(directory, filename);
|
|
@@ -33,9 +32,9 @@ const getPathToCurrentOpenApiSpec = async () => {
|
|
|
33
32
|
return await assertExists(await getRelativePathToFile(constants.YAML_SCHEMA_PATH));
|
|
34
33
|
};
|
|
35
34
|
async function loadAndValidateOpenApiYaml(path) {
|
|
36
|
-
const yaml =
|
|
37
|
-
await Parser__default.default.validate(lodash.cloneDeep(yaml));
|
|
38
|
-
return yaml;
|
|
35
|
+
const yaml$1 = yaml.loadYaml(await fs__default.default.readFile(path, "utf8"));
|
|
36
|
+
await Parser__default.default.validate(lodash.cloneDeep(yaml$1));
|
|
37
|
+
return yaml$1;
|
|
39
38
|
}
|
|
40
39
|
function toGeneratorAdditionalProperties({
|
|
41
40
|
initialValue,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var YAML = require('js-yaml');
|
|
4
|
+
|
|
5
|
+
const YAML_SCHEMA = YAML.CORE_SCHEMA.withTags(YAML.mergeTag);
|
|
6
|
+
function loadYaml(source) {
|
|
7
|
+
return YAML.load(source, { schema: YAML_SCHEMA });
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
exports.loadYaml = loadYaml;
|
|
11
|
+
//# sourceMappingURL=yaml.cjs.js.map
|
package/dist/package.json.cjs.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/repo-tools",
|
|
3
|
-
"version": "0.19.2-next.
|
|
3
|
+
"version": "0.19.2-next.2",
|
|
4
4
|
"description": "CLI for Backstage repo tooling ",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "cli"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@backstage/backend-plugin-api": "1.11.0-next.1",
|
|
47
47
|
"@backstage/catalog-model": "1.10.2-next.0",
|
|
48
48
|
"@backstage/cli-common": "0.3.2-next.0",
|
|
49
|
-
"@backstage/cli-node": "0.3.5-next.
|
|
49
|
+
"@backstage/cli-node": "0.3.5-next.1",
|
|
50
50
|
"@backstage/config-loader": "1.11.4-next.0",
|
|
51
51
|
"@backstage/errors": "1.3.2-next.0",
|
|
52
52
|
"@electric-sql/pglite": "^0.5.8",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"glob": "^13.0.0",
|
|
72
72
|
"globby": "^11.0.0",
|
|
73
73
|
"is-glob": "^4.0.3",
|
|
74
|
-
"js-yaml": "^
|
|
74
|
+
"js-yaml": "^5.0.0",
|
|
75
75
|
"just-diff": "^6.0.2",
|
|
76
76
|
"knex": "^3.0.0",
|
|
77
77
|
"knex-pglite": "^0.14.0",
|