Skip to content

Commit

Permalink
Code Overhaul v1.0.0
Browse files Browse the repository at this point in the history
- Ported to Typescript
- Added Vite build/bundler
- Added Github workflow to publish to Github Pages

Porting to Typescript revealed several issues with the code structure,
fixes to those issues are included in this port.
Most types were build around the existing shape of an object, however,
there were some objects which were rebuild do to some Javascript abuse.

I ported to Typescript because:
  * I like Typescript more than JSDoc
  * I like explicit in-code types rather than JSDoc comments
  * I like the Typescript LSP and the resulting IDE integration
  * It's my project and I can do what I want :)
  • Loading branch information
justino committed Apr 4, 2024
1 parent fbbe747 commit 7ed28a5
Show file tree
Hide file tree
Showing 37 changed files with 1,485 additions and 308 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"customizations": {
"vscode": {
"extensions": [
"EditorConfig.EditorConfig"
"EditorConfig.EditorConfig",
"YoavBls.pretty-ts-errors"
]
}
}
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy to Github Pages

on:
push:
branches: ['master']
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: 'pages'
cancel-in-progress: true

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install Dependencies
run: npm ci

- name: Build
run: npm run build

- name: Setup Github Pages staging area
uses: actions/configure-pages@v5

- name: Upload build to Github Pages staging area
uses: actions/upload-pages-artifact@v3
with:
path: './dest'

- name: Deploy to Github Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*~
node_modules/
dist/
7 changes: 2 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<title>Grid Warriors</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Orbitron">
<link rel="stylesheet" type="text/css" href="css/gridwarriors.css" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<link rel="icon" type="image/x-icon" href="images/favicon.ico" />
</head>
<body>
<header id="scoreboard">
Expand All @@ -15,7 +15,6 @@
High Score: <span id="highscore">0</span>
</div>
</header>

<main>
<div class="gamegrid">
<canvas id="gamegrid"></canvas>
Expand All @@ -24,14 +23,12 @@
</div>
</div>
</main>

<footer>
<ul>
<li><a href="https://github.com/justino/GridWarriors">Github</a></li>
</ul>
</footer>

<!-- Game starts here -->
<script type="module" src="js/main.js"></script>
<script type="module" src="src/main.ts"></script>
</body>
</html>
55 changes: 0 additions & 55 deletions js/keyboard.js

This file was deleted.

7 changes: 0 additions & 7 deletions js/main.js

This file was deleted.

22 changes: 0 additions & 22 deletions js/overlay.js

This file was deleted.

49 changes: 0 additions & 49 deletions js/scoreboard.js

This file was deleted.

12 changes: 0 additions & 12 deletions js/units/warrior.js

This file was deleted.

Loading

0 comments on commit 7ed28a5

Please sign in to comment.