Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAJOR: Upgrade packages and cut first major release #118

Merged
merged 2 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Use Node.js 15.x
- name: Use Node.js 20.x
uses: actions/setup-node@v2
with:
node-version: 15.x
node-version: 20.x
- run: npm ci
- run: npm test
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Use Node.js 15.x
- name: Use Node.js 20.x
uses: actions/setup-node@v2
with:
node-version: 15.x
node-version: 20.x
- run: npm ci
- run: npm test

Expand All @@ -31,7 +31,7 @@ jobs:
minor-wording: "MINOR:"
- uses: actions/setup-node@v2
with:
node-version: 15.x
node-version: 20.x
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
Expand Down
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"tabWidth": 2,
"useTabs": false
}
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function isNotDoubleBlankLine(state, line) {
function getLines(state, startLine, endLine) {
return state.src.slice(
state.bMarks[startLine],
state.eMarks[endLine - 1 || startLine]
state.eMarks[endLine - 1 || startLine],
);
}

Expand Down
10 changes: 5 additions & 5 deletions lib/chord.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const CHORD_PATTERN = new RegExp(
")?",
"(?:/([CDEFGAB](?:#|b)?))?",
"$",
].join("")
].join(""),
);

const NOTE_SEQUENCE = new Map(
Expand All @@ -46,7 +46,7 @@ const NOTE_SEQUENCE = new Map(
"G",
"G#",
"Ab",
].map((note, index) => [note, index])
].map((note, index) => [note, index]),
);

const CHORD_SEQUENCE_SHARP = [
Expand Down Expand Up @@ -92,7 +92,7 @@ const NOTE_ALIASES = new Map(
["A"],
["A#", "Bb"],
["B"],
].flatMap((aliases) => aliases.map((alias) => [alias, aliases]))
].flatMap((aliases) => aliases.map((alias) => [alias, aliases])),
);

function transpose(note, amount) {
Expand Down Expand Up @@ -144,15 +144,15 @@ class Chord {
return new Chord(
transpose(this.root, amount),
this.quality,
transpose(this.bass, amount)
transpose(this.bass, amount),
);
}

aliases() {
const rootAliases = NOTE_ALIASES.get(this.root) || [];
const bassAliases = this.bass ? NOTE_ALIASES.get(this.bass) || [] : [""];
return rootAliases.flatMap((root) =>
bassAliases.map((bass) => new Chord(root, this.quality, bass))
bassAliases.map((bass) => new Chord(root, this.quality, bass)),
);
}
}
Expand Down
54 changes: 27 additions & 27 deletions lib/chordbook.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,119 +51,119 @@ addGuitarChord(parseChord("Am7"), "m1 n3,2 n5,1");
for (let os = 1; os < 17; os++) {
addGuitarChord(
parseChord("E").transpose(os),
`o${os} b1,6,${os} n2,${2 + os} n3,${2 + os} n4,${1 + os}`
`o${os} b1,6,${os} n2,${2 + os} n3,${2 + os} n4,${1 + os}`,
);
addGuitarChord(
parseChord("Em").transpose(os),
`o${os} b1,6,${os} n2,${2 + os} n3,${2 + os}`
`o${os} b1,6,${os} n2,${2 + os} n3,${2 + os}`,
);
addGuitarChord(
parseChord("E7").transpose(os),
`o${os} b1,6,${os} n2,${2 + os} n4,${1 + os} n5,${3 + os}`
`o${os} b1,6,${os} n2,${2 + os} n4,${1 + os} n5,${3 + os}`,
);
addGuitarChord(
parseChord("E9").transpose(os),
`o${os} b1,6,${os} n2,${2 + os} n4,${1 + os} n6,${2 + os}`
`o${os} b1,6,${os} n2,${2 + os} n4,${1 + os} n6,${2 + os}`,
);
addGuitarChord(
parseChord("Em6").transpose(os),
`o${os} b1,6,${os} n2,${2 + os} n3,${2 + os} n5,${2 + os}`
`o${os} b1,6,${os} n2,${2 + os} n3,${2 + os} n5,${2 + os}`,
);
addGuitarChord(
parseChord("Em7").transpose(os),
`o${os} b1,6,${os} n2,${2 + os}`
`o${os} b1,6,${os} n2,${2 + os}`,
);
addGuitarChord(
parseChord("Edim").transpose(os),
`o${os} b1,4,${os} n2,${1 + os} n3,${2 + os} m5 m6`
`o${os} b1,4,${os} n2,${1 + os} n3,${2 + os} m5 m6`,
);
addGuitarChord(
parseChord("Edim7").transpose(os),
`o${os} b1,6,${os} n2,${1 + os} n3,${2 + os} n5,${2 + os}`
`o${os} b1,6,${os} n2,${1 + os} n3,${2 + os} n5,${2 + os}`,
);
addGuitarChord(
parseChord("Esus4").transpose(os),
`o${os} b1,6,${os} n3,${2 + os} n4,${2 + os}`
`o${os} b1,6,${os} n3,${2 + os} n4,${2 + os}`,
);
addGuitarChord(
parseChord("E7sus4").transpose(os),
`o${os} b1,6,${os} n2,${2 + os} n4,${2 + os}`
`o${os} b1,6,${os} n2,${2 + os} n4,${2 + os}`,
);
}

