Skip to content

Commit

Permalink
chore: convert to standalone repository
Browse files Browse the repository at this point in the history
  • Loading branch information
yume-chan committed Sep 15, 2023
1 parent 64496e2 commit 156d7f5
Show file tree
Hide file tree
Showing 30 changed files with 10,308 additions and 285 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
open_collective: ya-webadb
41 changes: 41 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Deploy

on:
push:
branches: [main]

env:
BASE_PATH: /old-demo

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x

- uses: pnpm/action-setup@v2
with:
version: 8
run_install: true

- run: pnpm recursive run build

- run: npx next export
working-directory: ./packages/demo

- run: touch packages/demo/out/.nojekyll

- name: Deploy
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: gh-pages
FOLDER: packages/demo/out
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
2 changes: 2 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
trailingComma: all
tabWidth: 4
15 changes: 15 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"editor.formatOnSave": true,
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020-2023 Simon Chan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Demo (deprecated)

This is the now deprecated demo project for `@yume-chan/adb` package. It won't be updated, but it still mostly reflects the current API.

## Build

```bash
pnpm install
pnpm recursive run build
```

## Generate static build that can be hosted on GitHub Pages

```bash
cd packages/demo
npx next export
```
1 change: 1 addition & 0 deletions packages/adb-daemon-direct-sockets/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
esm
20 changes: 10 additions & 10 deletions packages/adb-daemon-direct-sockets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
"email": "[email protected]",
"url": "https://chensi.moe/blog"
},
"homepage": "https://github.com/yume-chan/ya-webadb/tree/main/libraries/adb-daemon-direct-sockets#readme",
"homepage": "https://github.com/tango-adb/old-demo/tree/main/packages/adb-daemon-direct-sockets#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/yume-chan/ya-webadb.git",
"directory": "libraries/adb-daemon-direct-sockets"
"url": "git+https://github.com/tango-adb/old-demo.git",
"directory": "packages/adb-daemon-direct-sockets"
},
"bugs": {
"url": "https://github.com/yume-chan/ya-webadb/issues"
"url": "https://github.com/tango-adb/old-demo/issues"
},
"license": "MIT",
"type": "module",
Expand All @@ -32,15 +32,15 @@
"prepublishOnly": "npm run build"
},
"dependencies": {
"@yume-chan/adb": "workspace:^0.0.21",
"@yume-chan/stream-extra": "workspace:^0.0.21",
"tslib": "^2.6.0"
"@yume-chan/adb": "^0.0.21",
"@yume-chan/stream-extra": "^0.0.21",
"tslib": "^2.6.2"
},
"devDependencies": {
"@yume-chan/eslint-config": "workspace:^1.0.0",
"@yume-chan/tsconfig": "workspace:^1.0.0",
"eslint": "^8.44.0",
"prettier": "^3.0.0",
"typescript": "^5.1.6"
"eslint": "^8.49.0",
"prettier": "^3.0.3",
"typescript": "^5.2.2"
}
}
15 changes: 3 additions & 12 deletions packages/adb-daemon-direct-sockets/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
{
"extends": "./node_modules/@yume-chan/tsconfig/tsconfig.base.json",
"compilerOptions": {
"lib": [
"ESNext",
"DOM"
],
"tsBuildInfoFile": "esm/.tsbuildinfo",
"lib": ["ESNext", "DOM"]
},
"references": [
{
"path": "../adb/tsconfig.build.json"
},
{
"path": "../stream-extra/tsconfig.build.json"
},
]
"references": []
}
1 change: 1 addition & 0 deletions packages/adb-daemon-ws/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
esm
22 changes: 11 additions & 11 deletions packages/adb-daemon-ws/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
"email": "[email protected]",
"url": "https://chensi.moe/blog"
},
"homepage": "https://github.com/yume-chan/ya-webadb/tree/main/libraries/adb-daemon-ws#readme",
"homepage": "https://github.com/tango-adb/old-demo/tree/main/packages/adb-daemon-ws#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/yume-chan/ya-webadb.git",
"directory": "libraries/adb-daemon-ws"
"url": "git+https://github.com/tango-adb/old-demo.git",
"directory": "packages/adb-daemon-ws"
},
"bugs": {
"url": "https://github.com/yume-chan/ya-webadb/issues"
"url": "https://github.com/tango-adb/old-demo/issues"
},
"type": "module",
"main": "esm/index.js",
Expand All @@ -31,16 +31,16 @@
"lint": "eslint src/**/*.ts --fix"
},
"dependencies": {
"@yume-chan/adb": "workspace:^0.0.21",
"@yume-chan/stream-extra": "workspace:^0.0.21",
"tslib": "^2.6.0"
"@yume-chan/adb": "^0.0.21",
"@yume-chan/stream-extra": "^0.0.21",
"tslib": "^2.6.2"
},
"devDependencies": {
"@yume-chan/eslint-config": "workspace:^1.0.0",
"@yume-chan/tsconfig": "workspace:^1.0.0",
"eslint": "^8.44.0",
"jest": "^29.5.0",
"prettier": "^3.0.0",
"typescript": "^5.1.6"
"eslint": "^8.49.0",
"jest": "^29.7.0",
"prettier": "^3.0.3",
"typescript": "^5.2.2"
}
}
20 changes: 13 additions & 7 deletions packages/adb-daemon-ws/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import type { AdbDaemonDevice } from "@yume-chan/adb";
import type {
AdbDaemonDevice,
AdbPacketData,
AdbPacketInit,
} from "@yume-chan/adb";
import {
AdbPacket,
AdbPacketSerializeStream,
unreachable,
} from "@yume-chan/adb";
import type { Consumable } from "@yume-chan/stream-extra";
import type { Consumable, ReadableWritablePair } from "@yume-chan/stream-extra";
import {
ConsumableWritableStream,
DuplexStreamFactory,
Expand All @@ -23,7 +27,9 @@ export default class AdbDaemonWebSocketDevice implements AdbDaemonDevice {
this.name = name;
}

async connect() {
async connect(): Promise<
ReadableWritablePair<AdbPacketData, Consumable<AdbPacketInit>>
> {
const socket = new WebSocket(this.serial);
socket.binaryType = "arraybuffer";

Expand Down Expand Up @@ -65,21 +71,21 @@ export default class AdbDaemonWebSocketDevice implements AdbDaemonDevice {
size(chunk) {
return chunk.byteLength;
},
}
)
},
),
);

