Skip to content

Commit 0524305

Browse files
cAttteGerrit0
authored andcommitted
refactor: access 'pretty' option directly from generateJson()
1 parent d5930e0 commit 0524305

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

bin/typedoc

+2-4
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ async function run(app) {
6666
}
6767
const json = app.options.getValue("json");
6868
if (json) {
69-
const pretty = app.options.getValue("pretty");
70-
await app.generateJson(project, json, pretty);
69+
await app.generateJson(project, json);
7170
}
7271

7372
if (!out && !json) {
@@ -88,8 +87,7 @@ async function run(app) {
8887
}
8988
const json = app.options.getValue("json");
9089
if (json) {
91-
const pretty = app.options.getValue("pretty");
92-
await app.generateJson(project, json, pretty);
90+
await app.generateJson(project, json);
9391
}
9492

9593
if (!out && !json) {

scripts/rebuild_specs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ async function rebuildRendererTest() {
107107
app.options.setValue("entryPoints", app.expandInputFiles([src]));
108108
const project = app.convert();
109109
await app.generateDocs(project, out);
110-
await app.generateJson(project, path.join(out, "specs.json"), true);
110+
await app.generateJson(project, path.join(out, "specs.json"));
111111

112112
/**
113113
* Avoiding sync methods here is... difficult.

src/lib/application.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -388,13 +388,11 @@ export class Application extends ChildableComponent<
388388
* Run the converter for the given set of files and write the reflections to a json file.
389389
*
390390
* @param out The path and file name of the target file.
391-
* @param format Whether the JSON data should be formatted with tabs.
392391
* @returns Whether the JSON file could be written successfully.
393392
*/
394393
public async generateJson(
395394
project: ProjectReflection,
396-
out: string,
397-
format = true
395+
out: string
398396
): Promise<void> {
399397
out = Path.resolve(out);
400398
const eventData = {
@@ -406,7 +404,7 @@ export class Application extends ChildableComponent<
406404
end: eventData,
407405
});
408406

409-
const space = format ? "\t" : "";
407+
const space = this.application.options.getValue("pretty") ? "\t" : "";
410408
await FS.promises.writeFile(out, JSON.stringify(ser, null, space));
411409
this.logger.success("JSON written to %s", out);
412410
}

0 commit comments

Comments
 (0)