Skip to content

Commit

Permalink
feat: changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
matt committed Feb 25, 2020
1 parent c329927 commit 7d3bb5e
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 104 deletions.
18 changes: 18 additions & 0 deletions .versionrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"packageFiles": [
{
"filename": "package.json",
"type": "json"
}
],
"bumpFiles": [
{
"filename": "package.json",
"type": "json"
},
{
"filename": "_config.yml",
"updater": "build/config-updater.js"
}
]
}
22 changes: 22 additions & 0 deletions build/config-updater.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const yaml = require("js-yaml");
const fs = require("fs");

// Get document, or throw exception on error
module.exports.readVersion = content => {
try {
const doc = yaml.safeLoad(content);
return doc.current_version;
} catch (e) {
console.log(e);
}
};

// Get document, or throw exception on error
module.exports.writeVersion = (content, version) => {
try {
const doc = yaml.safeLoad(content);
return yaml.safeDump({ ...doc, current_version: version });
} catch (e) {
console.log(e);
}
};
Loading

0 comments on commit 7d3bb5e

Please sign in to comment.