-
Notifications
You must be signed in to change notification settings - Fork 4
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
Move to TypeScript #78
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
97a71de
feat(ts): initial move to typescript (no tests)
vernak2539 458c5aa
feat(ts): update type of default export
vernak2539 418bf34
feat(ts): add tsx as dep to run node test runner with typescript support
vernak2539 ddf05dc
feat(ts): covert test files to ts
vernak2539 681519b
feat(ts): udpate test files and get runner working
vernak2539 86d51f8
feat(ts): build package before publish
vernak2539 4581855
feat(ts): upgrade typedoc and deps
vernak2539 4a2fb49
feat(ts): add build command to tests
vernak2539 95a9491
feat(ts): move build to own job
vernak2539 6df53c4
feat(ts): update name of test+build gh action
vernak2539 bcea29a
fix(docs): point typedoc at index.ts + export option type again
vernak2539 bdb8f1a
fix(docs): add back description
vernak2539 3ba0bec
fix(tsconfig): update tsconfig.json
vernak2539 1c56336
fix(structure): move index to plugin + use index for exports
vernak2539 ee1835d
fix(types): export CollectionConfig
vernak2539 8789e23
chore: install and use typedoc-plugin-zod
vernak2539 c050656
chore: allow back ts extensions
vernak2539 007a526
fix(tests): fix tests
vernak2539 cbf99fe
fix(docs): remove old jsdoc + update barrel file
vernak2539 7a0e4fa
fix(tsconfig): update tsconfig for typedoc
vernak2539 dea8cf8
fix: add checks for potentially non-existing variables
vernak2539 b830c6e
fix(docs): link to options type in docs
vernak2539 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ oldtest.mjs | |
!.yarn/releases | ||
!.yarn/plugins | ||
.pnp.* | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,14 +9,11 @@ | |
"relative links" | ||
], | ||
"homepage": "https://github.com/vernak2539/astro-rehype-relative-markdown-links", | ||
"main": "./src/index.mjs", | ||
"type": "module", | ||
"types": "./src/index.d.ts", | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"files": [ | ||
"src/index.mjs", | ||
"src/utils.mjs", | ||
"src/options.mjs", | ||
"src/**/*.d.ts" | ||
"dist" | ||
], | ||
"repository": { | ||
"type": "git", | ||
|
@@ -30,10 +27,10 @@ | |
}, | ||
"packageManager": "[email protected]", | ||
"scripts": { | ||
"pre-release": "yarn run changelog && yarn run prettier && yarn run generate-docs", | ||
"build": "tsup", | ||
"generate-docs": "typedoc", | ||
"prettier": "prettier ./src/** -w", | ||
"test": "ARRML_MATTER_CACHE_DISABLE=true node --loader=esmock --test", | ||
"test": "ARRML_MATTER_CACHE_DISABLE=true node --import tsx --loader=esmock --test src/**/*.test.ts", | ||
"type-check": "tsc --noEmit --emitDeclarationOnly false", | ||
"prepare": "husky" | ||
}, | ||
|
@@ -59,9 +56,12 @@ | |
"prettier": "^4.0.0-alpha.8", | ||
"rehype": "^13.0.2", | ||
"remark-toc": "^9.0.0", | ||
"typedoc": "^0.27.4", | ||
"typedoc-plugin-markdown": "^4.3.2", | ||
"typedoc-plugin-remark": "^1.2.0", | ||
"tsup": "^8.3.5", | ||
"tsx": "^4.19.2", | ||
"typedoc": "^0.27.5", | ||
"typedoc-plugin-markdown": "^4.3.3", | ||
"typedoc-plugin-remark": "^1.2.1", | ||
"typedoc-plugin-zod": "^1.3.1", | ||
"typescript": "^5.7.2" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// NOTE - The order of exports is very important see https://github.com/Gerrit0/typedoc-plugin-zod/issues/8 | ||
export type { CollectionConfig, Options } from "./options"; | ||
|
||
export { default } from "./plugin"; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of things here:
z.input
whileEffectiveOptions
should usez.infer
(which is the same asz.output
)Options
andCollectionsSchema
to interface and make all the other changes that I recommend, the docs should generate identical to current. However, we wantOptions
to be a type to solve for thehover
issue. So, we use the@interface
typedoc tag as a workaround for now. This is not ideal as the docs will haveOptions
as an interface and we're going to lose the TOC, etc. but the code itself will be correct. I'm going to update the isuses I have filed with typedoc, etc. to cover a few additional situations that I found just now. Once all those issues are addressed, we can eliminate the@interface
workaround.EDIT: Per my recent comment, the
@interface
workaround should no longer be required and its inclusion can be ignored. The docs should generate correctly withOptions
andCollectionConfig
as types assuming all the changes in other comments are implemented.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vernak2539 -
Sorry if I caused some confusion with my edit regarding
@interface
:( The part about needing the@interface
tag still applies but the other changes are still needed and seem to have been missed:Options
should usez.input
- This ensures that the docs correctly reflect optional properties. Currently, for example, collectionBase does not show as optional.EffectiveOptions
should usez.infer
- These are the options after defaults are applied so for options that have a default, even if the user doesn't provide one, the effective options, which we use, have proper types based on presence of defaults.CollectionConfig
should be a type - This ensures that "hover" works.The final code block should be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Fixed in #79