Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark authored May 26, 2024
0 parents commit addbff9
Show file tree
Hide file tree
Showing 80 changed files with 5,558 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": ["@commitlint/config-conventional"],
"rules": {
"body-max-line-length": [1, "always", 100],
"footer-max-line-length": [1, "always", 100]
}
}
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VITE_APP_NAME=$npm_package_name
VITE_APP_VERSION=$npm_package_version
VITE_GOOGLE_ANALYTICS_ID=
13 changes: 13 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"parser": "@typescript-eslint/parser",
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"plugins": ["@typescript-eslint", "prettier", "simple-import-sort"],
"rules": {
"@typescript-eslint/no-non-null-assertion": "off",
"no-console": "error",
"no-debugger": "error",
"prettier/prettier": "error",
"simple-import-sort/exports": "error",
"simple-import-sort/imports": "error"
}
}
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* @remarkablemark

/package-lock.json
/package.json
27 changes: 27 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'daily'
groups:
commitlint:
patterns:
- '@commitlint/*'
prettier:
patterns:
- prettier
- eslint-plugin-prettier
typescript-eslint:
patterns:
- '@typescript-eslint/*'

- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'daily'
8 changes: 8 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pull_request_rules:
- name: automatic merge for Dependabot pull requests
conditions:
- author=dependabot[bot]
- check-success=build
actions:
merge:
method: squash
45 changes: 45 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: build
on: [push, pull_request]

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Use Node.js
uses: actions/setup-node@v4
with:
cache: npm
node-version-file: .nvmrc

- name: Install dependencies
run: npm ci --prefer-offline

- name: Lint commit message
run: npx commitlint --from=HEAD~1

- name: Run ESLint
run: npm run lint

- name: Type check
run: npm run lint:tsc

- name: Build
run: npm run build -- --base /${{ github.event.repository.name }}/
env:
VITE_GOOGLE_ANALYTICS_ID: ${{ vars.GOOGLE_ANALYTICS_ID }}

- name: Deploy
if: github.ref_name == 'master'
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: dist
54 changes: 54 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: release-please
on:
push:
branches:
- master

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}

steps:
- name: Release Please
uses: google-github-actions/release-please-action@v4
id: release
with:
release-type: node

publish:
needs: release-please
runs-on: ubuntu-latest
if: ${{ needs.release-please.outputs.release_created }}

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

- name: Use Node.js
uses: actions/setup-node@v4
with:
cache: npm
node-version-file: .nvmrc

- name: Install dependencies
run: npm ci --prefer-offline

- name: Read package version
run: echo "VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV

- name: Build
run: npm run bundle

- name: Setup butler
uses: remarkablegames/setup-butler@v1

- name: Upload to itch.io
run: butler push dist ${{ github.repository }}:html5 --userversion ${{ env.VERSION }}
env:
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# vite
/dist

# misc
*.swp
.DS_Store

npm-debug.log*
yarn-debug.log*
yarn-error.log*
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx commitlint --edit $1
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
4 changes: 4 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"*.{js,jsx,mjs,mts,ts,tsx}": "eslint --fix",
"*.{css,html,json,md,yml}": "prettier --write"
}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
4 changes: 4 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"semi": false
}
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License

Copyright (c) 2024 Menglin "Mark" Xu <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# kaboom-template

<kbd>kaboom-template</kbd> is a template for making [Kaboom](https://kaboomjs.com/) games. See [example](https://remarkablegames.org/kaboom-template).

## Stack

- [Kaboom](https://kaboomjs.com/)
- [Vite](https://vitejs.dev/)
- [GitHub Pages](https://pages.github.com/)

## Prerequisites

- [nvm](https://github.com/nvm-sh/nvm#readme)

## Install

Clone the repository:

```sh
git clone https://github.com/remarkablegames/kaboom-template.git
cd kaboom-template
```

Use the Node.js version:

```sh
nvm use
```

Install the dependencies:

```sh
npm install
```

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the game in the development mode.

Open [http://localhost:5173](http://localhost:5173) to view it in the browser.

The page will reload if you make edits.

You will also see any errors in the console.

### `npm run build`

Builds the game for production to the `dist` folder.

It correctly bundles in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.

Your game is ready to be deployed!

### `npm run bundle`

Builds the game and packages it into a Zip file in the `dist` folder.

Your game can be uploaded to your server, [Itch.io](https://itch.io/), [Newgrounds](https://www.newgrounds.com/), etc.

## License

[MIT](LICENSE)
71 changes: 71 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="utf-8" />
<link rel="icon" href="/logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web game created using kaboom-template."
/>
<meta
property="og:image"
content="https://remarkablegames.org/kaboom-template/logo.png"
/>

<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="/manifest.json" />

<!--
GitHub Corners. See https://github.com/remarkablemark/github-corners
-->
<% if (process.env.BUNDLE !== 'true') { %>
<script
src="https://unpkg.com/github-corners/dist/embed.min.js"
data-href="https://github.com/remarkablegames/kaboom-template"
data-target="_blank"
async
defer
></script>
<style>
.github-corner > svg {
opacity: 0.6;
transition: opacity 0.4s;
}
.github-corner:hover > svg {
opacity: 1;
}
</style>
<% } %>

<title>Kaboom Template | remarkablegames</title>
</head>
<body>
<noscript>You need to enable JavaScript to play this game.</noscript>

<script type="module">
import kaboom from 'kaboom'
kaboom()
</script>
<script type="module" src="src/index.ts"></script>

<!-- Global site tag (gtag.js) - Google Analytics -->
<script>
window['ga-disable-%VITE_GOOGLE_ANALYTICS_ID%'] = %DEV%;
window.dataLayer = window.dataLayer || [];
window.gtag = function () {
dataLayer.push(arguments);
};
gtag('js', new Date());
gtag('config', '%VITE_GOOGLE_ANALYTICS_ID%');
</script>
<script
async
src="https://www.googletagmanager.com/gtag/js?id=%VITE_GOOGLE_ANALYTICS_ID%"
></script>
</body>
</html>
Loading

0 comments on commit addbff9

Please sign in to comment.