Skip to content

Commit

Permalink
Check browser compatibility
Browse files Browse the repository at this point in the history
Switch to type: module
  • Loading branch information
curiousdannii committed Jan 19, 2022
1 parent d0f46cd commit 97d0343
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 20 deletions.
File renamed without changes.
26 changes: 8 additions & 18 deletions .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,7 @@ on:
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '17'
- run: npm install --ignore-scripts
- run: npm run lint

deploy:
needs: test
if: github.ref == 'refs/heads/master' || 'refs/heads/asyncglk'
test-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -29,6 +17,8 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: '17'
- run: npm install --ignore-scripts
- run: npm run lint
- name: Get Emglken commit ref
id: emglken-ref
run: echo "::set-output name=ref::$(git submodule status src/upstream/emglken | cut -c 2-13)"
Expand All @@ -38,18 +28,18 @@ jobs:
with:
path: src/upstream/emglken/build
key: emglken-${{ steps.emglken-ref.outputs.ref }}
- run: npm install --ignore-scripts
- run: npm run link-local-emglken
- name: Build AsyncGlk
if: github.ref == 'refs/heads/asyncglk'
if: github.ref == 'refs/heads/testing'
run: cd src/upstream/asyncglk && npm install && npx tsc
- name: Build Emglken
if: steps.cache-emglken.outputs.cache-hit != 'true'
run: cd src/upstream/emglken && npm run build
- run: npm run gulp
- name: Package Parchment for Inform 7
if: github.ref == 'refs/heads/master'
run: npm run inform7
run: ./tools/package-inform7.sh
- name: Check browser compatibility
run: ./tools/check-compat.sh
- run: cp tools/deploy.gitignore .gitignore
- name: Deploy to Pages 🚀
if: github.ref == 'refs/heads/master'
Expand All @@ -58,7 +48,7 @@ jobs:
branch: gh-pages
folder: .
- name: Deploy to testing site 🚀
if: github.ref == 'refs/heads/asyncglk'
if: github.ref == 'refs/heads/testing'
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
Expand Down
File renamed without changes.
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"url": "https://github.com/curiousdannii/parchment/issues"
},
"homepage": "https://github.com/curiousdannii/parchment#readme",
"type": "module",
"dependencies": {
"emglken": "^0.3.3",
"jquery": "^3.6.0",
Expand All @@ -22,7 +23,7 @@
"@rollup/plugin-alias": "^3.1.8",
"@rollup/stream": "^2.0.0",
"eslint": "^8.3.0",
"esm": "^3.2.25",
"eslint-plugin-compat": "^4.0.0",
"gulp": "^4.0.2",
"gulp-clean-css": "^4.3.0",
"gulp-cli": "^2.3.0",
Expand All @@ -34,12 +35,19 @@
"vinyl-source-stream": "^2.0.0"
},
"scripts": {
"check-compat": "tools/check-compat.sh",
"gulp": "gulp",
"inform7": "tools/package-inform7.sh",
"link-local-emglken": "npm link ./src/upstream/emglken",
"lint": "eslint src/common/ src/inform7/",
"prepare": "gulp",
"prestart": "gulp",
"start": "gulp serve"
}
},
"browserslist": [
"> 0.2% and supports es6-module",
"last 2 versions and supports es6-module",
"Firefox ESR",
"not dead"
]
}
13 changes: 13 additions & 0 deletions tools/browser-compat/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
extends: 'plugin:compat/recommended',
parserOptions: {
ecmaVersion: 12,
sourceType: 'module',
},
root: true,
settings: {
polyfills: [
"WebAssembly.instantiateStreaming",
]
}
}
7 changes: 7 additions & 0 deletions tools/browser-compat/inform7/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "parchment-for-inform7",
"browserslist": [
"defaults",
"not IE <= 12"
]
}
10 changes: 10 additions & 0 deletions tools/check-compat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

cd "$(dirname "$0")/.."

cp -r tools/browser-compat/. dist/

cd dist
npx eslint web
cd inform7
npx eslint .
2 changes: 2 additions & 0 deletions tools/deploy.gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
.eslintrc.js
.gitmodules
dist/**/package.json
dist/inform7/Parchment*
gulpfile.esm.js
node_modules
package-lock.json
src
tools/*.sh
tools/browser-compat
tools/deploy.gitignore

0 comments on commit 97d0343

Please sign in to comment.