Skip to content

Commit

Permalink
refactor!: module exports and shims
Browse files Browse the repository at this point in the history
  • Loading branch information
tomoriny committed Feb 2, 2025
1 parent 4554a16 commit cfc8447
Show file tree
Hide file tree
Showing 32 changed files with 269 additions and 3,953 deletions.
15 changes: 5 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,17 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup node
uses: actions/setup-node@v4
- uses: oven-sh/setup-bun@v2
with:
node-version: 18.x
cache: pnpm
bun-version: latest

- name: Install
run: pnpm install
run: bun i

- name: Build
run: pnpm build
run: bun run preversion

- name: Test
run: |
aria2c --enable-rpc=true --rpc-listen-all=true --rpc-allow-origin-all=true --rpc-listen-port=6800 --rpc-secret=123456 &
pnpm test
bun run test
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 22.x

- run: npx changelogithub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 0 additions & 2 deletions .npmrc

This file was deleted.

8 changes: 0 additions & 8 deletions .prettierrc

This file was deleted.

11 changes: 0 additions & 11 deletions .vscode/settings.json

This file was deleted.

11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ Modern & Simple RPC Library for aria2.
`maria2` can control `aria2c` by its [RPC interface](https://aria2.github.io/manual/en/html/aria2c.html#rpc-interface).

## Features
- Simple.
- Simple and Light (Just `4.12KB` after minified)
- Better TypeScript IDE Support.
- Browser and Node.js Support.

## Getting Started

- If you are using Deno, just import it.
```ts
// See https://deno.land/x/maria2
import { open, aria2, system } from 'https://deno.land/x/maria2/index.ts'
import { aria2, open, system } from 'https://deno.land/x/maria2/index.ts'
import { createHTTP, createWebSocket } from 'https://deno.land/x/maria2/transport.ts'
```

Expand All @@ -38,7 +37,7 @@ aria2c --enable-rpc=true --rpc-listen-all=true --rpc-allow-origin-all=true --rpc

- Connect by WebSocket
```ts
import { open, aria2 } from 'maria2'
import { aria2, open } from 'maria2'

const conn = await open(
new WebSocket('ws://localhost:6800/jsonrpc')
Expand All @@ -52,7 +51,7 @@ const version = await aria2.getVersion(conn)

- Connect by HTTP
```ts
import { open, aria2 } from 'maria2'
import { aria2, open } from 'maria2'
import { createHTTP } from 'maria2/transport'

const conn = await open(
Expand Down Expand Up @@ -84,4 +83,4 @@ const [result0, result1] = await system.multicall({
- [L0serj3rry (@Cnotech)](https://github.com/Cnotech)

## License
MIT License © 2023 [Hydration](https://github.com/hydrati)
MIT License © 2023 [Hydration](https://github.com/hydrati)
14 changes: 0 additions & 14 deletions build.config.ts

This file was deleted.

Binary file added bun.lockb
Binary file not shown.
7 changes: 7 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import antfu from '@antfu/eslint-config'

export default antfu({
rules: {
eqeqeq: 'off',
},
})
90 changes: 31 additions & 59 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
{
"name": "maria2",
"type": "module",
"version": "0.3.4",
"description": "Simple RPC Library for aria2",
"description": "Simple and Light RPC Library for aria2",
"author": {
"name": "Hydration",
"url": "https://github.com/hydrati"
},
"license": "MIT",
"homepage": "https://github.com/hydrati/maria2#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/hydrati/maria2.git"
},
"bugs": {
"url": "https://github.com/hydrati/maria2/issues"
},
"keywords": [
"aria2",
"download",
Expand All @@ -13,73 +27,31 @@
"bittorrent",
"typescript"
],
"homepage": "https://github.com/hydrati/maria2#readme",
"bugs": {
"url": "https://github.com/hydrati/maria2/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/hydrati/maria2.git"
},
"license": "MIT",
"author": {
"name": "Hydration",
"url": "https://github.com/hydrati"
},
"type": "module",
"exports": {
".": {
"default": "./dist/index.mjs",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./transport": {
"default": "./dist/transport.mjs",
"import": "./dist/transport.mjs",
"types": "./dist/transport.d.ts"
},
"./*": null
},
"module": "./dist/index.mjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"typesVersions": {
"*": {
"*": [
"./dist/*",
"./*"
]
}
},
"files": [
"dist"
],
"engines": {
"node": ">= 22.5.0"
},
"scripts": {
"build": "unbuild",
"denocheck": "deno check --no-npm ./index.ts && deno check --no-npm ./transport.ts",
"format": "prettier --write src/**/*.ts",
"release": "bumpp --commit --push --tag && pnpm publish",
"bundle": "pkgroll --minify --sourcemap --clean-dist",
"lint": "eslint .",
"release": "bumpp --commit --push --tag && bun publish",
"test": "vitest",
"typecheck": "tsc --noEmit",
"preversion": "pnpm typecheck && pnpm build"
},
"dependencies": {
"uuid": "^9.0.1",
"ws": "^8.18.0"
"preversion": "bun typecheck && bun bundle"
},
"devDependencies": {
"@types/node": "^20.14.12",
"@types/uuid": "^9.0.8",
"@types/ws": "^8.5.11",
"bumpp": "^9.4.1",
"prettier": "^3.3.3",
"typescript": "^5.5.4",
"unbuild": "^1.2.1",
"vite": "^5.3.5",
"vitest": "^0.34.6"
},
"packageManager": "[email protected]",
"engines": {
"node": ">= 14.8.0"
"@antfu/eslint-config": "^4.1.1",
"@types/bun": "^1.2.2",
"bumpp": "^9.11.1",
"eslint": "^9.19.0",
"pkgroll": "^2.6.1",
"typescript": "^5.7.3",
"vite": "^6.0.11",
"vitest": "^3.0.4"
},
"publishConfig": {
"access": "public",
Expand Down
Loading

0 comments on commit cfc8447

Please sign in to comment.