Skip to content

Commit

Permalink
Add script to create dist binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoborus committed Mar 14, 2024
1 parent 2781c13 commit 93f67d7
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ lib
.vim
*.bundle.js
npm
release
3 changes: 2 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"tasks": {
"bundle-assets": "deno run --allow-read --allow-write scripts/bundle_assets.ts",
"install": "deno task bundle-assets && deno install --allow-read --allow-write estilo.ts",
"build-npm": "deno run -A scripts/build_npm.ts"
"build-npm": "deno run -A scripts/build_npm.ts",
"create-binaries": "deno run -A scripts/create_binaries.ts"
}
}
64 changes: 64 additions & 0 deletions deno.lock

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

32 changes: 32 additions & 0 deletions scripts/create_binaries.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import $ from "jsr:@david/dax";
import denojson from "../deno.json" with { type: "json" };

const prefix = `estilo-${denojson.version}-`;

const archs = [
["x86_64-unknown-linux-gnu", "linux-x86"],
["aarch64-unknown-linux-gnu", "linux-arm"],
["x86_64-pc-windows-msvc", "windows-x86", ".exe"],
["x86_64-apple-darwin", "apple-x86"],
["aarch64-apple-darwin", "apple-arm"],
] as const;

await $`rm -rf bin`;

for await (const arch of archs) {
await releaseArch(arch);
}

console.log("Done!");

async function releaseArch(arch: typeof archs[number]) {
const folder = "release/" + prefix + arch[1];
await $`mkdir ${folder} -p`;
await $`rm -rf ${folder}/*.*`;
const filepath = folder + "/estilo" + (arch[2] ? arch[2] : "");
await $`deno compile --allow-read --allow-write --target ${
arch[0]
} -o ${filepath} estilo.ts`;
await $`zip -r -j ${folder}.zip ${filepath}`;
await $`rm -rf ${folder}`;
}
2 changes: 1 addition & 1 deletion src/load-project.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { parse as yamlParse } from "jsr:@std/[email protected]";
import { basename, resolve } from "jsr:@std/[email protected]";
import { hexterm } from "jsr:@jacoborus/[email protected].0";
import { hexterm } from "jsr:@jacoborus/[email protected].1";

import {
ColorObj,
Expand Down
2 changes: 1 addition & 1 deletion src/render-colorscheme.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render } from "npm:[email protected]";
import { hexterm } from "jsr:@jacoborus/[email protected].0";
import { hexterm } from "jsr:@jacoborus/[email protected].1";
import assets from "./assets.ts";
import denojson from "../deno.json" with { type: "json" };
import { crash, isHexColor } from "./util.ts";
Expand Down

0 comments on commit 93f67d7

Please sign in to comment.