Skip to content

Commit

Permalink
Update demo parser
Browse files Browse the repository at this point in the history
  • Loading branch information
BeepIsla committed Nov 21, 2023
1 parent 8c814df commit c6c29cb
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 19 deletions.
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@ node_modules
pnpm-lock.yaml
package-lock.json
yarn.lock
demoparser
src/lib/demoparser
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
- name: Install and Build
run: |
npm ci
npm run fix
npm run build
- name: Deploy to GitHub Pages
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ node_modules
pnpm-lock.yaml
package-lock.json
yarn.lock
src/lib/demoparser
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ Parse crosshair codes out of any CS2 demo you want! **CSGO is not supported.**

## Build

The [wasm demoparser](https://github.com/LaihoE/demoparser) doesn't seem to be on NPM (Only the node version is on npm right now) so I just submoduled it into this project under `src/lib/demoparser`

1. `npm i`
2. `npm run dev` / `npm run build`
2. `npm run fix` (Fix some issues in the `demoparser2/package.json` due to `wasm-pack`)
3. `npm run dev` / `npm run build`

## Credits

Expand Down
65 changes: 60 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check . && eslint .",
"format": "prettier --write ."
"format": "prettier --write .",
"fix": "node ./scripts/fix.js"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.0.0",
Expand All @@ -18,7 +19,7 @@
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"autoprefixer": "^10.4.16",
"demoparser2": "file:src/lib/demoparser/src/wasm/www/pkg",
"demoparser2": "^0.2.0",
"eslint": "^8.28.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-svelte": "^2.30.0",
Expand All @@ -31,7 +32,8 @@
"tailwindcss": "^3.3.5",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^4.4.2"
"vite": "^4.4.2",
"vite-plugin-wasm-pack": "0.1.11"
},
"type": "module"
}
7 changes: 7 additions & 0 deletions scripts/fix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import fs from "fs";

// wasm-pack seems to output a not-so-great package.json
const pkg = JSON.parse(fs.readFileSync("./node_modules/demoparser2/package.json", "utf8"));
pkg.main = "demoparser2.js";
pkg.type = "module";
fs.writeFileSync("./node_modules/demoparser2/package.json", JSON.stringify(pkg, null, "\t"));
1 change: 0 additions & 1 deletion src/lib/demoparser
Submodule demoparser deleted from 2101ca
3 changes: 2 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite";
import wasmPack from "vite-plugin-wasm-pack";

export default defineConfig({
plugins: [sveltekit()]
plugins: [wasmPack([], ["demoparser2"]), sveltekit()]
});

0 comments on commit c6c29cb

Please sign in to comment.