Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hitorisensei/markdown-readme-generator

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hitorisensei/markdown-readme-generator - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

29

index.js

@@ -10,2 +10,4 @@ #!/usr/bin/env node

const generatedHeader = 'DO NOT EDIT THIS FILE';
const logging = {

@@ -15,2 +17,18 @@ verbose: false,

function replaceComment(blockName, string) {
logging.verbose && console.log(`Creating block <!-- ${blockName} -->`);
const reBlock = regexEscape(blockName);
const regExp = new RegExp(`<!--\\s+${reBlock}\\s+(.*?)-->|^`, 'gs');
return (template) => {
let match = template.match(regExp);
if (match) {
logging.verbose && console.log(`Found comment <!-- ${blockName} -->, replacing`);
return template.replace(regExp, `<!-- ${blockName} ${string.trim()} -->\n`);
} else {
return template;
}
};
}
async function buildReadme(argv) {

@@ -24,2 +42,3 @@ const {

recursive,
skipGeneratedHeader,
keepTags: _keepTags,

@@ -43,3 +62,3 @@ create,

`<!--\\s+${reBlock}\\s+-->([\\s\\n]*)(.*?([\\s\\n]*)<!-- ${reBlock} end -->)?`,
'gsm',
'gs',
);

@@ -152,5 +171,7 @@

const thisBlock = [{ p: outFile }];
const generatedComment = `It is generated from ${inFile}, edit that file instead.`;
const linkThisBlock = [{ link: { title: outFile, source: outFile } }];
const mdResult = [
...(skipGeneratedHeader ? [] : [replaceComment(generatedHeader, generatedComment)]),
...rootPackageJsonBlocks,

@@ -234,2 +255,8 @@ replaceBlock('packages', json2md(packagesBlock)),

})
.option('skipGeneratedHeader', {
boolean: true,
default: false,
required: false,
describe: `Do not add "${generatedHeader}" header to output files when template file is used`,
})
.option('recursive', {

@@ -236,0 +263,0 @@ alias: 'r',

10

package.json
{
"name": "@hitorisensei/markdown-readme-generator",
"version": "1.0.1",
"version": "1.0.2",
"description": "Fills template blocks within your markdown readme files. With monorepo packages support build-in.",

@@ -17,3 +17,3 @@ "main": "index.js",

"scripts": {
"prepare": "LANG=en_US.UTF-8 node ./index.js --custom blocks.custom.js"
"prepublishOnly": "LANG=en_US.UTF-8 node ./index.js --custom blocks.custom.js"
},

@@ -36,4 +36,10 @@ "keywords": [],

"eslint-plugin-prettier": "^3.4.0",
"husky": "^7.0.1",
"prettier": "^2.3.2"
},
"husky": {
"hooks": {
"pre-commit": "npm run prepublishOnly"
}
}
}

@@ -0,1 +1,4 @@

<!-- DO NOT EDIT THIS FILE It is generated from README.md, edit that file instead. -->
<!-- title -->

@@ -71,20 +74,27 @@ # @hitorisensei/markdown-readme-generator

Options:
--version Show version number [boolean]
-o, --outFile output file path. Can be relative to project root or absolute
[required] [default: "README.md"]
-i, --inFile input/template file path. Can be relative to project root or
absolute. If inFile is used, outFile will not contain
template comment tags, unless keepTags option is set.
--version Show version number [boolean]
-o, --outFile output file path. Can be relative to project root
or absolute [required] [default: "README.md"]
-i, --inFile input/template file path. Can be relative to
project root or absolute. If inFile is used,
outFile will not contain template comment tags,
unless keepTags option is set.
[default: "README.md"]
--packages packages directory location [default: "packages/"]
--keepTags keep template tags even if inFile is used.
--packages packages directory location [default: "packages/"]
--keepTags keep template tags even if inFile is used.
[boolean] [default: false]
--project root project location
--dry do not write output file, print results to stdout instead
[boolean]
-r, --recursive should also update readme files in packages [default: true]
--create create readme file if one does not exist yet [default: true]
-v, --verbose display verbose output [boolean] [default: false]
--custom load custom block definitions from file (js or json)
--help Show help [boolean]
--project root project location
--dry do not write output file, print results to stdout
instead [boolean]
--skipGeneratedHeader Do not add "DO NOT EDIT THIS FILE" header to output
files when template file is used
[boolean] [default: false]
-r, --recursive should also update readme files in packages
[default: true]
--create create readme file if one does not exist yet
[default: true]
-v, --verbose display verbose output [boolean] [default: false]
--custom load custom block definitions from file (js or
json)
--help Show help [boolean]

@@ -135,3 +145,3 @@ ```

"content": [
"Options:\n --version Show version number [boolean]\n -o, --outFile output file path. Can be relative to project root or absolute\n [required] [default: \"README.md\"]\n -i, --inFile input/template file path. Can be relative to project root or\n absolute. If inFile is used, outFile will not contain\n template comment tags, unless keepTags option is set.\n [default: \"README.md\"]\n --packages packages directory location [default: \"packages/\"]\n --keepTags keep template tags even if inFile is used.\n [boolean] [default: false]\n --project root project location\n --dry do not write output file, print results to stdout instead\n [boolean]\n -r, --recursive should also update readme files in packages [default: true]\n --create create readme file if one does not exist yet [default: true]\n -v, --verbose display verbose output [boolean] [default: false]\n --custom load custom block definitions from file (js or json)\n --help Show help [boolean]\n"
"Options:\n --version Show version number [boolean]\n -o, --outFile output file path. Can be relative to project root\n or absolute [required] [default: \"README.md\"]\n -i, --inFile input/template file path. Can be relative to\n project root or absolute. If inFile is used,\n outFile will not contain template comment tags,\n unless keepTags option is set.\n [default: \"README.md\"]\n --packages packages directory location [default: \"packages/\"]\n --keepTags keep template tags even if inFile is used.\n [boolean] [default: false]\n --project root project location\n --dry do not write output file, print results to stdout\n instead [boolean]\n --skipGeneratedHeader Do not add \"DO NOT EDIT THIS FILE\" header to output\n files when template file is used\n [boolean] [default: false]\n -r, --recursive should also update readme files in packages\n [default: true]\n --create create readme file if one does not exist yet\n [default: true]\n -v, --verbose display verbose output [boolean] [default: false]\n --custom load custom block definitions from file (js or\n json)\n --help Show help [boolean]\n"
]

@@ -141,5 +151,5 @@ }

],
"asLiteralMd": "\n ```bash\n Options:\n --version Show version number [boolean]\n -o, --outFile output file path. Can be relative to project root or absolute\n [required] [default: \"README.md\"]\n -i, --inFile input/template file path. Can be relative to project root or\n absolute. If inFile is used, outFile will not contain\n template comment tags, unless keepTags option is set.\n [default: \"README.md\"]\n --packages packages directory location [default: \"packages/\"]\n --keepTags keep template tags even if inFile is used.\n [boolean] [default: false]\n --project root project location\n --dry do not write output file, print results to stdout instead\n [boolean]\n -r, --recursive should also update readme files in packages [default: true]\n --create create readme file if one does not exist yet [default: true]\n -v, --verbose display verbose output [boolean] [default: false]\n --custom load custom block definitions from file (js or json)\n --help Show help [boolean]\n\n ```\n "
"asLiteralMd": "\n ```bash\n Options:\n --version Show version number [boolean]\n -o, --outFile output file path. Can be relative to project root\n or absolute [required] [default: \"README.md\"]\n -i, --inFile input/template file path. Can be relative to\n project root or absolute. If inFile is used,\n outFile will not contain template comment tags,\n unless keepTags option is set.\n [default: \"README.md\"]\n --packages packages directory location [default: \"packages/\"]\n --keepTags keep template tags even if inFile is used.\n [boolean] [default: false]\n --project root project location\n --dry do not write output file, print results to stdout\n instead [boolean]\n --skipGeneratedHeader Do not add \"DO NOT EDIT THIS FILE\" header to output\n files when template file is used\n [boolean] [default: false]\n -r, --recursive should also update readme files in packages\n [default: true]\n --create create readme file if one does not exist yet\n [default: true]\n -v, --verbose display verbose output [boolean] [default: false]\n --custom load custom block definitions from file (js or\n json)\n --help Show help [boolean]\n\n ```\n "
}
```
<!-- jsonExample end -->
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc