From b9f4c0329914414afca7bfae770574776e0e6f4a Mon Sep 17 00:00:00 2001 From: Phara0h Date: Mon, 3 Aug 2020 15:34:20 -0400 Subject: [PATCH] Removed Debug Logs, Added Changelogs and Uses mdsquash its self --- ExampleUse.md | 21 +++++++++++++++++++++ README.md => Readme.nbs | 22 +++++----------------- changelog-template.hbs | 30 ++++++++++++++++++++++++++++++ index.js | 2 -- package.json | 4 +++- 5 files changed, 59 insertions(+), 20 deletions(-) create mode 100644 ExampleUse.md rename README.md => Readme.nbs (75%) create mode 100644 changelog-template.hbs diff --git a/ExampleUse.md b/ExampleUse.md new file mode 100644 index 0000000..4e1eb18 --- /dev/null +++ b/ExampleUse.md @@ -0,0 +1,21 @@ +```sh +mdsquash -i /some/mdfile.md,/another/mdfile.md +``` + +This example expects two MD files as the input. +## Example Readme.nbs + +```md + +# Test + +## Something + +{{doc1}} + + +## Foo + +{{doc2}} + +``` diff --git a/README.md b/Readme.nbs similarity index 75% rename from README.md rename to Readme.nbs index 0452120..142d5aa 100644 --- a/README.md +++ b/Readme.nbs @@ -22,25 +22,13 @@ Options: ## Example Use - -```sh -mdsquash -i /some/mdfile.md,/another/mdfile.md -``` - -This example expects two MD files as the input. -## Example Readme.nbs - -```md - -# Test - -## Something - {{doc1}} - -## Foo +## Changelog {{doc2}} -``` + +## License + +{{doc3}} diff --git a/changelog-template.hbs b/changelog-template.hbs new file mode 100644 index 0000000..20ff950 --- /dev/null +++ b/changelog-template.hbs @@ -0,0 +1,30 @@ +### Changelog + +All notable changes to this project will be documented in this file. Dates are displayed in UTC. + +{{#each releases}} + {{#if href}} + ###{{#unless major}}#{{/unless}} [{{title}}]({{href}}) + {{else}} + #### {{title}} + {{/if}} + + {{#if tag}} + > {{niceDate}} + {{/if}} + + {{#if summary}} + {{summary}} + {{/if}} + + {{#each merges}} + - {{{message}}}{{#if href}} [`#{{id}}`]({{href}}){{/if}} + {{/each}} + {{#each fixes}} + - {{{commit.subject}}}{{#each fixes}}{{#if href}} [`#{{id}}`]({{href}}){{/if}}{{/each}} + {{/each}} + {{#each commits}} + - {{#if breaking}}**Breaking change:** {{/if}}{{{subject}}}{{#if href}} [`{{shorthash}}`]({{href}}){{/if}} + {{/each}} + +{{/each}} diff --git a/index.js b/index.js index e77a957..df2e341 100755 --- a/index.js +++ b/index.js @@ -45,9 +45,7 @@ async function start() { for (var i = 0; i < program.input.length; i++) { mdFiles[`doc${i+1}`] = await fs.readFile(program.input[i], {encoding: 'ascii'}); } - console.log(mdFiles) var merged = template(mdFiles); - console.log(merged) await fs.writeFile(program.out,merged, {encoding: 'ascii'}); console.log('Done'); diff --git a/package.json b/package.json index d93517c..ebbdf17 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,9 @@ "description": "Merges multiple MD files into one readme", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "version": "auto-changelog -l false --template changelog-template.hbs -p && ./index.js -i ExampleUse.md,CHANGELOG.md,LICENSE && git add -A CHANGELOG.md && git add -A README.md", + "postversion": "git push && git push --tags && npm publish" }, "repository": { "type": "git",