include the dir entries to the changelog
This commit is contained in:
parent
f759989698
commit
251dce5b56
@ -6,18 +6,16 @@ project:
|
|||||||
releases:
|
releases:
|
||||||
- version: NEXT
|
- version: NEXT
|
||||||
changes:
|
changes:
|
||||||
- add `git-gather` command
|
|
||||||
- type: feat
|
- type: feat
|
||||||
desc: " add 'next' to alias to 'upcoming'"
|
desc: add `git-gather` command
|
||||||
commit: 363c195477231a6b3b770e74ebfe316296ec5af2
|
- type: feat
|
||||||
|
desc: add 'next' to alias to 'upcoming'
|
||||||
- type: feat
|
- type: feat
|
||||||
desc: cutting a release also add a new NEXT release
|
desc: cutting a release also add a new NEXT release
|
||||||
commit: 167f631d1fe4eadba3ed5fdadbe378b8255d4ad2
|
|
||||||
- type: feat
|
- type: feat
|
||||||
desc: git-gather also filters on descs
|
desc: git-gather also filters on descs
|
||||||
- type: feat
|
- type: feat
|
||||||
desc: add the validate command
|
desc: add the validate command
|
||||||
commit: 5ba75a8e3d42f633e38c3584898ef0085c48fb04
|
|
||||||
- version: 0.1.0
|
- version: 0.1.0
|
||||||
changes:
|
changes:
|
||||||
- port the core of the Perl changelord to JavaScript.
|
- port the core of the Perl changelord to JavaScript.
|
||||||
|
2
changelog-next/2023-05-18T19:24:44.720Z-support_ch.yml
Normal file
2
changelog-next/2023-05-18T19:24:44.720Z-support_ch.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
- desc: support changelog-next directory
|
||||||
|
type: feat
|
@ -30,6 +30,7 @@
|
|||||||
"consola": "^3.1.0",
|
"consola": "^3.1.0",
|
||||||
"filenamify": "^6.0.0",
|
"filenamify": "^6.0.0",
|
||||||
"fs-extra": "^11.1.1",
|
"fs-extra": "^11.1.1",
|
||||||
|
"globby": "^13.1.4",
|
||||||
"markdown-utils": "^1.0.0",
|
"markdown-utils": "^1.0.0",
|
||||||
"nanoid": "^4.0.2",
|
"nanoid": "^4.0.2",
|
||||||
"remeda": "^1.14.0",
|
"remeda": "^1.14.0",
|
||||||
|
@ -23,6 +23,8 @@ import latest, { latest_version } from "./command/latest-version.js";
|
|||||||
import validate from "./command/validate.js";
|
import validate from "./command/validate.js";
|
||||||
import git_gather from "./command/git-gather.js";
|
import git_gather from "./command/git-gather.js";
|
||||||
import schemaV1 from "./changelog-schema.js";
|
import schemaV1 from "./changelog-schema.js";
|
||||||
|
import { globby } from "globby";
|
||||||
|
import { flatMap } from "remeda";
|
||||||
|
|
||||||
consola.raw = (...args) => console.log(...args);
|
consola.raw = (...args) => console.log(...args);
|
||||||
|
|
||||||
@ -34,6 +36,27 @@ yargs(hideBin(process.argv))
|
|||||||
fs
|
fs
|
||||||
.readFile(config.source, "utf-8")
|
.readFile(config.source, "utf-8")
|
||||||
.then(yaml.parse)
|
.then(yaml.parse)
|
||||||
|
.then(async (doc) => {
|
||||||
|
if (!doc.project.next_directory) return doc;
|
||||||
|
|
||||||
|
const changes = await globby([
|
||||||
|
doc.project.next_directory + "/*.yml",
|
||||||
|
doc.project.next_directory + "/*.yaml",
|
||||||
|
])
|
||||||
|
.then((files) =>
|
||||||
|
Promise.all(
|
||||||
|
files.map((f) => fs.readFile(f, "utf-8").then(yaml.parse))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.then((r) => r.flat());
|
||||||
|
|
||||||
|
if (changes.length)
|
||||||
|
doc.releases
|
||||||
|
.find((r) => r.version === "NEXT")
|
||||||
|
.changes.push(...changes);
|
||||||
|
|
||||||
|
return doc;
|
||||||
|
})
|
||||||
.then((doc) => {
|
.then((doc) => {
|
||||||
const ajv = new Ajv();
|
const ajv = new Ajv();
|
||||||
const validate = ajv.compile(schemaV1);
|
const validate = ajv.compile(schemaV1);
|
||||||
@ -63,6 +86,7 @@ yargs(hideBin(process.argv))
|
|||||||
const filename = join(
|
const filename = join(
|
||||||
dir,
|
dir,
|
||||||
[
|
[
|
||||||
|
new Date().toISOString(),
|
||||||
entry.ticket,
|
entry.ticket,
|
||||||
entry.feat,
|
entry.feat,
|
||||||
slugify(entry.desc, {
|
slugify(entry.desc, {
|
||||||
@ -77,6 +101,9 @@ yargs(hideBin(process.argv))
|
|||||||
argv.consola.error(`file ${filename} already exist`);
|
argv.consola.error(`file ${filename} already exist`);
|
||||||
yargs.exit(1);
|
yargs.exit(1);
|
||||||
}
|
}
|
||||||
|
if (Object.keys(entry).length === 1) {
|
||||||
|
entry = entry.desc;
|
||||||
|
}
|
||||||
return fs.writeFile(filename, yaml.stringify([entry]));
|
return fs.writeFile(filename, yaml.stringify([entry]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user