docs-util: fixes following packages reorg (#9326)
- Typescript config aren't picked up properly anymore since they're moved to `_tsconfig.base.json` in the root. So, we now read the config from the config file. - Update Typescript version in the `utils` monorepo to match that of the root monorepo
This commit is contained in:
@@ -28,7 +28,7 @@
|
|||||||
"pluralize": "^8.0.0",
|
"pluralize": "^8.0.0",
|
||||||
"prettier": "^3.2.4",
|
"prettier": "^3.2.4",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "5.5",
|
"typescript": "^5.6.2",
|
||||||
"utils": "*",
|
"utils": "*",
|
||||||
"yaml": "^2.3.4"
|
"yaml": "^2.3.4"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { CommonCliOptions } from "../../types/index.js"
|
|||||||
import { existsSync, readdirSync, statSync } from "node:fs"
|
import { existsSync, readdirSync, statSync } from "node:fs"
|
||||||
import path from "node:path"
|
import path from "node:path"
|
||||||
import getBasePath from "../../utils/get-base-path.js"
|
import getBasePath from "../../utils/get-base-path.js"
|
||||||
|
import getMonorepoRoot from "../../utils/get-monorepo-root.js"
|
||||||
|
|
||||||
export type Options = {
|
export type Options = {
|
||||||
paths: string[]
|
paths: string[]
|
||||||
@@ -50,7 +51,7 @@ abstract class AbstractGenerator {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
this.program = ts.createProgram(files, {})
|
this.program = ts.createProgram(files, this.getBaseCompilerOptions())
|
||||||
|
|
||||||
this.checker = this.program.getTypeChecker()
|
this.checker = this.program.getTypeChecker()
|
||||||
|
|
||||||
@@ -90,6 +91,23 @@ abstract class AbstractGenerator {
|
|||||||
this.program = undefined
|
this.program = undefined
|
||||||
this.checker = undefined
|
this.checker = undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getBaseCompilerOptions(): ts.CompilerOptions {
|
||||||
|
const monorepoPath = getMonorepoRoot()
|
||||||
|
const tsconfigBasePath = path.join(monorepoPath, "_tsconfig.base.json")
|
||||||
|
|
||||||
|
const configStr = ts.sys.readFile(tsconfigBasePath)
|
||||||
|
|
||||||
|
if (!configStr) {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ts.parseJsonConfigFileContent(
|
||||||
|
JSON.parse(configStr),
|
||||||
|
ts.sys,
|
||||||
|
monorepoPath
|
||||||
|
).options
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AbstractGenerator
|
export default AbstractGenerator
|
||||||
|
|||||||
@@ -37,6 +37,34 @@ class SchemaFactory {
|
|||||||
BigNumberValue: {
|
BigNumberValue: {
|
||||||
type: "number",
|
type: "number",
|
||||||
},
|
},
|
||||||
|
expand: {
|
||||||
|
type: "string",
|
||||||
|
title: "expand",
|
||||||
|
description:
|
||||||
|
"Comma-separated relations that should be expanded in the returned data.",
|
||||||
|
},
|
||||||
|
fields: {
|
||||||
|
type: "string",
|
||||||
|
title: "fields",
|
||||||
|
description:
|
||||||
|
"Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields. without prefix it will replace the entire default fields.",
|
||||||
|
},
|
||||||
|
offset: {
|
||||||
|
type: "number",
|
||||||
|
title: "offset",
|
||||||
|
description: "The number of items to skip when retrieving a list.",
|
||||||
|
},
|
||||||
|
limit: {
|
||||||
|
type: "number",
|
||||||
|
title: "limit",
|
||||||
|
description: "Limit the number of items returned in the list.",
|
||||||
|
},
|
||||||
|
order: {
|
||||||
|
type: "string",
|
||||||
|
title: "order",
|
||||||
|
description:
|
||||||
|
"The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with `-`.",
|
||||||
|
},
|
||||||
File: {
|
File: {
|
||||||
type: "object",
|
type: "object",
|
||||||
description: "A File to upload.",
|
description: "A File to upload.",
|
||||||
|
|||||||
@@ -35,7 +35,11 @@ export default class TypesHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleanUpTypes(types: ts.Type[]): ts.Type[] {
|
cleanUpTypes(types: ts.Type[]): ts.Type[] {
|
||||||
let cleanedUpTypes = this.removeStringRegExpTypeOverlaps(types)
|
let cleanedUpTypes = this.removeUndefinedNullTypes(types)
|
||||||
|
|
||||||
|
cleanedUpTypes = this.removeExtraBoolean(cleanedUpTypes)
|
||||||
|
|
||||||
|
cleanedUpTypes = this.removeStringRegExpTypeOverlaps(cleanedUpTypes)
|
||||||
|
|
||||||
cleanedUpTypes = this.joinDateAndString(cleanedUpTypes)
|
cleanedUpTypes = this.joinDateAndString(cleanedUpTypes)
|
||||||
|
|
||||||
@@ -80,4 +84,28 @@ export default class TypesHelper {
|
|||||||
|
|
||||||
return dateType && hasStringType ? [dateType] : types
|
return dateType && hasStringType ? [dateType] : types
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private removeUndefinedNullTypes(types: ts.Type[]): ts.Type[] {
|
||||||
|
return types.filter(
|
||||||
|
(type) =>
|
||||||
|
type.flags !== ts.TypeFlags.Undefined &&
|
||||||
|
type.flags !== ts.TypeFlags.Null
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private removeExtraBoolean(types: ts.Type[]): ts.Type[] {
|
||||||
|
let found = false
|
||||||
|
return types.filter((tsType) => {
|
||||||
|
if (tsType.flags !== ts.TypeFlags.BooleanLiteral) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found) {
|
||||||
|
found = true
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1356,7 +1356,9 @@ class OasKindGenerator extends FunctionKindGenerator {
|
|||||||
name: title,
|
name: title,
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
case "intrinsicName" in itemType && itemType.intrinsicName === "boolean":
|
case ("intrinsicName" in itemType &&
|
||||||
|
itemType.intrinsicName === "boolean") ||
|
||||||
|
itemType.flags === ts.TypeFlags.BooleanLiteral:
|
||||||
return {
|
return {
|
||||||
type: "boolean",
|
type: "boolean",
|
||||||
title: title || typeAsString,
|
title: title || typeAsString,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"typedoc": "^0.26.2",
|
"typedoc": "^0.26.2",
|
||||||
"typedoc-plugin-custom": "*",
|
"typedoc-plugin-custom": "*",
|
||||||
"typescript": "5.5",
|
"typescript": "^5.6.2",
|
||||||
"utils": "*"
|
"utils": "*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"glob": "^10.3.10",
|
"glob": "^10.3.10",
|
||||||
"randomcolor": "^0.6.2",
|
"randomcolor": "^0.6.2",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "5.5"
|
"typescript": "^5.6.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.12.10",
|
"@types/node": "^20.12.10",
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
"typedoc-plugin-rename-defaults": "^0.7.0",
|
"typedoc-plugin-rename-defaults": "^0.7.0",
|
||||||
"typedoc-plugin-workflows": "*",
|
"typedoc-plugin-workflows": "*",
|
||||||
"types": "*",
|
"types": "*",
|
||||||
"typescript": "5.5",
|
"typescript": "^5.6.2",
|
||||||
"utils": "*",
|
"utils": "*",
|
||||||
"yaml": "^2.3.4"
|
"yaml": "^2.3.4"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
"@types/eslint": "^8.56.6",
|
"@types/eslint": "^8.56.6",
|
||||||
"@types/node": "^20.12.10",
|
"@types/node": "^20.12.10",
|
||||||
"types": "*",
|
"types": "*",
|
||||||
"typescript": "5.5"
|
"typescript": "^5.6.2"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"typedocplugin",
|
"typedocplugin",
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
"copyfiles": "^2.4.1",
|
"copyfiles": "^2.4.1",
|
||||||
"typedoc": "^0.26.2",
|
"typedoc": "^0.26.2",
|
||||||
"types": "*",
|
"types": "*",
|
||||||
"typescript": "5.5"
|
"typescript": "^5.6.2"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"typedocplugin",
|
"typedocplugin",
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
"@types/eslint": "^8.56.6",
|
"@types/eslint": "^8.56.6",
|
||||||
"@types/node": "^20.12.10",
|
"@types/node": "^20.12.10",
|
||||||
"types": "*",
|
"types": "*",
|
||||||
"typescript": "5.5"
|
"typescript": "^5.6.2"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"typedocplugin",
|
"typedocplugin",
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
"typedoc": "0.26.x"
|
"typedoc": "0.26.x"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "5.5"
|
"typescript": "^5.6.2"
|
||||||
},
|
},
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"main": "./lib/index.js",
|
"main": "./lib/index.js",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.12.10",
|
"@types/node": "^20.12.10",
|
||||||
"typescript": "5.5"
|
"typescript": "^5.6.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"octokit": "^3.1.2",
|
"octokit": "^3.1.2",
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
"@mermaid-js/mermaid-cli": "^10.6.1",
|
"@mermaid-js/mermaid-cli": "^10.6.1",
|
||||||
"commander": "^11.1.0",
|
"commander": "^11.1.0",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "5.5"
|
"typescript": "^5.6.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.12.10"
|
"@types/node": "^20.12.10"
|
||||||
|
|||||||
+18
-18
@@ -2387,7 +2387,7 @@ __metadata:
|
|||||||
prettier: ^3.2.4
|
prettier: ^3.2.4
|
||||||
ts-node: ^10.9.1
|
ts-node: ^10.9.1
|
||||||
types: "*"
|
types: "*"
|
||||||
typescript: 5.5
|
typescript: ^5.6.2
|
||||||
utils: "*"
|
utils: "*"
|
||||||
yaml: ^2.3.4
|
yaml: ^2.3.4
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
@@ -4651,7 +4651,7 @@ __metadata:
|
|||||||
ts-node: ^10.9.1
|
ts-node: ^10.9.1
|
||||||
typedoc: ^0.26.2
|
typedoc: ^0.26.2
|
||||||
typedoc-plugin-custom: "*"
|
typedoc-plugin-custom: "*"
|
||||||
typescript: 5.5
|
typescript: ^5.6.2
|
||||||
utils: "*"
|
utils: "*"
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
typedoc: 0.25.x
|
typedoc: 0.25.x
|
||||||
@@ -4855,7 +4855,7 @@ __metadata:
|
|||||||
glob: ^10.3.10
|
glob: ^10.3.10
|
||||||
randomcolor: ^0.6.2
|
randomcolor: ^0.6.2
|
||||||
ts-node: ^10.9.1
|
ts-node: ^10.9.1
|
||||||
typescript: 5.5
|
typescript: ^5.6.2
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
@@ -5369,7 +5369,7 @@ __metadata:
|
|||||||
typedoc-plugin-rename-defaults: ^0.7.0
|
typedoc-plugin-rename-defaults: ^0.7.0
|
||||||
typedoc-plugin-workflows: "*"
|
typedoc-plugin-workflows: "*"
|
||||||
types: "*"
|
types: "*"
|
||||||
typescript: 5.5
|
typescript: ^5.6.2
|
||||||
utils: "*"
|
utils: "*"
|
||||||
yaml: ^2.3.4
|
yaml: ^2.3.4
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@@ -5387,7 +5387,7 @@ __metadata:
|
|||||||
glob: ^10.3.10
|
glob: ^10.3.10
|
||||||
minimatch: ^10.0.1
|
minimatch: ^10.0.1
|
||||||
types: "*"
|
types: "*"
|
||||||
typescript: 5.5
|
typescript: ^5.6.2
|
||||||
utils: "*"
|
utils: "*"
|
||||||
yaml: ^2.3.3
|
yaml: ^2.3.3
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@@ -5404,7 +5404,7 @@ __metadata:
|
|||||||
handlebars: ^4.7.8
|
handlebars: ^4.7.8
|
||||||
typedoc: ^0.26.2
|
typedoc: ^0.26.2
|
||||||
types: "*"
|
types: "*"
|
||||||
typescript: 5.5
|
typescript: ^5.6.2
|
||||||
utils: "*"
|
utils: "*"
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
typedoc: 0.26.x
|
typedoc: 0.26.x
|
||||||
@@ -5433,7 +5433,7 @@ __metadata:
|
|||||||
eslint: ^8.53.0
|
eslint: ^8.53.0
|
||||||
glob: ^10.3.10
|
glob: ^10.3.10
|
||||||
types: "*"
|
types: "*"
|
||||||
typescript: 5.5
|
typescript: ^5.6.2
|
||||||
utils: "*"
|
utils: "*"
|
||||||
yaml: ^2.3.3
|
yaml: ^2.3.3
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@@ -5462,29 +5462,29 @@ __metadata:
|
|||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "types@workspace:packages/types"
|
resolution: "types@workspace:packages/types"
|
||||||
dependencies:
|
dependencies:
|
||||||
typescript: 5.5
|
typescript: ^5.6.2
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
typedoc: 0.26.x
|
typedoc: 0.26.x
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
"typescript@npm:5.5":
|
"typescript@npm:^5.6.2":
|
||||||
version: 5.5.2
|
version: 5.6.2
|
||||||
resolution: "typescript@npm:5.5.2"
|
resolution: "typescript@npm:5.6.2"
|
||||||
bin:
|
bin:
|
||||||
tsc: bin/tsc
|
tsc: bin/tsc
|
||||||
tsserver: bin/tsserver
|
tsserver: bin/tsserver
|
||||||
checksum: 8ca39b27b5f9bd7f32db795045933ab5247897660627251e8254180b792a395bf061ea7231947d5d7ffa5cb4cc771970fd4ef543275f9b559f08c9325cccfce3
|
checksum: 3ed8297a8c7c56b7fec282532503d1ac795239d06e7c4966b42d4330c6cf433a170b53bcf93a130a7f14ccc5235de5560df4f1045eb7f3550b46ebed16d3c5e5
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"typescript@patch:typescript@5.5#~builtin<compat/typescript>":
|
"typescript@patch:typescript@^5.6.2#~builtin<compat/typescript>":
|
||||||
version: 5.5.2
|
version: 5.6.2
|
||||||
resolution: "typescript@patch:typescript@npm%3A5.5.2#~builtin<compat/typescript>::version=5.5.2&hash=7ad353"
|
resolution: "typescript@patch:typescript@npm%3A5.6.2#~builtin<compat/typescript>::version=5.6.2&hash=7ad353"
|
||||||
bin:
|
bin:
|
||||||
tsc: bin/tsc
|
tsc: bin/tsc
|
||||||
tsserver: bin/tsserver
|
tsserver: bin/tsserver
|
||||||
checksum: 6721ac8933a70c252d7b640b345792e103d881811ff660355617c1836526dbb71c2044e2e77a8823fb3570b469f33276875a4cab6d3c4de4ae7d7ee1c3074ae4
|
checksum: e6c1662e4852e22fe4bbdca471dca3e3edc74f6f1df043135c44a18a7902037023ccb0abdfb754595ca9028df8920f2f8492c00fc3cbb4309079aae8b7de71cd
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@@ -5635,7 +5635,7 @@ __metadata:
|
|||||||
"@types/node": ^20.12.10
|
"@types/node": ^20.12.10
|
||||||
octokit: ^3.1.2
|
octokit: ^3.1.2
|
||||||
rimraf: ^5.0.5
|
rimraf: ^5.0.5
|
||||||
typescript: 5.5
|
typescript: ^5.6.2
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
typedoc: 0.26.x
|
typedoc: 0.26.x
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
@@ -5722,7 +5722,7 @@ __metadata:
|
|||||||
"@types/node": ^20.12.10
|
"@types/node": ^20.12.10
|
||||||
commander: ^11.1.0
|
commander: ^11.1.0
|
||||||
ts-node: ^10.9.1
|
ts-node: ^10.9.1
|
||||||
typescript: 5.5
|
typescript: ^5.6.2
|
||||||
bin:
|
bin:
|
||||||
workflow-diagrams-generator: dist/index.js
|
workflow-diagrams-generator: dist/index.js
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
|
|||||||
Reference in New Issue
Block a user