From ba4877367c89c122def005cbbb1903db0f765524 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Wed, 3 Apr 2024 16:37:10 -0700 Subject: [PATCH 01/10] add arm --- bun.lockb | Bin 21351 -> 21351 bytes npm/darwin-arm64/README.md | 3 +++ npm/darwin-arm64/package.json | 18 ++++++++++++++++++ package.json | 2 ++ 4 files changed, 23 insertions(+) create mode 100644 npm/darwin-arm64/README.md create mode 100644 npm/darwin-arm64/package.json diff --git a/bun.lockb b/bun.lockb index 50a1bf2d3b0915389a0de113421b50669618e70c..646e61059396bb061ccd8bc8bdb9e3444de5642d 100755 GIT binary patch delta 360 zcmW;AEerv10EY4X$4pY}e1Cr&6K;knHc=D=nkZ^6UKEwvMDe28Y@#TNqDV7IG~TED z_Uw5E<{6m7$}+}xt=Zoz+6lFXH*}IZYrJDWrL(~Y4%0eYeBmggv%?RLvpNBOahlWF zVLjQnMA0M$NqIbe!ICGO$uVR)k-& delta 360 zcmW;AEertx0ES_QnWWhHch282!6d~dih@8BMU8mzqH>!kUNoCc6h-l(c$!TSjqm-! zvv2P+FrI;N+L%Vn-ER_{rF;`Pr;|(oaWs7%o>MAaV*l(zK_`qRPWrq=tTPk~e;iRo{zzomu@2DI*3;&(S`-5ciY= 10" + } +} \ No newline at end of file diff --git a/package.json b/package.json index 3fb0923..03c0284 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "defaults": false, "additional": [ "x86_64-apple-darwin", + "aarch64-apple-darwin", "x86_64-unknown-linux-gnu" ] } @@ -42,6 +43,7 @@ }, "optionalDependencies": { "@replit/ruspty-darwin-x64": "1.0.0-alpha.1", + "@replit/ruspty-darwin-arm64": "1.0.0-alpha.1", "@replit/ruspty-linux-x64-gnu": "1.0.0-alpha.1" } } From 3b41eec0ed88db066e7fdf087e5cb85183952045 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Wed, 3 Apr 2024 16:42:39 -0700 Subject: [PATCH 02/10] add m1 to ci --- .github/workflows/CI.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e623fd6..7786686 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -27,11 +27,17 @@ jobs: fail-fast: false matrix: settings: - - host: macos-latest + # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories + - host: macos-13 target: x86_64-apple-darwin build: | bun run build strip -x *.node + - host: macos-14 + target: aarch64-apple-darwin + build: | + bun run build + strip -x *.node - host: ubuntu-latest target: x86_64-unknown-linux-gnu docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian From 26dc9a5e96288e9368428a794f08852522c8ad64 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Wed, 3 Apr 2024 17:08:19 -0700 Subject: [PATCH 03/10] format --- index.d.ts | 19 +++++++++++++------ index.test.ts | 10 +++++----- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/index.d.ts b/index.d.ts index 12f8396..698b362 100644 --- a/index.d.ts +++ b/index.d.ts @@ -4,12 +4,19 @@ /* auto-generated by NAPI-RS */ export interface Size { - cols: number - rows: number + cols: number; + rows: number; } export class Pty { - fd: number - pid: number - constructor(command: string, args: Array, envs: Record, dir: string, size: Size, onExit: (err: null | Error, exitCode: number) => void) - resize(size: Size): void + fd: number; + pid: number; + constructor( + command: string, + args: Array, + envs: Record, + dir: string, + size: Size, + onExit: (err: null | Error, exitCode: number) => void, + ); + resize(size: Size): void; } diff --git a/index.test.ts b/index.test.ts index 6ad32e0..11a0838 100644 --- a/index.test.ts +++ b/index.test.ts @@ -20,7 +20,7 @@ describe('PTY', () => { }, ); - const readStream = fs.createReadStream('', { fd: pty.fd }); + const readStream = fs.createReadStream('', { fd: pty.fd, start: 0 }); readStream.on('data', (chunk) => { expect(chunk.toString()).toBe(message + '\r\n'); @@ -54,7 +54,7 @@ describe('PTY', () => { () => {}, ); - const readStream = fs.createReadStream('', { fd: pty.fd }); + const readStream = fs.createReadStream('', { fd: pty.fd, start: 0 }); const writeStream = fs.createWriteStream('', { fd: pty.fd }); readStream.on('data', (chunk) => { @@ -75,7 +75,7 @@ describe('PTY', () => { () => {}, ); - const readStream = fs.createReadStream('', { fd: pty.fd }); + const readStream = fs.createReadStream('', { fd: pty.fd, start: 0 }); const writeStream = fs.createWriteStream('', { fd: pty.fd }); let buffer = ''; @@ -113,7 +113,7 @@ describe('PTY', () => { }, ); - const readStream = fs.createReadStream('', { fd: pty.fd }); + const readStream = fs.createReadStream('', { fd: pty.fd, start: 0 }); readStream.on('data', (chunk) => { expect(chunk.toString()).toBe(`${CWD}\r\n`); @@ -141,7 +141,7 @@ describe('PTY', () => { }, ); - const readStream = fs.createReadStream('', { fd: pty.fd }); + const readStream = fs.createReadStream('', { fd: pty.fd, start: 0 }); readStream.on('data', (chunk) => { buffer += chunk.toString(); From 903127ce8440b7507267bab93851d74f74d0a4f1 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Wed, 3 Apr 2024 17:08:53 -0700 Subject: [PATCH 04/10] remove comment --- .github/workflows/CI.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7786686..95d9d46 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -27,7 +27,6 @@ jobs: fail-fast: false matrix: settings: - # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories - host: macos-13 target: x86_64-apple-darwin build: | From 3a392caf20e87eb115326fd73d375211e2ec57e9 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Thu, 4 Apr 2024 10:06:10 -0700 Subject: [PATCH 05/10] specify bun version --- .github/workflows/CI.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 95d9d46..d417a55 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -51,6 +51,8 @@ jobs: - uses: actions/checkout@v4 - name: Setup Bun uses: oven-sh/setup-bun@v1 + with: + bun-version: 1.0.30 - name: Setup node uses: actions/setup-node@v4 if: ${{ !matrix.settings.docker }} From b85d9befaf3092ac19523236c67e0a82d3f24c01 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Thu, 4 Apr 2024 10:10:43 -0700 Subject: [PATCH 06/10] pin bun version --- .github/workflows/CI.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d417a55..d70c6ce 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -116,6 +116,8 @@ jobs: - uses: actions/checkout@v4 - name: Setup Bun uses: oven-sh/setup-bun@v1 + with: + bun-version: 1.0.30 - name: Setup node uses: actions/setup-node@v4 with: @@ -147,6 +149,8 @@ jobs: - uses: actions/checkout@v4 - name: Setup Bun uses: oven-sh/setup-bun@v1 + with: + bun-version: 1.0.30 - name: Setup node uses: actions/setup-node@v4 with: @@ -174,6 +178,8 @@ jobs: - uses: actions/checkout@v4 - name: Setup Bun uses: oven-sh/setup-bun@v1 + with: + bun-version: 1.0.30 - name: Setup node uses: actions/setup-node@v4 with: From ff477de5ab9376397415d3f3f69c89cca2f7407a Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Thu, 4 Apr 2024 10:17:38 -0700 Subject: [PATCH 07/10] another ci fix attempt --- .github/workflows/CI.yml | 68 ++-------------------------------------- 1 file changed, 2 insertions(+), 66 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d70c6ce..f162bd7 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -95,6 +95,8 @@ jobs: run: ${{ matrix.settings.build }} if: ${{ !matrix.settings.docker }} shell: bash + - name: Test + run: bun test - name: Upload artifact uses: actions/upload-artifact@v3 with: @@ -102,72 +104,6 @@ jobs: path: ${{ env.APP_NAME }}.*.node if-no-files-found: error - test-macos-binding: - name: Test on ${{ matrix.settings.target }} - needs: - - build - strategy: - matrix: - settings: - - host: macos-latest - target: x86_64-apple-darwin - runs-on: ${{ matrix.settings.host }} - steps: - - uses: actions/checkout@v4 - - name: Setup Bun - uses: oven-sh/setup-bun@v1 - with: - bun-version: 1.0.30 - - name: Setup node - uses: actions/setup-node@v4 - with: - node-version: 20 - - name: Install dependencies - run: bun install - - name: Download artifacts - uses: actions/download-artifact@v3 - with: - name: bindings-${{ matrix.settings.target }} - path: . - - name: List packages - run: ls -R . - shell: bash - - name: Test bindings - run: bun test - - test-linux-binding: - name: Test on ${{ matrix.settings.target }} - needs: - - build - strategy: - matrix: - settings: - - host: ubuntu-latest - target: x86_64-unknown-linux-gnu - runs-on: ${{ matrix.settings.host }} - steps: - - uses: actions/checkout@v4 - - name: Setup Bun - uses: oven-sh/setup-bun@v1 - with: - bun-version: 1.0.30 - - name: Setup node - uses: actions/setup-node@v4 - with: - node-version: 20 - - name: Install dependencies - run: bun install - - name: Download artifacts - uses: actions/download-artifact@v3 - with: - name: bindings-${{ matrix.settings.target }} - path: . - - name: List packages - run: ls -R . - shell: bash - - name: Test bindings - run: docker run --rm -v $(pwd):/build -w /build oven/bun:1 bun test - publish: name: Publish runs-on: ubuntu-latest From 99f091b4c146b5683a337054d5943f5fcfaaf3e0 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Thu, 4 Apr 2024 10:40:12 -0700 Subject: [PATCH 08/10] oops fix missing step --- .github/workflows/CI.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f162bd7..f76d3d2 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -108,8 +108,7 @@ jobs: name: Publish runs-on: ubuntu-latest needs: - - test-macos-binding - - test-linux-binding + - build steps: - uses: actions/checkout@v4 - name: Setup Bun From 464986b3c4ac3ada2596f53706c5e02548be6a23 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Thu, 4 Apr 2024 10:48:50 -0700 Subject: [PATCH 09/10] make test same as old --- index.test.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/index.test.ts b/index.test.ts index 11a0838..6ad32e0 100644 --- a/index.test.ts +++ b/index.test.ts @@ -20,7 +20,7 @@ describe('PTY', () => { }, ); - const readStream = fs.createReadStream('', { fd: pty.fd, start: 0 }); + const readStream = fs.createReadStream('', { fd: pty.fd }); readStream.on('data', (chunk) => { expect(chunk.toString()).toBe(message + '\r\n'); @@ -54,7 +54,7 @@ describe('PTY', () => { () => {}, ); - const readStream = fs.createReadStream('', { fd: pty.fd, start: 0 }); + const readStream = fs.createReadStream('', { fd: pty.fd }); const writeStream = fs.createWriteStream('', { fd: pty.fd }); readStream.on('data', (chunk) => { @@ -75,7 +75,7 @@ describe('PTY', () => { () => {}, ); - const readStream = fs.createReadStream('', { fd: pty.fd, start: 0 }); + const readStream = fs.createReadStream('', { fd: pty.fd }); const writeStream = fs.createWriteStream('', { fd: pty.fd }); let buffer = ''; @@ -113,7 +113,7 @@ describe('PTY', () => { }, ); - const readStream = fs.createReadStream('', { fd: pty.fd, start: 0 }); + const readStream = fs.createReadStream('', { fd: pty.fd }); readStream.on('data', (chunk) => { expect(chunk.toString()).toBe(`${CWD}\r\n`); @@ -141,7 +141,7 @@ describe('PTY', () => { }, ); - const readStream = fs.createReadStream('', { fd: pty.fd, start: 0 }); + const readStream = fs.createReadStream('', { fd: pty.fd }); readStream.on('data', (chunk) => { buffer += chunk.toString(); From f09c9876605d646c54c77d6af2ce91d2170010b2 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Thu, 4 Apr 2024 10:53:15 -0700 Subject: [PATCH 10/10] macos latest for all ci runners --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f76d3d2..4ea3c30 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -27,12 +27,12 @@ jobs: fail-fast: false matrix: settings: - - host: macos-13 + - host: macos-latest target: x86_64-apple-darwin build: | bun run build strip -x *.node - - host: macos-14 + - host: macos-latest target: aarch64-apple-darwin build: | bun run build