Files
webamp/packages/webamp-demo/js/config.ts
T
Jordan EldredgeandClaude Opus 4.6 c7a282c1fd Split demo site into its own package (#1351)
* Split demo site into its own package

Move the demo site from packages/webamp/demo/ into packages/webamp-demo/
as a standalone workspace package. This cleanly separates the library
(published to npm) from the demo site (deployed to webamp.org).

Key changes:
- Demo imports webamp source via relative paths (no aliases needed)
- Demo has its own package.json with demo-specific deps
- Simplified vite config (just nodePolyfills plugin)
- Removed vite branching from rollupPlugins.mjs (library-only now)
- Renamed build-library -> build in webamp package
- Updated turbo.json, CI, netlify config, and code-size workflow
- Removed demo-only deps from webamp package (sentry, butterchurn stays
  for the butterchurn bundle)
- Zero bundle size change for the library

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* Fix: add type-check dependency to webamp#build task

The webamp-docs package needs type declarations from webamp to
type-check. These are generated by tsc (type-check), which must run
before the build task.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* Add updated readme to webamp-demo package

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* Document the live reloading dev flow in both readmes

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* Fix code-size CI: use deploy script that exists on both branches

The compressed-size-action checks out master and runs the build script.
Master doesn't have a root "build" script, so revert to using "deploy"
which exists on both branches.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

---------

Co-authored-by: Claude Opus 4.6 <[email protected]>
2026-06-07 14:40:07 -07:00

163 lines
4.4 KiB
TypeScript

import { Track, URLTrack, PartialState } from "../../webamp/js/types";
// @ts-ignore
import llamaAudio from "../mp3/llama-2.91.mp3";
interface Config {
initialTracks?: Track[];
audioUrl?: string;
skinUrl?: string;
disableMarquee?: boolean;
initialState?: PartialState;
}
const { hash } = window.location;
let config: Config = {};
if (hash) {
try {
config = JSON.parse(decodeURIComponent(hash).slice(1));
} catch (_e) {
console.error("Failed to decode config from hash: ", hash);
}
}
// Backwards compatibility with the old syntax
if (config.audioUrl && !config.initialTracks) {
config.initialTracks = [{ url: config.audioUrl }];
}
export const SHOW_DESKTOP_ICONS = true;
if ("URLSearchParams" in window) {
// const params = new URLSearchParams(location.search);
// SHOW_DESKTOP_ICONS = Boolean(params.get("icons"));
}
export const skinUrl = config.skinUrl ?? null;
// https://freemusicarchive.org/music/netBloc_Artists/netBloc_Vol_24_tiuqottigeloot/
const album = "netBloc Vol. 24: tiuqottigeloot";
export const defaultInitialTracks: URLTrack[] = [
{
metaData: {
artist: "DJ Mike Llama",
title: "Llama Whippin' Intro",
},
url: llamaAudio,
duration: 5.322286,
},
{
url: "https://raw.githubusercontent.com/captbaritone/webamp-music/4b556fbf/Diablo_Swing_Orchestra_-_01_-_Heroines.mp3",
duration: 322.612245,
metaData: {
title: "Heroines",
artist: "Diablo Swing Orchestra",
album,
},
},
{
url: "https://raw.githubusercontent.com/captbaritone/webamp-music/4b556fbf/Eclectek_-_02_-_We_Are_Going_To_Eclecfunk_Your_Ass.mp3",
duration: 190.093061,
metaData: {
title: "We Are Going To Eclecfunk Your Ass",
artist: "Eclectek",
album,
},
},
{
url: "https://raw.githubusercontent.com/captbaritone/webamp-music/4b556fbf/Auto-Pilot_-_03_-_Seventeen.mp3",
duration: 214.622041,
metaData: {
title: "Seventeen",
artist: "Auto-Pilot",
album,
},
},
{
url: "https://raw.githubusercontent.com/captbaritone/webamp-music/4b556fbf/Muha_-_04_-_Microphone.mp3",
duration: 181.838367,
metaData: {
title: "Microphone",
artist: "Muha",
album,
},
},
{
url: "https://raw.githubusercontent.com/captbaritone/webamp-music/4b556fbf/Just_Plain_Ant_-_05_-_Stumble.mp3",
duration: 86.047347,
metaData: {
title: "Stumble",
artist: "Just Plain Ant",
album,
},
},
{
url: "https://raw.githubusercontent.com/captbaritone/webamp-music/4b556fbf/Sleaze_-_06_-_God_Damn.mp3",
duration: 226.795102,
metaData: {
title: "God Damn",
artist: "Sleaze",
album,
},
},
{
url: "https://raw.githubusercontent.com/captbaritone/webamp-music/4b556fbf/Juanitos_-_07_-_Hola_Hola_Bossa_Nova.mp3",
duration: 207.072653,
metaData: {
title: "Hola Hola Bossa Nova",
artist: "Juanitos",
album,
},
},
{
url: "https://raw.githubusercontent.com/captbaritone/webamp-music/4b556fbf/Entertainment_for_the_Braindead_-_08_-_Resolutions_Chris_Summer_Remix.mp3",
duration: 314.331429,
metaData: {
title: "Resolutions (Chris Summer Remix)",
artist: "Entertainment for the Braindead",
album,
},
},
{
url: "https://raw.githubusercontent.com/captbaritone/webamp-music/4b556fbf/Nobara_Hayakawa_-_09_-_Trail.mp3",
duration: 204.042449,
metaData: {
title: "Trail",
artist: "Nobara Hayakawa",
album,
},
},
{
url: "https://raw.githubusercontent.com/captbaritone/webamp-music/4b556fbf/Paper_Navy_-_10_-_Tongue_Tied.mp3",
duration: 201.116735,
metaData: {
title: "Tongue Tied",
artist: "Paper Navy",
album,
},
},
{
url: "https://raw.githubusercontent.com/captbaritone/webamp-music/4b556fbf/60_Tigres_-_11_-_Garage.mp3",
duration: 245.394286,
metaData: {
title: "Garage",
artist: "60 Tigres",
album,
},
},
{
url: "https://raw.githubusercontent.com/captbaritone/webamp-music/4b556fbf/CM_aka_Creative_-_12_-_The_Cycle_Featuring_Mista_Mista.mp3",
duration: 221.44,
metaData: {
title: "The Cycle (Featuring Mista Mista)",
artist: "CM aka Creative",
album,
},
},
];
export const initialTracks = config.initialTracks || defaultInitialTracks;
export const disableMarquee = config.disableMarquee || false;
export const initialState = config.initialState || undefined;