forked from PrismarineJS/prismarine-web-client
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
51 changed files
with
1,041 additions
and
542 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Vercel Deploy Preview | ||
env: | ||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | ||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install Global Dependencies | ||
run: npm install --global vercel pnpm | ||
- name: Pull Vercel Environment Information | ||
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} | ||
- name: Build Project Artifacts | ||
run: vercel build --token=${{ secrets.VERCEL_TOKEN }} | ||
- name: Deploy Project Artifacts to Vercel | ||
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { context } from 'esbuild' | ||
import { build } from 'esbuild' | ||
import { polyfillNode } from 'esbuild-plugin-polyfill-node' | ||
import path from 'path' | ||
import { fileURLToPath } from 'url' | ||
|
||
const allowedWorkerFiles = ['blocks', 'blockCollisionShapes', 'tints', 'blockStates', | ||
'biomes', 'features', 'version', 'legacy', 'versions', 'version', 'protocolVersions'] | ||
|
||
const __dirname = path.dirname(fileURLToPath(new URL(import.meta.url))) | ||
|
||
/** @type {import('esbuild').BuildOptions} */ | ||
const buildOptions = { | ||
bundle: true, | ||
banner: { | ||
js: 'globalThis.global = globalThis;process = {env: {}, versions: {}, };', | ||
}, | ||
platform: 'browser', | ||
entryPoints: [path.join(__dirname, './viewer/lib/worker.js')], | ||
outfile: path.join(__dirname, './public/worker.js'), | ||
minify: true, | ||
drop: [ | ||
'debugger' | ||
], | ||
sourcemap: true, | ||
plugins: [ | ||
{ | ||
name: 'external-json', | ||
setup (build) { | ||
build.onResolve({ filter: /\.json$/ }, args => { | ||
const fileName = args.path.split('/').pop().replace('.json', '') | ||
if (args.resolveDir.includes('minecraft-data') && !allowedWorkerFiles.includes(fileName)) { | ||
// console.log('skipped', fileName) | ||
return { path: args.path, namespace: 'empty-file', } | ||
} | ||
}) | ||
build.onResolve({ | ||
filter: /^zlib$/, | ||
}, ({ path }) => { | ||
return { | ||
path, | ||
namespace: 'empty-file', | ||
} | ||
}) | ||
build.onLoad({ | ||
filter: /.*/, | ||
namespace: 'empty-file', | ||
}, () => { | ||
return { contents: 'module.exports = undefined', loader: 'js' } | ||
}) | ||
} | ||
}, | ||
polyfillNode(), | ||
], | ||
} | ||
|
||
if (process.argv.includes('-w')) { | ||
const ctx = await context(buildOptions) | ||
await ctx.watch() | ||
} else { | ||
await build(buildOptions) | ||
} |
Oops, something went wrong.