Logo

index : jinit

---

  • summary
  • about
  • tree
  • log
  • branches
<< path: root/public/jinit.git/html/README.md blob: 5d0c4ee00893de7eaa9b217cbef192a0913780f5 [raw] [clear marker]

        
0# Jai Init
1This program creates files and directories based on templates for Jai development.
2
3> [!WARNING]
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.
6>
7> Templates in this project will adapt to it in the future - probably in Q3 2026.
8> I'm awaiting more syntax changes.
9
10
11## Build / Install
12```plain
13$ jai -version
14Version: beta 0.2.024, built on 31 December 2025.
15```
16
17```plain
18$ jai build.jai - silent release
19```
20
21- The executable is stored as `bin/jinit`.
22- Add the binary to your $PATH or symlink it where appropriate
23
24
25## Usage
26Init a minimal project:
27`$ jinit -t min`
28
29Init a library project:
30`$ jinit -t lib -r my_lib_name`
31
32Don't create a scm repo:
33`$ jinit -t min -g`
34
35
36**Overview**
37```
38$ init -help
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
43
44 -help, -HELP, -?: Show the list of commands.
45```
46
47### Arg: `-g`
48The default SCM is Git. But you can change it inside the `build.jai`.
49
50### Arg: `-r <string>`
51Some templates support "replace markers". If they're present, you can
52pass a string via `-r <string>` and those markers get replaced with
53your string.
54
55More informations inside `templates/lib/rules_lib.jai`.
56
57### Arg: `-t <template type>`
58You can specify the exact template that should be used here.
59Use `-l` to list all available templates.
60
61You can omit this argument, then it will use the default template, which
62you can configure in `build.jai`.
63
64
65## Templates
66A template consists of two files: `rules_*.jai` and `template.jai`.
67
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.
70
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.
73
74### Examples
75
76For example the `templates/minimal` creates this structure:
77
78```
79.
80├── .git
81├── .gitignore
82├── build.jai
83├── README.md
84└── src
85 └── main.jai
86```
87
88Where the `templates/lib` creates this:
89
90```
91.
92├── .git
93├── .gitignore
94├── build.jai
95├── my_lib
96│ ├── lib.jai
97│ └── module.jai
98├── README.md
99└── test
100 └── test.jai
101```
102
103### Create a Template
104You can create a new template with those steps:
105
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`
111
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.
114
115
116## How does it Work
117All templates get baked into the binary. So the final executable does not depend
118on any template files at runtime.
119
120Basically, the `build.jai` collects all `rules_*.jai` files and creates the
121necessary data structures, which get baked into the `src/main.jai` file.
122
123The `main.jai` file evaluates at compile time all rules and creates the final
124template as static `[N]Rules` array.
125
126
127## Credits
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)
129
130
131
Copyright 2026  E766CB298A6D1E64 | Git-Thing heavily inspired by cgit