@barmark/cli 0.13.0 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -1
- package/README.md +20 -0
- package/dist/export.js +39 -16
- package/dist/help.js +8 -4
- package/dist/main.js +2 -2
- package/dist/node-io.js +1 -0
- package/dist/render.js +1 -1
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,37 @@ package uses [semantic versioning](https://semver.org/).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.14.1] - 2026-11-19
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- **Uses** @barmark/render 0.21.0, @barmark/score 0.7.0 and
|
|
14
|
+
@barmark/lyricsheet 0.1.1. `render` draws as before: the renderer's new
|
|
15
|
+
`melody` option is not a flag here.
|
|
16
|
+
|
|
17
|
+
## [0.14.0] - 2026-11-19
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- **`export --lyricsheet`** writes the chart as a ChordPro lyric sheet
|
|
22
|
+
(usually `.cho`), to stdout or `--out`; `--part <label>` writes one
|
|
23
|
+
part's chords, and `--diagrams guitar` adds guitar chord diagrams. What
|
|
24
|
+
the sheet can't carry goes to stderr as `song.chart.md: warning:
|
|
25
|
+
message`, each message naming its own bars. `--version` lists
|
|
26
|
+
`@barmark/lyricsheet`.
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- **`check`, `format`, `render` and the exports read more spellings of
|
|
31
|
+
the major seventh** (`CMaj9`, `Cma13`, `CmΔ7`, `C∆7`, `Cm△9`), as
|
|
32
|
+
`barmark` now reads them; they print canonically.
|
|
33
|
+
- **`render --score`: a lyric row's rhythm slashes sit on their line**,
|
|
34
|
+
with no ledger lines through them.
|
|
35
|
+
- **Uses** barmark 0.25.0, @barmark/render 0.20.2, @barmark/musicxml
|
|
36
|
+
0.9.3, @barmark/score 0.6.3, @barmark/midi 0.3.5 and
|
|
37
|
+
@barmark/lyricsheet 0.1.0 (and through them @barmark/fretboard 0.1.2
|
|
38
|
+
and @barmark/sync 0.4.3).
|
|
39
|
+
|
|
9
40
|
## [0.13.0] - 2026-11-14
|
|
10
41
|
|
|
11
42
|
### Changed
|
|
@@ -411,7 +442,9 @@ The first release of the `barmark` command. Uses `barmark` 0.8.0 and
|
|
|
411
442
|
- **The `barmark` command:** `check`, `format`, `render` and `transpose`
|
|
412
443
|
for `.chart.md` files, on npm and as standalone binaries.
|
|
413
444
|
|
|
414
|
-
[Unreleased]: https://github.com/kevinpeckham/barmark/compare/cli-v0.
|
|
445
|
+
[Unreleased]: https://github.com/kevinpeckham/barmark/compare/cli-v0.14.1...HEAD
|
|
446
|
+
[0.14.1]: https://github.com/kevinpeckham/barmark/compare/cli-v0.14.0...cli-v0.14.1
|
|
447
|
+
[0.14.0]: https://github.com/kevinpeckham/barmark/compare/cli-v0.13.0...cli-v0.14.0
|
|
415
448
|
[0.13.0]: https://github.com/kevinpeckham/barmark/compare/cli-v0.12.0...cli-v0.13.0
|
|
416
449
|
[0.12.0]: https://github.com/kevinpeckham/barmark/compare/cli-v0.11.3...cli-v0.12.0
|
|
417
450
|
[0.11.3]: https://github.com/kevinpeckham/barmark/compare/cli-v0.11.2...cli-v0.11.3
|
package/README.md
CHANGED
|
@@ -38,6 +38,7 @@ barmark export --musicxml song.chart.md --out song.musicxml # for MuseScore, D
|
|
|
38
38
|
barmark import song.musicxml --out song.chart.md # or a compressed song.mxl
|
|
39
39
|
barmark export --midi song.chart.md --out song.mid # for a DAW or a practice player
|
|
40
40
|
barmark import song.mid --out song.chart.md # chords named from the notes
|
|
41
|
+
barmark export --lyricsheet song.chart.md --out song.cho # a ChordPro lyric sheet
|
|
41
42
|
barmark check --strict --format github songs # warnings fail too; PR annotations
|
|
42
43
|
barmark format song.chart.md # print it in standard form
|
|
43
44
|
barmark format --write songs # rewrite the files that change
|
|
@@ -108,6 +109,25 @@ names the harmony's tracks by number or name (ignoring case) instead of
|
|
|
108
109
|
letting the import choose. As for MusicXML, it exits 1 when no chart came
|
|
109
110
|
out.
|
|
110
111
|
|
|
112
|
+
`export --lyricsheet` writes the chart as a ChordPro lyric sheet, text for
|
|
113
|
+
any app that reads ChordPro (the usual extension is `.cho`), to stdout or
|
|
114
|
+
`--out`. `--part <label>` writes one part's chords with the singer's
|
|
115
|
+
words, and `--diagrams guitar` adds guitar chord diagrams. A chart with no
|
|
116
|
+
title takes its file name. What a lyric sheet can't hold goes to stderr as
|
|
117
|
+
`song.chart.md: warning: message`, each message naming its own bars. A
|
|
118
|
+
chart with errors is not exported.
|
|
119
|
+
|
|
120
|
+
```sh
|
|
121
|
+
$ barmark export --lyricsheet examples/shenandoah.chart.md
|
|
122
|
+
{title: Shenandoah}
|
|
123
|
+
{key: C}
|
|
124
|
+
{time: 4/4}
|
|
125
|
+
{comment: A simplified arrangement of the traditional song, every note a quarter.}
|
|
126
|
+
|
|
127
|
+
{start_of_verse: label="Verse"}
|
|
128
|
+
[*N.C.]Oh [C]Shenandoah [C]I long to hear [F]you
|
|
129
|
+
```
|
|
130
|
+
|
|
111
131
|
## Exit codes
|
|
112
132
|
|
|
113
133
|
| Code | Meaning |
|
package/dist/export.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
/** barmark export: a chart in another format: MusicXML, or a
|
|
1
|
+
/** barmark export: a chart in another format: MusicXML, a MIDI file or a lyric sheet. */
|
|
2
2
|
import { basename } from "node:path";
|
|
3
|
+
import { exportLyricsheet } from "@barmark/lyricsheet";
|
|
3
4
|
import { exportMidi } from "@barmark/midi";
|
|
4
5
|
import { exportMusicXml } from "@barmark/musicxml";
|
|
5
|
-
import { parseFlags } from "./args.js";
|
|
6
|
+
import { oneOf, parseFlags } from "./args.js";
|
|
6
7
|
import { readCharts, STDIN } from "./inputs.js";
|
|
7
8
|
import { UsageError } from "./io.js";
|
|
8
9
|
import { onlyChart, writeFile, writeOutput } from "./output.js";
|
|
10
|
+
import { DIAGRAMS } from "./render.js";
|
|
9
11
|
import { textLine } from "./report.js";
|
|
10
12
|
/**
|
|
11
13
|
* `file: bar N: warning: message`, as `check` prints its findings; N is the
|
|
@@ -19,31 +21,35 @@ export function lossLine(path, loss) {
|
|
|
19
21
|
const diagnosticLine = (path, d) => d.line ? textLine(path, d) : `${path}: ${d.message}`;
|
|
20
22
|
/** The format the flags name: exactly one; --midi writes bytes, so it needs --out. */
|
|
21
23
|
function formatOf(values) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
const named = ["musicxml", "midi", "lyricsheet"].filter((f) => values[f]);
|
|
25
|
+
if (named.length > 1)
|
|
26
|
+
throw new UsageError("give one format: --musicxml, --midi or --lyricsheet");
|
|
27
|
+
const format = named[0];
|
|
28
|
+
if (format === undefined)
|
|
29
|
+
throw new UsageError("give a format: --musicxml, --midi or --lyricsheet");
|
|
30
|
+
if (format === "midi" && values.out === undefined)
|
|
31
|
+
throw new UsageError("--midi writes a file: give --out <file.mid>");
|
|
32
|
+
if (values.diagrams !== undefined && format !== "lyricsheet")
|
|
33
|
+
throw new UsageError("--diagrams goes with --lyricsheet");
|
|
34
|
+
return format;
|
|
32
35
|
}
|
|
33
36
|
export async function exportCommand(args, io) {
|
|
34
37
|
const { values, positionals } = parseFlags(args, {
|
|
35
38
|
musicxml: { type: "boolean" },
|
|
36
39
|
midi: { type: "boolean" },
|
|
40
|
+
lyricsheet: { type: "boolean" },
|
|
37
41
|
out: { type: "string" },
|
|
38
42
|
part: { type: "string" },
|
|
43
|
+
diagrams: { type: "string" },
|
|
39
44
|
});
|
|
40
45
|
const format = formatOf(values);
|
|
46
|
+
const diagrams = values.diagrams === undefined ? undefined : oneOf("diagrams", values.diagrams, DIAGRAMS);
|
|
41
47
|
const { path, text } = onlyChart(await readCharts(positionals, io, { folders: false }), "export");
|
|
42
48
|
const options = {
|
|
43
49
|
...(values.part === undefined ? {} : { part: values.part }),
|
|
44
50
|
...(path === STDIN ? {} : { title: basename(path).replace(/(\.chart)?\.[^.]*$/, "") }),
|
|
45
51
|
};
|
|
46
|
-
const result = format
|
|
52
|
+
const result = convert(format, text, options, diagrams);
|
|
47
53
|
// As transpose does: problems to stderr, and no file written from a chart with errors.
|
|
48
54
|
for (const d of result.diagnostics)
|
|
49
55
|
io.stderr(`${diagnosticLine(path, d)}\n`);
|
|
@@ -52,13 +58,30 @@ export async function exportCommand(args, io) {
|
|
|
52
58
|
io.stderr(`${values.out} not written: the chart has errors\n`);
|
|
53
59
|
return 1;
|
|
54
60
|
}
|
|
61
|
+
writeResult(result, path, values.out, io);
|
|
62
|
+
return 0;
|
|
63
|
+
}
|
|
64
|
+
function convert(format, text, options, diagrams) {
|
|
65
|
+
if (format === "midi")
|
|
66
|
+
return exportMidi(text, options);
|
|
67
|
+
if (format === "lyricsheet")
|
|
68
|
+
return exportLyricsheet(text, { ...options, ...(diagrams ? { diagrams } : {}) });
|
|
69
|
+
return exportMusicXml(text, options);
|
|
70
|
+
}
|
|
71
|
+
/** A good result's losses to stderr, then its file or its text. */
|
|
72
|
+
function writeResult(result, path, out, io) {
|
|
55
73
|
if ("bytes" in result) {
|
|
56
74
|
for (const loss of result.losses)
|
|
57
75
|
io.stderr(`${lossLine(path, loss)}\n`);
|
|
58
76
|
// formatOf made --out required for --midi.
|
|
59
|
-
writeFile(
|
|
77
|
+
writeFile(out, result.bytes, io);
|
|
78
|
+
}
|
|
79
|
+
else if ("text" in result) {
|
|
80
|
+
// The sheet's messages name their bars already: no second naming.
|
|
81
|
+
for (const loss of result.losses)
|
|
82
|
+
io.stderr(`${lossLine(path, { message: loss.message })}\n`);
|
|
83
|
+
writeOutput(result.text, out, io);
|
|
60
84
|
}
|
|
61
85
|
else
|
|
62
|
-
writeOutput(result.xml,
|
|
63
|
-
return 0;
|
|
86
|
+
writeOutput(result.xml, out, io);
|
|
64
87
|
}
|
package/dist/help.js
CHANGED
|
@@ -3,7 +3,7 @@ export const HELP = `Usage: barmark <command> [options]
|
|
|
3
3
|
|
|
4
4
|
Commands:
|
|
5
5
|
check <paths…> Report each chart's errors and warnings
|
|
6
|
-
export <file> Write a chart as MusicXML or
|
|
6
|
+
export <file> Write a chart as MusicXML, MIDI or a lyric sheet (--musicxml, --midi, --lyricsheet)
|
|
7
7
|
format <paths…> Print or rewrite charts in standard form
|
|
8
8
|
import <file> Read a MusicXML score or a MIDI file as a chart
|
|
9
9
|
part <label> <file> Print one part of a chart of several
|
|
@@ -29,18 +29,22 @@ inside them; - reads stdin.
|
|
|
29
29
|
github: annotations on a pull request
|
|
30
30
|
json: an array of { file, diagnostics }
|
|
31
31
|
`,
|
|
32
|
-
export: `Usage: barmark export (--musicxml | --midi) <file> [options]
|
|
32
|
+
export: `Usage: barmark export (--musicxml | --midi | --lyricsheet) <file> [options]
|
|
33
33
|
|
|
34
34
|
The chart as MusicXML 4.0, for MuseScore, Dorico, Sibelius or Finale: one
|
|
35
35
|
part per declared part, playing in the chart's order. Or as a MIDI file
|
|
36
36
|
of its play order, for a DAW or a practice player; what MIDI can't hold
|
|
37
|
-
goes to stderr as file: bar N: warning: message.
|
|
38
|
-
|
|
37
|
+
goes to stderr as file: bar N: warning: message. Or as a lyric sheet, a
|
|
38
|
+
text file in ChordPro's format (usually .cho) for any app that reads
|
|
39
|
+
it; what it can't hold goes to stderr as file: warning: message. A chart
|
|
40
|
+
with errors is not exported; problems go to stderr.
|
|
39
41
|
|
|
40
42
|
--musicxml Export MusicXML
|
|
41
43
|
--midi Export a Standard MIDI File (needs --out)
|
|
42
44
|
--out <file> Write to a file instead of stdout
|
|
45
|
+
--lyricsheet Export a ChordPro lyric sheet
|
|
43
46
|
--part <label> Export only this part
|
|
47
|
+
--diagrams guitar With --lyricsheet: add guitar chord diagrams
|
|
44
48
|
`,
|
|
45
49
|
format: `Usage: barmark format <paths…> [options]
|
|
46
50
|
|
package/dist/main.js
CHANGED
|
@@ -21,8 +21,8 @@ export const COMMANDS = {
|
|
|
21
21
|
export async function main(argv, io) {
|
|
22
22
|
const [name, ...args] = argv;
|
|
23
23
|
if (name === "--version" || name === "-v") {
|
|
24
|
-
const { cli, barmark, render, musicxml, score, midi, verovio } = io.versions;
|
|
25
|
-
io.stdout(`@barmark/cli ${cli} (barmark ${barmark}, @barmark/render ${render}, @barmark/musicxml ${musicxml}, @barmark/score ${score}, @barmark/midi ${midi}, verovio ${verovio})\n`);
|
|
24
|
+
const { cli, barmark, render, musicxml, score, midi, lyricsheet, verovio } = io.versions;
|
|
25
|
+
io.stdout(`@barmark/cli ${cli} (barmark ${barmark}, @barmark/render ${render}, @barmark/musicxml ${musicxml}, @barmark/score ${score}, @barmark/midi ${midi}, @barmark/lyricsheet ${lyricsheet}, verovio ${verovio})\n`);
|
|
26
26
|
return 0;
|
|
27
27
|
}
|
|
28
28
|
if (name === "--help" || name === "-h") {
|
package/dist/node-io.js
CHANGED
package/dist/render.js
CHANGED
|
@@ -13,7 +13,7 @@ import { DEFAULT_WIDTH, MAX_WIDTH, MIN_WIDTH, scoreBody } from "./score.js";
|
|
|
13
13
|
const THEMES = ["auto", "light", "dark"];
|
|
14
14
|
const NUMERALS = ["nashville", "roman"];
|
|
15
15
|
const COLUMNS = ["shared", "row"];
|
|
16
|
-
const DIAGRAMS = ["guitar"];
|
|
16
|
+
export const DIAGRAMS = ["guitar"];
|
|
17
17
|
const escapeHtml = (text) => text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
18
18
|
function htmlDocument(title, body) {
|
|
19
19
|
return `<!doctype html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barmark/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "The barmark command: check, format, render, transpose and export barmark chord charts (.chart.md) from the terminal and in CI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -37,11 +37,12 @@
|
|
|
37
37
|
"url": "https://github.com/kevinpeckham/barmark/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"barmark": "0.
|
|
41
|
-
"@barmark/render": "0.
|
|
42
|
-
"@barmark/musicxml": "0.9.
|
|
43
|
-
"@barmark/midi": "0.3.
|
|
44
|
-
"@barmark/
|
|
40
|
+
"barmark": "0.25.0",
|
|
41
|
+
"@barmark/render": "0.21.0",
|
|
42
|
+
"@barmark/musicxml": "0.9.3",
|
|
43
|
+
"@barmark/midi": "0.3.5",
|
|
44
|
+
"@barmark/lyricsheet": "0.1.1",
|
|
45
|
+
"@barmark/score": "0.7.0",
|
|
45
46
|
"verovio": "6.4.1"
|
|
46
47
|
},
|
|
47
48
|
"scripts": {
|