Skip to content

Commit

Permalink
ci: manually replace esbuild with target arch version
Browse files Browse the repository at this point in the history
  • Loading branch information
tao-cumplido committed Nov 7, 2024
1 parent 5c79280 commit 33c8922
Show file tree
Hide file tree
Showing 4 changed files with 207 additions and 8 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,21 @@ jobs:
- os: windows-latest
platform: win32
arch: x64
npm_config_arch: x64
- os: windows-latest
platform: win32
arch: arm64
npm_config_arch: arm64
- os: ubuntu-latest
platform: linux
arch: x64
npm_config_arch: x64
- os: ubuntu-latest
platform: linux
arch: arm64
npm_config_arch: arm64
- os: macos-latest
platform: darwin
arch: x64
npm_config_arch: x64
- os: macos-latest
platform: darwin
arch: arm64
npm_config_arch: arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -45,9 +39,10 @@ jobs:
- run: npm ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
npm_config_arch: ${{ matrix.npm_config_arch }}
npm_config_arch: ${{ matrix.arch }}
- shell: pwsh
run: echo "target=${{ matrix.platform }}-${{ matrix.arch }}" >> $env:GITHUB_ENV
- run: node ./install-esbuild.mjs ${{ env.target }}
- run: npx vsce package --target ${{ env.target }}
- uses: actions/upload-artifact@v4
with:
Expand Down
17 changes: 17 additions & 0 deletions install-esbuild.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import fs from "node:fs/promises";

import { extract } from "tar";

import pkg from "./package.json" with { type: "json" };

const target = process.argv[2];
const version = pkg.dependencies.esbuild;
const url = `https://registry.npmjs.org/@esbuild/${target}/-/${target}-${version}.tgz`;

const data = await fetch(url).then((response) => response.blob()).then((blob) => blob.bytes());

await fs.writeFile("esbuild.tgz", data);
await extract({ file: "esbuild.tgz", });
await fs.rm("node_modules/@esbuild", { recursive: true, force: true, });
await fs.mkdir("node_modules/@esbuild", { recursive: true, });
await fs.rename("package", `node_modules/@esbuild/${target}`);
186 changes: 186 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
"typescript-eslint": "8.13.0",
"@stylistic/eslint-plugin": "2.10.1",
"@shigen/eslint-plugin": "0.12.1",
"eslint-plugin-unused-imports": "4.1.4"
"eslint-plugin-unused-imports": "4.1.4",
"tar": "7.4.3"
}
}

0 comments on commit 33c8922

Please sign in to comment.