Skip to content

Commit 6f78180

Browse files
authored
Experiment with Rollup/Vite (#1263)
* Trial switching to vite rollup * Vite/Rollup fixups * Cleanup * Fixup CI * Fix serve * Disable post-css injection for vite * Update image snapshots * Update snapshots * Enable graphql tests * Remove tinder card * Fix GraphQL tests with discord urls * Avoid unused vars
1 parent e4ef68d commit 6f78180

36 files changed

+696
-191
lines changed

examples/minimalMilkdrop/index.html

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,17 @@
4040
},
4141
butterchurnOpen: true,
4242
},
43-
__initialWindowLayout: {
44-
main: { position: { x: 0, y: 0 } },
45-
equalizer: { position: { x: 0, y: 116 } },
46-
playlist: { position: { x: 0, y: 232 }, size: [0, 4] },
47-
milkdrop: { position: { x: 275, y: 0 }, size: [7, 12] },
43+
windowLayout: {
44+
main: { position: { top: 0, left: 0 } },
45+
equalizer: { position: { top: 116, left: 0 } },
46+
playlist: {
47+
position: { top: 232, left: 0 },
48+
size: { extraWidth: 0, extraHeight: 4 },
49+
},
50+
milkdrop: {
51+
position: { top: 0, left: 275 },
52+
size: { extraHeight: 12, extraWidth: 7 },
53+
},
4854
},
4955
});
5056
webamp.renderWhenReady(document.getElementById("app"));

packages/skin-database/api/__tests__/graphql.test.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -106,24 +106,25 @@ describe(".me", () => {
106106
});
107107
});
108108

