Skip to content

Commit

Permalink
Merge pull request #15 from krutoo/refactoring
Browse files Browse the repository at this point in the history
refactor
  • Loading branch information
krutoo authored Nov 4, 2024
2 parents 34d29cf + 6f144f8 commit 507a140
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 4 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: Deploy demo on Github Pages

on:
push:
branches:
- main
branches: [$default-branch]

jobs:
build-and-deploy:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: Publish Node.js Package

on:
release:
types: [created]
types:
- created

jobs:
build:
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Test

on:
push:
branches: [$default-branch]

pull_request:
branches: [$default-branch]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20

- name: Unit tests
run: |
npm ci
npm run check
- name: Package build
run: |
npm run build
npm pack
- name: Package tests
working-directory: ./tests
run: |
npm run preparing
npm run test
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dist
node_modules
.DS_Store
.tsimp
.tsimp
*.tgz
7 changes: 7 additions & 0 deletions tests/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import assert from 'node:assert';
import { createExplorer, createPathfinder, createPRNG, Dungeon } from 'rglk';

assert.strictEqual('function' === typeof createExplorer, true);
assert.strictEqual('function' === typeof createPathfinder, true);
assert.strictEqual('function' === typeof createPRNG, true);
assert.strictEqual('function' === typeof Dungeon, true);
12 changes: 12 additions & 0 deletions tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions tests/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "rglk-tests",
"type": "module",
"private": true,
"version": "0.0.0",
"scripts": {
"preparing": "npm i --no-save ../rglk-0.0.0.tgz",
"test": "node index.js"
}
}

0 comments on commit 507a140

Please sign in to comment.