-
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.
✨ feat(updateApiDocumentation): add updating api documentation script
- Loading branch information
seungok Jeong
committed
Jul 15, 2023
1 parent
72709ca
commit b79c167
Showing
6 changed files
with
156 additions
and
4 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,20 @@ | ||
## skylight-utils | ||
|
||
Typescript, Javascript utility collection | ||
|
||
![npm](https://img.shields.io/npm/v/skylight-utils) ![skylight-utils tests](https://github.com/vsnm25/skylight-utils/actions/workflows/main.yml/badge.svg) ![npm](https://img.shields.io/npm/dw/skylight-utils) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/skylight-utils) | ||
|
||
|
||
## Installation | ||
```shell | ||
## npm | ||
npm install skylight-utils | ||
|
||
## yarn | ||
yarn add skylight-utils | ||
``` | ||
|
||
|
||
## API Documentation | ||
You can check entire api documentation in [here](https://github.com/vsnm25/skylight-utils/blob/main/README_API_DOCUMENTATION.md) | ||
|
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,7 @@ | ||
|
||
## API documentation | ||
|
||
| API | API spec | | ||
| -- | -- | | ||
| hexToRgba | [hexToRgba.md](https://github.com/vsnm25/skylight-utils/blob/main/src/hexToRgba.md) | | ||
| minMaxBetween | [minMaxBetween.md](https://github.com/vsnm25/skylight-utils/blob/main/src/minMaxBetween.md) | |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import fs from "fs/promises"; | ||
import path from "path"; | ||
|
||
const SOURCE_PATH = path.join(__dirname, "..", "src"); | ||
let API_DOCUMENTATION_TEMPLATE = ` | ||
## API documentation | ||
| API | API spec | | ||
| -- | -- | | ||
`; | ||
|
||
/** | ||
* get entire api readme files and update api documentation(name, file link) | ||
*/ | ||
const updateApiDocumentation = async () => { | ||
try { | ||
const sourceFiles = await fs.readdir(SOURCE_PATH); | ||
const utilityReadmeList = sourceFiles.filter((sourceFile) => | ||
sourceFile.endsWith(".md") | ||
); | ||
|
||
for (let i = 0; i < utilityReadmeList.length; i += 1) { | ||
const utilityReadme = utilityReadmeList[i]; | ||
const utilityName = utilityReadme.split(".md")[0]; | ||
API_DOCUMENTATION_TEMPLATE += `| ${utilityName} | [${utilityReadme}](https://github.com/vsnm25/skylight-utils/blob/main/src/${utilityReadme}) | \n`; | ||
} | ||
fs.writeFile("README_API.md", API_DOCUMENTATION_TEMPLATE); | ||
} catch (err) { | ||
process.exit(1); | ||
} | ||
}; | ||
|
||
updateApiDocumentation(); |
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