Skip to content
Closed
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
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,14 @@ __pycache__/
.hypothesis/

.ai-tool-config

# TypeScript build artifacts (generated by tsc --build)
*.tsbuildinfo
/src/engine/*.js
/src/engine/*.js.map
/src/engine/*.d.ts
/src/importer/*.js
/src/importer/*.js.map
/src/importer/*.d.ts
/website/rspress.config.js
/website/docs/**/*.js
76 changes: 66 additions & 10 deletions scripts/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,74 @@ else
exit 1
fi

echo -n "Checking TypeScript types... "
TSC_OUTPUT="$(mktemp)"
if yarn tsc > "$TSC_OUTPUT" 2>&1; then
echo -e "${GREEN}✓${NC}"
rm -f "$TSC_OUTPUT"
# Check if WASM modules are built (required for full type checking)
ENGINE_WASM="$REPO_ROOT/src/engine/core"
IMPORTER_WASM="$REPO_ROOT/src/importer/core"

if [ -d "$ENGINE_WASM" ] && [ -d "$IMPORTER_WASM" ]; then
# Full WASM build available - check all projects
echo -n "Checking TypeScript types (full)... "
TSC_OUTPUT="$(mktemp)"
if yarn tsc --build > "$TSC_OUTPUT" 2>&1; then
echo -e "${GREEN}✓${NC}"
rm -f "$TSC_OUTPUT"
else
echo -e "${RED}✗${NC}"
echo -e "${RED}TypeScript type checking failed:${NC}"
cat "$TSC_OUTPUT"
rm -f "$TSC_OUTPUT"
echo -e "${YELLOW}Run 'yarn tsc --build' to see errors${NC}"
exit 1
fi
else
echo -e "${RED}✗${NC}"
echo -e "${RED}TypeScript type checking failed:${NC}"
cat "$TSC_OUTPUT"
# WASM not built - check projects that don't depend on WASM
echo -e "${YELLOW}WASM not built - checking independent projects only${NC}"
TSC_OUTPUT="$(mktemp)"
TSC_FAILED=0

echo -n " Checking core... "
if yarn tsc --build src/core > "$TSC_OUTPUT" 2>&1; then
echo -e "${GREEN}✓${NC}"
else
echo -e "${RED}✗${NC}"
cat "$TSC_OUTPUT"
TSC_FAILED=1
fi

echo -n " Checking website... "
if yarn tsc --build website > "$TSC_OUTPUT" 2>&1; then
echo -e "${GREEN}✓${NC}"
else
echo -e "${RED}✗${NC}"
cat "$TSC_OUTPUT"
TSC_FAILED=1
fi

echo -n " Checking engine2... "
if yarn tsc --build src/engine2 > "$TSC_OUTPUT" 2>&1; then
echo -e "${GREEN}✓${NC}"
else
echo -e "${RED}✗${NC}"
cat "$TSC_OUTPUT"
TSC_FAILED=1
fi

echo -n " Checking xmutil-js... "
if yarn tsc --build src/xmutil-js > "$TSC_OUTPUT" 2>&1; then
echo -e "${GREEN}✓${NC}"
else
echo -e "${RED}✗${NC}"
cat "$TSC_OUTPUT"
TSC_FAILED=1
fi

rm -f "$TSC_OUTPUT"
echo -e "${YELLOW}Run 'yarn tsc' to see errors${NC}"
exit 1

if [ "$TSC_FAILED" -eq 1 ]; then
echo -e "${RED}TypeScript type checking failed${NC}"
echo -e "${YELLOW}Run 'yarn tsc --build' to see all errors${NC}"
exit 1
fi
fi

# Run engine2 tests if WASM is built
Expand Down
1 change: 1 addition & 0 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"devDependencies": {
"@emotion/react": "^11.14.0",
"rsbuild-plugin-google-analytics": "^1.0.2",
"@emotion/styled": "^11.14.0",
"@mui/material": "^7.1.2",
"@types/react": "^19.0.0",
Expand Down
13 changes: 7 additions & 6 deletions website/rspress.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { defineConfig } from 'rspress/config';
import path from 'path';
import { pluginGoogleAnalytics } from 'rsbuild-plugin-google-analytics';

const GithubBase = 'https://github.com/bpowers/simlin';

Expand Down Expand Up @@ -104,12 +105,12 @@ export default defineConfig({
},
// Output configuration
outDir: 'build',
// Analytics
analytics: {
ga: {
measurementId: 'G-DYC89XS4YM',
},
},
// Builder plugins (includes Google Analytics)
builderPlugins: [
pluginGoogleAnalytics({
id: 'G-DYC89XS4YM',
}),
],
// Generate sitemap
ssg: true,
});
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12212,6 +12212,11 @@ router@^2.0.0, router@^2.2.0:
parseurl "^1.3.3"
path-to-regexp "^8.0.0"

rsbuild-plugin-google-analytics@^1.0.2:
version "1.0.5"
resolved "https://registry.yarnpkg.com/rsbuild-plugin-google-analytics/-/rsbuild-plugin-google-analytics-1.0.5.tgz#dfd0e97a34fe467a3a9394f9b1d6b507045d6a84"
integrity sha512-1qSMjmH3HBNMIyrRjBFHQKmTdL86VNc42HjL3z25z4k4n+N7+cl9UvpD5ou3G6YAn1jNJ2GS2pia+PKNyaTzmg==

rspack-plugin-virtual-module@0.1.13:
version "0.1.13"
resolved "https://registry.yarnpkg.com/rspack-plugin-virtual-module/-/rspack-plugin-virtual-module-0.1.13.tgz#2acb3e5bba6fff458fd3428322978e0a51bb3294"
Expand Down
Loading