@backstage/repo-tools 0.13.1 → 0.13.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 +13 -0
- package/dist/commands/api-reports/cli-reports/generateCliReport.cjs.js +15 -16
- package/dist/commands/api-reports/cli-reports/runCliExtraction.cjs.js +33 -25
- package/dist/commands/lint-legacy-backend-exports/lint-legacy-backend-exports.cjs.js +15 -1
- package/dist/package.json.cjs.js +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @backstage/repo-tools
|
|
2
2
|
|
|
3
|
+
## 0.13.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 18ce51c: Checking up the files where `createRouter` has been declared and check if `@deprecated` tag exists. If it does not exist then only the message will appear.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/backend-plugin-api@1.3.0
|
|
10
|
+
- @backstage/catalog-model@1.7.3
|
|
11
|
+
- @backstage/cli-common@0.1.15
|
|
12
|
+
- @backstage/cli-node@0.2.13
|
|
13
|
+
- @backstage/config-loader@1.10.0
|
|
14
|
+
- @backstage/errors@1.2.7
|
|
15
|
+
|
|
3
16
|
## 0.13.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
function generateCliReport(options) {
|
|
4
|
+
const { model, packageName } = options;
|
|
4
5
|
const content = [
|
|
5
|
-
`## CLI Report file for "${
|
|
6
|
+
`## CLI Report file for "${packageName}"`,
|
|
6
7
|
"",
|
|
7
8
|
"> Do not edit this file. It is a report generated by `yarn build:api-reports`",
|
|
8
9
|
""
|
|
9
10
|
];
|
|
10
|
-
for (const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
content.push("", "Options:", ...helpPage.options.map((l) => ` ${l}`));
|
|
20
|
-
}
|
|
21
|
-
if (helpPage.commands.length > 0) {
|
|
22
|
-
content.push("", "Commands:", ...helpPage.commands.map((l) => ` ${l}`));
|
|
23
|
-
}
|
|
24
|
-
content.push("```", "");
|
|
11
|
+
for (const helpPage of model.helpPages) {
|
|
12
|
+
content.push(
|
|
13
|
+
`### \`${[model.name, ...helpPage.path].join(" ")}\``,
|
|
14
|
+
"",
|
|
15
|
+
"```",
|
|
16
|
+
`Usage: ${helpPage.usage ?? "<none>"}`
|
|
17
|
+
);
|
|
18
|
+
if (helpPage.options.length > 0) {
|
|
19
|
+
content.push("", "Options:", ...helpPage.options.map((l) => ` ${l}`));
|
|
25
20
|
}
|
|
21
|
+
if (helpPage.commands.length > 0) {
|
|
22
|
+
content.push("", "Commands:", ...helpPage.commands.map((l) => ` ${l}`));
|
|
23
|
+
}
|
|
24
|
+
content.push("```", "");
|
|
26
25
|
}
|
|
27
26
|
return content.join("\n");
|
|
28
27
|
}
|
|
@@ -40,6 +40,9 @@ function parseHelpPage(helpPageContent) {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
+
options.sort();
|
|
44
|
+
commands.sort();
|
|
45
|
+
commandArguments.sort();
|
|
43
46
|
return {
|
|
44
47
|
usage,
|
|
45
48
|
options,
|
|
@@ -89,33 +92,38 @@ async function runCliExtraction({
|
|
|
89
92
|
models.push({ name, helpPages });
|
|
90
93
|
}
|
|
91
94
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
`The conflicting file is ${path.relative(
|
|
110
|
-
paths.paths.targetRoot,
|
|
111
|
-
reportPath
|
|
112
|
-
)}, expecting the following content:`
|
|
113
|
-
);
|
|
114
|
-
console.log("");
|
|
115
|
-
console.log(report);
|
|
95
|
+
for (const model of models) {
|
|
96
|
+
const report = generateCliReport.generateCliReport({ packageName: pkgJson.name, model });
|
|
97
|
+
const reportPath = path.resolve(
|
|
98
|
+
fullDir,
|
|
99
|
+
`cli-report.${models.length === 1 ? "" : `${model.name}.`}md`
|
|
100
|
+
);
|
|
101
|
+
const existingReport = await fs__default.default.readFile(reportPath, "utf8").catch((error) => {
|
|
102
|
+
if (error.code === "ENOENT") {
|
|
103
|
+
return void 0;
|
|
104
|
+
}
|
|
105
|
+
throw error;
|
|
106
|
+
});
|
|
107
|
+
if (existingReport !== report) {
|
|
108
|
+
if (isLocalBuild) {
|
|
109
|
+
console.warn(`CLI report changed for ${packageDir}`);
|
|
110
|
+
await fs__default.default.writeFile(reportPath, report);
|
|
111
|
+
} else {
|
|
116
112
|
logApiReportInstructions.logApiReportInstructions();
|
|
113
|
+
if (existingReport) {
|
|
114
|
+
console.log("");
|
|
115
|
+
console.log(
|
|
116
|
+
`The conflicting file is ${path.relative(
|
|
117
|
+
paths.paths.targetRoot,
|
|
118
|
+
reportPath
|
|
119
|
+
)}, expecting the following content:`
|
|
120
|
+
);
|
|
121
|
+
console.log("");
|
|
122
|
+
console.log(report);
|
|
123
|
+
logApiReportInstructions.logApiReportInstructions();
|
|
124
|
+
}
|
|
125
|
+
throw new Error(`CLI report changed for ${packageDir}, `);
|
|
117
126
|
}
|
|
118
|
-
throw new Error(`CLI report changed for ${packageDir}, `);
|
|
119
127
|
}
|
|
120
128
|
}
|
|
121
129
|
}
|
|
@@ -49,12 +49,26 @@ function verifyIndex(pkg, packageJson) {
|
|
|
49
49
|
console.log(" \u274C Missing default export");
|
|
50
50
|
}
|
|
51
51
|
let createRouterDeprecated = void 0;
|
|
52
|
+
let routerCreateRouterDeprecated = void 0;
|
|
52
53
|
if (createRouterExport) {
|
|
53
54
|
createRouterDeprecated = createRouterExport.getJsDocTags().find((tag) => tag.getName() === "deprecated");
|
|
55
|
+
const declarations = createRouterExport?.getDeclarations();
|
|
56
|
+
const firstDeclaration = declarations?.[0];
|
|
57
|
+
let resolvedSymbol = void 0;
|
|
58
|
+
if (firstDeclaration) {
|
|
59
|
+
resolvedSymbol = createRouterExport.getAliasedSymbol();
|
|
60
|
+
if (resolvedSymbol) {
|
|
61
|
+
const resolvedDeclarations = resolvedSymbol.getDeclarations();
|
|
62
|
+
const resolvedDeclaration = resolvedDeclarations?.[0];
|
|
63
|
+
if (resolvedDeclaration) {
|
|
64
|
+
routerCreateRouterDeprecated = resolvedDeclaration.getSymbol()?.getJsDocTags().find((tag) => tag.getName() === "deprecated");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
54
68
|
}
|
|
55
69
|
if (createRouterExport) {
|
|
56
70
|
console.log(" \u274C createRouter is exported");
|
|
57
|
-
if (!createRouterDeprecated)
|
|
71
|
+
if (!createRouterDeprecated && !routerCreateRouterDeprecated)
|
|
58
72
|
console.log(" \u274C createRouter is NOT deprecated");
|
|
59
73
|
}
|
|
60
74
|
const pkgJson = packageJson ?? readPackageJson(pkg);
|
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.13.
|
|
3
|
+
"version": "0.13.2",
|
|
4
4
|
"description": "CLI for Backstage repo tooling ",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "cli"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@apidevtools/swagger-parser": "^10.1.0",
|
|
45
45
|
"@apisyouwonthate/style-guide": "^1.4.0",
|
|
46
|
-
"@backstage/backend-plugin-api": "^1.
|
|
46
|
+
"@backstage/backend-plugin-api": "^1.3.0",
|
|
47
47
|
"@backstage/catalog-model": "^1.7.3",
|
|
48
48
|
"@backstage/cli-common": "^0.1.15",
|
|
49
49
|
"@backstage/cli-node": "^0.2.13",
|
|
@@ -84,8 +84,8 @@
|
|
|
84
84
|
"yaml-diff-patch": "^2.0.0"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
|
-
"@backstage/backend-test-utils": "^1.
|
|
88
|
-
"@backstage/cli": "^0.
|
|
87
|
+
"@backstage/backend-test-utils": "^1.4.0",
|
|
88
|
+
"@backstage/cli": "^0.32.0",
|
|
89
89
|
"@backstage/types": "^1.2.1",
|
|
90
90
|
"@types/is-glob": "^4.0.2",
|
|
91
91
|
"@types/node": "^20.16.0",
|