{"id":14902,"library":"samengine-build","title":"Samengine Build Tool","description":"Samengine Build is a command-line interface (CLI) and potentially programmatic utility designed to facilitate the build and export processes for projects developed with the `samengine` game engine. As of version 1.7.10, this tool likely provides functionalities related to compiling game assets, bundling game code, and preparing exportable packages for various target platforms supported by `samengine`. It acts as the dedicated build utility within the `samengine` ecosystem, streamlining the development workflow for creators using that specific engine. Due to its highly specialized application, specific details regarding its release cadence are not extensively publicized, but updates typically focus on maintenance, compatibility, and core integrations rather than rapid, broad feature expansion. Its primary differentiator is its deep and direct integration with the `samengine` platform, offering an optimized and coherent build experience tailored for that environment.","status":"maintenance","version":"1.7.10","language":"javascript","source_language":"en","source_url":"https://github.com/shadowdara/samengine","tags":["javascript"],"install":[{"cmd":"npm install samengine-build","lang":"bash","label":"npm"},{"cmd":"yarn add samengine-build","lang":"bash","label":"yarn"},{"cmd":"pnpm add samengine-build","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"For programmatic access to initiate a build process. Primarily used in custom build scripts.","symbol":"build","correct":"import { build } from 'samengine-build';"},{"note":"For programmatic access to export the project for deployment or distribution. Assumed export functionality based on package description.","symbol":"exportProject","correct":"import { exportProject } from 'samengine-build';"},{"note":"Typical CommonJS `require` for full module import; ES modules are preferred in modern Node.js environments. The package is likely ESM-first or dual-mode.","wrong":"const SamengineBuild = require('samengine-build');","symbol":"* as SamengineBuild","correct":"import * as SamengineBuild from 'samengine-build';"}],"quickstart":{"code":"import { build, exportProject } from 'samengine-build';\n\nasync function runBuildAndExport() {\n  console.log('Starting samengine project build...');\n  try {\n    // Assuming a default build function that takes an optional config path\n    const buildResult = await build({ projectPath: './src', outputPath: './build' });\n    console.log(`Build successful: ${buildResult.message}`);\n\n    console.log('Starting project export...');\n    // Assuming exportProject also takes similar paths and a target platform\n    const exportResult = await exportProject({\n      projectPath: './build',\n      targetPlatform: 'desktop',\n      exportPath: './dist',\n      // Authentication might be required for some export targets\n      apiKey: process.env.SAMENGINE_API_KEY ?? ''\n    });\n    console.log(`Export successful: ${exportResult.message}`);\n  } catch (error) {\n    console.error(`Build or export failed: ${error.message}`);\n    process.exit(1);\n  }\n}\n\nrunBuildAndExport();\n\n// CLI Usage Example (usually run via `npx` or `npm run build`)\n// npx samengine-build build --projectPath ./src --outputPath ./build\n// npx samengine-build export --platform desktop --outputPath ./dist","lang":"typescript","description":"This quickstart demonstrates both programmatic usage and typical CLI invocation for building and exporting a samengine project, handling success and failure."},"warnings":[{"fix":"Consult the `package.json` for the `engines` field, or try using a Node.js version manager (e.g., `nvm`) to switch to a compatible LTS version, such as Node.js 16 or 18.","message":"Node.js version compatibility can be a concern. Older build tools might not support the latest Node.js LTS versions without specific updates or polyfills. Always check the `package.json` engines field or documentation for supported Node.js ranges.","severity":"gotcha","affected_versions":"<1.7.0"},{"fix":"Review the official documentation or release notes for `samengine-build` and `samengine` for any breaking changes related to build configuration files. Update configuration files to the expected format.","message":"Configuration file format changes (e.g., `samengine.config.js` to `samengine.config.json` or YAML) can cause builds to fail silently or with parsing errors.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Ensure your `samengine` project adheres to the expected directory structure. Verify that all necessary `samengine` components and external dependencies are correctly installed and accessible in your environment, especially for cross-platform exports.","message":"The `samengine-build` tool relies heavily on the underlying `samengine` project structure and assets. Incorrect project setup or missing engine-specific dependencies (e.g., binaries, asset compilers) will lead to build failures.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Check the detailed output preceding this error for specific messages from `samengine` or its dependencies. Verify that the `samengine` CLI (if separate) or any required SDKs are correctly installed and configured in your system's PATH. Ensure necessary permissions for build directories.","cause":"Generic error indicating an underlying shell command or child process invoked by `samengine-build` failed. This often points to issues with external tools or environment setup for the engine itself.","error":"Error: Command failed with exit code 1"},{"fix":"Ensure your `samengine.config.js` (or similar) file exists in the expected location and has a valid structure. Check for syntax errors in the configuration file or missing required fields.","cause":"Often indicates that `samengine-build` failed to load or parse its configuration file, or that an expected configuration property is missing.","error":"TypeError: Cannot read properties of undefined (reading 'config')"},{"fix":"Verify that all asset paths referenced in your `samengine` project (e.g., in scene files, code) are correct and that the files physically exist at those locations relative to the project root. Ensure case sensitivity matches the target platform requirements.","cause":"The build process failed because a specified asset (e.g., texture, model, script) could not be found at its expected path.","error":"Error: AssetNotFound: Missing required asset 'texture.png'"}],"ecosystem":"npm"}