Generator Options

The generator accepts the following options:

Option Short Default Description
--name -n "MyApp" Project name
--author -a "Your Name" Author name
--version -v "1.0.0" Version
--output -o Generated from project name Output directory
--with-git - false Initialize git repository
--help -h - Show help

Examples

Basic Usage

# Generate with default settings
deno run --allow-read --allow-write --allow-run \
  https://raw.githubusercontent.com/COx2/deno-advent-calender-2025/main/generator/generate.ts

Custom Settings

# Specify all options
deno run --allow-read --allow-write --allow-run \
  https://raw.githubusercontent.com/COx2/deno-advent-calender-2025/main/generator/generate.ts \
  --name "GameEngine" \
  --author "John Doe" \
  --version "0.1.0" \
  --output ./my-game-engine \
  --with-git

Short Form Options

deno run --allow-read --allow-write --allow-run \
  https://raw.githubusercontent.com/COx2/deno-advent-calender-2025/main/generator/generate.ts \
  -n "MyLib" -a "Developer" -o ./mylib

Build Commands

The generated project includes the following Deno tasks:

Build Commands

Command Description
deno task build Build in Release mode
deno task build:debug Build in Debug mode
deno task build:release Build in Release mode (explicit)
deno task clean Delete build directory
deno task rebuild Clean and rebuild
deno task test Build and run the executable

Development Commands

Command Description
deno task format Format TypeScript files
deno task format:check Check formatting
deno task lint Lint TypeScript files

Build Script Options

Additional options when running the build script directly:

# Clean only
deno run --allow-all ./build.ts --clean

# Debug build
deno run --allow-all ./build.ts --config Debug

# Build and test
deno run --allow-all ./build.ts --test

# Use Ninja generator (if installed)
deno run --allow-all ./build.ts --generator Ninja
Note (Windows): On Windows, the default generator is "Visual Studio 17 2022". If you have Ninja installed, use --generator Ninja for faster builds.

Build Outputs

Building generates the following targets:

Static Library

[project]_core

Provides core functionality like calculations

  • Windows: build/Release/[project]_core.lib
  • Unix: build/lib/lib[project]_core.a

Shared Library

[project]_utils

Provides utility functions

  • Windows: build/Release/[project]_utils.dll
  • macOS: build/lib/lib[project]_utils.dylib
  • Linux: build/lib/lib[project]_utils.so

Executable

[project]

Main application using both libraries

  • Windows: build/Release/[project].exe
  • Unix: build/bin/[project]

Directory Structure Differences

build/
├── Release/              # Release build artifacts
│   ├── myapp.exe
│   ├── myapp_core.lib
│   ├── myapp_utils.dll
│   ├── myapp_utils.lib   # Import library
│   └── myapp_utils.exp
└── Debug/                # Debug build artifacts
    └── ...
build/
├── bin/                  # Executables
│   └── myapp
└── lib/                  # Libraries
    ├── libmyapp_core.a
    └── libmyapp_utils.so (or .dylib)

Customization

Changing Build Configuration

Edit build.config.ts to change project settings:

export const config: BuildConfig = {
  projectName: "MyApp",
  version: "1.0.0",
  author: "Your Name",
  buildTypes: ["Debug", "Release"],
};

Modifying CMake Settings

Edit CMakeLists.txt to add libraries or change settings.

Adding New Source Files

  1. Create new files under src/
  2. Add the files to the appropriate target in CMakeLists.txt
  3. Rebuild with deno task rebuild

Troubleshooting

CMake not found

Make sure CMake is installed:

cmake --version

Deno permission errors

The build script requires proper permissions:

deno run --allow-all build.ts

Build errors

Clean the build directory and try again:

deno task clean
deno task build

DLL not found (Windows)

Executables and DLLs are placed in the same directory. If you move the executable, copy the DLL along with it.