Skip to content

Commit 97d0343

Browse files
committed
Check browser compatibility
Switch to type: module
1 parent d0f46cd commit 97d0343

File tree

8 files changed

+50
-20
lines changed

8 files changed

+50
-20
lines changed
File renamed without changes.

.github/workflows/test-and-deploy.yml

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,7 @@ on:
88
pull_request:
99

1010
jobs:
11-
test:
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: actions/checkout@v2
15-
- uses: actions/setup-node@v2
16-
with:
17-
node-version: '17'
18-
- run: npm install --ignore-scripts
19-
- run: npm run lint
20-
21-
deploy:
22-
needs: test
23-
if: github.ref == 'refs/heads/master' || 'refs/heads/asyncglk'
11+
test-and-deploy:
2412
runs-on: ubuntu-latest
2513
steps:
2614
- uses: actions/checkout@v2
@@ -29,6 +17,8 @@ jobs:
2917
- uses: actions/setup-node@v2
3018
with:
3119
node-version: '17'
20+
- run: npm install --ignore-scripts
21+
- run: npm run lint
3222
- name: Get Emglken commit ref
3323
id: emglken-ref
3424
run: echo "::set-output name=ref::$(git submodule status src/upstream/emglken | cut -c 2-13)"
@@ -38,18 +28,18 @@ jobs:
3828
with:
3929
path: src/upstream/emglken/build
4030
key: emglken-${{ steps.emglken-ref.outputs.ref }}
41-
- run: npm install --ignore-scripts
4231
- run: npm run link-local-emglken
4332
- name: Build AsyncGlk
44-
if: github.ref == 'refs/heads/asyncglk'
33+
if: github.ref == 'refs/heads/testing'
4534
run: cd src/upstream/asyncglk && npm install && npx tsc
4635
- name: Build Emglken
4736
if: steps.cache-emglken.outputs.cache-hit != 'true'
4837
run: cd src/upstream/emglken && npm run build
4938
- run: npm run gulp
5039
- name: Package Parchment for Inform 7
51-
if: github.ref == 'refs/heads/master'
52-
run: npm run inform7
40+
run: ./tools/package-inform7.sh
41+
- name: Check browser compatibility
42+
run: ./tools/check-compat.sh
5343
- run: cp tools/deploy.gitignore .gitignore
5444
- name: Deploy to Pages 🚀
5545
if: github.ref == 'refs/heads/master'
@@ -58,7 +48,7 @@ jobs:
5848
branch: gh-pages
5949
folder: .
6050
- name: Deploy to testing site 🚀
61-
if: github.ref == 'refs/heads/asyncglk'
51+
if: github.ref == 'refs/heads/testing'
6252
uses: JamesIves/github-pages-deploy-action@v4
6353
with:
6454
branch: gh-pages
File renamed without changes.

package.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"url": "https://github.com/curiousdannii/parchment/issues"
1313
},
1414
"homepage": "https://github.com/curiousdannii/parchment#readme",
15+
"type": "module",
1516
"dependencies": {
1617
"emglken": "^0.3.3",
1718
"jquery": "^3.6.0",
@@ -22,7 +23,7 @@
2223
"@rollup/plugin-alias": "^3.1.8",
2324
"@rollup/stream": "^2.0.0",
2425
"eslint": "^8.3.0",
25-
"esm": "^3.2.25",
26+
"eslint-plugin-compat": "^4.0.0",
2627
"gulp": "^4.0.2",
2728
"gulp-clean-css": "^4.3.0",
2829
"gulp-cli": "^2.3.0",
@@ -34,12 +35,19 @@
3435
"vinyl-source-stream": "^2.0.0"
3536
},
3637
"scripts": {
38+
"check-compat": "tools/check-compat.sh",
3739
"gulp": "gulp",
3840
"inform7": "tools/package-inform7.sh",
3941
"link-local-emglken": "npm link ./src/upstream/emglken",
4042
"lint": "eslint src/common/ src/inform7/",
4143
"prepare": "gulp",
4244
"prestart": "gulp",
4345
"start": "gulp serve"
44-
}
46+
},
47+
"browserslist": [
48+
"> 0.2% and supports es6-module",
49+
"last 2 versions and supports es6-module",
50+
"Firefox ESR",
51+
"not dead"
52+
]
4553
}

tools/browser-compat/.eslintrc.cjs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
extends: 'plugin:compat/recommended',
3+
parserOptions: {
4+
ecmaVersion: 12,
5+
sourceType: 'module',
6+
},
7+
root: true,
8+
settings: {
9+
polyfills: [
10+
"WebAssembly.instantiateStreaming",
11+
]
12+
}
13+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "parchment-for-inform7",
3+
"browserslist": [
4+
"defaults",
5+
"not IE <= 12"
6+
]
7+
}

tools/check-compat.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
3+
cd "$(dirname "$0")/.."
4+
5+
cp -r tools/browser-compat/. dist/
6+
7+
cd dist
8+
npx eslint web
9+
cd inform7
10+
npx eslint .

tools/deploy.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
.eslintrc.js
22
.gitmodules
3+
dist/**/package.json
34
dist/inform7/Parchment*
45
gulpfile.esm.js
56
node_modules
67
package-lock.json
78
src
89
tools/*.sh
10+
tools/browser-compat
911
tools/deploy.gitignore

0 commit comments

Comments
 (0)