Merge branch 'lord7-schema'
This commit is contained in:
commit
7336efacbb
59
src/changelog-schema.yml
Normal file
59
src/changelog-schema.yml
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
properties:
|
||||||
|
project:
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
properties:
|
||||||
|
homepage:
|
||||||
|
type: [ string, 'null' ]
|
||||||
|
description: url of the project's homepage
|
||||||
|
examples:
|
||||||
|
- https://github.com/yanick/app-changelord
|
||||||
|
name:
|
||||||
|
type: [ 'null', string ]
|
||||||
|
description: name of the project
|
||||||
|
examples:
|
||||||
|
- App::Changelord
|
||||||
|
ticket_url:
|
||||||
|
type: string
|
||||||
|
description: perl code that takes a ticket string (e.g. 'GH123') via the `$_` variable and turns it into a link.
|
||||||
|
examples:
|
||||||
|
- s!GH(\d+)!https://github.com/yanick/App-Changelord/issue/$1/
|
||||||
|
- /^\d+$/ ? "https://.../$_" : undef
|
||||||
|
with_stats:
|
||||||
|
description: if true, add git statistics when bumping the version.
|
||||||
|
change_types:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
properties:
|
||||||
|
keywords:
|
||||||
|
type: array
|
||||||
|
items: { type: string }
|
||||||
|
level: { enum: [ major, minor, patch ] }
|
||||||
|
title: { type: string }
|
||||||
|
releases:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
oneOf:
|
||||||
|
- type: string
|
||||||
|
- type: object
|
||||||
|
additionalProperties: false
|
||||||
|
properties:
|
||||||
|
version: { type: [ 'null', string ] }
|
||||||
|
date: { type: ['null',string] }
|
||||||
|
changes: { type: 'array', items: { $ref: '#/$defs/change' } }
|
||||||
|
$defs:
|
||||||
|
change:
|
||||||
|
oneOf:
|
||||||
|
- type: string
|
||||||
|
- type: object
|
||||||
|
required: [ desc ]
|
||||||
|
additionalProperties: false
|
||||||
|
properties:
|
||||||
|
desc: { type: string }
|
||||||
|
ticket: { type: [ string, 'null' ] }
|
||||||
|
type: { type: [ string, 'null' ] }
|
||||||
|
commit: { type: [ string, 'null' ] }
|
@ -6,8 +6,15 @@ import { join } from 'path';
|
|||||||
|
|
||||||
import print from './command/print.js'
|
import print from './command/print.js'
|
||||||
import init from './command/init.js'
|
import init from './command/init.js'
|
||||||
|
import schema from './command/schema.js';
|
||||||
|
import consola from 'consola';
|
||||||
|
|
||||||
|
consola.raw = (...args) => console.log(...args);
|
||||||
|
|
||||||
yargs(hideBin(process.argv))
|
yargs(hideBin(process.argv))
|
||||||
|
.config({
|
||||||
|
consola
|
||||||
|
})
|
||||||
.default('source', join( process.cwd(), 'CHANGELOG.yml' ))
|
.default('source', join( process.cwd(), 'CHANGELOG.yml' ))
|
||||||
.describe('source', 'changelog source')
|
.describe('source', 'changelog source')
|
||||||
.command({
|
.command({
|
||||||
@ -15,4 +22,5 @@ yargs(hideBin(process.argv))
|
|||||||
command: '$0',
|
command: '$0',
|
||||||
})
|
})
|
||||||
.command(init)
|
.command(init)
|
||||||
|
.command(schema)
|
||||||
.command(print).help().parse();
|
.command(print).help().parse();
|
||||||
|
16
src/command/schema.js
Normal file
16
src/command/schema.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import fs from "fs-extra";
|
||||||
|
|
||||||
|
const handler = async ({consola}) => {
|
||||||
|
consola.raw(
|
||||||
|
await fs.readFile(
|
||||||
|
new URL("../changelog-schema.yml", import.meta.url),
|
||||||
|
"utf-8"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
command: "schema",
|
||||||
|
desc: "output the changelog schema",
|
||||||
|
handler,
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user