Skip to content

Commit

Permalink
Add an option to use a play button instead of autoplaying, fixes
Browse files Browse the repository at this point in the history
Updated ESLint
  • Loading branch information
curiousdannii committed Dec 12, 2024
1 parent 2f241bb commit 2d0d0dd
Show file tree
Hide file tree
Showing 23 changed files with 290 additions and 162 deletions.
32 changes: 0 additions & 32 deletions .eslintrc.cjs

This file was deleted.

10 changes: 6 additions & 4 deletions .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
with:
path: |
src/upstream/emglken/build/*.js
src/upstream/emglken/build/*.json
src/upstream/emglken/build/*.wasm
key: emglken-${{ steps.emglken-ref.outputs.ref }}
- name: Build Emglken
Expand All @@ -46,18 +47,19 @@ jobs:
npm install
npm run link-local-emglken
cd src/iplayif.com/app && npm install
- name: Static tests
run: |
npm run lint
npm run tsc-check
- name: Restore Emglken from the cache
id: cache-emglken
uses: actions/cache@v4
with:
path: |
src/upstream/emglken/build/*.js
src/upstream/emglken/build/*.json
src/upstream/emglken/build/*.wasm
key: emglken-${{ needs.build-emglken.outputs.ref }}
- name: Static tests
run: |
npm run lint
npm run svelte-check
- name: Build Parchment distributions
run: |
./build.js
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,25 @@ git clone --recurse-submodules https://github.com/curiousdannii/parchment.git
cd parchment
```

Then install the `npm` dependencies:
Install the `npm` dependencies, and then build Parchment:

```
npm install
npm run build
```

This will also automatically build Parchment.

Then, you'll need to open `index.html` on a web server. (It won't work when you run it on your filesystem as a `file:///` URL.) You can launch a simple web server like this:
You can now open `index.html` on a web server. But... it won't work when you run it on your filesystem as a `file:///` URL. You can instead launch a simple web server like this:

```
npm start
```

Then you can view Parchment at `http://localhost:8080` to see your handiwork.

Each time you change code in the `src` folder, the server will automatically rebuild the web code. Refresh to see your changes.
In addition, each time you change code in the `src` folder, the server will automatically rebuild the web code! Refresh to see your changes.

You can also build your own `dist/inform/parchment-for-inform7.zip` like this:

```
npm install
npm run inform7
```
```
50 changes: 50 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import eslintPluginSvelte from 'eslint-plugin-svelte'
import globals from 'globals'
import js from '@eslint/js'
import svelteParser from "svelte-eslint-parser"
import tseslint from 'typescript-eslint'

export default [
js.configs.recommended,
...tseslint.configs.recommended,
...eslintPluginSvelte.configs['flat/recommended'],
{
files: ['**/*.svelte', '*.svelte'],
languageOptions: {
parser: svelteParser,
parserOptions: {
parser: '@typescript-eslint/parser',
},
},
},
{
languageOptions: {
ecmaVersion: 13,
globals: {
...globals.browser,
...globals.es2021,
...globals.jquery,
},
sourceType: 'module',
},
rules: {
'brace-style': ['error', 'stroustrup', {'allowSingleLine': true}],
'comma-dangle': ['error', 'always-multiline'],
curly: ['error'],
eqeqeq: ['error', 'always', {null: 'ignore'}],
indent: ['error', 4, {MemberExpression: 'off', SwitchCase: 1}],
'linebreak-style': ['error', 'unix'],
'no-constant-condition': ['error', {checkLoops: false}],
'no-empty': ['error', {allowEmptyCatch: true}],
'no-trailing-spaces': ['error'],
'no-var': ['error'],
'prefer-const': ['error', {destructuring: 'all'}],
quotes: ['error', 'single', {allowTemplateLiterals: true, avoidEscape: true}],
semi: ['error', 'never'],
'@typescript-eslint/no-empty-function': ['off'],
'@typescript-eslint/no-explicit-any': ['off'],
'@typescript-eslint/no-non-null-assertion': ['off'],
'@typescript-eslint/no-unused-vars': ['error', {'args': 'none'}],
},
},
]
25 changes: 13 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "parchment",
"version": "2024.10.0",
"version": "2024.12.0",
"description": "Parchment Interactive Fiction Player",
"repository": "curiousdannii/parchment",
"keywords": [
Expand Down Expand Up @@ -33,28 +33,29 @@
"@types/js-cookie": "^3.0.4",
"@types/lodash-es": "^4.17.5",
"@types/minimist": "^1.2.2",
"@typescript-eslint/eslint-plugin": "~6.7.0",
"@typescript-eslint/parser": "~6.7.0",
"@typescript-eslint/parser": "~8.18.0",
"esbuild": "^0.24.0",
"esbuild-svelte": "^0.8.1",
"eslint": "^8.3.0",
"eslint-plugin-compat": "^4.0.0",
"eslint": "^9.12.0",
"eslint-plugin-compat": "^6.0.0",
"eslint-plugin-svelte": "^2.44.1",
"minimist": "^1.2.6",
"regtest-html": "^0.1.4",
"svelte": "^4.2.18",
"svelte-preprocess": "^6.0.2",
"typescript": "~5.2.0"
"svelte": "^4.2.19",
"svelte-check": "^4.0.4",
"svelte-preprocess": "^6.0.3",
"typescript": "~5.6.0",
"typescript-eslint": "~8.17.0"
},
"scripts": {
"build": "./build.js",
"check-compat": "tests/check-compat.sh",
"inform7": "tools/package-inform7.sh",
"link-local-emglken": "npm link ./src/upstream/emglken",
"lint": "eslint src/common/ src/inform7/ src/iplayif.com/app/src/ src/tools/",
"prepare": "./build.js",
"lint": "eslint src/common/**/* src/inform7/ src/iplayif.com/app/src/ src/tools/",
"start": "./build.js --serve",
"test": "./tests/runtests.sh",
"tsc-check": "tsc --noEmit"
"svelte-check": "svelte-check",
"test": "./tests/runtests.sh"
},
"browserslist": [
"> 0.2% and supports es6-module",
Expand Down
3 changes: 1 addition & 2 deletions src/common/formats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ export interface Format {
id: string
}

async function generic_emglken_vm(story: StoryOptions, options: ParchmentOptions, requires: [any, Uint8Array])
{
async function generic_emglken_vm(story: StoryOptions, options: ParchmentOptions, requires: [any, Uint8Array]) {
const [engine, wasmBinary] = requires

const vm_options = Object.assign({}, options, {
Expand Down
3 changes: 1 addition & 2 deletions src/common/ie.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Show an error in Internet Explorer

function show_error()
{
function show_error() {
$('#errorcontent').text('Sorry, but Parchment depends on web features unsupported by this browser. Please try a more modern browser.')
$('#errorpane').show()
}
Expand Down
20 changes: 16 additions & 4 deletions src/common/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,25 @@ https://github.com/curiousdannii/parchment

import type {BrowserDialog, /*GlkApi,*/ GlkOte, GlkOteOptions, TruthyOption} from '../upstream/asyncglk/src/index-common.js'

/** The size and gzipped size of a file */
export interface FileSize {
/** Size of file in bytes, gzip compressed (doesn't need to be exact) */
gz: number
/** Size of file in bytes, uncompressed */
size: number
}

export interface StoryOptions {
/** Size of storyfile in bytes, uncompressed */
filesize?: number
/** Size of storyfile in bytes, gzip compressed (doesn't need to be exact) */
filesize_gz?: number
/** Size of storyfile */
filesize?: FileSize
/** Format ID, matching formats.js */
format?: string
/** Dialog file path */
path?: string
/** Sound formats this game uses */
sounds?: ['aiff' | 'mod' | 'ogg']
/** Story title (can include author name too) */
title?: string
/** Actual URL to the storyfile */
url?: string
}
Expand All @@ -29,6 +39,8 @@ export interface ParchmentOptions extends Omit<GlkOteOptions, 'accept'> {

/** Whether or not to automatically launch Parchment */
auto_launch?: TruthyOption,
/** Whether or not to autoplay, if not a Play button will be shown (useful for games that play sounds on startup) */
autoplay?: TruthyOption,
/** Story path in the array format traditionally used by Parchment for Inform 7 */
default_story?: [string],
/** Storyfile path or metadata */
Expand Down
Loading

0 comments on commit 2d0d0dd

Please sign in to comment.