@backstage/repo-tools 0.19.2-next.2 → 0.19.2-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 +8 -0
- package/dist/commands/api-reports/api-reports/patchApiReportGeneration.cjs.js +1 -0
- package/dist/commands/api-reports/api-reports/runApiExtraction.cjs.js +14 -15
- package/dist/commands/api-reports/cli-reports/runCliExtraction.cjs.js +7 -12
- package/dist/commands/api-reports/common/logReportDiff.cjs.js +29 -0
- package/dist/commands/api-reports/sql-reports/runSqlExtraction.cjs.js +7 -12
- package/dist/commands/knip-reports/knip-extractor.cjs.js +7 -12
- package/dist/package.json.cjs.js +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @backstage/repo-tools
|
|
2
2
|
|
|
3
|
+
## 0.19.2-next.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- dec6175: When an API, CLI, SQL, or knip report is out of date in CI, the error output now shows a diff of the changes that need to be committed instead of printing the full expected report.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/backend-plugin-api@1.11.0-next.2
|
|
10
|
+
|
|
3
11
|
## 0.19.2-next.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -10,13 +10,13 @@ var path = require('node:path');
|
|
|
10
10
|
var getPackageExportDetails = require('../../../lib/getPackageExportDetails.cjs.js');
|
|
11
11
|
var cliCommon = require('@backstage/cli-common');
|
|
12
12
|
var logApiReportInstructions = require('../common/logApiReportInstructions.cjs.js');
|
|
13
|
+
var logReportDiff = require('../common/logReportDiff.cjs.js');
|
|
13
14
|
var patchApiReportGeneration = require('./patchApiReportGeneration.cjs.js');
|
|
14
15
|
|
|
15
16
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
16
17
|
|
|
17
18
|
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
18
19
|
|
|
19
|
-
const tmpDir = cliCommon.targetPaths.resolveRoot("./node_modules/.cache/api-extractor");
|
|
20
20
|
async function countApiReportWarnings(reportPath) {
|
|
21
21
|
try {
|
|
22
22
|
const content = await fs__default.default.readFile(reportPath, "utf8");
|
|
@@ -194,15 +194,12 @@ async function runApiExtraction({
|
|
|
194
194
|
showVerboseMessages: false,
|
|
195
195
|
showDiagnostics: false,
|
|
196
196
|
messageCallback(message) {
|
|
197
|
-
if (message.text.includes("The API report file is missing")
|
|
198
|
-
shouldLogInstructions = true;
|
|
199
|
-
}
|
|
200
|
-
if (message.text.includes(
|
|
197
|
+
if (message.text.includes("The API report file is missing") || message.text.includes(
|
|
201
198
|
"You have changed the API signature for this project."
|
|
202
199
|
)) {
|
|
203
200
|
shouldLogInstructions = true;
|
|
204
201
|
const match = message.text.match(
|
|
205
|
-
/Please copy the file "(.*)" to "
|
|
202
|
+
/Please copy the file "(.*)" to "[^"]*\.api\.md"/
|
|
206
203
|
);
|
|
207
204
|
if (match) {
|
|
208
205
|
conflictingFile = match[1];
|
|
@@ -237,16 +234,18 @@ async function runApiExtraction({
|
|
|
237
234
|
if (shouldLogInstructions) {
|
|
238
235
|
logApiReportInstructions.logApiReportInstructions();
|
|
239
236
|
if (conflictingFile) {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
237
|
+
const existing = await fs__default.default.readFile(extractorConfig.reportFilePath, "utf8").catch((error) => {
|
|
238
|
+
if (error.code === "ENOENT") {
|
|
239
|
+
return void 0;
|
|
240
|
+
}
|
|
241
|
+
throw error;
|
|
242
|
+
});
|
|
243
|
+
const expected = await fs__default.default.readFile(conflictingFile, "utf8");
|
|
244
|
+
logReportDiff.logReportDiff(
|
|
245
|
+
path.relative(cliCommon.targetPaths.rootDir, extractorConfig.reportFilePath),
|
|
246
|
+
existing,
|
|
247
|
+
expected
|
|
246
248
|
);
|
|
247
|
-
console.log("");
|
|
248
|
-
const content = await fs__default.default.readFile(conflictingFile, "utf8");
|
|
249
|
-
console.log(content);
|
|
250
249
|
logApiReportInstructions.logApiReportInstructions();
|
|
251
250
|
}
|
|
252
251
|
}
|
|
@@ -8,6 +8,7 @@ var util = require('../../util.cjs.js');
|
|
|
8
8
|
var cliCommon = require('@backstage/cli-common');
|
|
9
9
|
var generateCliReport = require('./generateCliReport.cjs.js');
|
|
10
10
|
var logApiReportInstructions = require('../common/logApiReportInstructions.cjs.js');
|
|
11
|
+
var logReportDiff = require('../common/logReportDiff.cjs.js');
|
|
11
12
|
|
|
12
13
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
13
14
|
|
|
@@ -130,18 +131,12 @@ async function runCliExtraction({
|
|
|
130
131
|
await fs__default.default.writeFile(reportPath, report);
|
|
131
132
|
} else {
|
|
132
133
|
logApiReportInstructions.logApiReportInstructions();
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
)}, expecting the following content:`
|
|
140
|
-
);
|
|
141
|
-
console.log("");
|
|
142
|
-
console.log(report);
|
|
143
|
-
logApiReportInstructions.logApiReportInstructions();
|
|
144
|
-
}
|
|
134
|
+
logReportDiff.logReportDiff(
|
|
135
|
+
path.relative(cliCommon.targetPaths.rootDir, reportPath),
|
|
136
|
+
existingReport,
|
|
137
|
+
report
|
|
138
|
+
);
|
|
139
|
+
logApiReportInstructions.logApiReportInstructions();
|
|
145
140
|
throw new Error(`CLI report changed for ${packageDir}`);
|
|
146
141
|
}
|
|
147
142
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var diff = require('diff');
|
|
4
|
+
|
|
5
|
+
function formatReportDiff(path, existing, expected) {
|
|
6
|
+
const patch = diff.createTwoFilesPatch(
|
|
7
|
+
existing === void 0 ? "/dev/null" : `a/${path}`,
|
|
8
|
+
`b/${path}`,
|
|
9
|
+
existing ?? "",
|
|
10
|
+
expected,
|
|
11
|
+
void 0,
|
|
12
|
+
void 0,
|
|
13
|
+
{ context: 3 }
|
|
14
|
+
);
|
|
15
|
+
return patch.split("\n").filter((line) => !line.startsWith("Index: ") && !line.startsWith("=====")).join("\n").trimEnd();
|
|
16
|
+
}
|
|
17
|
+
function logReportDiff(path, existing, expected) {
|
|
18
|
+
console.log("");
|
|
19
|
+
console.log(
|
|
20
|
+
`The report ${path} is out of date. These are the changes that need to be committed:`
|
|
21
|
+
);
|
|
22
|
+
console.log("");
|
|
23
|
+
console.log(formatReportDiff(path, existing, expected));
|
|
24
|
+
console.log("");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
exports.formatReportDiff = formatReportDiff;
|
|
28
|
+
exports.logReportDiff = logReportDiff;
|
|
29
|
+
//# sourceMappingURL=logReportDiff.cjs.js.map
|
|
@@ -8,6 +8,7 @@ var getPgSchemaInfo = require('./getPgSchemaInfo.cjs.js');
|
|
|
8
8
|
var generateSqlReport = require('./generateSqlReport.cjs.js');
|
|
9
9
|
var tryRunPrettier = require('../common/tryRunPrettier.cjs.js');
|
|
10
10
|
var logApiReportInstructions = require('../common/logApiReportInstructions.cjs.js');
|
|
11
|
+
var logReportDiff = require('../common/logReportDiff.cjs.js');
|
|
11
12
|
|
|
12
13
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
13
14
|
|
|
@@ -130,18 +131,12 @@ async function runSingleSqlExtraction(targetDir, migrationTarget, pkgName, knex,
|
|
|
130
131
|
await fs__default.default.writeFile(reportPath, report);
|
|
131
132
|
} else {
|
|
132
133
|
logApiReportInstructions.logApiReportInstructions();
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
)}, expecting the following content:`
|
|
140
|
-
);
|
|
141
|
-
console.log("");
|
|
142
|
-
console.log(report);
|
|
143
|
-
logApiReportInstructions.logApiReportInstructions();
|
|
144
|
-
}
|
|
134
|
+
logReportDiff.logReportDiff(
|
|
135
|
+
path.relative(cliCommon.targetPaths.rootDir, reportPath),
|
|
136
|
+
existingReport,
|
|
137
|
+
report
|
|
138
|
+
);
|
|
139
|
+
logApiReportInstructions.logApiReportInstructions();
|
|
145
140
|
throw new Error(`Report ${reportPath} is out of date`);
|
|
146
141
|
}
|
|
147
142
|
}
|
|
@@ -6,6 +6,7 @@ var os = require('node:os');
|
|
|
6
6
|
var path = require('node:path');
|
|
7
7
|
var fs = require('fs-extra');
|
|
8
8
|
var util = require('../util.cjs.js');
|
|
9
|
+
var logReportDiff = require('../api-reports/common/logReportDiff.cjs.js');
|
|
9
10
|
|
|
10
11
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
11
12
|
|
|
@@ -118,18 +119,12 @@ async function handlePackage({
|
|
|
118
119
|
await fs__default.default.writeFile(reportPath, report);
|
|
119
120
|
} else {
|
|
120
121
|
logKnipReportInstructions();
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
)}, expecting the following content:`
|
|
128
|
-
);
|
|
129
|
-
console.log("");
|
|
130
|
-
console.log(report);
|
|
131
|
-
logKnipReportInstructions();
|
|
132
|
-
}
|
|
122
|
+
logReportDiff.logReportDiff(
|
|
123
|
+
path.relative(cliCommon.targetPaths.rootDir, reportPath),
|
|
124
|
+
existingReport,
|
|
125
|
+
report
|
|
126
|
+
);
|
|
127
|
+
logKnipReportInstructions();
|
|
133
128
|
throw new Error(`Knip report changed for ${packageDir}, `);
|
|
134
129
|
}
|
|
135
130
|
}
|
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.3",
|
|
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.11.0-next.
|
|
46
|
+
"@backstage/backend-plugin-api": "1.11.0-next.2",
|
|
47
47
|
"@backstage/catalog-model": "1.10.2-next.0",
|
|
48
48
|
"@backstage/cli-common": "0.3.2-next.0",
|
|
49
49
|
"@backstage/cli-node": "0.3.5-next.1",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"codeowners-utils": "^1.0.2",
|
|
68
68
|
"command-exists": "^1.2.9",
|
|
69
69
|
"commander": "^14.0.3",
|
|
70
|
+
"diff": "^9.0.0",
|
|
70
71
|
"fs-extra": "^11.2.0",
|
|
71
72
|
"glob": "^13.0.0",
|
|
72
73
|
"globby": "^11.0.0",
|
|
@@ -86,7 +87,7 @@
|
|
|
86
87
|
"zod": "^3.25.76 || ^4.0.0"
|
|
87
88
|
},
|
|
88
89
|
"devDependencies": {
|
|
89
|
-
"@backstage/backend-test-utils": "1.11.8-next.
|
|
90
|
+
"@backstage/backend-test-utils": "1.11.8-next.2",
|
|
90
91
|
"@backstage/cli": "0.36.7-next.0",
|
|
91
92
|
"@backstage/types": "1.2.2",
|
|
92
93
|
"@types/is-glob": "^4.0.2",
|