Fixed two critical bugs preventing ten-frames from rendering: 1. **Mastery mode not handled** (typstGenerator.ts:61) - Code only checked for 'smart' | 'manual' modes - Mastery mode fell into manual path, tried to use boolean flags that don't exist - Resulted in all display options being `undefined` - Fix: Check for both 'smart' OR 'mastery' modes (both use displayRules) 2. **Typst array membership syntax** (already fixed in previous commit) - Used `(i in array)` which doesn't work in Typst - Changed to `array.contains(i)` Added comprehensive unit tests (tenFrames.test.ts): - Problem analysis tests (regrouping detection) - Display rule evaluation tests - Full Typst template generation tests - Mastery mode specific tests - All 14 tests now passing Added debug logging to trace display rules resolution: - displayRules.ts: Shows rule evaluation per problem - typstGenerator.ts: Shows enriched problems and Typst data - Helps diagnose future issues The issue was that mastery mode (which uses displayRules like smart mode) was being treated as manual mode (which uses boolean flags), resulting in undefined display options. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
62 lines
1.9 KiB
JavaScript
Executable File
62 lines
1.9 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
/**
|
|
* Generate build information for deployment tracking
|
|
* This script captures git commit, branch, timestamp, and other metadata
|
|
*/
|
|
|
|
const { execSync } = require('child_process')
|
|
const fs = require('fs')
|
|
const path = require('path')
|
|
|
|
function exec(command) {
|
|
try {
|
|
return execSync(command, { encoding: 'utf-8' }).trim()
|
|
} catch (_error) {
|
|
return null
|
|
}
|
|
}
|
|
|
|
function getBuildInfo() {
|
|
// Try to get git info from environment variables first (for Docker builds)
|
|
// Fall back to git commands (for local development)
|
|
const gitCommit = process.env.GIT_COMMIT || exec('git rev-parse HEAD')
|
|
const gitCommitShort = process.env.GIT_COMMIT_SHORT || exec('git rev-parse --short HEAD')
|
|
const gitBranch = process.env.GIT_BRANCH || exec('git rev-parse --abbrev-ref HEAD')
|
|
const gitTag = process.env.GIT_TAG || exec('git describe --tags --exact-match 2>/dev/null')
|
|
const gitDirty =
|
|
process.env.GIT_DIRTY === 'true' || exec('git diff --quiet || echo "dirty"') === 'dirty'
|
|
|
|
const packageJson = require('../package.json')
|
|
|
|
return {
|
|
version: packageJson.version,
|
|
buildTime: new Date().toISOString(),
|
|
buildTimestamp: Date.now(),
|
|
git: {
|
|
commit: gitCommit,
|
|
commitShort: gitCommitShort,
|
|
branch: gitBranch,
|
|
tag: gitTag,
|
|
isDirty: gitDirty,
|
|
},
|
|
environment: process.env.NODE_ENV || 'development',
|
|
buildNumber: process.env.BUILD_NUMBER || null,
|
|
nodeVersion: process.version,
|
|
}
|
|
}
|
|
|
|
const buildInfo = getBuildInfo()
|
|
const outputPath = path.join(__dirname, '..', 'src', 'generated', 'build-info.json')
|
|
|
|
// Ensure directory exists
|
|
const dir = path.dirname(outputPath)
|
|
if (!fs.existsSync(dir)) {
|
|
fs.mkdirSync(dir, { recursive: true })
|
|
}
|
|
|
|
fs.writeFileSync(outputPath, JSON.stringify(buildInfo, null, 2))
|
|
|
|
console.log('✅ Build info generated:', outputPath)
|
|
console.log(JSON.stringify(buildInfo, null, 2))
|