From 385c09896a99f4c95905d168ca6c6e070272665b Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Wed, 10 May 2023 17:29:37 -0400 Subject: [PATCH] add command upcoming --- CHANGELOG.yml | 2 +- src/changelord.js | 2 ++ src/command/upcoming.js | 24 ++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/command/upcoming.js diff --git a/CHANGELOG.yml b/CHANGELOG.yml index 3746938..676514c 100644 --- a/CHANGELOG.yml +++ b/CHANGELOG.yml @@ -6,7 +6,7 @@ project: releases: - version: NEXT changes: - - port the Perl changelord to JavaScript. + - port the core of the Perl changelord to JavaScript. change_types: - title: "" level: minor diff --git a/src/changelord.js b/src/changelord.js index 5ee4af7..e21a144 100755 --- a/src/changelord.js +++ b/src/changelord.js @@ -12,6 +12,7 @@ import init from "./command/init.js"; import schema from "./command/schema.js"; import add from "./command/add.js"; import cut from "./command/cut.js"; +import upcoming from "./command/upcoming.js"; consola.raw = (...args) => console.log(...args); @@ -27,5 +28,6 @@ yargs(hideBin(process.argv)) .command(schema) .command(cut) .command(print) + .command(upcoming) .help() .parse(); diff --git a/src/command/upcoming.js b/src/command/upcoming.js new file mode 100644 index 0000000..9899ab4 --- /dev/null +++ b/src/command/upcoming.js @@ -0,0 +1,24 @@ +import u from "@yanick/updeep-remeda"; +import fs from "fs-extra"; +import yaml from "yaml"; +import { render_release } from "./print.js"; + +const handler = async (config) => { + const source = await fs.readFile(config.source, "utf-8").then(yaml.parse); + + const res = render_release( + { ...config, next: true }, + source + )(source.releases.find(u.matches({ version: "NEXT" }))); + + config.consola.raw("\n" + res.body); +}; + +export default { + command: "upcoming", + desc: "output the changes in NEXT", + builder: (yargs) => { + yargs; + }, + handler, +};