<<
path:
root/public/jinit.git/html/README.md
blob: 5d0c4ee00893de7eaa9b217cbef192a0913780f5
[raw]
[clear marker]
1This program creates files and directories based on templates for Jai development.
4> Jai version: `beta 0.2.022` (15. Dec. 2025) cleaned up some syntax.
5> The dot notation for implicitly calling structs can be omitted from now on.
7> Templates in this project will adapt to it in the future - probably in Q3 2026.
8> I'm awaiting more syntax changes.
14Version: beta 0.2.024, built on 31 December 2025.
18$ jai build.jai - silent release
21- The executable is stored as `bin/jinit`.
22- Add the binary to your $PATH or symlink it where appropriate
26Init a minimal project:
29Init a library project:
30`$ jinit -t lib -r my_lib_name`
32Don't create a scm repo:
39 -g: If provided, no SCM repository will be created
40 -l: List available template types
41 -r: Replace the replace marker with a given string
42 -t: Pass a template type
44 -help, -HELP, -?: Show the list of commands.
48The default SCM is Git. But you can change it inside the `build.jai`.
51Some templates support "replace markers". If they're present, you can
52pass a string via `-r <string>` and those markers get replaced with
55More informations inside `templates/lib/rules_lib.jai`.
57### Arg: `-t <template type>`
58You can specify the exact template that should be used here.
59Use `-l` to list all available templates.
61You can omit this argument, then it will use the default template, which
62you can configure in `build.jai`.
66A template consists of two files: `rules_*.jai` and `template.jai`.
68The `template.jai` can be named however you want. It contains the build
69script, which will be known as `build.jai` if you initialize your project.
71The `rules_*.jai` has a strict naming, otherwise this program cannot find it.
72In this file we declare which files and directories should be created upfront.
76For example the `templates/minimal` creates this structure:
88Where the `templates/lib` creates this:
104You can create a new template with those steps:
1061. create a new template directory in `templates/<your dir>`
1071. copy the `empty` (or any) template as starting point `$ cp -r empty <your dir>`
1081. start creating your build script in `template.jai`
1091. adapt the configuration in `rules_*.jai`
1101. recompile `jinit` via `$ jai build.jai`
112**Note:** Inside the `src/main.jai` you can enable the `DRY_RUN` flag, which
113won't create any files and directories. It just logs the actions instead.
117All templates get baked into the binary. So the final executable does not depend
118on any template files at runtime.
120Basically, the `build.jai` collects all `rules_*.jai` files and creates the
121necessary data structures, which get baked into the `src/main.jai` file.
123The `main.jai` file evaluates at compile time all rules and creates the final
124template as static `[N]Rules` array.
128Procs `build_release` and `build_debug` are adapted from the [Jai Wiki](https://github.com/Ivo-Balbaert/The_Way_to_Jai/blob/main/book/30B_Manipulating_the_build_process.md)