Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
41 changes: 30 additions & 11 deletions buildCore.js → buildCore.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { execSync } from "child_process";
import fs from "fs";
import { execSync } from "node:child_process";
import fs from "node:fs";

let toolchain = "";
let profile = "debug";
Expand All @@ -8,8 +8,24 @@ let cargoFlags = "";
let rustFlags =
"-C target-feature=+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,+simd128,+extended-const,+multivalue,+reference-types,+tail-call";
let wasmBindgenFlags = "--encode-into always --target web --reference-types";
let target = "wasm32-unknown-unknown";
let targetFolder = target;
const target = "wasm32-unknown-unknown";
const targetFolder = target;
const coreFeatures = [
"parsing",
"run-saving",
"timing",
"run-editing",
"layouts",
"layout-editing",
"hotkeys",
"web-command-sink",
"server-protocol",
"web-rendering",
"therun-gg",
"localization",
"image-shrinking",
].join(",");
const bindingsDir = "target/livesplit-one-bindings";

if (process.argv.some((v) => v === "--max-opt")) {
// Do a fully optimized build ready for deployment.
Expand Down Expand Up @@ -57,13 +73,16 @@ if (process.argv.some((v) => v === "--nightly")) {
}
}

execSync(`cargo ${toolchain} run`, {
cwd: "livesplit-core/capi/bind_gen",
stdio: "inherit",
});
execSync(
`cargo ${toolchain} run -- --no-default-features --features ${coreFeatures} --output-dir ${bindingsDir}`,
{
cwd: "livesplit-core/capi/bind_gen",
stdio: "inherit",
},
);

execSync(
`cargo ${toolchain} rustc -p livesplit-core-capi --crate-type cdylib --features wasm-web,web-rendering,therun-gg --target ${target} ${cargoFlags}`,
`cargo ${toolchain} rustc -p livesplit-core-capi --crate-type cdylib --no-default-features --features ${coreFeatures} --target ${target} ${cargoFlags}`,
{
cwd: "livesplit-core",
stdio: "inherit",
Expand All @@ -82,9 +101,9 @@ execSync(
);

fs.createReadStream(
"livesplit-core/capi/bindings/wasm_bindgen/web/index.ts",
`livesplit-core/capi/bind_gen/${bindingsDir}/wasm_bindgen/web/index.ts`,
).pipe(fs.createWriteStream("src/livesplit-core/index.ts"));

fs.createReadStream(
"livesplit-core/capi/bindings/wasm_bindgen/web/preload.ts",
`livesplit-core/capi/bind_gen/${bindingsDir}/wasm_bindgen/web/preload.ts`,
).pipe(fs.createWriteStream("src/livesplit-core/preload.ts"));
36 changes: 0 additions & 36 deletions eslint.config.mjs

This file was deleted.

47 changes: 47 additions & 0 deletions eslint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import tseslint from "typescript-eslint";

export default tseslint.config({
ignores: ["src/livesplit-core/**", "src/type-definitions/**"],
extends: tseslint.configs.recommendedTypeChecked,
rules: {
"@typescript-eslint/consistent-type-exports": "error",
"@typescript-eslint/consistent-type-imports": [
"error",
{ fixStyle: "inline-type-imports" },
],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-misused-promises": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
},
languageOptions: {
parserOptions: {
// The project service only discovers files from conventionally
// named tsconfig.json files. These root-level scripts instead
// belong to tsconfig.node.json, so opt them into the service's
// default project for editor linting.
projectService: {
allowDefaultProject: [
"buildCore.ts",
"eslint.config.ts",
"vite.config.ts",
],
defaultProject: "tsconfig.node.json",
},
tsconfigRootDir: import.meta.dirname,
},
},
});
1 change: 1 addition & 0 deletions package-lock.json

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

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"main": "dist/bundle.js",
"type": "module",
"scripts": {
"build:core": "node buildCore.js",
"build:core:release": "node buildCore.js --release",
"build:core:deploy": "node buildCore.js --max-opt --nightly",
"lint": "eslint src",
"build:core": "node buildCore.ts",
"build:core:release": "node buildCore.ts --release",
"build:core:deploy": "node buildCore.ts --max-opt --nightly",
"lint": "eslint src buildCore.ts eslint.config.ts vite.config.ts",
"typecheck": "tsc -p tsconfig.json && tsc -p tsconfig.node.json",
"publish": "vite build",
"serve": "vite",
Expand Down Expand Up @@ -41,6 +41,7 @@
"@vitejs/plugin-react": "^6.0.1",
"eslint": "^10.0.1",
"favicons": "^7.2.0",
"jiti": "^2.7.0",
"typescript": "^6.0.2",
"typescript-eslint": "^8.24.0",
"vite": "^8.0.0",
Expand Down
7 changes: 6 additions & 1 deletion tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,10 @@
"types": ["node"],
"lib": ["ES2024", "DOM", "WebWorker"]
},
"include": ["vite.config.ts", "src/type-definitions/babel-core-shim.d.ts"]
"include": [
"buildCore.ts",
"eslint.config.ts",
"vite.config.ts",
"src/type-definitions/babel-core-shim.d.ts"
]
}
Loading