Skip to content

Commit 25f7ffb

Browse files
authored
Merge pull request #110 from lunarcloud/development
Update packages and lint
2 parents 777488f + 52c7db6 commit 25f7ffb

File tree

13 files changed

+2416
-2989
lines changed

13 files changed

+2416
-2989
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,40 @@
1-
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
3-
4-
name: Node.js CI
1+
# This workflow will run the three lint tools
2+
name: Lint
53

64
on:
75
push:
8-
branches: [ "development" ]
6+
branches: [ "development", "main" ]
97
pull_request:
8+
# The branches below must be a subset of the branches above
109
branches: [ "main" ]
10+
workflow_dispatch:
1111

1212
jobs:
13-
build:
14-
13+
lint:
14+
name: Run Code Quality Checks
1515
runs-on: ubuntu-latest
16-
16+
permissions:
17+
contents: read
18+
security-events: write
19+
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
1720
steps:
18-
- uses: actions/checkout@v3
19-
20-
- name: Use Node.js 18.x
21-
uses: actions/setup-node@v3
22-
with:
23-
node-version: 18.x
24-
cache: 'npm'
25-
registry-url: 'https://npm.pkg.github.com'
21+
- name: Checkout code
22+
uses: actions/checkout@v4
2623

27-
- name: Install Tools
28-
run: npm ci
29-
env:
30-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
- name: Install Tools
25+
run: npm ci
26+
env:
27+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3128

32-
- name: Lint JavaScript
33-
run: npm run eslint
29+
- name: Lint JavaScript
30+
if: ${{ ! cancelled() }}
31+
run: npm run eslint
3432

35-
- name: Lint HTML
36-
run: npm run htmllint
33+
- name: Lint HTML
34+
if: ${{ ! cancelled() }}
35+
run: npm run htmllint
3736

38-
- name: Lint CSS
39-
run: npm run csslint
37+
- name: Lint CSS
38+
if: ${{ ! cancelled() }}
39+
run: npm run csslint
4040

41-
#- run: npm run build --if-present
42-
#- run: npm test --if-present

3d-showcase.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@
207207

208208
</div>
209209
</aside>
210+
211+
<script src="https://html2canvas.hertzen.com/dist/html2canvas.min.js" crossorigin="anonymous"></script>
212+
<script type="module" src="controllers/3d-showcase.js"></script>
210213
</body>
211-
<script src="https://html2canvas.hertzen.com/dist/html2canvas.min.js" crossorigin="anonymous"></script>
212-
<script type="module" src="controllers/3d-showcase.js"></script>
213214
</html>

