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

Experiment with Rollup/Vite #1263

Merged
merged 12 commits into from
Oct 1, 2024
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
16 changes: 11 additions & 5 deletions examples/minimalMilkdrop/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,17 @@
},
butterchurnOpen: true,
},
__initialWindowLayout: {
main: { position: { x: 0, y: 0 } },
equalizer: { position: { x: 0, y: 116 } },
playlist: { position: { x: 0, y: 232 }, size: [0, 4] },
milkdrop: { position: { x: 275, y: 0 }, size: [7, 12] },
windowLayout: {
main: { position: { top: 0, left: 0 } },
equalizer: { position: { top: 116, left: 0 } },
playlist: {
position: { top: 232, left: 0 },
size: { extraWidth: 0, extraHeight: 4 },
},
milkdrop: {
position: { top: 0, left: 275 },
size: { extraHeight: 12, extraWidth: 7 },
},
},
});
webamp.renderWhenReady(document.getElementById("app"));
Expand Down
23 changes: 12 additions & 11 deletions packages/skin-database/api/__tests__/graphql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,24 +106,25 @@ describe(".me", () => {
});
});

test.skip("/auth", async () => {
const { body } = await request(app)
.get("/auth")
.expect(302)
.expect(
"Location",
"https://discord.com/api/oauth2/authorize?client_id=%3CDUMMY_DISCORD_CLIENT_ID%3E&redirect_uri=https%3A%2F%2Fapi.webampskins.org%2Fauth%2Fdiscord&response_type=code&scope=identify%20guilds"
);
// TODO: The redirect_uri is different on github
test("/auth", async () => {
const { body } = await request(app).get("/auth").expect(302);
// TODO: The redirect_uri is different on github
// .expect(
// "Location",
// "https://discord.com/api/oauth2/authorize?client_id=%3CDUMMY_DISCORD_CLIENT_ID%3E&redirect_uri=https%3A%2F%2Fapi.webampskins.org%2Fauth%2Fdiscord&response_type=code&scope=identify%20guilds"
// );
expect(body).toEqual({});
});

describe.skip("/auth/discord", () => {
describe("/auth/discord", () => {
test("valid code", async () => {
const response = await request(app)
.get("/auth/discord")
.query({ code: "<A_FAKE_CODE>" })
.expect(302)
.expect("Location", "https://skins.webamp.org/review/");
.expect(302);
// TODO: The location is different on github
// .expect("Location", "https://skins.webamp.org/review/");
// TODO: Assert that we get cookie headers. I think that will not work now
// because express does not think it's secure in a test env.
expect(Auth.auth).toHaveBeenCalledWith("<A_FAKE_CODE>");
Expand Down
1 change: 0 additions & 1 deletion packages/skin-museum-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"react-helmet": "^6.1.0",
"react-redux": "^7.2.1",
"react-scripts": "^5.0.1",
"react-tinder-card": "^1.3.1",
"react-twitter-embed": "^3.0.3",
"react-window": "^1.8.1",
"redux": "^4.0.1",
Expand Down
71 changes: 36 additions & 35 deletions packages/skin-museum-client/src/ReviewPage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Utils from "./utils";
import { gql } from "./utils";
import TinderCard from "react-tinder-card";
// import TinderCard from "react-tinder-card";
import { API_URL } from "./constants";
import React, { useState, useEffect } from "react";

Expand Down Expand Up @@ -128,22 +128,22 @@ export default function ReviewPage() {
};
});

function swiped(dir, skin) {
switch (dir) {
case "left":
reject(skin);
break;
case "right":
approve(skin);
break;
default:
}
console.log({ dir, skin });
}

function outOfFrame(skin) {
console.log("out of frame", { skin });
}
// function _swiped(dir, skin) {
// switch (dir) {
// case "left":
// reject(skin);
// break;
// case "right":
// approve(skin);
// break;
// default:
// }
// console.log({ dir, skin });
// }

// function _outOfFrame(skin) {
// console.log("out of frame", { skin });
// }
if (skins.length === 0) {
return <h2 style={{ color: "white" }}>Loading...</h2>;
}
Expand All @@ -164,24 +164,25 @@ export default function ReviewPage() {
NSFW.
</p>
{reverseSkins.map((skin) => {
return (
<TinderCard
className="tinder-card"
key={skin.md5}
onSwipe={(dir) => swiped(dir, skin)}
onCardLeftScreen={() => outOfFrame(skin)}
preventSwipe={["up", "down"]}
>
<img
style={{
width: "100%",
imageRendering: "pixelated",
}}
src={Utils.screenshotUrlFromHash(skin.md5)}
alt={skin.filename}
/>
</TinderCard>
);
return <div>FIXME: Add TinderCard here</div>;
// return (
// <TinderCard
// className="tinder-card"
// key={skin.md5}
// onSwipe={(dir) => swiped(dir, skin)}
// onCardLeftScreen={() => outOfFrame(skin)}
// preventSwipe={["up", "down"]}
// >
// <img
// style={{
// width: "100%",
// imageRendering: "pixelated",
// }}
// src={Utils.screenshotUrlFromHash(skin.md5)}
// alt={skin.filename}
// />
// </TinderCard>
// );
})}
<br />
</div>
Expand Down
1 change: 0 additions & 1 deletion packages/webamp/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
*.min.js
built/
dist/
coverage/
**/node_modules/
examples/webpack/bundle.js
Expand Down
2 changes: 1 addition & 1 deletion packages/webamp/demo/js/DemoDesktop.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WebampLazy } from "./Webamp";
import WebampLazy from "../../js/webampLazy";
import { Suspense } from "react";
import WebampIcon from "./WebampIcon";
// import Mp3Icon from "./Mp3Icon";
Expand Down
3 changes: 2 additions & 1 deletion packages/webamp/demo/js/MilkIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { WebampLazy, loadPresets } from "./Webamp";
import type WebampLazy from "../../js/webampLazy";
import { loadPresets } from "../../js/actionCreators/milkdrop";
import { useCallback } from "react";
// @ts-ignore
import iconLarge from "../images/manifest/icon-96x96.png";
Expand Down
3 changes: 2 additions & 1 deletion packages/webamp/demo/js/Mp3Icon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { WebampLazy, URLTrack } from "./Webamp";
import WebampLazy from "../../js/webampLazy";
import { URLTrack } from "../../js/types";
import { useCallback } from "react";
// @ts-ignore
import iconLarge from "../images/manifest/icon-96x96.png";
Expand Down
2 changes: 1 addition & 1 deletion packages/webamp/demo/js/SkinIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WebampLazy } from "./Webamp";
import WebampLazy from "../../js/webampLazy";
// @ts-ignore
import iconSmall from "../images/icons/paint-file-32x32.png";
import DesktopIcon from "./DesktopIcon";
Expand Down
33 changes: 0 additions & 33 deletions packages/webamp/demo/js/Webamp.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/webamp/demo/js/WebampIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WebampLazy } from "./Webamp";
import WebampLazy from "../../js/webampLazy";
import { useEffect, useState } from "react";
// @ts-ignore
import iconSmall from "../images/icons/winamp2-32x32.png";
Expand Down
14 changes: 7 additions & 7 deletions packages/webamp/demo/js/availableSkins.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// @ts-ignore
import osx from "url:../skins/MacOSXAqua1-5.wsz";
import osx from "../skins/MacOSXAqua1-5.wsz";
// @ts-ignore
import topaz from "url:../skins/TopazAmp1-2.wsz";
import topaz from "../skins/TopazAmp1-2.wsz";
// @ts-ignore
import visor from "url:../skins/Vizor1-01.wsz";
import visor from "../skins/Vizor1-01.wsz";
// @ts-ignore
import xmms from "url:../skins/XMMS-Turquoise.wsz";
import xmms from "../skins/XMMS-Turquoise.wsz";
// @ts-ignore
import zaxon from "url:../skins/ZaxonRemake1-0.wsz";
import zaxon from "../skins/ZaxonRemake1-0.wsz";
// @ts-ignore
import green from "url:../skins/Green-Dimension-V2.wsz";
import green from "../skins/Green-Dimension-V2.wsz";
// @ts-ignore
import internetArchive from "url:../skins/Internet-Archive.wsz";
import internetArchive from "../skins/Internet-Archive.wsz";

export default [
{ url: green, name: "Green Dimension V2" },
Expand Down
2 changes: 1 addition & 1 deletion packages/webamp/demo/js/butterchurnOptions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ButterchurnOptions } from "./Webamp";
import { ButterchurnOptions } from "../../js/types";

const KNOWN_PRESET_URLS_REGEXES = [
/^https:\/\/unpkg\.com\/butterchurn-presets\/.*\.json$/,
Expand Down
4 changes: 2 additions & 2 deletions packages/webamp/demo/js/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Track, URLTrack, PartialState } from "./Webamp";
import { Track, URLTrack, PartialState } from "../../js/types";
// @ts-ignore
import llamaAudio from "url:../mp3/llama-2.91.mp3";
import llamaAudio from "../mp3/llama-2.91.mp3";

interface Config {
initialTracks?: Track[];
Expand Down
2 changes: 1 addition & 1 deletion packages/webamp/demo/js/dropboxFilePicker.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FilePicker } from "./Webamp";
import { FilePicker } from "../../js/types";

interface DropboxFile {
link: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/webamp/demo/js/eventLogger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { log, GoogleAnalyticsEvent } from "./logger";
import { Action } from "./Webamp";
import { Action } from "../../js/types";

function logEventFromAction(action: Action): GoogleAnalyticsEvent | null {
switch (action.type) {
Expand Down
10 changes: 6 additions & 4 deletions packages/webamp/demo/js/index.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import React from "react";
import * as Sentry from "@sentry/browser";
import ReactDOM from "react-dom/client";
// @ts-ignore
import isButterchurnSupported from "butterchurn/dist/isSupported.min";
import { getWebampConfig } from "./webampConfig";
import * as SoundCloud from "./SoundCloud";

import WebampLazy from "../../js/webampLazy";
import {
WebampLazy,
DISABLE_MARQUEE,
SET_DUMMY_VIZ_DATA,
SET_EQ_AUTO,
TOGGLE_REPEAT,
TOGGLE_SHUFFLE,
SET_EQ_AUTO,
SET_DUMMY_VIZ_DATA,
} from "./Webamp";
} from "../../js/actionTypes";

import { disableMarquee, skinUrl as configSkinUrl } from "./config";
import DemoDesktop from "./DemoDesktop";
Expand Down Expand Up @@ -87,6 +88,7 @@ async function main() {
}
let soundcloudPlaylist = null;
if (soundcloudPlaylistId != null) {
// @ts-ignore
soundcloudPlaylist = await SoundCloud.getPlaylist(soundcloudPlaylistId);
}
const config = await getWebampConfig(screenshot, skinUrl, soundcloudPlaylist);
Expand Down
2 changes: 1 addition & 1 deletion packages/webamp/demo/js/mediaSession.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WebampLazy } from "./Webamp";
import type WebampLazy from "../../js/webampLazy";

export default function enableMediaSession(webamp: WebampLazy) {
if ("mediaSession" in navigator) {
Expand Down
2 changes: 1 addition & 1 deletion packages/webamp/demo/js/screenshotInitialState.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PartialState } from "./Webamp";
import { PartialState } from "../../js/types";

const defaultTracksState = {
"0": {
Expand Down
12 changes: 4 additions & 8 deletions packages/webamp/demo/js/webampConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,24 @@ import isButterchurnSupported from "butterchurn/dist/isSupported.min";
import { loggerMiddleware } from "./eventLogger";
import * as SoundCloud from "./SoundCloud";

import { Action, Options, AppState, WindowLayout } from "../../js/types";

import {
Action,
Options,
PrivateOptions,
WINDOWS,
STEP_MARQUEE,
UPDATE_TIME_ELAPSED,
UPDATE_WINDOW_POSITIONS,
SET_VOLUME,
SET_BALANCE,
SET_BAND_VALUE,
AppState,
WindowLayout,
} from "./Webamp";
} from "../../js/actionTypes";

import { getButterchurnOptions } from "./butterchurnOptions";
import dropboxFilePicker from "./dropboxFilePicker";
import availableSkins from "./availableSkins";

import { initialTracks, initialState } from "./config";
import screenshotInitialState from "./screenshotInitialState";
import { InjectableDependencies } from "../../js/webampLazy.jsx";
import { InjectableDependencies, PrivateOptions } from "../../js/webampLazy";

const NOISY_ACTION_TYPES = new Set([
STEP_MARQUEE,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/webamp/js/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { useTypedSelector, useActionCreator } from "../hooks";
import Css from "./Css";

// @ts-ignore
import cssText from "bundle-text:../../css/webamp.css";
import cssText from "../../css/webamp.css?inline";

interface Props {
filePickers: FilePicker[];
Expand Down
Loading
Loading