Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

break: upgrade to typescript 5.2, typedoc 0.25 #156

Merged
merged 33 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
289f0fd
WIP break: upgrade TypeScript and typedoc
adidahiya Oct 5, 2022
34a46a6
Merge remote-tracking branch 'origin/develop' into ad/upgrade-typescript
adidahiya Oct 19, 2023
633b029
bump to typedoc v0.25
adidahiya Oct 19, 2023
f9e79b4
Upgrade to TypeScript v5.2, typedoc v0.25
adidahiya Oct 19, 2023
9c5520b
snapshot changes for jest upgrade
adidahiya Oct 19, 2023
0082c03
update snapshots for typedoc upgrade
adidahiya Oct 19, 2023
54ea82d
update --project path
adidahiya Oct 19, 2023
c19246e
fix lint
adidahiya Oct 19, 2023
a8c6b0a
Upgrade to Node v18
adidahiya Oct 19, 2023
4f87f0f
update snapshot for node upgrade
adidahiya Oct 19, 2023
8d83c5a
Update deploy-preview script
adidahiya Oct 19, 2023
971c77e
make script executable
adidahiya Oct 19, 2023
e625aa6
Merge remote-tracking branch 'origin/develop' into ad/upgrade-typescript
adidahiya Oct 20, 2023
0f3c99b
remove commented code
adidahiya Oct 20, 2023
50edfb0
revert whitespace changes
adidahiya Oct 20, 2023
4ced1c5
adjust some typedoc options
adidahiya Oct 20, 2023
50d5a7f
fix enum member defaults
adidahiya Oct 20, 2023
cf1e325
Add tsconfig-resolver, --out option
adidahiya Oct 20, 2023
01fd91e
Add typedoc-plugin-missing-exports
adidahiya Oct 20, 2023
eada2ce
implement multi-ts-project support
adidahiya Oct 20, 2023
8ccc0d7
Merge remote-tracking branch 'origin/develop' into ad/upgrade-typescript
adidahiya Oct 20, 2023
2362a89
fix lint
adidahiya Oct 20, 2023
e0cecc3
remove missing exports plugin
adidahiya Oct 20, 2023
93ac80f
fix lint again
adidahiya Oct 20, 2023
4ec2747
Handle @deprecated tag better
adidahiya Oct 20, 2023
ac76fb1
Fix interface property signatures
adidahiya Oct 20, 2023
119fc09
fix lint
adidahiya Oct 20, 2023
1ac43d7
update more snapshots
adidahiya Oct 20, 2023
53f106a
remove extraneous type definitions
adidahiya Oct 20, 2023
9d106bc
Merge remote-tracking branch 'origin/develop' into ad/upgrade-typescript
adidahiya Oct 23, 2023
1bd1caf
dedupe lockfile
adidahiya Oct 23, 2023
4078481
address minor review comments
adidahiya Oct 23, 2023
30bfb7d
don't capitalize TypeScript in public API
adidahiya Oct 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"devDependencies": {
"tslint": "^6.1.3",
"typescript": "~4.6.2"
"typescript": "~5.2.2"
},
"engines": {
"node": ">=18"
Expand Down
3 changes: 1 addition & 2 deletions packages/client/src/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "../lib/",
"target": "es5"
"outDir": "../lib/"
}
}
5 changes: 3 additions & 2 deletions packages/client/src/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ export interface ITsTypeAlias extends ITsDocBase {
type: string;
}

export type TypescriptDocEntry = ITsClass | ITsInterface | ITsEnum | ITsMethod | ITsTypeAlias;

/**
* The `TypescriptPlugin` exports a `typescript` key that contains a map of member name to
* `class` or `interface` definition.
Expand All @@ -199,15 +201,14 @@ export interface ITsTypeAlias extends ITsDocBase {
*/
export interface ITypescriptPluginData {
typescript: {
[name: string]: ITsClass | ITsInterface | ITsEnum | ITsMethod | ITsTypeAlias;
[name: string]: TypescriptDocEntry;
};
}

function typeguard<T extends ITsDocBase>(kind: Kind) {
return (data: any): data is T => data != null && (data as T).kind === kind;
}

