dynamic-package-update
A simple node.js module for dynamic updating packages list in the markdown file.
Installation
Prerequisites
Install Package
npm install --save dynamic-package-update
yarn add dynamic-package-update
const dpu = require("dynamic-package-update");
const option = {
outPutFileName: 'docs.md',
packageJsonFile: 'your json file',
showNpmLinkColumn: true,
showTypeColumn: true,
showDependencies: true,
showDevDependencies: true
}
dpu.generateTableMarkDown(readmefile, option);
Examples
Create a readme.js file for updating README.md file.
Folder structure with readme.js:
+-- node_modules
+-- src
| +-- index.js
| +-- file1.js
| +-- file1.js
+-- package.json
+-- package-lock.json
+-- readme.js
+-- README.md
const dpu = require("dynamic-package-update");
const fs = require('fs');
const path = require('path');
const readmefile = fs.readFileSync(path.join(__dirname, "README.md"), "utf8");
dpu.generateTableMarkDown(readmefile);
Notes:
- Add this below html code in anywhere in your README.md file.
- Don't add anything inside this content div.
- It will automatically inject package list from your package.json file.
- Along with package list, It will automatically add Package List as a title tag. Don't add it explicitely.
<div id="content">
</div>
"scripts": {
"start": "node src/index.js",
"readme:dpu": "node readme.js"
},
npm run readme:dpu
Package Insights
Build
npm install
npm build
Package List
Package Name | Version | Type | Npm Link |
---|
@types/node | ^20.8.7 | devDependencies | @types/node |
lint-staged | ^15.0.2 | devDependencies | lint-staged |
prettier | ^3.0.3 | devDependencies | prettier |
typescript | ^5.2.2 | devDependencies | typescript |
husky | ^8.0.0 | devDependencies | husky |
Note: The build artifacts will be stored in the `dist/` directory.
Contributors
License
MIT
Free Software