Skip to content

Commit

Permalink
🚚 Split the large main.ts file into smaller modules
Browse files Browse the repository at this point in the history
  • Loading branch information
leolabs committed Aug 7, 2023
1 parent 50fd4e2 commit 0fe47b5
Show file tree
Hide file tree
Showing 8 changed files with 860 additions and 827 deletions.
2 changes: 1 addition & 1 deletion scripts/inline-icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { readFileSync, writeFileSync } from 'fs'
import { join } from 'path'

const iconPath = join(__dirname, '..', 'icons')
const mainPath = join(__dirname, '..', 'dist', 'main.js')
const mainPath = join(__dirname, '..', 'dist', 'icons.js')

let mainCode = readFileSync(mainPath, 'utf-8')
const matches = mainCode.matchAll(/\<icon:(.+?)\>/g)
Expand Down
25 changes: 25 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export const SONG_PRESET_COUNT = 64
export const SECTION_PRESET_COUNT = 32

export const BOOLEAN_SETTINGS = [
{ id: 'autoplay', label: 'Autoplay' },
{ id: 'safeMode', label: 'Safe Mode' },
{ id: 'alwaysStopOnSongEnd', label: 'Always Stop on Song End' },
{ id: 'autoJumpToNextSong', label: 'Autojump to the Next Song' },
{ id: 'autoLoopCurrentSection', label: 'Autoloop the Current Section' },
{ id: 'countIn', label: 'Count-In' },
{ id: 'countInSoloClick', label: 'Solo Click During Count-In' },
]

export const JUMP_MODES = [
{ id: 'quantized', label: 'Quantized' },
{ id: 'end-of-section', label: 'End of Section' },
{ id: 'end-of-song', label: 'End of Song' },
{ id: 'manual', label: 'Manual' },
]

export const COUNT_IN_DURATIONS = [
{ id: '1', label: '1 Bar' },
{ id: '2', label: '2 Bars' },
{ id: '4', label: '4 Bars' },
]
17 changes: 17 additions & 0 deletions src/icons.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export const PLAY_ICON = '<icon:play.png>'
export const PLAY_ICON_GRAY = '<icon:play-gray.png>'
export const PAUSE_ICON_GREEN = '<icon:pause-green.png>'
export const STOP_ICON_GREEN = '<icon:stop-green.png>'
export const LOOP_ICON = '<icon:loop.png>'
export const LOOP_ICON_GRAY = '<icon:loop-gray.png>'
export const LOOP_ICON_GREEN = '<icon:loop-green.png>'

export const PROGRESS_0 = '<icon:progress/0.png>'
export const PROGRESS_1 = '<icon:progress/1.png>'
export const PROGRESS_2 = '<icon:progress/2.png>'
export const PROGRESS_3 = '<icon:progress/3.png>'
export const PROGRESS_4 = '<icon:progress/4.png>'
export const PROGRESS_5 = '<icon:progress/5.png>'
export const PROGRESS_6 = '<icon:progress/6.png>'
export const PROGRESS_7 = '<icon:progress/7.png>'
export const PROGRESS_8 = '<icon:progress/8.png>'
Loading

0 comments on commit 0fe47b5

Please sign in to comment.