@backstage/repo-tools 0.12.2-next.3 → 0.13.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
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @backstage/repo-tools
|
|
2
2
|
|
|
3
|
+
## 0.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b78b2b0: Adds a new experimental hidden command `package-docs` for generating API documentation. This is currently only intended for use in the Backstage main repository.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 474b748: Improve knip reports by using a single workspace-based config
|
|
12
|
+
- 98ddf05: The `api-reports` command is now also able to generate SQL reports, enabled by the `--sql-reports` flag.
|
|
13
|
+
- cb76663: Internal refactor to support native ESM.
|
|
14
|
+
- ecd01a9: Internal refactor of API report generation.
|
|
15
|
+
- 58ec9e7: Removed older versions of React packages as a preparatory step for upgrading to React 19. This commit does not introduce any functional changes, but removes dependencies on previous React versions, allowing for a cleaner upgrade path in subsequent commits.
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @backstage/cli-node@0.2.13
|
|
18
|
+
- @backstage/config-loader@1.9.6
|
|
19
|
+
- @backstage/backend-plugin-api@1.2.0
|
|
20
|
+
- @backstage/catalog-model@1.7.3
|
|
21
|
+
- @backstage/cli-common@0.1.15
|
|
22
|
+
- @backstage/errors@1.2.7
|
|
23
|
+
|
|
3
24
|
## 0.12.2-next.3
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -128,6 +128,7 @@ function registerCommands(program) {
|
|
|
128
128
|
program.command("knip-reports [paths...]").option("--ci", "CI run checks that there is no changes on knip reports").description("Generate a knip report for selected packages").action(
|
|
129
129
|
lazy(() => import('./knip-reports/knip-reports.cjs.js'), "buildKnipReports")
|
|
130
130
|
);
|
|
131
|
+
program.command("package-docs [paths...]", { hidden: true }).description("EXPERIMENTAL: Generate package documentation").action(lazy(() => import('./package-docs/command.cjs.js'), "default"));
|
|
131
132
|
registerPackageCommand(program);
|
|
132
133
|
registerRepoCommand(program);
|
|
133
134
|
registerLintCommand(program);
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var child_process = require('child_process');
|
|
6
|
+
var util = require('util');
|
|
7
|
+
var paths = require('../../lib/paths.cjs.js');
|
|
8
|
+
var utils = require('./utils.cjs.js');
|
|
9
|
+
var promises = require('fs/promises');
|
|
10
|
+
var pLimit = require('p-limit');
|
|
11
|
+
|
|
12
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
13
|
+
|
|
14
|
+
var pLimit__default = /*#__PURE__*/_interopDefaultCompat(pLimit);
|
|
15
|
+
|
|
16
|
+
const limit = pLimit__default.default(8);
|
|
17
|
+
const execAsync = util.promisify(child_process.exec);
|
|
18
|
+
const EXCLUDE = [
|
|
19
|
+
"packages/app",
|
|
20
|
+
"packages/app-next",
|
|
21
|
+
"packages/app-next-example-plugin",
|
|
22
|
+
"packages/cli",
|
|
23
|
+
"packages/cli-common",
|
|
24
|
+
"packages/cli-node",
|
|
25
|
+
"packages/e2e-test",
|
|
26
|
+
"packages/e2e-test-utils",
|
|
27
|
+
"packages/opaque-internal",
|
|
28
|
+
"packages/techdocs-cli",
|
|
29
|
+
"packages/techdocs-cli-embedded-app",
|
|
30
|
+
"packages/yarn-plugin",
|
|
31
|
+
"packages/backend"
|
|
32
|
+
];
|
|
33
|
+
const HIGHLIGHT_LANGUAGES = [
|
|
34
|
+
"ts",
|
|
35
|
+
"tsx",
|
|
36
|
+
"yaml",
|
|
37
|
+
"bash",
|
|
38
|
+
"sh",
|
|
39
|
+
"shell",
|
|
40
|
+
"yml",
|
|
41
|
+
"jsx",
|
|
42
|
+
"diff",
|
|
43
|
+
"js",
|
|
44
|
+
"json"
|
|
45
|
+
];
|
|
46
|
+
function getExports(packageJson) {
|
|
47
|
+
if (packageJson.exports) {
|
|
48
|
+
return Object.values(packageJson.exports).filter(
|
|
49
|
+
(e) => !e.endsWith("package.json")
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
return [packageJson.main];
|
|
53
|
+
}
|
|
54
|
+
async function generateDocJson(pkg) {
|
|
55
|
+
const temporaryTsConfigPath = await utils.createTemporaryTsConfig(pkg);
|
|
56
|
+
const packageJson = JSON.parse(
|
|
57
|
+
await promises.readFile(paths.paths.resolveTargetRoot(pkg, "package.json"), "utf-8")
|
|
58
|
+
);
|
|
59
|
+
const exports = getExports(packageJson);
|
|
60
|
+
if (!exports.length || !exports.some((e) => e.startsWith("src") || e.startsWith("./src"))) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
await promises.mkdir(paths.paths.resolveTargetRoot(`dist-types`, pkg), {
|
|
65
|
+
recursive: true
|
|
66
|
+
});
|
|
67
|
+
const { stdout, stderr } = await execAsync(
|
|
68
|
+
[
|
|
69
|
+
paths.paths.resolveTargetRoot("node_modules/.bin/typedoc"),
|
|
70
|
+
"--json",
|
|
71
|
+
paths.paths.resolveTargetRoot(`dist-types`, pkg, "docs.json"),
|
|
72
|
+
"--tsconfig",
|
|
73
|
+
temporaryTsConfigPath,
|
|
74
|
+
"--basePath",
|
|
75
|
+
paths.paths.targetRoot,
|
|
76
|
+
"--skipErrorChecking",
|
|
77
|
+
...getExports(packageJson).flatMap((e) => [
|
|
78
|
+
"--entryPoints",
|
|
79
|
+
e
|
|
80
|
+
])
|
|
81
|
+
].join(" "),
|
|
82
|
+
{
|
|
83
|
+
cwd: pkg,
|
|
84
|
+
env: { ...process.env, NODE_OPTIONS: "--max-old-space-size=12288" }
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
console.log(`### Processed ${pkg}`);
|
|
88
|
+
console.log(stdout);
|
|
89
|
+
console.error(stderr);
|
|
90
|
+
} catch (e) {
|
|
91
|
+
console.error("Failed to generate docs for", pkg);
|
|
92
|
+
console.error(e);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async function packageDocs(paths$1 = [], opts) {
|
|
96
|
+
console.warn("!!! This is an experimental command !!!");
|
|
97
|
+
const selectedPackageDirs = await paths.resolvePackagePaths({
|
|
98
|
+
paths: paths$1,
|
|
99
|
+
include: opts.include,
|
|
100
|
+
exclude: opts.exclude
|
|
101
|
+
});
|
|
102
|
+
console.log(`### Generating docs.`);
|
|
103
|
+
await Promise.all(
|
|
104
|
+
selectedPackageDirs.map(
|
|
105
|
+
(pkg) => limit(async () => {
|
|
106
|
+
if (EXCLUDE.includes(pkg)) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
console.log(`### Processing ${pkg}`);
|
|
110
|
+
await generateDocJson(pkg);
|
|
111
|
+
})
|
|
112
|
+
)
|
|
113
|
+
);
|
|
114
|
+
const generatedPackageDirs = [];
|
|
115
|
+
for (const pkg of selectedPackageDirs) {
|
|
116
|
+
try {
|
|
117
|
+
const docsJsonPath = paths.paths.resolveTargetRoot(
|
|
118
|
+
`dist-types/${pkg}/docs.json`
|
|
119
|
+
);
|
|
120
|
+
const docsJson = JSON.parse(await promises.readFile(docsJsonPath, "utf-8"));
|
|
121
|
+
const index = docsJson.children?.find(
|
|
122
|
+
(child) => child.sources.some((e) => e.fileName.endsWith("src/index.ts"))
|
|
123
|
+
);
|
|
124
|
+
if (index) {
|
|
125
|
+
index.name = "index";
|
|
126
|
+
}
|
|
127
|
+
await promises.writeFile(docsJsonPath, JSON.stringify(docsJson, null, 2));
|
|
128
|
+
generatedPackageDirs.push(pkg);
|
|
129
|
+
} catch (e) {
|
|
130
|
+
if (e.code === "ENOENT") {
|
|
131
|
+
console.log("No docs.json found for", pkg);
|
|
132
|
+
} else {
|
|
133
|
+
throw e;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const { stdout, stderr } = await execAsync(
|
|
138
|
+
[
|
|
139
|
+
paths.paths.resolveTargetRoot("node_modules/.bin/typedoc"),
|
|
140
|
+
"--entryPointStrategy",
|
|
141
|
+
"merge",
|
|
142
|
+
...generatedPackageDirs.flatMap((pkg) => [
|
|
143
|
+
"--entryPoints",
|
|
144
|
+
`dist-types/${pkg}/docs.json`
|
|
145
|
+
]),
|
|
146
|
+
...HIGHLIGHT_LANGUAGES.flatMap((e) => ["--highlightLanguages", e]),
|
|
147
|
+
"--out",
|
|
148
|
+
paths.paths.resolveTargetRoot("type-docs")
|
|
149
|
+
].join(" "),
|
|
150
|
+
{
|
|
151
|
+
cwd: paths.paths.targetRoot
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
console.log(stdout);
|
|
155
|
+
console.error(stderr);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
exports.default = packageDocs;
|
|
159
|
+
//# sourceMappingURL=command.cjs.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var fs = require('fs-extra');
|
|
4
|
+
var paths = require('../../lib/paths.cjs.js');
|
|
5
|
+
|
|
6
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
7
|
+
|
|
8
|
+
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
9
|
+
|
|
10
|
+
async function createTemporaryTsConfig(dir) {
|
|
11
|
+
const path = paths.paths.resolveOwnRoot(dir, "tsconfig.typedoc.tmp.json");
|
|
12
|
+
process.once("exit", () => {
|
|
13
|
+
fs__default.default.removeSync(path);
|
|
14
|
+
});
|
|
15
|
+
let assetTypeFile = [];
|
|
16
|
+
try {
|
|
17
|
+
assetTypeFile = [
|
|
18
|
+
require.resolve("@backstage/cli/asset-types/asset-types.d.ts")
|
|
19
|
+
];
|
|
20
|
+
} catch {
|
|
21
|
+
}
|
|
22
|
+
await fs__default.default.writeJson(path, {
|
|
23
|
+
extends: "../../tsconfig.json",
|
|
24
|
+
include: [...assetTypeFile, "src"],
|
|
25
|
+
exclude: []
|
|
26
|
+
});
|
|
27
|
+
return path;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports.createTemporaryTsConfig = createTemporaryTsConfig;
|
|
31
|
+
//# sourceMappingURL=utils.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.
|
|
3
|
+
"version": "0.13.0",
|
|
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.2.0
|
|
47
|
-
"@backstage/catalog-model": "1.7.3",
|
|
48
|
-
"@backstage/cli-common": "0.1.15",
|
|
49
|
-
"@backstage/cli-node": "0.2.13
|
|
50
|
-
"@backstage/config-loader": "1.9.6
|
|
51
|
-
"@backstage/errors": "1.2.7",
|
|
46
|
+
"@backstage/backend-plugin-api": "^1.2.0",
|
|
47
|
+
"@backstage/catalog-model": "^1.7.3",
|
|
48
|
+
"@backstage/cli-common": "^0.1.15",
|
|
49
|
+
"@backstage/cli-node": "^0.2.13",
|
|
50
|
+
"@backstage/config-loader": "^1.9.6",
|
|
51
|
+
"@backstage/errors": "^1.2.7",
|
|
52
52
|
"@electric-sql/pglite": "^0.2.15",
|
|
53
53
|
"@manypkg/get-packages": "^1.1.3",
|
|
54
54
|
"@microsoft/api-documenter": "^7.25.7",
|
|
@@ -84,12 +84,13 @@
|
|
|
84
84
|
"yaml-diff-patch": "^2.0.0"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
|
-
"@backstage/backend-test-utils": "1.3.0
|
|
88
|
-
"@backstage/cli": "0.30.0
|
|
89
|
-
"@backstage/types": "1.2.1",
|
|
87
|
+
"@backstage/backend-test-utils": "^1.3.0",
|
|
88
|
+
"@backstage/cli": "^0.30.0",
|
|
89
|
+
"@backstage/types": "^1.2.1",
|
|
90
90
|
"@types/is-glob": "^4.0.2",
|
|
91
91
|
"@types/node": "^20.16.0",
|
|
92
|
-
"@types/prettier": "^2.0.0"
|
|
92
|
+
"@types/prettier": "^2.0.0",
|
|
93
|
+
"typedoc": "^0.27.6"
|
|
93
94
|
},
|
|
94
95
|
"peerDependencies": {
|
|
95
96
|
"@microsoft/api-extractor-model": "*",
|
|
@@ -97,11 +98,15 @@
|
|
|
97
98
|
"@microsoft/tsdoc-config": "*",
|
|
98
99
|
"@useoptic/optic": "^1.0.0",
|
|
99
100
|
"prettier": "^2.8.1",
|
|
101
|
+
"typedoc": "^0.27.0",
|
|
100
102
|
"typescript": "> 3.0.0"
|
|
101
103
|
},
|
|
102
104
|
"peerDependenciesMeta": {
|
|
103
105
|
"prettier": {
|
|
104
106
|
"optional": true
|
|
107
|
+
},
|
|
108
|
+
"typedoc": {
|
|
109
|
+
"optional": true
|
|
105
110
|
}
|
|
106
111
|
}
|
|
107
112
|
}
|