Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Trivia Game (with jest tests integrated) #99

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions games/trivia-with-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
dist/
21 changes: 21 additions & 0 deletions games/trivia-with-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Trivia

A trivia game written in TypeScript

Compile:

```
npm install
npm run build
```

Extism plugin will compile to dist/plugin.wasm

To query for questions use the opentriviadb api: https://opentdb.com/api_config.php

Pass the querystring to the trivia.rb program and pipe it to data.json:

```
ruby trivia.rb "amount=10&difficulty=medium&type=multiple" > src/data.json
```

1 change: 1 addition & 0 deletions games/trivia-with-tests/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {presets: ['@babel/preset-env']}
12 changes: 12 additions & 0 deletions games/trivia-with-tests/esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const esbuild = require('esbuild');

esbuild
.build({
entryPoints: ['src/index.js'],
outdir: 'dist',
bundle: true,
sourcemap: true,
minify: false, // might want to use true for production build
format: 'cjs', // needs to be CJS for now
target: ['es2020'], // don't go over es2020 because quickjs doesn't support it
})
Loading