// A Shape Barre Chords
for (let os = 1; os < 17; os++) {
addGuitarChord(
parseChord("A").transpose(os),
`o${os} b1,6,${os} n3,${2 + os} n4,${2 + os} n5,${2 + os}`
`o${os} b1,6,${os} n3,${2 + os} n4,${2 + os} n5,${2 + os}`,
);
addGuitarChord(
parseChord("Am").transpose(os),
`o${os} b1,6,${os} n3,${2 + os} n4,${2 + os} n5,${1 + os}`
`o${os} b1,6,${os} n3,${2 + os} n4,${2 + os} n5,${1 + os}`,
);
addGuitarChord(
parseChord("A7").transpose(os),
`o${os} b1,6,${os} n3,${2 + os} n5,${2 + os}`
`o${os} b1,6,${os} n3,${2 + os} n5,${2 + os}`,
);
addGuitarChord(
parseChord("Am7").transpose(os),
`o${os} b1,6,${os} n3,${2 + os} n5,${1 + os}`
`o${os} b1,6,${os} n3,${2 + os} n5,${1 + os}`,
);
addGuitarChord(
parseChord("Amaj7").transpose(os),
`o${os} b1,6,${os} n3,${2 + os} n4,${1 + os} n5,${2 + os}`
`o${os} b1,6,${os} n3,${2 + os} n4,${1 + os} n5,${2 + os}`,
);
addGuitarChord(
parseChord("Amaj9").transpose(os),
`o${os} b1,6,${os} n3,${2 + os} n4,${1 + os}`
`o${os} b1,6,${os} n3,${2 + os} n4,${1 + os}`,
);
addGuitarChord(
parseChord("Asus2").transpose(os),
`o${os} b1,6,${os} n3,${2 + os} n4,${2 + os}`
`o${os} b1,6,${os} n3,${2 + os} n4,${2 + os}`,
);
addGuitarChord(
parseChord("Asus4").transpose(os),
`o${os} b1,6,${os} n4,${2 + os} n5,${3 + os}`
`o${os} b1,6,${os} n4,${2 + os} n5,${3 + os}`,
);
addGuitarChord(
parseChord("A7sus2").transpose(os),
`o${os} b1,5,${os} n3,${2 + os} n6,${3 + os}`
`o${os} b1,5,${os} n3,${2 + os} n6,${3 + os}`,
);
addGuitarChord(
parseChord("A7sus4").transpose(os),
`o${os} b1,6,${os} n3,${2 + os} n5,${3 + os}`
`o${os} b1,6,${os} n3,${2 + os} n5,${3 + os}`,
);
}

// G Shape Barre Chords
for (let os = 1; os < 17; os++) {
addGuitarChord(
parseChord("G").transpose(os),
`o${os} b3,5,${os} n1,${3 + os} n2,${2 + os} n6,${3 + os}`
`o${os} b3,5,${os} n1,${3 + os} n2,${2 + os} n6,${3 + os}`,
);
addGuitarChord(
parseChord("G6").transpose(os),
`o${os} b3,6,${os} n1,${3 + os} n2,${2 + os}`
`o${os} b3,6,${os} n1,${3 + os} n2,${2 + os}`,
);
addGuitarChord(
parseChord("G7").transpose(os),
`o${os} m1 m2 b3,5,${os} n6,${1 + os}`
`o${os} m1 m2 b3,5,${os} n6,${1 + os}`,
);
addGuitarChord(
parseChord("G9").transpose(os),
`o${os} m1 b2,5,${os} n6,${1 + os}`
`o${os} m1 b2,5,${os} n6,${1 + os}`,
);
addGuitarChord(
parseChord("Gdim").transpose(os),
`o${os} b1,6,${os} n2,${1 + os} n3,${2 + os} n5,${2 + os}`
`o${os} b1,6,${os} n2,${1 + os} n3,${2 + os} n5,${2 + os}`,
);
addGuitarChord(
parseChord("Gadd9").transpose(os),
`o${os} b2,5,${os} n1,${3 + os} n6,${3 + os}`
`o${os} b2,5,${os} n1,${3 + os} n6,${3 + os}`,
);
addGuitarChord(
parseChord("Gmaj7").transpose(os),
`o${os} m1 b3,5,${os} n2,${2 + os} n6,${2 + os}`
`o${os} m1 b3,5,${os} n2,${2 + os} n6,${2 + os}`,
);
}

Expand Down
18 changes: 12 additions & 6 deletions lib/chordbook.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ describe("Guitar Chordbook", () => {
"should contain %s barre chord as E shaped chord offset by %s",
(name, os) => {
expect(guitarChordbook.get(name)).toContainEqual(
parseVoicing(`o${os} b1,6,${os} n2,${2 + os} n3,${2 + os} n4,${1 + os}`)
parseVoicing(
`o${os} b1,6,${os} n2,${2 + os} n3,${2 + os} n4,${1 + os}`,
),
);
}
},
);

test.each([
Expand Down Expand Up @@ -65,9 +67,11 @@ describe("Guitar Chordbook", () => {
"should contain %s barre chord as A shaped chord offset by %s",
(name, os) => {
expect(guitarChordbook.get(name)).toContainEqual(
parseVoicing(`o${os} b1,6,${os} n3,${2 + os} n4,${2 + os} n5,${2 + os}`)
parseVoicing(
`o${os} b1,6,${os} n3,${2 + os} n4,${2 + os} n5,${2 + os}`,
),
);
}
},
);

test.each([
Expand Down Expand Up @@ -98,9 +102,11 @@ describe("Guitar Chordbook", () => {
"should contain %s barre chord as G shaped chord offset by %s",
(name, os) => {
expect(guitarChordbook.get(name)).toContainEqual(
parseVoicing(`o${os} b3,5,${os} n1,${3 + os} n2,${2 + os} n6,${3 + os}`)
parseVoicing(
`o${os} b3,5,${os} n1,${3 + os} n2,${2 + os} n6,${3 + os}`,
),
);
}
},
);

test.each([
Expand Down
Loading
Loading