generated from remarkablegames/phaser-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 036e2e1
Showing
48 changed files
with
9,269 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": ["@commitlint/config-conventional"], | ||
"rules": { | ||
"body-max-line-length": [1, "always", 100] | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
VITE_APP_HOMEPAGE=$npm_package_homepage | ||
VITE_APP_NAME=$npm_package_name | ||
VITE_APP_VERSION=$npm_package_version | ||
VITE_GOOGLE_ANALYTICS_ID= |
Validating CODEOWNERS rules …
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
* @remarkablemark | ||
|
||
/package-lock.json | ||
/package.json |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# 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/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: 'npm' | ||
directory: '/' | ||
schedule: | ||
interval: 'daily' | ||
groups: | ||
commitlint: | ||
patterns: | ||
- '@commitlint/*' | ||
eslint: | ||
patterns: | ||
- '@eslint/*' | ||
prettier: | ||
patterns: | ||
- prettier | ||
- eslint-plugin-prettier | ||
typescript-eslint: | ||
patterns: | ||
- '@typescript-eslint/*' | ||
|
||
- package-ecosystem: 'github-actions' | ||
directory: '/' | ||
schedule: | ||
interval: 'daily' |
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 |
---|---|---|
@@ -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 |
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
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: Set environment variables | ||
run: | | ||
echo "VITE_APP_HOMEPAGE=$(jq -r .homepage package.json)" >> $GITHUB_ENV | ||
echo "VITE_APP_VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV | ||
- name: Build | ||
run: npm run build -- --base /${{ github.event.repository.name }}/ | ||
env: | ||
VITE_GOOGLE_ANALYTICS_ID: ${{ secrets.GOOGLE_ANALYTICS_ID }} | ||
|
||
- name: Deploy | ||
if: github.ref_name == 'master' | ||
uses: remarkablemark/gitploy-action@v1 | ||
with: | ||
directory: dist |
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: release-please | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
release_created: ${{ steps.release.outputs.release_created }} | ||
tag_name: ${{ steps.release.outputs.tag_name }} | ||
|
||
steps: | ||
- name: Release Please | ||
uses: googleapis/release-please-action@v4 | ||
id: release | ||
with: | ||
release-type: node | ||
|
||
deploy: | ||
needs: release | ||
runs-on: ubuntu-latest | ||
if: ${{ needs.release.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 | ||
env: | ||
VITE_GOOGLE_ANALYTICS_ID: ${{ secrets.GOOGLE_ANALYTICS_ID }} | ||
|
||
- 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 }} | ||
|
||
- name: Upload Release Artifact | ||
run: gh release upload ${{ needs.release.outputs.tag_name }} dist/${{ github.event.repository.name }}-${{ env.VERSION }}.zip | ||
env: | ||
GITHUB_TOKEN: ${{ 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
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* |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
npx commitlint --edit $1 |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
npx lint-staged |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"*.{js,jsx,mjs,mts,ts,tsx}": "eslint --fix", | ||
"*.{css,html,json,md,yml}": "prettier --write" | ||
} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
20 |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"singleQuote": true | ||
} |
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 |
---|---|---|
@@ -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. |
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 |
---|---|---|
@@ -0,0 +1,119 @@ | ||
<p align="center"> | ||
<img src="https://github.com/remarkablegames/phaser-template/blob/master/public/logo192.png" alt="Phaser Template"> | ||
</p> | ||
|
||
# Phaser Template | ||
|
||
![release](https://img.shields.io/github/v/release/remarkablegames/phaser-template) | ||
[![build](https://github.com/remarkablegames/phaser-template/actions/workflows/build.yml/badge.svg)](https://github.com/remarkablegames/phaser-template/actions/workflows/build.yml) | ||
|
||
<kbd>phaser-template</kbd> is a template for making [Phaser](https://phaser.io/) games. | ||
|
||
Inspired by the tutorial "[Making your first Phaser 3 game](https://phaser.io/tutorials/making-your-first-phaser-3-game)". | ||
|
||
Play the game on: | ||
|
||
- [remarkablegames](https://remarkablegames.org/phaser-template/) | ||
- [CodeSandbox](https://codesandbox.io/s/phaser-template-4fy4y) | ||
|
||
## Prerequisites | ||
|
||
- [nvm](https://github.com/nvm-sh/nvm#readme) | ||
|
||
## Install | ||
|
||
Clone the repository: | ||
|
||
```sh | ||
git clone https://github.com/remarkablegames/phaser-template.git | ||
cd phaser-template | ||
``` | ||
|
||
Install the dependencies: | ||
|
||
```sh | ||
npm install | ||
``` | ||
|
||
Rename the project: | ||
|
||
```sh | ||
git grep -l phaser-template | xargs sed -i '' -e 's/phaser-template/my-game/g' | ||
git grep -l 'Phaser Template' | xargs sed -i '' -e 's/Phaser Template/My Game/g' | ||
``` | ||
|
||
Update the files: | ||
|
||
- [ ] `README.md` | ||
- [ ] `package.json` | ||
- [ ] `index.html` | ||
- [ ] `public/manifest.json` | ||
- [ ] `src/index.ts` | ||
|
||
Initialize a new repository: | ||
|
||
```sh | ||
rm -rf .git | ||
git init | ||
``` | ||
|
||
Make your first commit: | ||
|
||
```sh | ||
git add . | ||
git commit -m 'feat: initialize project from phaser-template' | ||
``` | ||
|
||
> [!NOTE] | ||
> Commit messages follow [Conventional Commits](https://conventionalcommits.org/), which helps with release. | ||
Once you're ready, [push the local repository to GitHub](https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/) (or another remote repository): | ||
|
||
```sh | ||
git remote add origin <remote-repository-url> | ||
git push origin -u origin master | ||
``` | ||
|
||
## Environment Variables | ||
|
||
Set the environment variables: | ||
|
||
```sh | ||
less .env | ||
``` | ||
|
||
Update the **Secrets** in the repository **Settings**. | ||
|
||
## 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) |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import path from 'node:path'; | ||
import { fileURLToPath } from 'node:url'; | ||
|
||
import { includeIgnoreFile } from '@eslint/compat'; | ||
import { FlatCompat } from '@eslint/eslintrc'; | ||
import js from '@eslint/js'; | ||
import typescriptEslint from '@typescript-eslint/eslint-plugin'; | ||
import tsParser from '@typescript-eslint/parser'; | ||
import prettier from 'eslint-plugin-prettier'; | ||
import simpleImportSort from 'eslint-plugin-simple-import-sort'; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
const gitignorePath = path.resolve(__dirname, '.gitignore'); | ||
|
||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
recommendedConfig: js.configs.recommended, | ||
allConfig: js.configs.all, | ||
}); | ||
|
||
export default [ | ||
includeIgnoreFile(gitignorePath), | ||
|
||
...compat.extends( | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
), | ||
|
||
{ | ||
plugins: { | ||
'@typescript-eslint': typescriptEslint, | ||
prettier, | ||
'simple-import-sort': simpleImportSort, | ||
}, | ||
|
||
languageOptions: { | ||
parser: tsParser, | ||
}, | ||
|
||
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', | ||
}, | ||
}, | ||
]; |
Oops, something went wrong.