Skip to content

Commit 38e30cf

Browse files
ocd
1 parent f4abd92 commit 38e30cf

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

packages/@pglt/pglt/scripts/generate-packages.mjs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async function downloadSchema(releaseTag, githubToken) {
3434
console.log(`Downloaded schema for ${releaseTag}`);
3535
}
3636

37-
async function downloadAsset(platform, os, arch, releaseTag, githubToken) {
37+
async function downloadAsset(platform, arch, os, releaseTag, githubToken) {
3838
const buildName = getBuildName(platform, arch);
3939
const assetUrl = `https://github.com/supabase-community/postgres_lsp/releases/download/${releaseTag}/${buildName}`;
4040

@@ -50,7 +50,7 @@ async function downloadAsset(platform, os, arch, releaseTag, githubToken) {
5050
}
5151

5252
// just download to root.
53-
const fileStream = fs.createWriteStream(getBinarySource(os, platform, arch));
53+
const fileStream = fs.createWriteStream(getBinarySource(platform, arch, os));
5454

5555
await streamPipeline(response.body, fileStream);
5656

@@ -65,7 +65,7 @@ function getBinaryExt(os) {
6565
return os === "windows" ? ".exe" : "";
6666
}
6767

68-
function getBinarySource(os, platform, arch) {
68+
function getBinarySource(platform, arch, os) {
6969
const ext = getBinaryExt(os);
7070
return resolve(PGLT_ROOT, `${getBuildName(platform, arch)}${ext}`);
7171
}
@@ -123,7 +123,7 @@ function copyBinaryToNativePackage(platform, arch, os) {
123123
fs.writeFileSync(manifestPath, manifest);
124124

125125
// Copy the CLI binary
126-
const binarySource = getBinarySource(os, platform, arch);
126+
const binarySource = getBinarySource(platform, arch, os);
127127
const ext = getBinaryExt(os);
128128
const binaryTarget = resolve(packageRoot, `pglt${ext}`);
129129

@@ -169,9 +169,10 @@ function copySchemaToNativePackage(platform, arch) {
169169
const ARCHITECTURES = ["x86_64", "aarch64"];
170170

171171
for (const platform of PLATFORMS) {
172+
const os = getOs(platform);
173+
172174
for (const arch of ARCHITECTURES) {
173-
const os = getOs(platform);
174-
await downloadAsset(platform, os, arch, releaseTag, githubToken);
175+
await downloadAsset(platform, arch, os, releaseTag, githubToken);
175176
copyBinaryToNativePackage(platform, arch, os);
176177
copySchemaToNativePackage(platform, arch);
177178
}

0 commit comments

Comments
 (0)