Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
twlite committed Apr 29, 2022
0 parents commit 4eb1fe7
Show file tree
Hide file tree
Showing 13 changed files with 1,448 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test/
node_modules/
27 changes: 27 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
MIT License

Copyright (c) 2022 DevAndromeda

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.

Original License

MIT License

Copyright (c) 2020-2022 the Deno authors
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# `deno_doc`

A **[Deno Doc](https://github.com/denoland/deno_doc)** port for Node.js

# Features
* Asynchronous
* Supports both JavaScript and TypeScript
* Generates documentation from remote url or file path
* ESM & CJS supported

# Installation

```sh
# npm
$ npm install --save deno_doc
# Yarn
$ yarn add deno_doc
```

# Example Usage

```js
// ES Modules
import { doc } from "deno_doc";

const colorsDoc = await doc("https://deno.land/std/fmt/colors.ts");

for (const node of colorsDoc) {
console.log(`name: ${node.name} kind: ${node.kind}`);
}

// CommonJS
const { doc } = require("deno_doc");

const colorsDoc = await doc("https://deno.land/std/fmt/colors.ts");

for (const node of colorsDoc) {
console.log(`name: ${node.name} kind: ${node.kind}`);
}
```

# API

## `doc()`

The `doc()` function takes a string URL module specifier and potentially some options, and asynchronously resolves with an array of documentation nodes, which represent the surface API of the module.

A minimal example of using `doc()` and printing out some information about a function:

```js
import { doc } from "deno_doc";

const colorsDoc = await doc("https://deno.land/std/fmt/colors.ts");

for (const node of colorsDoc) {
console.log(`name: ${node.name} kind: ${node.kind}`);
}
```

The `doc()` function needs a way to retrieve modules, and by default uses a `load()` function provided by a partial implementation of `deno_graph` which uses `fetch()` for remote modules and `fs.readFile()` for local modules.
42 changes: 42 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "deno_doc",
"version": "0.1.0",
"description": "Deno doc generator for node.js",
"main": "./src/index.cjs",
"type": "module",
"module": "./src/index.js",
"exports": {
"import": "./src/index.js",
"require": "./src/index.cjs"
},
"files": ["src"],
"scripts": {
"dev:cjs": "cd test && node index.cjs",
"dev:mjs": "cd test && node index.mjs"
},
"repository": {
"type": "git",
"url": "git+https://github.com/DevAndromeda/node-deno_doc.git"
},
"keywords": [
"deno",
"doc",
"docgen",
"jsdoc",
"typescript",
"typedoc",
"api",
"documentation",
"generator",
"node"
],
"author": "DevAndromeda",
"license": "MIT",
"bugs": {
"url": "https://github.com/DevAndromeda/node-deno_doc/issues"
},
"homepage": "https://github.com/DevAndromeda/node-deno_doc#readme",
"devDependencies": {
"@types/node": "^17.0.30"
}
}
Loading

0 comments on commit 4eb1fe7

Please sign in to comment.