@backstage/repo-tools 0.19.2-next.2 → 0.19.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 CHANGED
@@ -1,5 +1,30 @@
1
1
  # @backstage/repo-tools
2
2
 
3
+ ## 0.19.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
+ - 466bbea: Fixed CLI report generation failing when the `FORCE_COLOR` environment variable is set.
10
+ - 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.
11
+ - a281164: Updated SQL report generation to support newer Knex releases.
12
+ - Updated dependencies
13
+ - @backstage/cli-node@0.3.5
14
+ - @backstage/backend-plugin-api@1.11.0
15
+ - @backstage/config-loader@1.11.4
16
+ - @backstage/errors@1.3.2
17
+ - @backstage/catalog-model@1.10.2
18
+ - @backstage/cli-common@0.3.2
19
+
20
+ ## 0.19.2-next.3
21
+
22
+ ### Patch Changes
23
+
24
+ - 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.
25
+ - Updated dependencies
26
+ - @backstage/backend-plugin-api@1.11.0-next.2
27
+
3
28
  ## 0.19.2-next.2
4
29
 
5
30
  ### Patch Changes
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var tryRunPrettier = require('../common/tryRunPrettier.cjs.js');
4
+ require('diff');
4
5
  var cliCommon = require('@backstage/cli-common');
5
6
 
6
7
  let applied = false;
@@ -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 "report\.api\.md"/
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
- console.log("");
241
- console.log(
242
- `The conflicting file is ${path.relative(
243
- tmpDir,
244
- conflictingFile
245
- )}, with the following content:`
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
- if (existingReport) {
134
- console.log("");
135
- console.log(
136
- `The conflicting file is ${path.relative(
137
- cliCommon.targetPaths.rootDir,
138
- reportPath
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
- if (existingReport) {
134
- console.log("");
135
- console.log(
136
- `The conflicting file is ${path.relative(
137
- cliCommon.targetPaths.rootDir,
138
- reportPath
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
- if (existingReport) {
122
- console.log("");
123
- console.log(
124
- `The conflicting file is ${path.relative(
125
- cliCommon.targetPaths.rootDir,
126
- reportPath
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
  }
@@ -18,9 +18,10 @@ function createBinRunner(cwd, path$1) {
18
18
  const args = path$1 ? [path$1, ...command] : command;
19
19
  const outPath = path.join(os.tmpdir(), `backstage-cli-out-${crypto.randomUUID()}.txt`);
20
20
  const outFd = fs.openSync(outPath, "w");
21
+ const { FORCE_COLOR: _, ...env } = process.env;
21
22
  const child = node_child_process.spawn("node", args, {
22
23
  cwd,
23
- env: { ...process.env, NO_COLOR: "1" },
24
+ env: { ...env, NO_COLOR: "1" },
24
25
  stdio: ["ignore", outFd, "pipe"]
25
26
  });
26
27
  fs.closeSync(outFd);
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.19.2-next.2";
3
+ var version = "0.19.2";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/repo-tools",
3
- "version": "0.19.2-next.2",
3
+ "version": "0.19.2",
4
4
  "description": "CLI for Backstage repo tooling ",
5
5
  "backstage": {
6
6
  "role": "cli"
@@ -43,12 +43,12 @@
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.1",
47
- "@backstage/catalog-model": "1.10.2-next.0",
48
- "@backstage/cli-common": "0.3.2-next.0",
49
- "@backstage/cli-node": "0.3.5-next.1",
50
- "@backstage/config-loader": "1.11.4-next.0",
51
- "@backstage/errors": "1.3.2-next.0",
46
+ "@backstage/backend-plugin-api": "^1.11.0",
47
+ "@backstage/catalog-model": "^1.10.2",
48
+ "@backstage/cli-common": "^0.3.2",
49
+ "@backstage/cli-node": "^0.3.5",
50
+ "@backstage/config-loader": "^1.11.4",
51
+ "@backstage/errors": "^1.3.2",
52
52
  "@electric-sql/pglite": "^0.5.8",
53
53
  "@manypkg/get-packages": "^1.1.3",
54
54
  "@microsoft/api-documenter": "^7.28.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,9 +87,9 @@
86
87
  "zod": "^3.25.76 || ^4.0.0"
87
88
  },
88
89
  "devDependencies": {
89
- "@backstage/backend-test-utils": "1.11.8-next.1",
90
- "@backstage/cli": "0.36.7-next.0",
91
- "@backstage/types": "1.2.2",
90
+ "@backstage/backend-test-utils": "^1.11.8",
91
+ "@backstage/cli": "^0.36.7",
92
+ "@backstage/types": "^1.2.2",
92
93
  "@types/is-glob": "^4.0.2",
93
94
  "@types/node": "^22.13.14",
94
95
  "@types/prettier": "^2.0.0",