shiv-source / dynamic-package-update

A simple node.js module for dynamic updating packages list in the markdown file.

Home Page:https://www.npmjs.com/package/dynamic-package-update

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dynamic-package-update

NPM Version NPM Downloads GitHub release License

A simple node.js module for dynamic updating packages list in the markdown file.

Installation

Prerequisites

  • Node.js >= 10.0.0

Install Package

# With NPM

npm install --save dynamic-package-update

# With Yarn

yarn add dynamic-package-update
// Available options

const dpu = require("dynamic-package-update");

const option = {
    outPutFileName: 'docs.md',              // Default is README.md
    packageJsonFile: 'your json file',      // Default your root package.json file no need to set this option. 
    showNpmLinkColumn: true,                // Default is true.
    showTypeColumn: true,                   // Default is true.
    showDependencies: true,                 // Default is true.
    showDevDependencies: true               // Default is true.
}

// Note: By default option is an optional parameter.

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

// readme.js

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.

<!--README.md-->

<div id="content">
</div>
// package.json

  "scripts": {
    "start": "node src/index.js",
    "readme:dpu": "node readme.js"
  },
npm run readme:dpu     #This will automatically update package list in the README.md file

Package Insights

Build

npm install             #For installing dependencies

npm build               #For making 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

About

A simple node.js module for dynamic updating packages list in the markdown file.

https://www.npmjs.com/package/dynamic-package-update

License:MIT License


Languages

Language:TypeScript 98.6%Language:Shell 1.4%