Skip to content

Commit

Permalink
include brotli'd tarball in mac and win packages
Browse files Browse the repository at this point in the history
  • Loading branch information
bates64 committed Aug 23, 2023
1 parent ab4b5a0 commit f3332cb
Show file tree
Hide file tree
Showing 14 changed files with 174 additions and 276 deletions.
154 changes: 113 additions & 41 deletions package-lock.json

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

1 change: 1 addition & 0 deletions packages/cheerp-darwin-x64/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cheerp
2 changes: 0 additions & 2 deletions packages/cheerp-darwin-x64/.npmignore

This file was deleted.

Binary file added packages/cheerp-darwin-x64/cheerp.tar.br
Binary file not shown.
5 changes: 4 additions & 1 deletion packages/cheerp-darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@leaningtech/cheerp-darwin-x64",
"version": "0.0.0-1692034395",
"version": "3.0.0-rc.2",
"license": "Apache-2.0 WITH LLVM-exception",
"main": "index.mjs",
"types": "index.d.ts",
Expand All @@ -13,5 +13,8 @@
],
"scripts": {
"postinstall": "node postinstall.mjs"
},
"dependencies": {
"tar-fs": "^3.0.4"
}
}
31 changes: 9 additions & 22 deletions packages/cheerp-darwin-x64/postinstall.mjs
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
import { $ } from "execa";
import { writeFile, stat, constants } from "fs/promises";
import { brotliDecompress } from "zlib";
import { promisify } from "util";
import { readFile, rmdir } from "fs/promises";
import { Readable } from "stream";
import { extract } from "tar-fs";

const dest = ".";
const url =
"https://output.circle-artifacts.com/output/job/38375ec3-45be-4ac9-8662-8f2c777ab578/artifacts/0/~/project/packages/cheerp-macosx-1692034395.tar.bz2";
const tarPath = "cheerp.tar.bz2";
rmdir("cheerp", { recursive: true }).catch(() => {});

await $`rm -rf cheerp`

console.log(`downloading ${url}`)
const response = await fetch(url);
await writeFile(tarPath, new Uint8Array(await response.arrayBuffer()));

console.log(`extracting ${tarPath}`)
await $`tar -xjf ${tarPath} -C ${dest}`;

// Check that the binary is executable
const { mode } = await stat(`cheerp/bin/clang++`)
if (mode & constants.S_IXUSR) {
console.log("clang++ ok!")
} else {
process.exit(1)
}
let buffer = await readFile("cheerp.tar.br");
buffer = await promisify(brotliDecompress)(buffer);
await new Promise(resolve => Readable.from(buffer).pipe(extract(".")).once("close", resolve));
1 change: 1 addition & 0 deletions packages/cheerp-win32-x64/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cheerp
Binary file added packages/cheerp-win32-x64/cheerp.tar.br
Binary file not shown.
1 change: 1 addition & 0 deletions packages/cheerp-win32-x64/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const path: string;
4 changes: 4 additions & 0 deletions packages/cheerp-win32-x64/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { URL } from "url";
import { resolve } from "path";

export const path = resolve(new URL(".", import.meta.url).pathname, "cheerp");
19 changes: 19 additions & 0 deletions packages/cheerp-win32-x64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@leaningtech/cheerp-win32-x64",
"version": "3.0.0-rc.2",
"license": "Apache-2.0 WITH LLVM-exception",
"main": "index.mjs",
"types": "index.d.ts",
"os": [
"win32"
],
"cpu": [
"x64"
],
"scripts": {
"postinstall": "node postinstall.mjs"
},
"dependencies": {
"tar-fs": "^3.0.4"
}
}
Loading

0 comments on commit f3332cb

Please sign in to comment.