const writable = duplex.createWritable(
new ConsumableWritableStream({
write(chunk) {
socket.send(chunk);
},
})
}),
);

return {
readable: readable.pipeThrough(
new StructDeserializeStream(AdbPacket)
new StructDeserializeStream(AdbPacket),
),
writable: pipeFrom(writable, new AdbPacketSerializeStream()),
};
Expand Down
8 changes: 3 additions & 5 deletions packages/adb-daemon-ws/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
"extends": "./node_modules/@yume-chan/tsconfig/tsconfig.base.json",
"compilerOptions": {
"lib": [
"ESNext",
"DOM"
]
},
"tsBuildInfoFile": "esm/.tsbuildinfo",
"lib": ["ESNext", "DOM"]
}
}
66 changes: 33 additions & 33 deletions packages/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,55 +10,55 @@
"lint": "next lint"
},
"dependencies": {
"@fluentui/react": "^8.110.7",
"@fluentui/react-file-type-icons": "^8.9.3",
"@fluentui/react": "^8.111.2",
"@fluentui/react-file-type-icons": "^8.10.1",
"@fluentui/react-hooks": "^8.6.29",
"@fluentui/react-icons": "^2.0.206",
"@fluentui/style-utilities": "^8.9.16",
"@griffel/react": "^1.5.10",
"@yume-chan/adb": "workspace:^0.0.21",
"@yume-chan/adb-credential-web": "workspace:^0.0.21",
"@fluentui/react-icons": "^2.0.216",
"@fluentui/style-utilities": "^8.9.17",
"@griffel/react": "^1.5.14",
"@yume-chan/adb": "^0.0.21",
"@yume-chan/adb-credential-web": "^0.0.21",
"@yume-chan/adb-daemon-direct-sockets": "workspace:^0.0.9",
"@yume-chan/adb-daemon-webusb": "workspace:^0.0.21",
"@yume-chan/adb-daemon-webusb": "^0.0.21",
"@yume-chan/adb-daemon-ws": "workspace:^0.0.9",
"@yume-chan/adb-scrcpy": "workspace:^0.0.21",
"@yume-chan/android-bin": "workspace:^0.0.21",
"@yume-chan/aoa": "workspace:^0.0.21",
"@yume-chan/adb-scrcpy": "^0.0.21",
"@yume-chan/android-bin": "^0.0.21",
"@yume-chan/aoa": "^0.0.21",
"@yume-chan/async": "^2.2.0",
"@yume-chan/b-tree": "workspace:^0.0.21",
"@yume-chan/event": "workspace:^0.0.21",
"@yume-chan/fetch-scrcpy-server": "workspace:^0.0.21",
"@yume-chan/pcm-player": "workspace:^0.0.21",
"@yume-chan/scrcpy": "workspace:^0.0.21",
"@yume-chan/scrcpy-decoder-tinyh264": "workspace:^0.0.21",
"@yume-chan/scrcpy-decoder-webcodecs": "workspace:^0.0.21",
"@yume-chan/stream-extra": "workspace:^0.0.21",
"@yume-chan/b-tree": "^0.0.21",
"@yume-chan/event": "^0.0.21",
"@yume-chan/fetch-scrcpy-server": "^0.0.21",
"@yume-chan/pcm-player": "^0.0.21",
"@yume-chan/scrcpy": "^0.0.21",
"@yume-chan/scrcpy-decoder-tinyh264": "^0.0.21",
"@yume-chan/scrcpy-decoder-webcodecs": "^0.0.21",
"@yume-chan/stream-extra": "^0.0.21",
"@yume-chan/stream-saver": "^2.0.6",
"@yume-chan/struct": "workspace:^0.0.21",
"@yume-chan/struct": "^0.0.21",
"@yume-chan/tabby-launcher": "workspace:^1.0.197-nightly.1",
"@yume-chan/undici-browser": "5.22.1-mod.7",
"comlink": "^4.4.1",
"fflate": "^0.7.4",
"mobx": "^6.9.0",
"mobx-react-lite": "^3.4.3",
"next": "13.4.9",
"fflate": "^0.8.0",
"mobx": "^6.10.2",
"mobx-react-lite": "^4.0.4",
"next": "13.4.19",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"webm-muxer": "^3.1.1"
"webm-muxer": "^3.1.2"
},
"devDependencies": {
"@mdx-js/loader": "^2.3.0",
"@mdx-js/react": "^2.3.0",
"@next/bundle-analyzer": "^13.4.9",
"@next/mdx": "^13.4.9",
"@next/bundle-analyzer": "^13.4.19",
"@next/mdx": "^13.4.19",
"@types/dom-webcodecs": "^0.1.8",
"@types/node": "^20.4.0",
"@types/react": "18.2.14",
"@types/node": "^20.6.0",
"@types/react": "18.2.21",
"@yume-chan/next-pwa": "5.6.0-mod.2",
"eslint": "^8.44.0",
"eslint-config-next": "13.4.9",
"prettier": "^3.0.0",
"eslint": "^8.49.0",
"eslint-config-next": "13.4.19",
"prettier": "^3.0.3",
"source-map-loader": "^4.0.1",
"typescript": "^5.1.6"
"typescript": "^5.2.2"
}
}
16 changes: 11 additions & 5 deletions packages/demo/src/components/scrcpy/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { AdbSyncError } from "@yume-chan/adb";
import { AdbScrcpyClient, AdbScrcpyOptionsLatest } from "@yume-chan/adb-scrcpy";
import { VERSION } from "@yume-chan/fetch-scrcpy-server";
import {
CodecOptions,
DEFAULT_SERVER_PATH,
ScrcpyDisplay,
ScrcpyEncoder,
Expand Down Expand Up @@ -223,11 +224,16 @@ autorun(() => {
(async () => {
const sync = await GLOBAL_STATE.adb!.sync();
try {
const settings = JSON.parse(
await sync
.read(SCRCPY_SETTINGS_FILENAME)
.pipeThrough(new DecodeUtf8Stream())
.pipeThrough(new ConcatStringStream())
const content = await sync
.read(SCRCPY_SETTINGS_FILENAME)
.pipeThrough(new DecodeUtf8Stream())
.pipeThrough(new ConcatStringStream());
const settings = JSON.parse(content);
settings.settings.videoCodecOptions = new CodecOptions(
settings.settings.videoCodecOptions,
);
settings.settings.audioCodecOptions = new CodecOptions(
settings.settings.audioCodecOptions,
);
runInAction(() => {
SETTING_STATE.settings = {
Expand Down
Loading

0 comments on commit 156d7f5

Please sign in to comment.