-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Precompress assets uploaded to itch.io, prettify web code
- Loading branch information
1 parent
70fdf0d
commit d1e1b5d
Showing
29 changed files
with
882 additions
and
803 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,11 +83,21 @@ jobs: | |
cd ${{ github.workspace }}/src/asteroids-website | ||
npm run build | ||
- name: Upload artifact | ||
id: upload | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: '${{ github.workspace }}/src/asteroids-website/build' | ||
- name: Build Svelte-Compressed | ||
run: | | ||
cd ${{ github.workspace }}/src/asteroids-website | ||
npm run build-compressed | ||
- name: Upload compressed artifact | ||
id: upload-compressed | ||
uses: actions/upload-pages-artifact@v2 | ||
with: | ||
path: '${{ github.workspace }}/src/asteroids-website/build' | ||
|
||
deploy: | ||
deploy-github-pages: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
permissions: | ||
|
@@ -100,6 +110,36 @@ jobs: | |
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 | ||
|
||
deploy-itchio: | ||
runs-on: ubuntu-latest | ||
needs: deploy | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Download artifact compressed | ||
uses: actions/[email protected] | ||
with: | ||
name: github-pages | ||
path: asteroids-compressed | ||
- name: Set current datetime | ||
id: set_datetime | ||
run: echo "datetime=$(date +"%Y%m%d%H%M%S")" >> "$GITHUB_OUTPUT" | ||
- name: Create compressed ZIP | ||
run: | | ||
cd ../asteroids-compressed | ||
mkdir ./asteroids-compressed | ||
tar -xvf ./artifact-compressed.tar -C ./asteroids-compressed | ||
zip -r ../asteroids-v${{ steps.set_datetime.outputs.datetime }}.zip ./asteroids/ | ||
- uses: manleydev/butler-publish-itchio-action@master | ||
env: | ||
BUTLER_CREDENTIALS: ${{ secrets.ITCHIO_API_KEY }} | ||
CHANNEL: html | ||
VERSION: v${{ steps.set_datetime.outputs.datetime }} | ||
ITCH_GAME: asteroids | ||
ITCH_USER: dylanlangston | ||
PACKAGE: ./asteroids-v${{ steps.set_datetime.outputs.datetime }}.zip | ||
|
||
|
||
release: | ||
runs-on: ubuntu-latest | ||
|
@@ -110,7 +150,7 @@ jobs: | |
- name: Download artifact | ||
uses: actions/[email protected] | ||
with: | ||
name: github-pages | ||
name: artifact | ||
path: asteroids | ||
- name: Set current datetime | ||
id: set_datetime | ||
|
@@ -134,12 +174,4 @@ jobs: | |
draft: false | ||
commit: ${{ github.head_ref }} | ||
tag: v${{ steps.set_datetime.outputs.datetime }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: manleydev/butler-publish-itchio-action@master | ||
env: | ||
BUTLER_CREDENTIALS: ${{ secrets.ITCHIO_API_KEY }} | ||
CHANNEL: html | ||
VERSION: v${{ steps.set_datetime.outputs.datetime }} | ||
ITCH_GAME: asteroids | ||
ITCH_USER: dylanlangston | ||
PACKAGE: ./asteroids-v${{ steps.set_datetime.outputs.datetime }}.zip | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export default { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
} | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,21 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="%sveltekit.assets%/favicon.png" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<noscript> | ||
<style> | ||
.jsonly { | ||
display: none; | ||
} | ||
</style> | ||
</noscript> | ||
%sveltekit.head% | ||
</head> | ||
|
||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="%sveltekit.assets%/favicon.png" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<noscript> | ||
<style> | ||
.jsonly { | ||
display: none | ||
} | ||
</style> | ||
</noscript> | ||
%sveltekit.head% | ||
</head> | ||
|
||
<body data-sveltekit-preload-data="hover" class="h-screen touch-none"> | ||
<div style="display: contents">%sveltekit.body%</div> | ||
<script async src="fixes.js"></script> | ||
</body> | ||
|
||
</html> | ||
<body data-sveltekit-preload-data="hover" class="h-screen touch-none"> | ||
<div style="display: contents">%sveltekit.body%</div> | ||
<script async src="fixes.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<h1>Error</h1> | ||
<p>Code %sveltekit.status%</p> | ||
<p>%sveltekit.error.message%</p> | ||
<p>%sveltekit.error.message%</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
export enum Button { | ||
Up = 0, | ||
Down, | ||
Left, | ||
Right, | ||
Up_Left, | ||
Up_Right, | ||
Down_Left, | ||
Down_Right, | ||
A, | ||
Start, | ||
} | ||
Up = 0, | ||
Down, | ||
Left, | ||
Right, | ||
Up_Left, | ||
Up_Right, | ||
Down_Left, | ||
Down_Right, | ||
A, | ||
Start | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,71 @@ | ||
import { | ||
_, | ||
getLocaleFromNavigator, | ||
register, | ||
init, | ||
} from "svelte-i18n"; | ||
import { _, getLocaleFromNavigator, register, init } from 'svelte-i18n'; | ||
|
||
export enum Locales { | ||
unknown = 0, | ||
english, | ||
spanish, | ||
french, | ||
unknown = 0, | ||
english, | ||
spanish, | ||
french | ||
} | ||
|
||
class LocaleGroup { | ||
public readonly Locale: Locales; | ||
public readonly Index: number; | ||
public readonly Prefix: string; | ||
constructor(locale: Locales) { | ||
this.Locale = locale; | ||
this.Prefix = this.GetLocalePrefix(locale); | ||
this.Index = navigator.languages.findIndex(l => l.startsWith(this.Prefix)); | ||
} | ||
public readonly Locale: Locales; | ||
public readonly Index: number; | ||
public readonly Prefix: string; | ||
constructor(locale: Locales) { | ||
this.Locale = locale; | ||
this.Prefix = this.GetLocalePrefix(locale); | ||
this.Index = navigator.languages.findIndex((l) => l.startsWith(this.Prefix)); | ||
} | ||
|
||
private GetLocalePrefix(locale: Locales): string { | ||
switch (locale) { | ||
case Locales.english: | ||
return "en"; | ||
case Locales.spanish: | ||
return "es"; | ||
case Locales.french: | ||
return "fr"; | ||
default: | ||
return "undefined"; | ||
} | ||
} | ||
private GetLocalePrefix(locale: Locales): string { | ||
switch (locale) { | ||
case Locales.english: | ||
return 'en'; | ||
case Locales.spanish: | ||
return 'es'; | ||
case Locales.french: | ||
return 'fr'; | ||
default: | ||
return 'undefined'; | ||
} | ||
} | ||
} | ||
|
||
export class Localizer { | ||
private static _ = new Localizer(); | ||
private static _ = new Localizer(); | ||
|
||
constructor() { | ||
register("en", () => import("../locales/en.json")); | ||
register("es", () => import("../locales/es.json")); | ||
register("fr", () => import("../locales/fr.json")); | ||
constructor() { | ||
register('en', () => import('../locales/en.json')); | ||
register('es', () => import('../locales/es.json')); | ||
register('fr', () => import('../locales/fr.json')); | ||
|
||
init({ | ||
fallbackLocale: "en", | ||
initialLocale: getLocaleFromNavigator() | ||
}); | ||
} | ||
init({ | ||
fallbackLocale: 'en', | ||
initialLocale: getLocaleFromNavigator() | ||
}); | ||
} | ||
|
||
private static Locale: LocaleGroup | undefined = undefined; | ||
private static LoadLocale(): LocaleGroup | undefined { | ||
if (Localizer.Locale == undefined) { | ||
const allLocales = Object.entries(Locales).map((_, locale) => new LocaleGroup(locale)); | ||
const sortedLocales = allLocales.filter(l => l.Index > -1).sort((a, b) => a.Index - b.Index); | ||
Localizer.Locale = sortedLocales.at(0); | ||
} | ||
return Localizer.Locale; | ||
} | ||
private static Locale: LocaleGroup | undefined = undefined; | ||
private static LoadLocale(): LocaleGroup | undefined { | ||
if (Localizer.Locale == undefined) { | ||
const allLocales = Object.entries(Locales).map((_, locale) => new LocaleGroup(locale)); | ||
const sortedLocales = allLocales | ||
.filter((l) => l.Index > -1) | ||
.sort((a, b) => a.Index - b.Index); | ||
Localizer.Locale = sortedLocales.at(0); | ||
} | ||
return Localizer.Locale; | ||
} | ||
|
||
public static GetLocale(): Locales { | ||
const locale = Localizer.LoadLocale(); | ||
if (locale == undefined) return Locales.unknown; | ||
return locale.Locale; | ||
} | ||
public static GetLocale(): Locales { | ||
const locale = Localizer.LoadLocale(); | ||
if (locale == undefined) return Locales.unknown; | ||
return locale.Locale; | ||
} | ||
|
||
public static GetLocalePrefix(): string { | ||
const locale = Localizer.LoadLocale(); | ||
if (locale == undefined) return "en"; | ||
return locale.Prefix; | ||
} | ||
public static GetLocalePrefix(): string { | ||
const locale = Localizer.LoadLocale(); | ||
if (locale == undefined) return 'en'; | ||
return locale.Prefix; | ||
} | ||
} | ||
|
Oops, something went wrong.