Skip to content

Commit

Permalink
Script to build release ZIPs
Browse files Browse the repository at this point in the history
  • Loading branch information
Suyooo committed Feb 15, 2024
1 parent 486627f commit 3948a81
Show file tree
Hide file tree
Showing 12 changed files with 320 additions and 54 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DS_Store
node_modules
/build
/dist
/.svelte-kit
/package
.env
Expand Down
86 changes: 50 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,34 @@ guest user - no logins or permissions needed - to read the chat there, and recor

## How do I run it?

There are no download-and-run executables yet, but hopefully soon!

For now, to run this on your own machine, download this repo (click the green "Code" button at the top, pick "Download
ZIP", extract it somewhere) and [install the Node.JS runtime](https://nodejs.org/) (I've tested this project on LTS
version 20). Open a terminal in the repo folder (where the `package.json` file is located), and run `npm install` to
download dependencies. Create a file called `.env.development`, and fill it with `PUBLIC_APP_URL=http://localhost:5173`.
Then, use `npm run dev` to run the project. Once it's started up, visit `http://localhost:5173` in your browser to see
the app.

If you run the stream on another machine than the one you run this server on, or want to have your control panel on
another device like your phone, you need to replace `localhost` in the control panel and stream overlay URLs you copy
from your browser, with the local IP or hostname of the computer that is hosting. How exactly you get those depends on
your operating system - try searching for how to find your local network IP. You might also need to allow the server to
pass through the firewall on your computer (not the one on your router!).

## How do I build it?

- If you use Docker, you can simply run `docker build` and get a Docker container ready to run. You just need to add
the environment variables and port mappings to the `run` command or Compose file.
- Otherwise, you can build the project by running `npm run build`. You can then copy the `build` folder and
`package.json` to wherever you want to run it from, where you can start it using `node build`, assuming Node is
installed on the machine. Remember to set the environment variables.

In both cases, the app will run on port 3000 by default, which can be changed with the `PORT` environment variable. If
you are using a reverse proxy, [make sure to set it up correctly for Socket.IO in the `/socket.io` subpath](https://socket.io/docs/v4/reverse-proxy/).
Head over to [the Releases page](https://github.com/Suyooo/twitch-tgar-rating/releases) and download the ZIP! Download
the one for your OS (`linux`, `mac` or `win`) and architecture (in most cases: `arm` for Macs with M\* chips/Surface
devices/most SBCs like Raspberry Pi, `x64` otherwise). Extract the ZIP to an empty folder, then double-click the script
included (`run.sh`, `run.command` or `run.bat` depending on your OS) to start the server. The app will open in your
browser automatically!

Not working? Make sure you downloaded the ZIP for the right architecture, and double-check the architecture of your
system in the system settings of your OS. If you are using Mac or Linux, give the script file and executable in
`dist/node` permission to be executed if they don't have it. Try running the script from your terminal or command line
instead of double-clicking it, to see if it prints any error messages. You can
[open an Issue](https://github.com/Suyooo/twitch-tgar-rating/issues/new) if you need help with getting the server to run!

If you already have the NodeJS runtime installed on your computer, you can also just run `node dist/build` in your
terminal or command line. (The releases have been built with LTS v20.11.1.)

## How do I set it up?

If you use the Release ZIPs, the app will automatically open up in your browser once you start the server. You can also
find the URL in the server's output. Once you're in the app, it will show you the links you need to copy - one for the
Browser Source in OBS, and one to open in a new tab or window to control the overlay. You can find more information on
the page with the links. Check the "Styling" section below if you want to change the look of the overlay!

You can also run the stream on another machine than the one you run this server on, or have your control panel on
another device, like your phone - as long as they are on the same network as the server. For this, you need to replace
`localhost` in the control panel and stream overlay URLs you copy from your browser, with the local IP of the computer
that is hosting. How exactly you get those depends on your operating system - try searching for how to find your local
network IP. You might also need to allow the server to pass through the firewall on your computer (not the one on your
router!).

## Styling

Expand All @@ -52,21 +55,32 @@ override them on each of them seperately.
### Example

```css
#overlay {
--color-primary: #ec4899;
--color-secondary: #fbcfe8;
font-family: "FreeMono";
}
#overlay .bar-title {
letter-spacing: 10px;
}
#overlay .bar-rotator {
font-size: 30px;
}
#overlay {
--color-primary: #ec4899;
--color-secondary: #fbcfe8;
font-family: "FreeMono";
}
#overlay .bar-title {
letter-spacing: 10px;
}
#overlay .bar-rotator {
font-size: 30px;
}
```

![Example showing the CSS overrides above in action](styling_example.png?raw=true)

## Building

- If you use Docker, you can simply run `docker build` and get a Docker container ready to run. You just need to add
the environment variables and port mappings to the `run` command or Compose file.
- Otherwise, you can build the project by running `npm run build`. You can then copy the `build` folder and
`package.json` to wherever you want to run it from, where you can start it using `node build`, assuming Node is
installed on the machine. Remember to set the environment variables.

In both cases, the app will run on port 3000 by default, which can be changed with the `PORT` environment variable. If
you are using a reverse proxy, [make sure to set it up correctly for Socket.IO in the `/socket.io` subpath](https://socket.io/docs/v4/reverse-proxy/).

## Neat stuff I used for this

- [SvelteKit](https://kit.svelte.dev/)
Expand Down
138 changes: 136 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "twitch-tgar-rating",
"version": "0.0.1",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "vite dev --host 0.0.0.0",
Expand All @@ -9,13 +9,15 @@
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check .",
"format": "prettier --write ."
"format": "prettier --write .",
"release": "release/make.sh"
},
"devDependencies": {
"@sveltejs/kit": "^2.4.3",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@trivago/prettier-plugin-sort-imports": "^4.2.1",
"@types/tmi.js": "^1.8.6",
"open": "^10.0.3",
"prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.1.2",
"socket.io": "^4.7.3",
Expand Down
Loading

0 comments on commit 3948a81

Please sign in to comment.