Skip to content

Commit

Permalink
Merge pull request #5 from diltdicker/dev/1.1.0
Browse files Browse the repository at this point in the history
1.1.0
  • Loading branch information
diltdicker authored Jan 18, 2024
2 parents b1d5ec2 + 33771c1 commit a9737ae
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
generated using [log-change](https://github.com/diltdicker/log-change)
# Change Log

# 1.1.0

### Jan 17, 2024

### Changes

- Added new feature to hide/show issue numbers with changes. Set hide to default.

# 1.0.4

### Jan 13, 2024
Expand Down
5 changes: 3 additions & 2 deletions bin/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ program.command('release')
.option('-m --summary <releaseSummary>', 'Addtional description text for release', null)
.option('-p --preserve', "Does not delete TOML files after appending release to CAHNGELOG.md", false)
// .option("-l --release-link <releaseLink>", "Link to release page or release artifacts")
// .option("-h --hide-num", "Hide issue numbers in release", false)
.option("-s --show", "Show issue numbers in release", false)
.action((options) => {

console.log(options)
Expand All @@ -76,7 +76,8 @@ program.command('release')
releaseVer: options.version,
releaseDate: options.date,
releaseSummary: options.summary,
noDelete: options.preserve
noDelete: options.preserve,
showNums: options.show
})
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "log-change-cli",
"version": "1.0.4",
"version": "1.1.0",
"description": "TOML-based CLI for CHANGELOG branch-compatible tracking",
"bin": {
"log-change": "./bin/bin.js"
Expand Down
9 changes: 8 additions & 1 deletion src/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const SAFE_FILES = [CHANGELOG_CONFIG, EXAMPLE_CHANGE]

const HEADER_TEMPLATE = fs.readFileSync(__dirname.concat("/res/header_template.ejs"), {encoding: "utf-8"})
const RELEASE_TEMPLATE = fs.readFileSync(__dirname.concat("/res/release_template.ejs"), {encoding: "utf-8"})
const HIDE_RELEASE_TEMPLATE = fs.readFileSync(__dirname.concat("/res/release_hide_template.ejs"), {encoding: "utf-8"})

// const EJS_TEST = fs.readFileSync("./src/res/ejs_test.ejs", {encoding: "utf-8"})

Expand Down Expand Up @@ -186,7 +187,13 @@ function appendRelease(releaseObj) {

// write new release
const reelaseData = Object.assign({}, releaseObj, readChangeLogs());
const releaseStr = ejs.render(RELEASE_TEMPLATE, reelaseData)
let releaseStr;
if (releaseObj.show) {
releaseStr = ejs.render(RELEASE_TEMPLATE, reelaseData)
} else {
releaseStr = ejs.render(HIDE_RELEASE_TEMPLATE, reelaseData)
}

fs.appendFileSync(CHANGELOG_MD, releaseStr, {encoding: "utf-8"})

// append old releases
Expand Down
45 changes: 45 additions & 0 deletions src/res/release_hide_template.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<%- "\n" -%>
# <%- releaseVer %>

### <%- releaseDate %>
<% if (releaseSummary != null) { -%>
<%- releaseSummary %>
<% } // end of releaseSummary -%>
<% if (newList.length > 0) { -%>
### New
<% for (let i = 0; i < newList.length; i++) { %>
<% for (let k = 0; k < newList[i]["comments"].length; k++) { -%>
- <%- newList[i]["comments"][k] %>
<% } // end of k loop -%>
<% } // end of i loop -%>
<% } // end of if statement -%>
<% if (changeList.length > 0) { -%>
### Changes
<% for (let i = 0; i < changeList.length; i++) { %>
<% for (let k = 0; k < changeList[i]["comments"].length; k++) { -%>
- <%- changeList[i]["comments"][k] %>
<% } // end of k loop -%>
<% } // end of i loop -%>
<% } // end of if statement -%>
<% if (fixList.length > 0) { -%>
### Fixes
<% for (let i = 0; i < fixList.length; i++) { %>
<% for (let k = 0; k < fixList[i]["comments"].length; k++) { -%>
- <%- fixList[i]["comments"][k] %>
<% } // end of k loop -%>
<% } // end of i loop -%>
<% } // end of if statement -%>
<% if (breakList.length > 0) { -%>
### Breaks
<% for (let i = 0; i < breakList.length; i++) { %>
<% for (let k = 0; k < breakList[i]["comments"].length; k++) { -%>
- <%- breakList[i]["comments"][k] %>
<% } // end of k loop -%>
<% } // end of i loop -%>
<% } // end of if statement -%>
<%- -%>

0 comments on commit a9737ae

Please sign in to comment.