Skip to content

Commit

Permalink
refactor!: drop cjs support
Browse files Browse the repository at this point in the history
+ Publish to JSR (jsr.io)
  • Loading branch information
LuanRT committed Nov 2, 2024
1 parent b207634 commit ec64dd5
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 24 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,9 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: ${{ steps.release.outputs.release_created }}

- name: Publish to JSR
run: |
npm run build --if-present
npx jsr publish
if: ${{ steps.release.outputs.release_created }}
21 changes: 21 additions & 0 deletions jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "@luanrt/googlevideo",
"version": "1.1.0",
"exports": "./src/index.ts",
"imports": {
"@bufbuild/protobuf": "npm:@bufbuild/protobuf@^2.0.0"
},
"publish": {
"include": [
"LICENSE",
"README.md",
"protos/generated/**/*.ts",
"src/**/*.ts"
],
"exclude": [
"test",
"scripts",
"examples"
]
}
}
46 changes: 24 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,35 @@
"types": "./dist/src/index.d.ts",
"module": "./dist/src/index.js",
"scripts": {
"watch": "npx tsc --watch",
"lint": "npx eslint ./src/**/*.ts",
"lint:fix": "npx eslint --fix ./src/**/*.ts",
"clean": "npx rimraf ./dist ./bundle ./protos/generated",
"build": "npm run clean && npm run lint && npm run build:proto && npm run build:esm && npm run bundle:node",
"clean": "npx rimraf ./dist ./protos/generated",
"build": "npm run clean && npm run lint && npm run build:proto && npm run build:esm",
"build:esm": "npx tsc",
"build:proto": "node ./dev-scripts/generate-proto.mjs",
"bundle:node": "npx esbuild ./dist/src/index.js --bundle --outfile=./bundle/index.cjs --platform=node --target=node16 --format=cjs --sourcemap --banner:js=\"/* eslint-disable */\"",
"prepare": "npm run build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/LuanRT/GoogleVideo.git"
},
"author": "LuanRT <luan.lrt4@gmail.com> (https://github.com/LuanRT)",
"funding": [
"https://github.com/sponsors/LuanRT"
],
"keywords": [
"UMP",
"SABR",
"Google",
"YouTube"
],
"author": "LuanRT <luan.lrt4@gmail.com> (https://github.com/LuanRT)",
"license": "MIT",
"bugs": {
"url": "https://github.com/LuanRT/GoogleVideo/issues"
"exports": {
".": {
"node": {
"import": "./dist/src/index.js"
},
"types": "./dist/src/index.d.ts",
"default": "./dist/src/index.js"
}
},
"homepage": "https://github.com/LuanRT/GoogleVideo#readme",
"funding": [
"https://github.com/sponsors/LuanRT"
],
"devDependencies": {
"@eslint/js": "^9.9.0",
"@stylistic/eslint-plugin": "^2.6.4",
Expand All @@ -46,14 +47,15 @@
"typescript": "^5.5.4",
"typescript-eslint": "^8.2.0"
},
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"import": "./dist/src/index.js",
"require": "./bundle/index.cjs"
}
},
"dependencies": {
"@bufbuild/protobuf": "^2.0.0"
},
"bugs": {
"url": "https://github.com/LuanRT/GoogleVideo/issues"
},
"homepage": "https://github.com/LuanRT/GoogleVideo#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/LuanRT/GoogleVideo.git"
}
}
}
1 change: 0 additions & 1 deletion src/core/UMP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ export class UMP {
}

public canReadFromCurrentChunk(offset: number, length: number): boolean {
this.chunkedDataBuffer.isFocused(offset);
return offset - this.chunkedDataBuffer.currentChunkOffset + length <= this.chunkedDataBuffer.chunks[this.chunkedDataBuffer.currentChunkIndex].length;
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class CustomEvent extends Event {
this.#detail = options?.detail ?? null;
}

get detail() {
get detail(): any[] | null {
return this.#detail;
}
}

0 comments on commit ec64dd5

Please sign in to comment.