Skip to content

Commit

Permalink
Update to Deno 2
Browse files Browse the repository at this point in the history
* Update imports
* Update copyright year
* Prepare for jsr
* Refactor and add new examples
* Remove timers from root export
* Add SAR data and Steam utils
  • Loading branch information
NeKzor committed Nov 10, 2024
1 parent 729ecc3 commit d253fe7
Show file tree
Hide file tree
Showing 65 changed files with 22,448 additions and 1,946 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CD

on:
push:
tags:
- '*'

jobs:
release:
runs-on: ubuntu-latest

if: "!contains(github.event.head_commit.message, '[cd skip]')"

steps:
- uses: actions/checkout@v4

- uses: denoland/setup-deno@v2
with:
deno-version: v2.x

- name: Format check
run: deno fmt --check

- name: Lint check
run: deno lint

- name: Type Check
run: deno task check:types

- name: Test
run: deno task test

- name: Build
run: deno task build:npm ${{ github.ref_name }}

- name: Publish to jsr
run: npx jsr publish

#- name: Publish to npm
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# run: cd npm && npm publish --access public
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI

on:
push:
branches: ['main']
paths:
- 'src/**/*.ts'
- 'tests/**/*.ts'
pull_request:
branches: ['main']
paths:
- 'src/**/*.ts'
- 'tests/**/*.ts'
workflow_dispatch:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest

if: "!contains(github.event.head_commit.message, '[ci skip]')"

steps:
- uses: actions/checkout@v4

- uses: denoland/setup-deno@v2
with:
deno-version: v2.x

- name: Format check
run: deno fmt --check

- name: Lint check
run: deno lint

- name: Type Check
run: deno task check:types

- name: Test
run: deno task test
39 changes: 0 additions & 39 deletions .github/workflows/deno.yml

This file was deleted.

23 changes: 8 additions & 15 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: docs

on:
push:
branches: ["master"]
branches: ['main']
paths:
- "docs/**"
- "README.md"
- 'docs/**'
- 'README.md'

workflow_dispatch:

Expand All @@ -15,18 +15,18 @@ permissions:
id-token: write

concurrency:
group: "pages"
group: 'pages'
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Pages
uses: actions/configure-pages@v3
uses: actions/configure-pages@v5

- name: Copy Files
run: cp README.md showcase.gif docs
Expand All @@ -38,15 +38,8 @@ jobs:
destination: ./_site

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v4
41 changes: 0 additions & 41 deletions .github/workflows/release.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
.vscode/
demos/private/
demos/public/
demos/public/error/
demos/public/portal2_sp_wr/
demos/public/*_repaired.dem
examples/experimental/
dist/
npm/

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018-2023, NeKz
Copyright (c) 2018-2024, NeKz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
33 changes: 18 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![Deno CI](https://github.com/NeKzor/sdp/actions/workflows/deno.yml/badge.svg)](https://github.com/NeKzor/sdp/actions/workflows/deno.yml)
[![Release CD](https://github.com/NeKzor/sdp/actions/workflows/release.yml/badge.svg)](https://github.com/NeKzor/sdp/actions/workflows/release.yml)
[![CI](https://github.com/NeKzor/sdp/actions/workflows/ci.yml/badge.svg)](https://github.com/NeKzor/sdp/actions/workflows/ci.yml)
[![CD](https://github.com/NeKzor/sdp/actions/workflows/cd.yml/badge.svg)](https://github.com/NeKzor/sdp/actions/workflows/cd.yml)
[![jsr](https://jsr.io/badges/@nekz/sdp)](https://jsr.io/@nekz/sdp)
[![npm](https://img.shields.io/npm/v/@nekz/sdp?color=blue)](https://www.npmjs.com/package/@nekz/sdp)

# sdp
Expand All @@ -13,6 +14,7 @@ Simple Source Engine demo parser. Try it out on [StackBlitz]!
- Support for multiple engines
- Portal 2
- Half-Life 2
- Custom engine, see [Strata Source example](./examples/custom/strata.ts)
- Optional decoding of message data
- [User command info]
- [NET/SVC messages]
Expand All @@ -22,12 +24,15 @@ Simple Source Engine demo parser. Try it out on [StackBlitz]!
- Speedrun timing
- Rules for Portal, Portal 2 and mods
- [SAR] timing

[User command info]: https://nekz.me/dem/classes/usercmdinfo.html
[NET/SVC messages]: https://nekz.me/dem/classes/netsvc.html
[Send tables]: https://nekz.me/dem/classes/sendtable.html
[String tables]: https://nekz.me/dem/classes/stringtable.html
[Game events]: https://nekz.me/dem/classes/gameevent.html
- Utils
- Steam ID parsing
- SAR data

[User command info]: https://dem.nekz.me/dem/classes/usercmdinfo.html
[NET/SVC messages]: https://dem.nekz.me/dem/classes/netsvc.html
[Send tables]: https://dem.nekz.me/dem/classes/sendtable.html
[String tables]: https://dem.nekz.me/dem/classes/stringtable.html
[Game events]: https://dem.nekz.me/dem/classes/gameevent.html
[SAR]: https://sar.portal2.sr

## Examples
Expand All @@ -37,7 +42,7 @@ Simple Source Engine demo parser. Try it out on [StackBlitz]!
Using Deno + TypeScript:

```ts
import { SourceDemoParser } from 'npm:@nekz/sdp';
import { SourceDemoParser } from 'jsr:@nekz/sdp';

const demo = SourceDemoParser.default()
.setOptions({ messages: false })
Expand Down Expand Up @@ -87,20 +92,18 @@ console.log('registered jumps:', registeredJumps.length);
*/
```

### Jump Stats

The [examples directory](./examples/) contains more examples for Node and Deno.

### View Origin

[![showcase.gif](showcase.gif)](https://nekz.me/parser)

Used in [nekz.me/parser](https://nekz.me/parser). Updated example can be found in [examples/parser.html](./examples/parser.html).
Used in [nekz.me/parser](https://nekz.me/parser).
Updated example can be found in [examples/web/parser.html](./examples/web/parser.html).

## Credits
## Dependencies

[inolen/bit-buffer] for `BitStream` and `BitView`. I ported it to TypeScript because Deno cannot bundle npm specifiers
and any other bundler is not good enough. Also this port significantly improves typings which means less errors etc.
Vendored [inolen/bit-buffer] for TypeScript port + improvements.

[inolen/bit-buffer]: https://github.com/inolen/bit-buffer

Expand Down
31 changes: 0 additions & 31 deletions deno.json

This file was deleted.

Loading

0 comments on commit d253fe7

Please sign in to comment.