Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
scheibo committed Jan 7, 2024
1 parent e57e23a commit 5fe13fa
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 24 deletions.
26 changes: 11 additions & 15 deletions epoke/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const pkmn = @import("node_modules/@pkmn/engine/build.zig");

pub fn build(b: *std.Build) !void {
const release = if (std.os.getenv("DEBUG_PKMN_ENGINE")) |_| false else true;
const target = std.zig.CrossTarget{};
const target = b.resolveTargetQuery(.{});

const showdown =
b.option(bool, "showdown", "Enable Pokémon Showdown compatibility mode") orelse true;
Expand All @@ -32,8 +32,7 @@ pub fn build(b: *std.Build) !void {
try std.io.getStdErr().writeAll("Cannot find node headers\n");
std.process.exit(1);
};
const windows = (try std.zig.system.NativeTargetInfo.detect(target)).target.os.tag == .windows;
const node_import_lib = if (windows) lib: {
const node_import_lib = if (target.result.os.tag == .windows) lib: {
var lib = resolve(b, &.{ node, "..", "node.lib" });
if (try exists(lib)) break :lib lib;
lib = resolve(b, &.{ NODE_MODULES, "lib", "node.lib" });
Expand All @@ -44,18 +43,17 @@ pub fn build(b: *std.Build) !void {

const addon = b.addSharedLibrary(.{
.name = "addon",
.main_pkg_path = .{ .path = "." },
.root_source_file = .{ .path = "src/lib/binding/node.zig" },
.root_source_file = .{ .path = "src/lib/node.zig" },
.optimize = if (release) .ReleaseFast else .Debug,
.target = target,
.strip = release,
});
addon.addModule("pkmn", module);
addon.root_module.addImport("pkmn", module);
addon.addSystemIncludePath(.{ .path = node_headers });
addon.linkLibC();
if (node_import_lib) |il| addon.addObjectFile(.{ .path = il });
addon.linker_allow_shlib_undefined = true;
if (release) {
addon.strip = true;
if (b.findProgram(&.{"strip"}, &.{})) |strip| {
if (builtin.os.tag != .macos) {
const sh = b.addSystemCommand(&.{ strip, "-s" });
Expand All @@ -70,21 +68,20 @@ pub fn build(b: *std.Build) !void {

const wasm = b.addSharedLibrary(.{
.name = "addon",
.main_pkg_path = .{ .path = "." },
.root_source_file = .{ .path = "src/lib/binding/wasm.zig" },
.root_source_file = .{ .path = "src/lib/wasm.zig" },
.optimize = if (release) .ReleaseSmall else .Debug,
.target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },
.target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }),
.strip = release,
});
wasm.addModule("pkmn", module);
wasm.root_module.addImport("pkmn", module);
wasm.stack_size = std.wasm.page_size;
wasm.rdynamic = true;
if (release) {
wasm.strip = true;
if (b.findProgram(&.{"wasm-opt"}, &.{BIN})) |opt| {
const sh = b.addSystemCommand(&.{ opt, "-O4" });
sh.addArtifactArg(wasm);
sh.addArg("-o");
sh.addFileSourceArg(.{ .path = "build/lib/addon.wasm" });
sh.addFileArg(.{ .path = "build/lib/addon.wasm" });
b.getInstallStep().dependOn(&sh.step);
} else |_| {}
}
Expand All @@ -97,13 +94,12 @@ pub fn build(b: *std.Build) !void {

const tests = b.addTest(.{
.name = std.fs.path.basename(std.fs.path.dirname(test_file).?),
.main_pkg_path = .{ .path = "." },
.root_source_file = .{ .path = test_file },
.optimize = if (release) .ReleaseSafe else .Debug,
.target = target,
.filter = test_filter,
.single_threaded = true,
});
tests.single_threaded = true;

const lint = b.addSystemCommand(&.{"ziglint"});

Expand Down
2 changes: 1 addition & 1 deletion epoke/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"access": "public"
},
"dependencies": {
"@pkmn/engine": "0.1.0-dev.6c5fdce2",
"@pkmn/engine": "0.1.0-dev.3a62fd35",
"@pkmn/spreads": "file:../spreads"
},
"scripts": {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"repository": "github:pkmn/EPOke",
"license": "MIT",
"devDependencies": {
"@pkmn/eslint-config": "^6.0.0",
"@types/jest": "^29.5.8",
"@types/node": "^20.9.2",
"@pkmn/eslint-config": "^6.5.0",
"@types/jest": "^29.5.11",
"@types/node": "^20.10.7",
"binaryen": "^116.0.0",
"eslint": "^8.54.0",
"eslint": "^8.56.0",
"subpkg": "^4.1.0",
"typescript": "^5.3.2",
"vitest": "^0.34.6"
"typescript": "^5.3.3",
"vitest": "^1.1.3"
},
"subPackages": ["epoke", "gmd", "predictor", "spreads"],
"scripts": {
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions spreads/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"access": "public"
},
"dependencies": {
"@pkmn/types": "^3.0.0"
"@pkmn/types": "^4.0.0"
},
"devDependencies": {
"tsup": "^8.0.0"
"tsup": "^8.0.1"
},
"scripts": {
"lint": "eslint --cache src --ext ts",
Expand Down
File renamed without changes.

0 comments on commit 5fe13fa

Please sign in to comment.