// wooooo typeguards
export const isTsClass = typeguard<ITsClass>(Kind.Class);
export const isTsConstructor = typeguard<ITsConstructor>(Kind.Constructor);
export const isTsEnum = typeguard<ITsEnum>(Kind.Enum);
Expand Down
16 changes: 15 additions & 1 deletion packages/compiler/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
// Example Usage
// documentalist "./src/**/*"

const fs = require("fs");
const yargs = require("yargs");
const { Documentalist, KssPlugin, MarkdownPlugin, NpmPlugin, TypescriptPlugin } = require("./lib/");

Expand All @@ -46,6 +47,10 @@ const argv = yargs
desc: "use KssPlugin for .(css|less|scss) files",
type: "boolean",
})
.option("out", {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding this option allows us to log things to the console and still use the CLI to output a JSON file (previously, we were just using stdout in the docs package of this repo)

desc: "output file path (defaults to std out)",
type: "string",
})
.demandCommand(1, "Requires at least one file")
.argv;

Expand All @@ -66,4 +71,13 @@ if (argv.css) {

docs.documentGlobs(...argv._)
.then((data) => JSON.stringify(data, null, 2))
.then(console.log, console.error);
.then(
(output) => {
if (argv.out) {
fs.writeFileSync(argv.out, output, "utf-8");
} else {
console.log(output);
}
},
(failedReason) => console.error(failedReason),
);
17 changes: 9 additions & 8 deletions packages/compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,26 @@
"@types/kss": "^3.0.2",
"glob": "^10.3.10",
"js-yaml": "^4.1.0",
"kss": "^3.1.0",
"marked": "^4.2.12",
"typedoc": "~0.19.2",
"yargs": "^17.7.1"
"kss": "^3.0.1",
"marked": "^4.0.12",
"tsconfig-resolver": "^3.0.1",
"typedoc": "~0.25.2",
"yargs": "^17.4.0"
},
"devDependencies": {
"@types/glob": "^8.0.1",
"@types/glob": "^8.1.0",
"@types/jest": "^27.4.1",
"@types/js-yaml": "^4.0.5",
"@types/marked": "^4.0.8",
"@types/node": "^18.18.6",
"@types/yargs": "^17.0.24",
"jest": "^27.5.1",
"jest": "^29.1.2",
"jest-junit": "^14.0.1",
"npm-run-all": "^4.1.5",
"ts-jest": "^27.1.4",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"tslint": "^6.1.3",
"typescript": "~4.6.2"
"typescript": "~5.2.2"
},
"engines": {
"node": ">=18"
Expand Down
7 changes: 2 additions & 5 deletions packages/compiler/src/__tests__/__fixtures__/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
"experimentalDecorators": true,
"lib": [
"dom",
"es5",
"es2015.collection",
"es2015.iterable",
"es2015.promise"
"ES2015"
],
"module": "commonjs",
"moduleResolution": "node",
"skipLibCheck": true,
"target": "es2015"
"target": "ES2015"
}
}
22 changes: 11 additions & 11 deletions packages/compiler/src/__tests__/__snapshots__/markdown.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`MarkdownPlugin snapshot 1`] = `
Object {
"_nav": Object {
"contents": Array [
Object {
{
"_nav": {
"contents": [
{
"tag": "page",
"value": "file",
},
],
"contentsRaw": "@page file",
"metadata": Object {},
"metadata": {},
"reference": "_nav",
"route": "_nav",
"sourcePath": "path/to/_nav.md",
"title": "(untitled)",
},
"file": Object {
"contents": Array [
Object {
"file": {
"contents": [
{
"level": 1,
"route": "file",
"tag": "heading",
"value": "I'm special",
},
"<h2 id=\\"im-regular\\">I&#39;m regular</h2>
"<h2 id="im-regular">I&#39;m regular</h2>
",
Object {
{
"tag": "othertag",
"value": "params",
},
Expand All @@ -37,7 +37,7 @@ Object {
## I'm regular

@othertag params",
"metadata": Object {
"metadata": {
"key": "value",
},
"reference": "file",
Expand Down
Loading