109-
test.skip("/auth", async () => {
110-
const { body } = await request(app)
111-
.get("/auth")
112-
.expect(302)
113-
.expect(
114-
"Location",
115-
"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"
116-
);
109+
// TODO: The redirect_uri is different on github
110+
test("/auth", async () => {
111+
const { body } = await request(app).get("/auth").expect(302);
112+
// TODO: The redirect_uri is different on github
113+
// .expect(
114+
// "Location",
115+
// "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"
116+
// );
117117
expect(body).toEqual({});
118118
});
119119

120-
describe.skip("/auth/discord", () => {
120+
describe("/auth/discord", () => {
121121
test("valid code", async () => {
122122
const response = await request(app)
123123
.get("/auth/discord")
124124
.query({ code: "<A_FAKE_CODE>" })
125-
.expect(302)
126-
.expect("Location", "https://skins.webamp.org/review/");
125+
.expect(302);
126+
// TODO: The location is different on github
127+
// .expect("Location", "https://skins.webamp.org/review/");
127128
// TODO: Assert that we get cookie headers. I think that will not work now
128129
// because express does not think it's secure in a test env.
129130
expect(Auth.auth).toHaveBeenCalledWith("<A_FAKE_CODE>");

packages/skin-museum-client/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"react-helmet": "^6.1.0",
2121
"react-redux": "^7.2.1",
2222
"react-scripts": "^5.0.1",
23-
"react-tinder-card": "^1.3.1",
2423
"react-twitter-embed": "^3.0.3",
2524
"react-window": "^1.8.1",
2625
"redux": "^4.0.1",

packages/skin-museum-client/src/ReviewPage.js

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as Utils from "./utils";
22
import { gql } from "./utils";
3-
import TinderCard from "react-tinder-card";
3+
// import TinderCard from "react-tinder-card";
44
import { API_URL } from "./constants";
55
import React, { useState, useEffect } from "react";
66

@@ -128,22 +128,22 @@ export default function ReviewPage() {
128128
};
129129
});
130130

131-
function swiped(dir, skin) {
132-
switch (dir) {
133-
case "left":
134-
reject(skin);
135-
break;
136-
case "right":
137-
approve(skin);
138-
break;
139-
default:
140-
}
141-
console.log({ dir, skin });
142-
}
143-
144-
function outOfFrame(skin) {
145-
console.log("out of frame", { skin });
146-
}
131+
// function _swiped(dir, skin) {
132+
// switch (dir) {
133+
// case "left":
134+
// reject(skin);
135+
// break;
136+
// case "right":
137+
// approve(skin);
138+
// break;
139+
// default:
140+
// }
141+
// console.log({ dir, skin });
142+
// }
143+
144+
// function _outOfFrame(skin) {
145+
// console.log("out of frame", { skin });
146+
// }
147147
if (skins.length === 0) {
148148
return <h2 style={{ color: "white" }}>Loading...</h2>;
149149
}
@@ -164,24 +164,25 @@ export default function ReviewPage() {
164164
NSFW.
165165
</p>
166166
{reverseSkins.map((skin) => {
167-
return (
168-
<TinderCard
169-
className="tinder-card"
170-
key={skin.md5}
171-
onSwipe={(dir) => swiped(dir, skin)}
172-
onCardLeftScreen={() => outOfFrame(skin)}
173-
preventSwipe={["up", "down"]}
174-
>
175-
<img
176-
style={{
177-
width: "100%",
178-
imageRendering: "pixelated",
179-
}}
180-
src={Utils.screenshotUrlFromHash(skin.md5)}
181-
alt={skin.filename}
182-
/>
183-
</TinderCard>
184-
);
167+
return <div>FIXME: Add TinderCard here</div>;
168+
// return (
169+
// <TinderCard
170+
// className="tinder-card"
171+
// key={skin.md5}
172+
// onSwipe={(dir) => swiped(dir, skin)}
173+
// onCardLeftScreen={() => outOfFrame(skin)}
174+
// preventSwipe={["up", "down"]}
175+
// >
176+
// <img
177+
// style={{
178+
// width: "100%",
179+
// imageRendering: "pixelated",
180+
// }}
181+
// src={Utils.screenshotUrlFromHash(skin.md5)}
182+
// alt={skin.filename}
183+
// />
184+
// </TinderCard>
185+
// );
185186
})}
186187
<br />
187188
</div>

packages/webamp/.eslintignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
*.min.js
22
built/
3-
dist/
43
coverage/
54
**/node_modules/
65
examples/webpack/bundle.js

packages/webamp/demo/js/DemoDesktop.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { WebampLazy } from "./Webamp";
1+
import WebampLazy from "../../js/webampLazy";
22
import { Suspense } from "react";
33
import WebampIcon from "./WebampIcon";
44
// import Mp3Icon from "./Mp3Icon";

packages/webamp/demo/js/MilkIcon.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { WebampLazy, loadPresets } from "./Webamp";
1+
import type WebampLazy from "../../js/webampLazy";
2+
import { loadPresets } from "../../js/actionCreators/milkdrop";
23
import { useCallback } from "react";
34
// @ts-ignore
45
import iconLarge from "../images/manifest/icon-96x96.png";

packages/webamp/demo/js/Mp3Icon.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { WebampLazy, URLTrack } from "./Webamp";
1+
import WebampLazy from "../../js/webampLazy";
2+
import { URLTrack } from "../../js/types";
23
import { useCallback } from "react";
34
// @ts-ignore
45
import iconLarge from "../images/manifest/icon-96x96.png";

packages/webamp/demo/js/SkinIcon.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { WebampLazy } from "./Webamp";
1+
import WebampLazy from "../../js/webampLazy";
22
// @ts-ignore
33
import iconSmall from "../images/icons/paint-file-32x32.png";
44
import DesktopIcon from "./DesktopIcon";

packages/webamp/demo/js/Webamp.ts

Lines changed: 0 additions & 33 deletions
This file was deleted.

packages/webamp/demo/js/WebampIcon.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { WebampLazy } from "./Webamp";
1+
import WebampLazy from "../../js/webampLazy";
22
import { useEffect, useState } from "react";
33
// @ts-ignore
44
import iconSmall from "../images/icons/winamp2-32x32.png";

packages/webamp/demo/js/availableSkins.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
// @ts-ignore
2-
import osx from "url:../skins/MacOSXAqua1-5.wsz";
2+
import osx from "../skins/MacOSXAqua1-5.wsz";
33
// @ts-ignore
4-
import topaz from "url:../skins/TopazAmp1-2.wsz";
4+
import topaz from "../skins/TopazAmp1-2.wsz";
55
// @ts-ignore
6-
import visor from "url:../skins/Vizor1-01.wsz";
6+
import visor from "../skins/Vizor1-01.wsz";
77
// @ts-ignore
8-
import xmms from "url:../skins/XMMS-Turquoise.wsz";
8+
import xmms from "../skins/XMMS-Turquoise.wsz";
99
// @ts-ignore
10-
import zaxon from "url:../skins/ZaxonRemake1-0.wsz";
10+
import zaxon from "../skins/ZaxonRemake1-0.wsz";
1111
// @ts-ignore
12-
import green from "url:../skins/Green-Dimension-V2.wsz";
12+
import green from "../skins/Green-Dimension-V2.wsz";
1313
// @ts-ignore
14-
import internetArchive from "url:../skins/Internet-Archive.wsz";
14+
import internetArchive from "../skins/Internet-Archive.wsz";
1515

1616
export default [
1717
{ url: green, name: "Green Dimension V2" },

packages/webamp/demo/js/butterchurnOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ButterchurnOptions } from "./Webamp";
1+
import { ButterchurnOptions } from "../../js/types";
22

33
const KNOWN_PRESET_URLS_REGEXES = [
44
/^https:\/\/unpkg\.com\/butterchurn-presets\/.*\.json$/,

packages/webamp/demo/js/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Track, URLTrack, PartialState } from "./Webamp";
1+
import { Track, URLTrack, PartialState } from "../../js/types";
22
// @ts-ignore
3-
import llamaAudio from "url:../mp3/llama-2.91.mp3";
3+
import llamaAudio from "../mp3/llama-2.91.mp3";
44

55
interface Config {
66
initialTracks?: Track[];

packages/webamp/demo/js/dropboxFilePicker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FilePicker } from "./Webamp";
1+
import { FilePicker } from "../../js/types";
22

33
interface DropboxFile {
44
link: string;

packages/webamp/demo/js/eventLogger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { log, GoogleAnalyticsEvent } from "./logger";
2-
import { Action } from "./Webamp";
2+
import { Action } from "../../js/types";
33

44
function logEventFromAction(action: Action): GoogleAnalyticsEvent | null {
55
switch (action.type) {

packages/webamp/demo/js/index.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1+
import React from "react";
12
import * as Sentry from "@sentry/browser";
23
import ReactDOM from "react-dom/client";
34
// @ts-ignore
45
import isButterchurnSupported from "butterchurn/dist/isSupported.min";
56
import { getWebampConfig } from "./webampConfig";
67
import * as SoundCloud from "./SoundCloud";
78

9+
import WebampLazy from "../../js/webampLazy";
810
import {
9-
WebampLazy,
1011
DISABLE_MARQUEE,
12+
SET_DUMMY_VIZ_DATA,
13+
SET_EQ_AUTO,
1114
TOGGLE_REPEAT,
1215
TOGGLE_SHUFFLE,
13-
SET_EQ_AUTO,
14-
SET_DUMMY_VIZ_DATA,
15-
} from "./Webamp";
16+
} from "../../js/actionTypes";
1617

1718
import { disableMarquee, skinUrl as configSkinUrl } from "./config";
1819
import DemoDesktop from "./DemoDesktop";
@@ -87,6 +88,7 @@ async function main() {
8788
}
8889
let soundcloudPlaylist = null;
8990
if (soundcloudPlaylistId != null) {
91+
// @ts-ignore
9092
soundcloudPlaylist = await SoundCloud.getPlaylist(soundcloudPlaylistId);
9193
}
9294
const config = await getWebampConfig(screenshot, skinUrl, soundcloudPlaylist);

packages/webamp/demo/js/mediaSession.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { WebampLazy } from "./Webamp";
1+
import type WebampLazy from "../../js/webampLazy";
22

33
export default function enableMediaSession(webamp: WebampLazy) {
44
if ("mediaSession" in navigator) {

packages/webamp/demo/js/screenshotInitialState.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PartialState } from "./Webamp";
1+
import { PartialState } from "../../js/types";
22

33
const defaultTracksState = {
44
"0": {

packages/webamp/demo/js/webampConfig.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,24 @@ import isButterchurnSupported from "butterchurn/dist/isSupported.min";
66
import { loggerMiddleware } from "./eventLogger";
77
import * as SoundCloud from "./SoundCloud";
88

9+
import { Action, Options, AppState, WindowLayout } from "../../js/types";
10+
911
import {
10-
Action,
11-
Options,
12-
PrivateOptions,
13-
WINDOWS,
1412
STEP_MARQUEE,
1513
UPDATE_TIME_ELAPSED,
1614
UPDATE_WINDOW_POSITIONS,
1715
SET_VOLUME,
1816
SET_BALANCE,
1917
SET_BAND_VALUE,
20-
AppState,
21-
WindowLayout,
22-
} from "./Webamp";
18+
} from "../../js/actionTypes";
2319

2420
import { getButterchurnOptions } from "./butterchurnOptions";
2521
import dropboxFilePicker from "./dropboxFilePicker";
2622
import availableSkins from "./availableSkins";
2723

2824
import { initialTracks, initialState } from "./config";
2925
import screenshotInitialState from "./screenshotInitialState";
30-
import { InjectableDependencies } from "../../js/webampLazy.jsx";
26+
import { InjectableDependencies, PrivateOptions } from "../../js/webampLazy";
3127

3228
const NOISY_ACTION_TYPES = new Set([
3329
STEP_MARQUEE,

packages/webamp/js/components/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { useTypedSelector, useActionCreator } from "../hooks";
2525
import Css from "./Css";
2626

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

3030
interface Props {
3131
filePickers: FilePicker[];

0 commit comments

Comments
 (0)