Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ python hatch_build.py

This will automatically select an available runtime and build using it.

For more fine-grained control over how to build the package, you can set these environment variables:
- `EJS_BUILD_SKIP_INSTALL`: If this environment variable is set, the install step will be skipped.
It is expected that the required packages are available for the selected bundler.
No network access should be required if this variable is set.
- `EJS_BUILD_INSTALLER`: Order of installers to try, separated by `:` on POSIX or `;` on Windows.
These will be used to install the required dependencies for bundling the JavaScript package.
Can be any of `pnpm`, `deno`, `bun` or `npm` (this is also the default order).
- `EJS_BUILD_BUNDLER`: Order of bundlers to try, separated by `:` on POSIX or `;` on Windows.
These will be used to perform the bundling of the JavaScript package (calling rollup under the hood).
Can be any of `esbuild`, `pnpm`, `deno`, `bun`, `node` (this is also the default order).

### Tests

First, make sure the project's dependencies are installed and download the player JS files:
Expand Down
32 changes: 32 additions & 0 deletions build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import * as esbuild from "esbuild";

const buildConfig = await stdinJSON();
const result = await esbuild.build(buildConfig);
console.log(JSON.stringify(result.metafile ?? null));
await esbuild.stop();

async function stdinJSON() {
const chunks = [];
if (globalThis.Deno) {
for await (const chunk of globalThis.Deno.stdin.readable) {
chunks.push(chunk);
}
const length = chunks.reduce(
(previous, chunk) => previous + chunk.length,
0,
);
const buffer = new Uint8Array(length);
let offset = 0;
for (const chunk of chunks) {
buffer.set(chunk, offset);
offset += chunk.length;
}
return JSON.parse(new TextDecoder().decode(buffer));
}

for await (const chunk of process.stdin) {
chunks.push(chunk);
}
const text = Buffer.concat(chunks).toString("utf-8");
return JSON.parse(text);
}
199 changes: 46 additions & 153 deletions bun.lock

Large diffs are not rendered by default.

506 changes: 111 additions & 395 deletions deno.lock

Large diffs are not rendered by default.

Loading
Loading