-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
41bb630
commit b1317c2
Showing
18 changed files
with
5,035 additions
and
10 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
charset = utf-8 | ||
|
||
[*.js] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[{package.json,*.yml,*.cjson}] | ||
indent_style = space | ||
indent_size = 2 |
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,3 @@ | ||
node_modules | ||
coverage | ||
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": ["eslint-config-unjs"], | ||
"rules": {} | ||
} |
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,26 @@ | ||
name: autofix.ci # needed to securely identify the workflow | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: ["main"] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
autofix: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: corepack enable | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
cache: "pnpm" | ||
- run: pnpm install | ||
- name: Fix lint issues | ||
run: pnpm lint:fix | ||
- uses: autofix-ci/action@bee19d72e71787c12ca0f29de72f2833e437e4c9 | ||
with: | ||
commit-message: "chore: apply automated fixes" |
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,26 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
ci: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: corepack enable | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
cache: "pnpm" | ||
- run: pnpm install | ||
- run: pnpm lint | ||
- run: pnpm test:types | ||
- run: pnpm build | ||
- run: pnpm vitest --coverage | ||
- uses: codecov/codecov-action@v3 |
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,8 @@ | ||
node_modules | ||
coverage | ||
dist | ||
.vscode | ||
.DS_Store | ||
.eslintcache | ||
*.log* | ||
*.env* |
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 @@ | ||
{} |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 |
---|---|---|
@@ -1,2 +1,61 @@ | ||
# unjsdoc | ||
Unified utilities for parsing and retrieving JSDoc at runtime | ||
# UnJSDoc | ||
|
||
[![npm version][npm-version-src]][npm-version-href] | ||
[![npm downloads][npm-downloads-src]][npm-downloads-href] | ||
[![bundle][bundle-src]][bundle-href] | ||
[![Codecov][codecov-src]][codecov-href] | ||
|
||
Unified utilities for parsing and retrieving JSDoc annotations. | ||
|
||
## Usage | ||
|
||
Install package: | ||
|
||
```sh | ||
# npm | ||
npm install unjsdoc | ||
|
||
# yarn | ||
yarn add unjsdoc | ||
|
||
# pnpm | ||
pnpm install unjsdoc | ||
|
||
# bun | ||
bun install unjsdoc | ||
``` | ||
|
||
Import: | ||
|
||
```js | ||
// ESM | ||
import {} from "unjsdoc"; | ||
|
||
// CommonJS | ||
const {} = require("unjsdoc"); | ||
``` | ||
|
||
## Development | ||
|
||
- Clone this repository | ||
- Install latest LTS version of [Node.js](https://nodejs.org/en/) | ||
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable` | ||
- Install dependencies using `pnpm install` | ||
- Run interactive tests using `pnpm dev` | ||
|
||
## License | ||
|
||
Made with 💛 | ||
|
||
Published under [MIT License](./LICENSE). | ||
|
||
<!-- Badges --> | ||
|
||
[npm-version-src]: https://img.shields.io/npm/v/unjsdoc?style=flat&colorA=18181B&colorB=F0DB4F | ||
[npm-version-href]: https://npmjs.com/package/unjsdoc | ||
[npm-downloads-src]: https://img.shields.io/npm/dm/unjsdoc?style=flat&colorA=18181B&colorB=F0DB4F | ||
[npm-downloads-href]: https://npmjs.com/package/unjsdoc | ||
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/unjsdoc/main?style=flat&colorA=18181B&colorB=F0DB4F | ||
[codecov-href]: https://codecov.io/gh/unjs/unjsdoc | ||
[bundle-src]: https://img.shields.io/bundlephobia/minzip/unjsdoc?style=flat&colorA=18181B&colorB=F0DB4F | ||
[bundle-href]: https://bundlephobia.com/result?p=unjsdoc |
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,49 @@ | ||
{ | ||
"name": "unjsdoc", | ||
"version": "0.0.0", | ||
"description": "Unified utilities for parsing and retrieving JSDoc annotations.", | ||
"repository": "unjs/unjsdoc", | ||
"license": "MIT", | ||
"sideEffects": false, | ||
"type": "module", | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.cjs" | ||
} | ||
}, | ||
"main": "./dist/index.cjs", | ||
"module": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "unbuild", | ||
"dev": "vitest dev", | ||
"play": "jiti playground", | ||
"lint": "eslint --cache --ext .ts,.js,.mjs,.cjs . && prettier -c src test", | ||
"lint:fix": "eslint --cache --ext .ts,.js,.mjs,.cjs . --fix && prettier -c src test -w", | ||
"prepack": "pnpm build", | ||
"release": "pnpm test && changelogen --release && npm publish && git push --follow-tags", | ||
"test": "pnpm lint && pnpm test:types && vitest run --coverage", | ||
"test:types": "tsc --noEmit --skipLibCheck" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.10.5", | ||
"@vitest/coverage-v8": "^1.1.0", | ||
"changelogen": "^0.5.5", | ||
"eslint": "^8.56.0", | ||
"eslint-config-unjs": "^0.2.1", | ||
"jiti": "^1.21.0", | ||
"prettier": "^3.1.1", | ||
"typescript": "^5.3.3", | ||
"unbuild": "^2.0.0", | ||
"vitest": "^1.1.0" | ||
}, | ||
"packageManager": "[email protected]", | ||
"dependencies": { | ||
"pathe": "^1.1.2" | ||
} | ||
} |
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,21 @@ | ||
|
||
/** | ||
* Test function with JSDoc | ||
* @param test | ||
* @param test2 | ||
* @returns {number} | ||
*/ | ||
export function hasJSDoc(test: number, test2: number) { | ||
return test + test2; | ||
} | ||
|
||
export function noJSDoc(test: number, test2: number) { | ||
return test + test2; | ||
} | ||
|
||
|
||
|
||
// Use these to prevent error | ||
|
||
hasJSDoc(1,2); | ||
noJSDoc(1,2); |
Oops, something went wrong.