css/common.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ body {
221221
margin: 0;
222222
padding: 0;
223223
padding-top: var(--top-nav-height);
224-
overflow: auto auto;
224+
overflow: auto;
225225
overflow-wrap: anywhere;
226226
word-break: auto-phrase;
227227
hyphens: auto;

home-ala-homestar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ <h1>Sam Sarette's Portfolio</h1>
9595
</button>
9696
</container>
9797
<audio id="bg-audio" src="audio/536935__defaultv__campfire.mp3" loop="loop"></audio>
98+
<script type="module" src="controllers/home-ala-homestar.js"></script>
9899
</body>
99-
<script type="module" src="controllers/home-ala-homestar.js"></script>
100100

101101
</html>

home-console.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ <h2>Home Screens</h2>
9898
<audio id="ok-audio" src="audio/538551__sjonas88__3-select-ok.mp3"></audio>
9999
<audio id="select-audio" src="audio/538551__sjonas88__3-select-3.mp3"></audio>
100100
<audio id="bg-audio" src="audio/687905__tehclaw__ambient_piano__bpm62.mp3" loop="loop"></audio>
101+
102+
<script type="module" src="controllers/home-console.js"></script>
101103
</body>
102-
<script type="module" src="controllers/home-console.js"></script>
103104

104105
</html>

home-lcars.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ <h1>Sam Sarette's Portfolio</h1>
133133
<audio id="beep-ok-audio" src="audio/423167__plasterbrain__minimalist-sci-fi-ui-ok.mp3" preload></audio>
134134
<audio id="beep-cancel-audio" src="audio/423167__plasterbrain__minimalist-sci-fi-ui-cancel.mp3" preload></audio>
135135

136+
<script type="module" src="controllers/home-lcars.js"></script>
136137
</body>
137-
<script type="module" src="controllers/home-lcars.js"></script>
138138

139139
</html>

index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ <h2>Socials</h2>
164164

165165
</main>
166166
<footer>© Samuel James Sarette 2023</footer>
167+
168+
<script type="module" src="controllers/index.js"></script>
167169
</body>
168-
<script type="module" src="controllers/index.js"></script>
169170
</html>

lib/gameinputjs/README.md

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,48 @@
1-
Game-Input (JavaScript) Library
1+
[<img src="img/generic.png" width="48" />](img/generic.png) Game-Input JavaScript Library
22
=============
3-
![](img/generic.png)
3+
[![npm](https://img.shields.io/npm/v/gameinputjs)](https://www.npmjs.com/package/gameinputjs)
4+
[![license](https://img.shields.io/npm/l/gameinputjs)](LICENSE)
5+
[![language](https://img.shields.io/badge/lang-JavaScript-orange)](https://developer.mozilla.org/en-US/docs/Web/JavaScript)
6+
[![environment](https://img.shields.io/badge/env-Browser-green)](https://developer.mozilla.org/en-US/docs/Learn/JavaScript)
47

58
A client-side JavaScript module one can import to add good gamepad support to web-powered games or other gamepad-powered web applications.
69

10+
## Installation
11+
12+
GameinputJS's `src` and `img` folders need to be accessible in the distributed version of your website.
13+
14+
I would recommend setting up a `package.json` script to help update a distributable copy of the library outside node_modules:
15+
```json
16+
{
17+
"name": "@me/my-client-webapp",
18+
"scripts": {
19+
"deps2lib": "shx rm -rf lib && shx mkdir lib && shx cp -r node_modules/gameinputjs lib/"
20+
}
21+
...
22+
}
23+
```
24+
Which would allow you to run:
25+
26+
```sh
27+
npm i --save-dev shx
28+
npm i gameinputjs
29+
npm run deps2lib
30+
```
31+
32+
33+
## Usage
34+
Import from within a Javascript module, construct it, and then use either the events or make a game loop that uses the properties.
35+
736
```js
8-
import { GameInput, DetectedOS } from './gameinput.js'
9-
import { GameInputSchemaSectionNames, GameInputSchemaButtonNames } from './gameinput-schema.js'
37+
import { GameInput, DetectedOS } from './lib/gameinputjs/src/gameinput.js'
38+
import { GameInputSchemaSectionNames, GameInputSchemaButtonNames } from './lib/gameinputjs/src/gameinput-schema.js'
1039

11-
/** @type {GameInput} */
1240
const gameInput = new GameInput()
13-
// Events style
41+
```
42+
43+
### Event-Driven Style
44+
```js
45+
gameInput
1446
.onReinitialize(() => {
1547
console.debug("Players updated")
1648
const firstPlayer = gameInput.getPlayer(0)
@@ -38,8 +70,10 @@ const gameInput = new GameInput()
3870
console.debug('Jump / Confirm pushed')
3971
}
4072
})
73+
```
4174
42-
// Game-Loop Style
75+
### Game-Loop Style
76+
```js
4377
function gameLoop() {
4478
for (const player of gameInput.Players) {
4579
if (!player)

lib/gameinputjs/package.json

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
{
2-
"name": "@lunarcloud/gameinputjs",
2+
"name": "gameinputjs",
33
"type": "module",
44
"repository": {
55
"url": "https://github.com/lunarcloud/gameinputjs.git"
66
},
7-
"publishConfig": {
8-
"@lunarcloud:registry": "https://npm.pkg.github.com"
9-
},
10-
"version": "13.2.1",
7+
"version": "13.2.7",
118
"description": "Browser library to upgrade the Gamepad API experience",
129
"private": false,
1310
"scripts": {
@@ -31,6 +28,7 @@
3128
"eslint-plugin-n": "^16.1.0",
3229
"eslint-plugin-promise": "^6.1.1",
3330
"jest": "^29.7.0",
31+
"jest-environment-jsdom": "^29.7.0",
3432
"jsdoc": "^4.0.2",
3533
"jsdoc-tsimport-plugin": "^1.0.5",
3634
"serve": "^14.2.1",
@@ -52,7 +50,12 @@
5250
],
5351
"testLocationInResults": true
5452
},
55-
"dependencies": {
56-
"jest-environment-jsdom": "^29.7.0"
57-
}
58-
}
53+
"keywords": [
54+
"gamepad",
55+
"client",
56+
"gaming",
57+
"xbox",
58+
"dualshock",
59+
"joystick"
60+
]
61+
}

0 commit comments

Comments
 (0)