mirror repo (WIP)

Need to remove secrets before entire repo can be made public.
This commit is contained in:
Brandon Thomas
2025-09-18 22:55:03 -04:00
commit 0daf83dba9
8735 changed files with 2963896 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
{
"presets": [
[
"@nx/react/babel",
{
"runtime": "automatic",
"useBuiltIns": "usage"
}
]
],
"plugins": []
}
+36
View File
@@ -0,0 +1,36 @@
{
"extends": [
"plugin:@nx/react",
"../../.eslintrc.json"
],
"ignorePatterns": [
"!**/*",
"**/vite.config.*.timestamp*",
"**/vitest.config.*.timestamp*"
],
"overrides": [
{
"files": [
"*.ts",
"*.tsx",
"*.js",
"*.jsx"
],
"rules": {}
},
{
"files": [
"*.ts",
"*.tsx"
],
"rules": {}
},
{
"files": [
"*.js",
"*.jsx"
],
"rules": {}
}
]
}
+7
View File
@@ -0,0 +1,7 @@
# @frontend/soundboard
This library was generated with [Nx](https://nx.dev).
## Running unit tests
Run `nx test @frontend/soundboard` to execute the unit tests via [Vitest](https://vitest.dev/).
+3
View File
@@ -0,0 +1,3 @@
export * from './lib/SoundEffect';
export * from './lib/SoundRegistry';
//# sourceMappingURL=index.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
File diff suppressed because it is too large Load Diff
+12
View File
@@ -0,0 +1,12 @@
import { Howl } from 'howler';
export interface Args {
defaultVolume?: number;
}
export declare class SoundEffect {
readonly soundUrl: string;
readonly defaultVolume: number;
readonly howlerSound: Howl;
constructor(soundUrl: string, args?: Args);
play(): void;
}
//# sourceMappingURL=SoundEffect.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"SoundEffect.d.ts","sourceRoot":"","sources":["../../src/lib/SoundEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAE5B,MAAM,WAAW,IAAI;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,WAAW;IAEtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC;gBAEf,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI;IAalC,IAAI;CAGZ"}
+12
View File
@@ -0,0 +1,12 @@
import { SoundEffect } from './SoundEffect';
export declare class SoundRegistry {
#private;
private constructor();
static getInstance(): SoundRegistry;
hasSound(key: string): boolean;
setSound(key: string, sound: SoundEffect): void;
setSoundOnce(key: string, sound: SoundEffect): void;
getSound(key: string): SoundEffect | undefined;
playSound(key: string): void;
}
//# sourceMappingURL=SoundRegistry.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"SoundRegistry.d.ts","sourceRoot":"","sources":["../../src/lib/SoundRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,qBAAa,aAAa;;IAKxB,OAAO;WAIO,WAAW;IAOlB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAI,OAAO;IAI/B,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW;IAIxC,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW;IAM5C,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAI,WAAW,GAAG,SAAS;IAI/C,SAAS,CAAC,GAAG,EAAE,MAAM;CAG7B"}
+1
View File
@@ -0,0 +1 @@
//# sourceMappingURL=server.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":""}
+1
View File
@@ -0,0 +1 @@
//# sourceMappingURL=test-setup.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"test-setup.d.ts","sourceRoot":"","sources":["../src/test-setup.ts"],"names":[],"mappings":"AACA,OAAO,oCAAoC,CAAC"}
+23
View File
@@ -0,0 +1,23 @@
{
"name": "@storyteller/soundboard",
"version": "0.0.1",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"development": "./src/index.ts",
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"default": "./dist/index.js"
}
},
"dependencies": {
"howler": "^2.2.4"
},
"devDependencies": {
"@types/howler": "^2.2.12"
}
}
+3
View File
@@ -0,0 +1,3 @@
export * from './lib/SoundEffect';
export * from './lib/SoundRegistry';
@@ -0,0 +1,29 @@
import {Howl} from 'howler';
export interface Args {
defaultVolume?: number;
}
export class SoundEffect {
readonly soundUrl: string;
readonly defaultVolume: number;
readonly howlerSound: Howl;
constructor(soundUrl: string, args?: Args) {
const defaultVolume = args?.defaultVolume || 1.0;
this.soundUrl = soundUrl;
this.defaultVolume = defaultVolume;
this.howlerSound = new Howl({
src: [soundUrl],
autoplay: false,
loop: false,
volume: defaultVolume,
});
}
public play() {
this.howlerSound.play();
}
}
@@ -0,0 +1,40 @@
import { SoundEffect } from "./SoundEffect";
export class SoundRegistry {
static #instance: SoundRegistry | undefined;
#sounds: Map<string, SoundEffect>;
private constructor() {
this.#sounds = new Map();
}
public static getInstance() {
if (SoundRegistry.#instance === undefined) {
SoundRegistry.#instance = new SoundRegistry();
}
return SoundRegistry.#instance;
}
public hasSound(key: string) : boolean {
return this.#sounds.has(key);
}
public setSound(key: string, sound: SoundEffect) {
this.#sounds.set(key, sound);
}
public setSoundOnce(key: string, sound: SoundEffect) {
if (!this.#sounds.has(key)) {
this.#sounds.set(key, sound);
}
}
public getSound(key: string) : SoundEffect | undefined {
return this.#sounds.get(key);
}
public playSound(key: string) {
this.#sounds.get(key)?.play()
}
}
+1
View File
@@ -0,0 +1 @@
// This file should be used to export ONLY server-code from the library.
@@ -0,0 +1,3 @@
import { installGlobals } from '@remix-run/node';
import "@testing-library/jest-dom/matchers";
installGlobals();
+13
View File
@@ -0,0 +1,13 @@
{
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
],
"extends": "../../tsconfig.base.json"
}
@@ -0,0 +1,48 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "dist",
"types": [
"node",
"@nx/react/typings/cssmodule.d.ts",
"@nx/react/typings/image.d.ts",
"vite/client"
],
"rootDir": "src",
"jsx": "react-jsx",
"tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo"
},
"exclude": [
"out-tsc",
"dist",
"**/*.spec.ts",
"**/*.test.ts",
"**/*.spec.tsx",
"**/*.test.tsx",
"**/*.spec.js",
"**/*.test.js",
"**/*.spec.jsx",
"**/*.test.jsx",
"vite.config.ts",
"vite.config.mts",
"vitest.config.ts",
"vitest.config.mts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
"src/**/*.spec.tsx",
"src/**/*.test.js",
"src/**/*.spec.js",
"src/**/*.test.jsx",
"src/**/*.spec.jsx",
"eslint.config.js",
"eslint.config.cjs",
"eslint.config.mjs"
],
"include": [
"src/**/*.js",
"src/**/*.jsx",
"src/**/*.ts",
"src/**/*.tsx"
]
}
@@ -0,0 +1,34 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./out-tsc/vitest",
"types": [
"vitest/globals",
"vitest/importMeta",
"vite/client",
"node",
"vitest"
],
"jsx": "react-jsx"
},
"include": [
"vite.config.ts",
"vite.config.mts",
"vitest.config.ts",
"vitest.config.mts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
"src/**/*.spec.tsx",
"src/**/*.test.js",
"src/**/*.spec.js",
"src/**/*.test.jsx",
"src/**/*.spec.jsx",
"src/**/*.d.ts"
],
"references": [
{
"path": "./tsconfig.lib.json"
}
]
}
+49
View File
@@ -0,0 +1,49 @@
/// <reference types='vitest' />
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import dts from 'vite-plugin-dts';
import * as path from 'path';
export default defineConfig(() => ({
root: __dirname,
cacheDir: '../../node_modules/.vite/libs/soundboard',
plugins: [react(), dts({ entryRoot: 'src', tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') })],
// Uncomment this if you are using workers.
// worker: {
// plugins: [ nxViteTsPaths() ],
// },
// Configuration for building your library.
// See: https://vitejs.dev/guide/build.html#library-mode
build: {
outDir: './dist',
emptyOutDir: true,
reportCompressedSize: true,
commonjsOptions: {
transformMixedEsModules: true,
},
lib: {
// Could also be a dictionary or array of multiple entry points.
entry: 'src/index.ts',
name: '@frontend/soundboard',
fileName: 'index',
// Change this to the formats you want to support.
// Don't forget to update your package.json as well.
formats: ['es' as const]
},
rollupOptions: {
// External packages that should not be bundled into your library.
external: ['react','react-dom','react/jsx-runtime']
},
},
test: {setupFiles: ['./src/test-setup.ts'],
watch: false,
globals: true,
environment: 'jsdom',
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
reporters: ['default'],
coverage: {
reportsDirectory: './test-output/vitest/coverage',
provider: 'v8' as const,
}
},
}));