You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32-2Lines changed: 32 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,9 +13,12 @@
13
13
14
14
</h2>
15
15
16
-
Simple Scaffold is a file scaffolding tool. You define templates once, then generate files from them whenever you need — whether it's a single component or an entire app boilerplate.
16
+
Simple Scaffold is a file scaffolding tool. You define templates once, then generate files from them
17
+
whenever you need — whether it's a single component or an entire app boilerplate.
17
18
18
-
Templates use **Handlebars.js** syntax, so you can inject data, loop over lists, use conditionals, and write custom helpers. It works as a CLI or as a Node.js library, and it doesn't care what kind of files you're generating.
19
+
Templates use **Handlebars.js** syntax, so you can inject data, loop over lists, use conditionals,
20
+
and write custom helpers. It works as a CLI or as a Node.js library, and it doesn't care what kind
21
+
of files you're generating.
19
22
20
23
<divalign="center">
21
24
@@ -92,6 +95,33 @@ See information about each option and flag using the `--help` flag, or read the
92
95
[CLI documentation](https://chenasraf.github.io/simple-scaffold/docs/usage/cli). For information
93
96
about how configuration files work, [see below](#configuration-files).
94
97
98
+
### Interactive Mode
99
+
100
+
When running in a terminal, Simple Scaffold will interactively prompt for any missing required
101
+
values — name, output directory, template paths, and template key (if multiple are available).
102
+
103
+
Config files can also define **inputs** — custom fields that are prompted interactively and become
104
+
template data:
105
+
106
+
```js
107
+
module.exports= {
108
+
component: {
109
+
templates: ["templates/component"],
110
+
output:"src/components",
111
+
inputs: {
112
+
author: { message:"Author name", required:true },
113
+
license: { message:"License", default:"MIT" },
114
+
},
115
+
},
116
+
}
117
+
```
118
+
119
+
Inputs can be pre-provided via `--data` or `-D` to skip the prompt:
|`--name`\|`-n`| Name to be passed to the generated files. `{{name}}` and other data parameters inside contents and file names will be replaced accordingly. You may omit the `--name` or `-n` for this specific option. |
19
-
|`--config`\|`-c`| Filename or directory to load config from |
20
-
|`--git`\|`-g`| Git URL or GitHub path to load a template from. |
21
-
|`--key`\|`-k`| Key to load inside the config file. This overwrites the config key provided after the colon in `--config` (e.g. `--config scaffold.cmd.js:component)`|
22
-
|`--output`\|`-o`| Path to output to. If `--subdir` is enabled, the subdir will be created inside this path. Default is current working directory. |
23
-
|`--templates`\|`-t`| Template files to use as input. You may provide multiple files, each of which can be a relative or absolute path, or a glob pattern for multiple file matching easily. |
24
-
|`--overwrite`\|`-w`\|`--no-overwrite`\|`-W`| Enable to override output files, even if they already exist. (default: false) |
25
-
|`--data`\|`-d`| Add custom data to the templates. By default, only your app name is included. |
26
-
|`--append-data`\|`-D`| Append additional custom data to the templates, which will overwrite `--data`, using an alternate syntax, which is easier to use with CLI: `-D key1=string -D key2:=raw`|
27
-
|`--subdir`\|`-s`\|`--no-subdir`\|`-S`| Create a parent directory with the input name (and possibly `--subdir-helper` (default: false) |
28
-
|`--subdir-helper`\|`-H`| Default helper to apply to subdir name when using `--subdir`. |
29
-
|`--quiet`\|`-q`| Suppress output logs (Same as `--log-level none`)(default: false) |
30
-
|`--log-level`\|`-l`| Determine amount of logs to display. The values are: `none, debug, info, warn, error`. The provided level will display messages of the same level or higher. (default: info) |
31
-
|`--before-write`\|`-B`| Run a script before writing the files. This can be a command or a path to a file. A temporary file path will be passed to the given command and the command should return a string for the final output. |
32
-
|`--dry-run`\|`-dr`| Don't emit files. This is good for testing your scaffolds and making sure they don't fail, without having to write actual file contents or create directories. (default: false) |
|`--name`\|`-n`| Name to be passed to the generated files. `{{name}}` and other data parameters inside contents and file names will be replaced accordingly. If omitted in an interactive terminal, you will be prompted. |
19
+
|`--config`\|`-c`| Filename or directory to load config from |
20
+
|`--git`\|`-g`| Git URL or GitHub path to load a template from. |
21
+
|`--key`\|`-k`| Key to load inside the config file. If omitted and multiple templates are available, you will be prompted to select one. |
22
+
|`--output`\|`-o`| Path to output to. If `--subdir` is enabled, the subdir will be created inside this path. If omitted in an interactive terminal, you will be prompted. |
23
+
|`--templates`\|`-t`| Template files to use as input. You may provide multiple files, each of which can be a relative or absolute path, or a glob pattern for multiple file matching easily. If omitted in an interactive terminal, you will be prompted for a comma-separated list. |
24
+
|`--overwrite`\|`-w`\|`--no-overwrite`\|`-W`| Enable to override output files, even if they already exist. (default: false) |
25
+
|`--data`\|`-d`| Add custom data to the templates. By default, only your app name is included. |
26
+
|`--append-data`\|`-D`| Append additional custom data to the templates, which will overwrite `--data`, using an alternate syntax, which is easier to use with CLI: `-D key1=string -D key2:=raw`|
27
+
|`--subdir`\|`-s`\|`--no-subdir`\|`-S`| Create a parent directory with the input name (and possibly `--subdir-helper` (default: false) |
28
+
|`--subdir-helper`\|`-H`| Default helper to apply to subdir name when using `--subdir`. |
29
+
|`--quiet`\|`-q`| Suppress output logs (Same as `--log-level none`)(default: false) |
30
+
|`--log-level`\|`-l`| Determine amount of logs to display. The values are: `none, debug, info, warn, error`. The provided level will display messages of the same level or higher. (default: info) |
31
+
|`--before-write`\|`-B`| Run a script before writing the files. This can be a command or a path to a file. A temporary file path will be passed to the given command and the command should return a string for the final output. |
32
+
|`--dry-run`\|`-dr`| Don't emit files. This is good for testing your scaffolds and making sure they don't fail, without having to write actual file contents or create directories. (default: false) |
33
+
|`--version`\|`-v`| Display version. |
34
+
35
+
### Interactive Mode
36
+
37
+
When running in a terminal (TTY), Simple Scaffold will prompt for any missing required values:
38
+
39
+
-**Name** — text input if `--name` is not provided
40
+
-**Template key** — selectable list if `--key` is not provided and the config file has multiple
41
+
templates
42
+
-**Output directory** — text input if `--output` is not provided
43
+
-**Template paths** — comma-separated text input if `--templates` is not provided
44
+
45
+
In non-interactive environments (CI, piped input), missing values will cause an error instead of
46
+
prompting.
47
+
48
+
### Template Inputs
49
+
50
+
Config files can define **inputs** — custom fields that are prompted interactively and injected as
51
+
template data. This is useful for templates that need user-specific values like author name,
0 commit comments